Module: Awspec::Helper::Finder::AccountAttributes

Included in:
Awspec::Helper::Finder
Defined in:
lib/awspec/helper/finder/account_attributes.rb

Instance Method Summary collapse

Instance Method Details

#find_ec2_account_attributesObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/awspec/helper/finder/account_attributes.rb', line 4

def 
  attributes = {}
  ec2_client...each do |attr|
    values = attr[:attribute_values].map do |v|
      v[:attribute_value]
    end
    if attr[:attribute_name] == 'supported-platforms'
      # supported-platforms
      attributes[attr[:attribute_name].tr('-', '_').to_sym] = values
    else
      value = values.first
      if value =~ /\A\d+\z/
        attributes[attr[:attribute_name].tr('-', '_').to_sym] = value.to_i
      else
        attributes[attr[:attribute_name].tr('-', '_').to_sym] = value
      end
    end
  end
  attributes.to_struct
end

#find_lambda_account_settingsObject



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/awspec/helper/finder/account_attributes.rb', line 37

def 
  attributes = {}
  settings = lambda_client.
  settings..members.each do |key|
    attributes[key] = { limit: settings.[key] }
  end
  settings..members.each do |key|
    if attributes.include?(key)
      attributes[key][:usage] = settings.[key]
    else
      attributes[key] = { usage: settings.[key] }
    end
  end
  attributes.to_struct
end

#find_rds_account_attributesObject



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/awspec/helper/finder/account_attributes.rb', line 25

def 
  attributes = {}
  rds_client...each do |attr|
    values = {
      used: attr[:used],
      max: attr[:max]
    }
    attributes[attr[:account_quota_name].to_sym] = values.to_struct
  end
  attributes.to_struct
end

#find_ses_send_quotaObject



53
54
55
56
57
58
# File 'lib/awspec/helper/finder/account_attributes.rb', line 53

def find_ses_send_quota
  ses_client.get_send_quota
rescue
  # Aws::Errors::NoSuchEndpointError
  nil
end