Class: Jets::CLI::Dotenv::Set
Direct Known Subclasses
Unset
Instance Attribute Summary
Attributes inherited from Base
#options
Instance Method Summary
collapse
Methods included from Env::Parse
#parse_cli_env_values
Methods inherited from Base
#initialize, #paginate, #paging_params, rescue_api_error
#log
#apigateway, #aws_options, #cfn, #codebuild, #dynamodb, #lambda_client, #logs, #s3, #s3_resource, #sns, #sqs, #ssm, #sts, #wafv2
#output_value, #stack_exists?
included, #reset_cache!
Methods included from Api
#api, #api_key
Instance Method Details
#names ⇒ Object
31
32
33
|
# File 'lib/jets/cli/dotenv/set.rb', line 31
def names
vars.keys.map(&:to_s)
end
|
#option_key ⇒ Object
22
23
24
|
# File 'lib/jets/cli/dotenv/set.rb', line 22
def option_key
:values
end
|
13
14
15
|
# File 'lib/jets/cli/dotenv/set.rb', line 13
def perform
ssm_manager.set(vars)
end
|
#run ⇒ Object
5
6
7
8
9
10
11
|
# File 'lib/jets/cli/dotenv/set.rb', line 5
def run
sure? sure_message
puts "Setting SSM vars for #{Jets.project.namespace}"
perform Jets::CLI::Tip.show(:ssm_change)
end
|
#ssm_manager ⇒ Object
45
46
47
|
# File 'lib/jets/cli/dotenv/set.rb', line 45
def ssm_manager
Jets::CLI::Dotenv::Ssm.new(@options)
end
|
#ssm_method ⇒ Object
26
27
28
29
|
# File 'lib/jets/cli/dotenv/set.rb', line 26
def ssm_method
name = self.class.name.demodulize (name == "Set") ? :set : :delete
end
|
#sure_message ⇒ Object
35
36
37
38
39
40
41
42
43
|
# File 'lib/jets/cli/dotenv/set.rb', line 35
def sure_message
<<~EOL
Will #{ssm_method} the SSM vars for #{Jets.project.namespace}
Note: SSM changes do not update the Lambda function env vars.
You will need run jets deploy to update the env vars.
#{ssm_manager.preview_list(names)}
EOL
end
|
#vars ⇒ Object
17
18
19
|
# File 'lib/jets/cli/dotenv/set.rb', line 17
def vars
parse_cli_env_values(@options[option_key])
end
|