Sha256: 359928433bbdc9e98c5cf79609410c440e70ec954f538a07f490bd90caa52b86

Contents?: true

Size: 1.52 KB

Versions: 79

Compression:

Stored size: 1.52 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, uuid)
        res = ecs_client.describe_container_instances(cluster: cluster, container_instances: [uuid])
        res.container_instances.single_resource(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(cluster, service)
        res = ecs_client.describe_services(cluster: cluster, 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

79 entries across 79 versions & 3 rubygems

Version Path
awspec-1.14.0 lib/awspec/helper/finder/ecs.rb
awspec-1.13.0 lib/awspec/helper/finder/ecs.rb
awspec-1.12.7 lib/awspec/helper/finder/ecs.rb
awspec-1.12.6 lib/awspec/helper/finder/ecs.rb
awspec-1.12.5 lib/awspec/helper/finder/ecs.rb
awspec-1.12.4 lib/awspec/helper/finder/ecs.rb
awspec-1.12.3 lib/awspec/helper/finder/ecs.rb
awspec-1.12.2 lib/awspec/helper/finder/ecs.rb
awspec-1.12.1 lib/awspec/helper/finder/ecs.rb
awspec-1.12.0 lib/awspec/helper/finder/ecs.rb
awspec-1.11.1 lib/awspec/helper/finder/ecs.rb
awspec-1.11.0 lib/awspec/helper/finder/ecs.rb
awspec-1.10.0 lib/awspec/helper/finder/ecs.rb
awspec-1.9.0 lib/awspec/helper/finder/ecs.rb
awspec-1.8.0 lib/awspec/helper/finder/ecs.rb
awspec-1.7.0 lib/awspec/helper/finder/ecs.rb
awspec-1.6.1 lib/awspec/helper/finder/ecs.rb
awspec-1.6.0 lib/awspec/helper/finder/ecs.rb
awspec-1.5.4 lib/awspec/helper/finder/ecs.rb
awspec-1.5.3 lib/awspec/helper/finder/ecs.rb