Class: FluentECS::Metadata

Inherits:
Object
  • Object
show all
Includes:
Resource
Defined in:
lib/fluent_ecs/metadata.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Resource

included

Constructor Details

#initialize(attrs = {}) ⇒ Metadata

Returns a new instance of Metadata.



10
11
12
13
14
15
# File 'lib/fluent_ecs/metadata.rb', line 10

def initialize(attrs = {})
  @arn       = attrs['ContainerInstanceArn']
  @cluster   = attrs['Cluster']
  @version   = attrs['Version']
  @task_data = attrs['Tasks'] || Array(Task.get['Tasks'])
end

Instance Attribute Details

#arnObject

Returns the value of attribute arn.



7
8
9
# File 'lib/fluent_ecs/metadata.rb', line 7

def arn
  @arn
end

#clusterObject

Returns the value of attribute cluster.



7
8
9
# File 'lib/fluent_ecs/metadata.rb', line 7

def cluster
  @cluster
end

#containersObject



23
24
25
# File 'lib/fluent_ecs/metadata.rb', line 23

def containers
  @containers ||= tasks.map(&:containers).flatten
end

#tasksObject



17
18
19
20
21
# File 'lib/fluent_ecs/metadata.rb', line 17

def tasks
  @tasks ||= @task_data.map do |d|
    Task.new(d).tap { |t| t.container_instance = self }
  end
end

#versionObject

Returns the value of attribute version.



7
8
9
# File 'lib/fluent_ecs/metadata.rb', line 7

def version
  @version
end

Class Method Details

.takeObject



28
29
30
# File 'lib/fluent_ecs/metadata.rb', line 28

def take
  Metadata.new(get)
end