Class: Smplkit::Audit::ResourceTypes
- Inherits:
-
Object
- Object
- Smplkit::Audit::ResourceTypes
- Defined in:
- lib/smplkit/audit/resource_types.rb
Overview
client.audit.resource_types.list — distinct resource_type slugs seen for the account.
Response time is independent of how many years of events the account has accumulated. Sorted alphabetically; offset paginated.
Instance Method Summary collapse
-
#initialize(api) ⇒ ResourceTypes
constructor
A new instance of ResourceTypes.
-
#list(page_number: nil, page_size: nil, meta_total: nil, environments: nil) ⇒ Smplkit::Audit::ResourceTypeListPage
List the distinct
resource_typeslugs seen in the account.
Constructor Details
#initialize(api) ⇒ ResourceTypes
Returns a new instance of ResourceTypes.
11 12 13 |
# File 'lib/smplkit/audit/resource_types.rb', line 11 def initialize(api) @api = api end |
Instance Method Details
#list(page_number: nil, page_size: nil, meta_total: nil, environments: nil) ⇒ Smplkit::Audit::ResourceTypeListPage
List the distinct resource_type slugs seen in the account.
environments scopes the listing to a set of environments: pass an array of environment keys and/or the reserved “smplkit” control-plane bucket; the values are comma-joined into filter[environment]. Omitting it (or passing an empty array) leaves the filter off entirely.
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/smplkit/audit/resource_types.rb', line 34 def list(page_number: nil, page_size: nil, meta_total: nil, environments: nil) opts = {} opts[:page_number] = page_number if page_number opts[:page_size] = page_size if page_size opts[:meta_total] = unless .nil? joined_environments = Smplkit::Audit.join_environments(environments) opts[:filter_environment] = joined_environments if joined_environments resp = Smplkit::Audit.call_api { @api.list_resource_types(opts) } rows = (resp.data || []).map { |r| ResourceType.from_resource(r) } ResourceTypeListPage.new(rows, Smplkit::Audit.extract_pagination(resp.)) end |