Module: Awspec::Helper::Finder::AccountAttributes
- Included in:
- Awspec::Helper::Finder
- Defined in:
- lib/awspec/helper/finder/account_attributes.rb
Instance Method Summary collapse
- #find_ec2_account_attributes ⇒ Object
- #find_lambda_account_settings ⇒ Object
- #find_rds_account_attributes ⇒ Object
- #find_ses_send_quota ⇒ Object
Instance Method Details
#find_ec2_account_attributes ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/awspec/helper/finder/account_attributes.rb', line 6 def find_ec2_account_attributes attributes = {} ec2_client.describe_account_attributes.account_attributes.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 attributes[attr[:attribute_name].tr('-', '_').to_sym] = if value =~ /\A\d+\z/ value.to_i else value end end end attributes.to_struct end |
#find_lambda_account_settings ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/awspec/helper/finder/account_attributes.rb', line 39 def find_lambda_account_settings attributes = {} settings = lambda_client.get_account_settings settings.account_limit.members.each do |key| attributes[key] = { limit: settings.account_limit[key] } end settings.account_usage.members.each do |key| if attributes.include?(key) attributes[key][:usage] = settings.account_usage[key] else attributes[key] = { usage: settings.account_usage[key] } end end attributes.to_struct end |
#find_rds_account_attributes ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/awspec/helper/finder/account_attributes.rb', line 27 def find_rds_account_attributes attributes = {} rds_client.describe_account_attributes.account_quotas.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_quota ⇒ Object
55 56 57 58 59 60 |
# File 'lib/awspec/helper/finder/account_attributes.rb', line 55 def find_ses_send_quota ses_client.get_send_quota rescue StandardError # Aws::Errors::NoSuchEndpointError nil end |