Sha256: 359db7e67e8ad2cc4f59889077ae67a568458fb6094c27c9881cbea783784ced

Contents?: true

Size: 956 Bytes

Versions: 12

Compression:

Stored size: 956 Bytes

Contents

# frozen_string_literal: true

module Awspec::Type
  class AccountAttribute < Base
    def initialize(key = nil)
      @key = key.to_sym
    end

    def resource_via_client
      attributes = nil
      Awspec::Helper::Type::ACCOUNT_ATTRIBUTES.each do |type|
        key = type.gsub(Awspec::Type::Account::REMOVE_SUFFIX_RE, '').to_sym
        next unless key == @key

        if key == 'ses'
          # https://docs.aws.amazon.com/ses/latest/DeveloperGuide/regions.html
          next unless %w[us-east-1 us-west-2 eu-west-1].include?(Aws.config[:region])
        end
        eval "attributes = Awspec::Type::#{type.camelize}.new.resource_via_client"
      end
      @resource_via_client ||= attributes
    end

    def method_missing(name)
      name = name.to_s if name.instance_of?(Symbol)
      describe = name.tr('-', '_').to_sym
      super unless resource_via_client.members.include?(describe)
      resource_via_client[describe]
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

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