Sha256: 31a99c97450730d582345dbb77e187ae52e486e5b1a1328b6911e5c21d05f357

Contents?: true

Size: 706 Bytes

Versions: 5

Compression:

Stored size: 706 Bytes

Contents

module FluentECS
  class Metadata
    include Resource

    self.resource_endpoint = '/metadata'

    attr_accessor :arn,   :cluster, :version
    attr_writer   :tasks, :containers

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

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

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

    class << self
      def take
        Metadata.new(get)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
fluent-plugin-ecs-metadata-filter-v2-0.2.0 lib/fluent_ecs/metadata.rb
serafini010-ecs-metadata-filter-0.2.0 lib/fluent_ecs/metadata.rb
fluent-plugin-ecs-metadata-filter-0.2.0 lib/fluent_ecs/metadata.rb
fluent-plugin-ecs-metadata-filter-0.1.1 lib/fluent_ecs/metadata.rb
fluent-plugin-ecs-metadata-filter-0.1.0 lib/fluent_ecs/metadata.rb