Sha256: 598e8fec00d414dc837ecd5c75a9d5ec8251015c218651069ef209fae9b1bd4c

Contents?: true

Size: 1.51 KB

Versions: 25

Compression:

Stored size: 1.51 KB

Contents

module Awspec::Helper
  module Finder
    module Ecs
      def find_ecs_cluster(cluster)
        res = ecs_client.describe_clusters(clusters: [cluster])
        res.clusters.single_resource(cluster)
      end

      def find_ecs_container_instance(cluster, arn_or_uuid)
        res = ecs_client.describe_container_instances(cluster: cluster, container_instances: [arn_or_uuid])
        res.container_instances.single_resource(arn_or_uuid)
      end

      def find_ecs_task_definition(taskdef)
        res = ecs_client.describe_task_definition(task_definition: taskdef)
        res.task_definition
      end

      def find_ecs_service(service)
        res = ecs_client.describe_services(services: [service])
        res.services.single_resource(service)
      end

      def select_ecs_container_instance_arn_by_cluster_name(cluster)
        req = { cluster: cluster }
        arns = []
        loop do
          res = ecs_client.list_container_instances(req)
          arns.push(*res.container_instance_arns)
          break if res.next_token.nil?
          req[:next_token] = res.next_token
        end
        arns
      end

      # deprecated method
      def find_ecs_container_instances(cluster, container_instances)
        res = ecs_client.describe_container_instances(cluster: cluster, container_instances: container_instances)
        res.container_instances if res.container_instances
      end

      alias_method :list_ecs_container_instances, :select_ecs_container_instance_arn_by_cluster_name # deprecated method
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
awspec-0.79.0 lib/awspec/helper/finder/ecs.rb
awspec-0.78.1 lib/awspec/helper/finder/ecs.rb
awspec-0.77.1 lib/awspec/helper/finder/ecs.rb
awspec-0.77.0 lib/awspec/helper/finder/ecs.rb
awspec-0.76.1 lib/awspec/helper/finder/ecs.rb
awspec-0.76.0 lib/awspec/helper/finder/ecs.rb
awspec-0.75.2 lib/awspec/helper/finder/ecs.rb
awspec-0.75.1 lib/awspec/helper/finder/ecs.rb
awspec-0.75.0 lib/awspec/helper/finder/ecs.rb
awspec-0.74.1 lib/awspec/helper/finder/ecs.rb
awspec-0.74.0 lib/awspec/helper/finder/ecs.rb
awspec-0.73.2 lib/awspec/helper/finder/ecs.rb
awspec-0.73.1 lib/awspec/helper/finder/ecs.rb
awspec-0.73.0 lib/awspec/helper/finder/ecs.rb
awspec-0.72.0 lib/awspec/helper/finder/ecs.rb
awspec-0.71.0 lib/awspec/helper/finder/ecs.rb
awspec-0.70.0 lib/awspec/helper/finder/ecs.rb
awspec-0.69.1 lib/awspec/helper/finder/ecs.rb
awspec-0.69.0 lib/awspec/helper/finder/ecs.rb
awspec-0.68.0 lib/awspec/helper/finder/ecs.rb