Class: Fog::Google::Monitoring::Real

Inherits:
Object
  • Object
show all
Includes:
Shared
Defined in:
lib/fog/google/requests/monitoring/list_timeseries.rb,
lib/fog/google/monitoring.rb,
lib/fog/google/requests/monitoring/list_metric_descriptors.rb,
lib/fog/google/requests/monitoring/list_timeseries_descriptors.rb

Overview

List the descriptors of the time series that match the metric and labels values and that have data points in the interval.

Instance Attribute Summary collapse

Attributes included from Shared

#api_url, #api_version, #project

Instance Method Summary collapse

Methods included from Shared

#build_excon_response, #create_signing_key, #initialize_google_client, #new_pk12_google_client, #request, #shared_initialize

Constructor Details

#initialize(options) ⇒ Real

Returns a new instance of Real.



79
80
81
82
83
84
85
# File 'lib/fog/google/monitoring.rb', line 79

def initialize(options)
  shared_initialize(options[:google_project], GOOGLE_MONITORING_API_VERSION, GOOGLE_MONITORING_BASE_URL)
  options.merge!(:google_api_scope_url => GOOGLE_MONITORING_API_SCOPE_URLS.join(' '))

  @client = initialize_google_client(options)
  @monitoring = @client.discovered_api('cloudmonitoring', api_version)
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



76
77
78
# File 'lib/fog/google/monitoring.rb', line 76

def client
  @client
end

#monitoringObject (readonly)

Returns the value of attribute monitoring.



77
78
79
# File 'lib/fog/google/monitoring.rb', line 77

def monitoring
  @monitoring
end

Instance Method Details

#list_metric_descriptors(options = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/fog/google/requests/monitoring/list_metric_descriptors.rb', line 10

def list_metric_descriptors(options = {})
  api_method = @monitoring.metric_descriptors.list
  parameters = {
    'project' => @project,
  }

  parameters['count'] = options[:count] if options.key?(:count)
  parameters['pageToken'] = options[:page_token] if options.key?(:page_token)
  parameters['query'] = options[:query] if options.key?(:query)

  request(api_method, parameters)
end

#list_timeseries(metric, youngest, options = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/fog/google/requests/monitoring/list_timeseries.rb', line 10

def list_timeseries(metric, youngest, options = {})
  api_method = @monitoring.timeseries.list
  parameters = {
    'project' => @project,
    'metric' => metric,
    'youngest' => youngest,
  }

  parameters['count'] = options[:count] if options.key?(:count)
  parameters['labels'] = options[:labels] if options.key?(:labels)
  parameters['oldest'] = options[:oldest] if options.key?(:oldest)
  parameters['pageToken'] = options[:page_token] if options.key?(:page_token)
  parameters['timespan'] = options[:timespan] if options.key?(:timespan)

  request(api_method, parameters)
end

#list_timeseries_descriptors(metric, youngest, options = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/fog/google/requests/monitoring/list_timeseries_descriptors.rb', line 10

def list_timeseries_descriptors(metric, youngest, options = {})
  api_method = @monitoring.timeseries_descriptors.list
  parameters = {
    'project' => @project,
    'metric' => metric,
    'youngest' => youngest,
  }

  parameters['count'] = options[:count] if options.key?(:count)
  parameters['labels'] = options[:labels] if options.key?(:labels)
  parameters['oldest'] = options[:oldest] if options.key?(:oldest)
  parameters['pageToken'] = options[:page_token] if options.key?(:page_token)
  parameters['timespan'] = options[:timespan] if options.key?(:timespan)

  request(api_method, parameters)
end