Class: SidekiqEcsScaler::TaskMetaV4
- Inherits:
-
Object
- Object
- SidekiqEcsScaler::TaskMetaV4
- Defined in:
- lib/sidekiq-ecs-scaler/task_meta_v4.rb
Overview
SidekiqEcsScaler::TaskMetaV4
Instance Attribute Summary collapse
- #cluster ⇒ String readonly
- #task_arn ⇒ String readonly
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(resp) ⇒ void constructor
Constructor Details
#initialize(resp) ⇒ void
30 31 32 33 |
# File 'lib/sidekiq-ecs-scaler/task_meta_v4.rb', line 30 def initialize(resp) @cluster = resp.fetch("Cluster") @task_arn = resp.fetch("TaskARN") end |
Instance Attribute Details
#cluster ⇒ String (readonly)
23 24 25 |
# File 'lib/sidekiq-ecs-scaler/task_meta_v4.rb', line 23 def cluster @cluster end |
#task_arn ⇒ String (readonly)
26 27 28 |
# File 'lib/sidekiq-ecs-scaler/task_meta_v4.rb', line 26 def task_arn @task_arn end |
Class Method Details
.build_or_null ⇒ SidekiqEcsScaler::TaskMetaV4?
TODO:
If the metadata acquisition fails, an error will be output to the log.
12 13 14 15 16 17 18 |
# File 'lib/sidekiq-ecs-scaler/task_meta_v4.rb', line 12 def build_or_null ENV.fetch("ECS_CONTAINER_METADATA_URI_V4", nil)&.then do |uri| new(JSON.parse(Net::HTTP.get(URI.parse("#{uri}/task")))) end rescue StandardError nil end |