Class: Google::Apis::CloudmonitoringV2beta2::CloudMonitoringService

Inherits:
Google::Apis::Core::BaseService show all
Defined in:
generated/google/apis/cloudmonitoring_v2beta2/service.rb

Overview

Cloud Monitoring API

Accesses Google Cloud Monitoring data.

Examples:

require 'google/apis/cloudmonitoring_v2beta2'

Cloudmonitoring = Google::Apis::CloudmonitoringV2beta2 # Alias the module
service = Cloudmonitoring::CloudMonitoringService.new

See Also:

Instance Attribute Summary collapse

Attributes inherited from Google::Apis::Core::BaseService

#authorization, #base_path, #batch_path, #client, #client_options, #request_options, #root_url, #upload_path

Instance Method Summary collapse

Methods inherited from Google::Apis::Core::BaseService

#batch, #batch_upload, #fetch_all, #http

Constructor Details

#initializeCloudMonitoringService

Returns a new instance of CloudMonitoringService.



51
52
53
# File 'generated/google/apis/cloudmonitoring_v2beta2/service.rb', line 51

def initialize
  super('https://www.googleapis.com/', 'cloudmonitoring/v2beta2/projects/')
end

Instance Attribute Details

#keyString

Returns API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.

Returns:

  • (String)

    API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.



38
39
40
# File 'generated/google/apis/cloudmonitoring_v2beta2/service.rb', line 38

def key
  @key
end

#quota_userString

Returns Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.

Returns:

  • (String)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.



44
45
46
# File 'generated/google/apis/cloudmonitoring_v2beta2/service.rb', line 44

def quota_user
  @quota_user
end

#user_ipString

Returns IP address of the site where the request originates. Use this if you want to enforce per-user limits.

Returns:

  • (String)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.



49
50
51
# File 'generated/google/apis/cloudmonitoring_v2beta2/service.rb', line 49

def user_ip
  @user_ip
end

Instance Method Details

#create_metric_descriptor(project, metric_descriptor_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::CloudmonitoringV2beta2::MetricDescriptor

Create a new metric.

Parameters:

  • project (String)

    The project id. The value can be the numeric project ID or string-based project name.

  • metric_descriptor_object (Google::Apis::CloudmonitoringV2beta2::MetricDescriptor) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.

  • user_ip (String) (defaults to: nil)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



81
82
83
84
85
86
87
88
89
90
91
92
# File 'generated/google/apis/cloudmonitoring_v2beta2/service.rb', line 81

