Class: Fog::Google::Monitoring::MonitoredResourceDescriptors

Inherits:
Collection
  • Object
show all
Defined in:
lib/fog/google/models/monitoring/monitored_resource_descriptors.rb

Instance Method Summary collapse

Instance Method Details

#all(filter: nil, page_size: nil, page_token: nil) ⇒ Array<Fog::Google::Monitoring::MetricDescriptor>

Lists all Monitored Resource Descriptors.

Parameters:

  • filter (String) (defaults to: nil)

    The monitoring filter used to search against existing descriptors. @see cloud.google.com/monitoring/api/v3/filters filter documentation

  • page_size (String) (defaults to: nil)

    Maximum number of metric descriptors per page. Used for pagination.

  • page_token (String) (defaults to: nil)

    The pagination token, which is used to page through large result sets.

Returns:



18
19
20
21
22
23
24
25
# File 'lib/fog/google/models/monitoring/monitored_resource_descriptors.rb', line 18

def all(filter: nil, page_size: nil, page_token: nil)
  data = service.list_monitored_resource_descriptors(
    :filter => filter,
    :page_size => page_size,
    :page_token => page_token
  ).to_h[:resource_descriptors] || []
  load(data)
end

#get(resource_type) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/fog/google/models/monitoring/monitored_resource_descriptors.rb', line 27

def get(resource_type)
  data = service.get_monitored_resource_descriptor(resource_type).to_h
  new(data)
rescue ::Google::Apis::ClientError => e
  raise e unless e.status_code == 404
  nil
end