Class: Jets::CLI::Env::Set

Inherits:
Base
  • Object
show all
Includes:
Parse
Defined in:
lib/jets/cli/env/set.rb

Direct Known Subclasses

Unset

Instance Attribute Summary

Attributes inherited from Base

#options

Instance Method Summary collapse

Methods included from Parse

#parse_cli_env_values

Methods inherited from Base

#initialize, #paginate, #paging_params, rescue_api_error

Methods included from Util::Logging

#log

Methods included from AwsServices

#apigateway, #aws_options, #cfn, #codebuild, #dynamodb, #lambda_client, #logs, #s3, #s3_resource, #sns, #sqs, #ssm, #sts, #wafv2

Methods included from AwsServices::StackStatus

#output_value, #stack_exists?

Methods included from AwsServices::GlobalMemoist

included, #reset_cache!

Methods included from Api

#api, #api_key

Constructor Details

This class inherits a constructor from Jets::CLI::Base

Instance Method Details

#are_you_sure?Boolean

Returns:

  • (Boolean)


17
18
19
20
21
22
23
# File 'lib/jets/cli/env/set.rb', line 17

def are_you_sure?
  name = self.class.to_s.demodulize.underscore.humanize.downcase
  sure? <<~EOL
    Will #{name} env vars for #{@lambda_function.name}
    The Lambda Function will immediately use the new env vars.
  EOL
end

#environment_variablesObject



13
14
15
# File 'lib/jets/cli/env/set.rb', line 13

def environment_variables
  parse_cli_env_values(@options[:values])
end

#runObject



5
6
7
8
9
10
11
# File 'lib/jets/cli/env/set.rb', line 5

def run
  are_you_sure?
  puts "Setting env vars for #{@lambda_function.name}"

  @lambda_function.environment_variables = environment_variables
  Jets::CLI::Tip.show(:env_change)
end