Sha256: b583c286981c3f6880bab9b1f031910b3f6cc60f2884a13f8c87ab5bbe07dd16

Contents?: true

Size: 1.02 KB

Versions: 13

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

module Awspec::Type
  class Sqs < ResourceBase
    def resource_via_client
      return @resource_via_client if @resource_via_client

      queue_url = id
      attributes = {}
      res = sqs_client.get_queue_attributes({
                                              queue_url: queue_url,
                                              attribute_names: ['All']
                                            })
      res.attributes.each do |key, value|
        attributes[key.underscore] = value
      end
      attributes['queue_url'] = queue_url
      @resource_via_client ||= attributes
    end

    def id
      @id ||= find_queue(@display_name)
    end

    def method_missing(name)
      param_name = name.to_s
      if resource_via_client.include?(param_name)
        resource_via_client[param_name]
      else
        super
      end
    end

    def has_tag?(tag_key, tag_value)
      @tag_set ||= find_tags_for_queue(@id)
      return nil if @tag_set[tag_key] != tag_value

      true
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
awspec-1.31.0 lib/awspec/type/sqs.rb
awspec-1.30.0 lib/awspec/type/sqs.rb
awspec-1.29.3 lib/awspec/type/sqs.rb
awspec-1.29.2 lib/awspec/type/sqs.rb
awspec-1.29.1 lib/awspec/type/sqs.rb
awspec-1.29.0 lib/awspec/type/sqs.rb
awspec-1.28.2 lib/awspec/type/sqs.rb
awspec-1.28.1 lib/awspec/type/sqs.rb
awspec-1.28.0 lib/awspec/type/sqs.rb
awspec-1.27.1 lib/awspec/type/sqs.rb
awspec-1.27.0 lib/awspec/type/sqs.rb
awspec-1.26.0 lib/awspec/type/sqs.rb
awspec-1.25.2 lib/awspec/type/sqs.rb