def create_metric_descriptor(project, metric_descriptor_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
  command =  make_simple_command(:post, '{project}/metricDescriptors', options)
  command.request_representation = Google::Apis::CloudmonitoringV2beta2::MetricDescriptor::Representation
  command.request_object = metric_descriptor_object
  command.response_representation = Google::Apis::CloudmonitoringV2beta2::MetricDescriptor::Representation
  command.response_class = Google::Apis::CloudmonitoringV2beta2::MetricDescriptor
  command.params['project'] = project unless project.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  command.query['userIp'] = user_ip unless user_ip.nil?
  execute_or_queue_command(command, &block)
end

#delete_metric_descriptor(project, metric, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::CloudmonitoringV2beta2::DeleteMetricDescriptorResponse

Delete an existing metric.

Parameters:

  • project (String)

    The project ID to which the metric belongs.

  • metric (String)

    Name of the metric.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.

  • user_ip (String) (defaults to: nil)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



120
121
122
123
124
125
126
127
128
129
130
# File 'generated/google/apis/cloudmonitoring_v2beta2/service.rb', line 120

def delete_metric_descriptor(project, metric, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
  command =  make_simple_command(:delete, '{project}/metricDescriptors/{metric}', options)
  command.response_representation = Google::Apis::CloudmonitoringV2beta2::DeleteMetricDescriptorResponse::Representation
  command.response_class = Google::Apis::CloudmonitoringV2beta2::DeleteMetricDescriptorResponse
  command.params['project'] = project unless project.nil?
  command.params['metric'] = metric unless metric.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  command.query['userIp'] = user_ip unless user_ip.nil?
  execute_or_queue_command(command, &block)
end

#list_metric_descriptors(project, list_metric_descriptors_request_object = nil, count: nil, page_token: nil, query: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::CloudmonitoringV2beta2::ListMetricDescriptorsResponse

List metric descriptors that match the query. If the query is not set, then all of the metric descriptors will be returned. Large responses will be paginated, use the nextPageToken returned in the response to request subsequent pages of results by setting the pageToken query parameter to the value of the nextPageToken.

Parameters:

  • project (String)

    The project id. The value can be the numeric project ID or string-based project name.

  • list_metric_descriptors_request_object (Google::Apis::CloudmonitoringV2beta2::ListMetricDescriptorsRequest) (defaults to: nil)
  • count (Fixnum) (defaults to: nil)

    Maximum number of metric descriptors per page. Used for pagination. If not specified, count = 100.

  • page_token (String) (defaults to: nil)

    The pagination token, which is used to page through large result sets. Set this value to the value of the nextPageToken to retrieve the next page of results.

  • query (String) (defaults to: nil)

    The query used to search against existing metrics. Separate keywords with a space; the service joins all keywords with AND, meaning that all keywords must match for a metric to be returned. If this field is omitted, all metrics are returned. If an empty string is passed with this field, no metrics are returned.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.

  • user_ip (String) (defaults to: nil)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# File 'generated/google/apis/cloudmonitoring_v2beta2/service.rb', line 175

def list_metric_descriptors(project, list_metric_descriptors_request_object = nil, count: nil, page_token: nil, query: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
  command =  make_simple_command(:get, '{project}/metricDescriptors', options)
  command.request_representation = Google::Apis::CloudmonitoringV2beta2::ListMetricDescriptorsRequest::Representation
  command.request_object = list_metric_descriptors_request_object
  command.response_representation = Google::Apis::CloudmonitoringV2beta2::ListMetricDescriptorsResponse::Representation
  command.response_class = Google::Apis::CloudmonitoringV2beta2::ListMetricDescriptorsResponse
  command.params['project'] = project unless project.nil?
  command.query['count'] = count unless count.nil?
  command.query['pageToken'] = page_token unless page_token.nil?
  command.query['query'] = query unless query.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  command.query['userIp'] = user_ip unless user_ip.nil?
  execute_or_queue_command(command, &block)
end

#list_timeseries(project, metric, youngest, list_timeseries_request_object = nil, aggregator: nil, count: nil, labels: nil, oldest: nil, page_token: nil, timespan: nil, window: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::CloudmonitoringV2beta2::ListTimeseriesResponse

List the data points of the time series that match the metric and labels values and that have data points in the interval. Large responses are paginated; use the nextPageToken returned in the response to request subsequent pages of results by setting the pageToken query parameter to the value of the nextPageToken.

Parameters:

  • project (String)

    The project ID to which this time series belongs. The value can be the numeric project ID or string-based project name.

  • metric (String)

    Metric names are protocol-free URLs as listed in the Supported Metrics page. For example, compute.googleapis.com/instance/disk/read_ops_count.

  • youngest (String)

    End of the time interval (inclusive), which is expressed as an RFC 3339 timestamp.

  • list_timeseries_request_object (Google::Apis::CloudmonitoringV2beta2::ListTimeseriesRequest) (defaults to: nil)
  • aggregator (String) (defaults to: nil)

    The aggregation function that will reduce the data points in each window to a single point. This parameter is only valid for non-cumulative metrics with a value type of INT64 or DOUBLE.

  • count (Fixnum) (defaults to: nil)

    Maximum number of data points per page, which is used for pagination of results.

  • labels (Array<String>, String) (defaults to: nil)

    A collection of labels for the matching time series, which are represented as:

    • key==value: key equals the value
    • key=~value: key regex matches the value
    • key!=value: key does not equal the value
    • key!~value: key regex does not match the value For example, to list all of the time series descriptors for the region us-central1, you could specify: label=cloud.googleapis.com%2Flocation=~us-central1.*
  • oldest (String) (defaults to: nil)

    Start of the time interval (exclusive), which is expressed as an RFC 3339 timestamp. If neither oldest nor timespan is specified, the default time interval will be (youngest - 4 hours, youngest]

  • page_token (String) (defaults to: nil)

    The pagination token, which is used to page through large result sets. Set this value to the value of the nextPageToken to retrieve the next page of results.

  • timespan (String) (defaults to: nil)

    Length of the time interval to query, which is an alternative way to declare the interval: (youngest - timespan, youngest]. The timespan and oldest parameters should not be used together. Units:

    • s: second
    • m: minute
    • h: hour
    • d: day
    • w: week Examples: 2s, 3m, 4w. Only one unit is allowed, for example: 2w3d is not allowed; you should use 17d instead. If neither oldest nor timespan is specified, the default time interval will be (youngest - 4 hours, youngest].
  • window (String) (defaults to: nil)

    The sampling window. At most one data point will be returned for each window in the requested time interval. This parameter is only valid for non- cumulative metric types. Units:

    • m: minute
    • h: hour
    • d: day
    • w: week Examples: 3m, 4w. Only one unit is allowed, for example: 2w3d is not allowed; you should use 17d instead.
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.

  • user_ip (String) (defaults to: nil)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
# File 'generated/google/apis/cloudmonitoring_v2beta2/service.rb', line 272

def list_timeseries(project, metric, youngest, list_timeseries_request_object = nil, aggregator: nil, count: nil, labels: nil, oldest: nil, page_token: nil, timespan: nil, window: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
  command =  make_simple_command(:get, '{project}/timeseries/{metric}', options)
  command.request_representation = Google::Apis::CloudmonitoringV2beta2::ListTimeseriesRequest::Representation
  command.request_object = list_timeseries_request_object
  command.response_representation = Google::Apis::CloudmonitoringV2beta2::ListTimeseriesResponse::Representation
  command.response_class = Google::Apis::CloudmonitoringV2beta2::ListTimeseriesResponse
  command.params['project'] = project unless project.nil?
  command.params['metric'] = metric unless metric.nil?
  command.query['aggregator'] = aggregator unless aggregator.nil?
  command.query['count'] = count unless count.nil?
  command.query['labels'] = labels unless labels.nil?
  command.query['oldest'] = oldest unless oldest.nil?
  command.query['pageToken'] = page_token unless page_token.nil?
  command.query['timespan'] = timespan unless timespan.nil?
  command.query['window'] = window unless window.nil?
  command.query['youngest'] = youngest unless youngest.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  command.query['userIp'] = user_ip unless user_ip.nil?
  execute_or_queue_command(command, &block)
end

#list_timeseries_descriptors(project, metric, youngest, list_timeseries_descriptors_request_object = nil, aggregator: nil, count: nil, labels: nil, oldest: nil, page_token: nil, timespan: nil, window: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::CloudmonitoringV2beta2::ListTimeseriesDescriptorsResponse

List the descriptors of the time series that match the metric and labels values and that have data points in the interval. Large responses are paginated; use the nextPageToken returned in the response to request subsequent pages of results by setting the pageToken query parameter to the value of the nextPageToken.

Parameters:

  • project (String)

    The project ID to which this time series belongs. The value can be the numeric project ID or string-based project name.

  • metric (String)

    Metric names are protocol-free URLs as listed in the Supported Metrics page. For example, compute.googleapis.com/instance/disk/read_ops_count.

  • youngest (String)

    End of the time interval (inclusive), which is expressed as an RFC 3339 timestamp.

  • list_timeseries_descriptors_request_object (Google::Apis::CloudmonitoringV2beta2::ListTimeseriesDescriptorsRequest) (defaults to: nil)
  • aggregator (String) (defaults to: nil)

    The aggregation function that will reduce the data points in each window to a single point. This parameter is only valid for non-cumulative metrics with a value type of INT64 or DOUBLE.

  • count (Fixnum) (defaults to: nil)

    Maximum number of time series descriptors per page. Used for pagination. If not specified, count = 100.

  • labels (Array<String>, String) (defaults to: nil)

    A collection of labels for the matching time series, which are represented as:

    • key==value: key equals the value
    • key=~value: key regex matches the value
    • key!=value: key does not equal the value
    • key!~value: key regex does not match the value For example, to list all of the time series descriptors for the region us-central1, you could specify: label=cloud.googleapis.com%2Flocation=~us-central1.*
  • oldest (String) (defaults to: nil)

    Start of the time interval (exclusive), which is expressed as an RFC 3339 timestamp. If neither oldest nor timespan is specified, the default time interval will be (youngest - 4 hours, youngest]

  • page_token (String) (defaults to: nil)

    The pagination token, which is used to page through large result sets. Set this value to the value of the nextPageToken to retrieve the next page of results.

  • timespan (String) (defaults to: nil)

    Length of the time interval to query, which is an alternative way to declare the interval: (youngest - timespan, youngest]. The timespan and oldest parameters should not be used together. Units:

    • s: second
    • m: minute
    • h: hour
    • d: day
    • w: week Examples: 2s, 3m, 4w. Only one unit is allowed, for example: 2w3d is not allowed; you should use 17d instead. If neither oldest nor timespan is specified, the default time interval will be (youngest - 4 hours, youngest].
  • window (String) (defaults to: nil)

    The sampling window. At most one data point will be returned for each window in the requested time interval. This parameter is only valid for non- cumulative metric types. Units:

    • m: minute
    • h: hour
    • d: day
    • w: week Examples: 3m, 4w. Only one unit is allowed, for example: 2w3d is not allowed; you should use 17d instead.
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.

  • user_ip (String) (defaults to: nil)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
# File 'generated/google/apis/cloudmonitoring_v2beta2/service.rb', line 420

def list_timeseries_descriptors(project, metric, youngest, list_timeseries_descriptors_request_object = nil, aggregator: nil, count: nil, labels: nil, oldest: nil, page_token: nil, timespan: nil, window: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
  command =  make_simple_command(:get, '{project}/timeseriesDescriptors/{metric}', options)
  command.request_representation = Google::Apis::CloudmonitoringV2beta2::ListTimeseriesDescriptorsRequest::Representation
  command.request_object = list_timeseries_descriptors_request_object
  command.response_representation = Google::Apis::CloudmonitoringV2beta2::ListTimeseriesDescriptorsResponse::Representation
  command.response_class = Google::Apis::CloudmonitoringV2beta2::ListTimeseriesDescriptorsResponse
  command.params['project'] = project unless project.nil?
  command.params['metric'] = metric unless metric.nil?
  command.query['aggregator'] = aggregator unless aggregator.nil?
  command.query['count'] = count unless count.nil?
  command.query['labels'] = labels unless labels.nil?
  command.query['oldest'] = oldest unless oldest.nil?
  command.query['pageToken'] = page_token unless page_token.nil?
  command.query['timespan'] = timespan unless timespan.nil?
  command.query['window'] = window unless window.nil?
  command.query['youngest'] = youngest unless youngest.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  command.query['userIp'] = user_ip unless user_ip.nil?
  execute_or_queue_command(command, &block)
end

#write_timeseries(project, write_timeseries_request_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::CloudmonitoringV2beta2::WriteTimeseriesResponse

Put data points to one or more time series for one or more metrics. If a time series does not exist, a new time series will be created. It is not allowed to write a time series point that is older than the existing youngest point of that time series. Points that are older than the existing youngest point of that time series will be discarded silently. Therefore, users should make sure that points of a time series are written sequentially in the order of their end time.

Parameters:

  • project (String)

    The project ID. The value can be the numeric project ID or string-based project name.

  • write_timeseries_request_object (Google::Apis::CloudmonitoringV2beta2::WriteTimeseriesRequest) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.

  • user_ip (String) (defaults to: nil)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



326
327
328
329
330
331
332
333
334
335
336
337
# File 'generated/google/apis/cloudmonitoring_v2beta2/service.rb', line 326

def write_timeseries(project, write_timeseries_request_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
  command =  make_simple_command(:post, '{project}/timeseries:write', options)
  command.request_representation = Google::Apis::CloudmonitoringV2beta2::WriteTimeseriesRequest::Representation
  command.request_object = write_timeseries_request_object
  command.response_representation = Google::Apis::CloudmonitoringV2beta2::WriteTimeseriesResponse::Representation
  command.response_class = Google::Apis::CloudmonitoringV2beta2::WriteTimeseriesResponse
  command.params['project'] = project unless project.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  command.query['userIp'] = user_ip unless user_ip.nil?
  execute_or_queue_command(command, &block)
end