Sha256: ca46cc81825fdbbfe9d9cf4b3a934d1b115ac6b1d668a72cce71e8da005640b6

Contents?: true

Size: 1009 Bytes

Versions: 49

Compression:

Stored size: 1009 Bytes

Contents

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

49 entries across 49 versions & 3 rubygems

Version Path
awspec-1.25.1 lib/awspec/type/sqs.rb
awspec-1.25.0 lib/awspec/type/sqs.rb
awspec-1.24.4 lib/awspec/type/sqs.rb
awspec-1.24.3 lib/awspec/type/sqs.rb
awspec-1.24.2 lib/awspec/type/sqs.rb
awspec-1.24.1 lib/awspec/type/sqs.rb
awspec-1.24.0 lib/awspec/type/sqs.rb
awspec-1.23.0 lib/awspec/type/sqs.rb
awspec-1.22.1 lib/awspec/type/sqs.rb
awspec-1.22.0 lib/awspec/type/sqs.rb
awspec-1.21.1 lib/awspec/type/sqs.rb
awspec-1.21.0 lib/awspec/type/sqs.rb
awspec-1.20.0 lib/awspec/type/sqs.rb
awspec-1.19.2 lib/awspec/type/sqs.rb
awspec-1.19.1 lib/awspec/type/sqs.rb
awspec-1.19.0 lib/awspec/type/sqs.rb
cthiesfork-awspec-1.2.4 lib/awspec/type/sqs.rb
awspec-api_gateway_extended-1.2.4 lib/awspec/type/sqs.rb
awspec-api_gateway_extended-1.2.3 lib/awspec/type/sqs.rb
awspec-1.18.6 lib/awspec/type/sqs.rb