Class: Jets::CLI::Concurrency::Get

Inherits:
Base
  • Object
show all
Defined in:
lib/jets/cli/concurrency/get.rb

Direct Known Subclasses

Set

Instance Attribute Summary

Attributes inherited from Base

#options

Instance Method Summary collapse

Methods inherited from Base

#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

#initialize(options = {}) ⇒ Get

Returns a new instance of Get.



3
4
5
6
7
# File 'lib/jets/cli/concurrency/get.rb', line 3

def initialize(options = {})
  super
  function_name = Jets::CLI::Lambda::Lookup.function(@options[:function])
  @lambda_function = Jets::CLI::Lambda::Function.new(function_name)
end

Instance Method Details

#provisioned_concurrencyObject



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/jets/cli/concurrency/get.rb', line 17

def provisioned_concurrency
  info = @lambda_function.provisioned_concurrency_info

  if @lambda_function.provisioned_concurrency.nil?
    "not set"
  elsif info[:status] == "IN_PROGRESS"
    "#{info[:allocated]}/#{info[:requested]} (In progress)"
  else
    @lambda_function.provisioned_concurrency
  end
end

#reserved_concurrencyObject



29
30
31
32
33
34
35
# File 'lib/jets/cli/concurrency/get.rb', line 29

def reserved_concurrency
  if @lambda_function.reserved_concurrency.nil?
    "not set. Will scale to unreserved limit: #{.unreserved_concurrent_executions}"
  else
    @lambda_function.reserved_concurrency
  end
end

#runObject



9
10
11
12
13
14
15
# File 'lib/jets/cli/concurrency/get.rb', line 9

def run
  puts <<~EOL
    Settings for Function: #{@lambda_function.name}
    Reserved concurrency: #{reserved_concurrency}
    Provisioned concurrency: #{provisioned_concurrency}
  EOL
end