Class: AwsBillingReports

Inherits:
Object
  • Object
show all
Includes:
AwsPluralResourceMixin
Defined in:
lib/resources/aws/aws_billing_reports.rb

Defined Under Namespace

Classes: Backend

Instance Attribute Summary

Attributes included from AwsPluralResourceMixin

#table

Instance Method Summary collapse

Methods included from AwsPluralResourceMixin

included

Methods included from AwsResourceMixin

#catch_aws_errors, #check_resource_param_names, #initialize, #inspec_runner

Instance Method Details

#fetch_from_apiObject



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/resources/aws/aws_billing_reports.rb', line 48

def fetch_from_api
  @table = []
  pagination_opts = {}
  backend = BackendFactory.create(inspec_runner)
  loop do
    api_result = backend.describe_report_definitions(pagination_opts)
    api_result.report_definitions.each do |raw_report|
      report = raw_report.to_h
      %i{time_unit compression}.each { |field| report[field].downcase! }
      @table << report
    end
    pagination_opts = { next_token: api_result.next_token }
    break unless api_result.next_token
  end
end

#to_sObject



44
45
46
# File 'lib/resources/aws/aws_billing_reports.rb', line 44

def to_s
  "AWS Billing Reports"
end

#validate_params(resource_params) ⇒ Object



36
37
38
39
40
41
42
# File 'lib/resources/aws/aws_billing_reports.rb', line 36

def validate_params(resource_params)
  unless resource_params.empty?
    raise ArgumentError, "aws_billing_reports does not accept resource parameters."
  end

  resource_params
end