Reference documentation and code samples for the Cloud Monitoring Metrics Scopes V1 API class Google::Cloud::Monitoring::MetricsScope::V1::MetricsScopes::Client.
Client for the MetricsScopes service.
Manages Cloud Monitoring Metrics Scopes, and the monitoring of Google Cloud projects and AWS accounts.
Inherits
- Object
Methods
.configure
def self.configure() { |config| ... } -> Client::ConfigurationConfigure the MetricsScopes Client class.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
# Modify the configuration for all MetricsScopes clients ::Google::Cloud::Monitoring::MetricsScope::V1::MetricsScopes::Client.configure do |config| config.timeout = 10.0 end
#configure
def configure() { |config| ... } -> Client::ConfigurationConfigure the MetricsScopes Client instance.
The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
#create_monitored_project
def create_monitored_project(request, options = nil) -> ::Gapic::Operation
def create_monitored_project(parent: nil, monitored_project: nil) -> ::Gapic::OperationAdds a MonitoredProject with the given project ID
to the specified Metrics Scope.
def create_monitored_project(request, options = nil) -> ::Gapic::Operationcreate_monitored_project via a request object, either of type
CreateMonitoredProjectRequest or an equivalent Hash.
- request (::Google::Cloud::Monitoring::MetricsScope::V1::CreateMonitoredProjectRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def create_monitored_project(parent: nil, monitored_project: nil) -> ::Gapic::Operationcreate_monitored_project via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. The resource name of the existing
Metrics Scopethat will monitor this project. Example:locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER} -
monitored_project (::Google::Cloud::Monitoring::MetricsScope::V1::MonitoredProject, ::Hash) — Required. The initial
MonitoredProjectconfiguration. Specify only themonitored_project.namefield. All other fields are ignored. Themonitored_project.namemust be in the format:locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::Operation)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/monitoring/metrics_scope/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Monitoring::MetricsScope::V1::MetricsScopes::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Monitoring::MetricsScope::V1::CreateMonitoredProjectRequest.new # Call the create_monitored_project method. result = client.create_monitored_project request # The returned object is of type Gapic::Operation. You can use it to # check the status of an operation, cancel it, or wait for results. # Here is how to wait for a response. result.wait_until_done! timeout: 60 if result.response? p result.response else puts "No response received." end
#delete_monitored_project
def delete_monitored_project(request, options = nil) -> ::Gapic::Operation
def delete_monitored_project(name: nil) -> ::Gapic::OperationDeletes a MonitoredProject from the specified Metrics Scope.
def delete_monitored_project(request, options = nil) -> ::Gapic::Operationdelete_monitored_project via a request object, either of type
DeleteMonitoredProjectRequest or an equivalent Hash.
- request (::Google::Cloud::Monitoring::MetricsScope::V1::DeleteMonitoredProjectRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def delete_monitored_project(name: nil) -> ::Gapic::Operationdelete_monitored_project via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
name (::String) — Required. The resource name of the
MonitoredProject. Example:locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}Authorization requires the following Google IAM permissions on both the
Metrics Scopeand on theMonitoredProject:monitoring.metricsScopes.link
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::Operation)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/monitoring/metrics_scope/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Monitoring::MetricsScope::V1::MetricsScopes::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Monitoring::MetricsScope::V1::DeleteMonitoredProjectRequest.new # Call the delete_monitored_project method. result = client.delete_monitored_project request # The returned object is of type Gapic::Operation. You can use it to # check the status of an operation, cancel it, or wait for results. # Here is how to wait for a response. result.wait_until_done! timeout: 60 if result.response? p result.response else puts "No response received." end
#get_metrics_scope
def get_metrics_scope(request, options = nil) -> ::Google::Cloud::Monitoring::MetricsScope::V1::MetricsScope
def get_metrics_scope(name: nil) -> ::Google::Cloud::Monitoring::MetricsScope::V1::MetricsScopeReturns a specific Metrics Scope.
def get_metrics_scope(request, options = nil) -> ::Google::Cloud::Monitoring::MetricsScope::V1::MetricsScopeget_metrics_scope via a request object, either of type
GetMetricsScopeRequest or an equivalent Hash.
- request (::Google::Cloud::Monitoring::MetricsScope::V1::GetMetricsScopeRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_metrics_scope(name: nil) -> ::Google::Cloud::Monitoring::MetricsScope::V1::MetricsScopeget_metrics_scope via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
name (::String) — Required. The resource name of the
Metrics Scope. Example:locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Monitoring::MetricsScope::V1::MetricsScope)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/monitoring/metrics_scope/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Monitoring::MetricsScope::V1::MetricsScopes::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Monitoring::MetricsScope::V1::GetMetricsScopeRequest.new # Call the get_metrics_scope method. result = client.get_metrics_scope request # The returned object is of type Google::Cloud::Monitoring::MetricsScope::V1::MetricsScope. p result
#initialize
def initialize() { |config| ... } -> ClientCreate a new MetricsScopes client object.
- (config) — Configure the MetricsScopes client.
- config (Client::Configuration)
- (Client) — a new instance of Client
# Create a client using the default configuration client = ::Google::Cloud::Monitoring::MetricsScope::V1::MetricsScopes::Client.new # Create a client using a custom configuration client = ::Google::Cloud::Monitoring::MetricsScope::V1::MetricsScopes::Client.new do |config| config.timeout = 10.0 end
#list_metrics_scopes_by_monitored_project
def list_metrics_scopes_by_monitored_project(request, options = nil) -> ::Google::Cloud::Monitoring::MetricsScope::V1::ListMetricsScopesByMonitoredProjectResponse
def list_metrics_scopes_by_monitored_project(monitored_resource_container: nil) -> ::Google::Cloud::Monitoring::MetricsScope::V1::ListMetricsScopesByMonitoredProjectResponseReturns a list of every Metrics Scope that a specific MonitoredProject
has been added to. The metrics scope representing the specified monitored
project will always be the first entry in the response.
def list_metrics_scopes_by_monitored_project(request, options = nil) -> ::Google::Cloud::Monitoring::MetricsScope::V1::ListMetricsScopesByMonitoredProjectResponselist_metrics_scopes_by_monitored_project via a request object, either of type
ListMetricsScopesByMonitoredProjectRequest or an equivalent Hash.
- request (::Google::Cloud::Monitoring::MetricsScope::V1::ListMetricsScopesByMonitoredProjectRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_metrics_scopes_by_monitored_project(monitored_resource_container: nil) -> ::Google::Cloud::Monitoring::MetricsScope::V1::ListMetricsScopesByMonitoredProjectResponselist_metrics_scopes_by_monitored_project via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
monitored_resource_container (::String) — Required. The resource name of the
Monitored Projectbeing requested. Example:projects/{MONITORED_PROJECT_ID_OR_NUMBER}
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Monitoring::MetricsScope::V1::ListMetricsScopesByMonitoredProjectResponse)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/monitoring/metrics_scope/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Monitoring::MetricsScope::V1::MetricsScopes::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Monitoring::MetricsScope::V1::ListMetricsScopesByMonitoredProjectRequest.new # Call the list_metrics_scopes_by_monitored_project method. result = client.list_metrics_scopes_by_monitored_project request # The returned object is of type Google::Cloud::Monitoring::MetricsScope::V1::ListMetricsScopesByMonitoredProjectResponse. p result
#logger
def logger() -> LoggerThe logger used for request/response debug logging.
- (Logger)
#operations_client
def operations_client() -> ::Google::Cloud::Monitoring::MetricsScope::V1::MetricsScopes::OperationsGet the associated client for long-running operations.
#universe_domain
def universe_domain() -> StringThe effective universe domain
- (String)