# Cloud Monitoring Metrics Scopes V1 API - Class Google::Cloud::Monitoring::MetricsScope::V1::MetricsScopes::Client (v1.8.0)

1.8.0 (latest) 1.7.0 1.6.0 1.5.1 1.4.0 1.3.0 1.2.1 1.1.0 1.0.1 0.6.0 0.5.2 0.4.0 0.3.1 0.2.0 0.1.3 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.


<br />

Manages Cloud Monitoring Metrics Scopes, and the monitoring of Google Cloud
projects and AWS accounts.

## Inherits

- Object

## Includes

- [Google::Cloud::Monitoring::MetricsScope::V1::MetricsScopes::Paths](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-metrics_scope-v1/latest/Google-Cloud-Monitoring-MetricsScope-V1-MetricsScopes-Paths)

## Methods

### .configure

    def self.configure() { |config| ... } -> Client::Configuration

Configure the MetricsScopes Client class.


<br />

See [Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-metrics_scope-v1/latest/Google-Cloud-Monitoring-MetricsScope-V1-MetricsScopes-Client-Configuration "Google::Cloud::Monitoring::MetricsScope::V1::MetricsScopes::Client::Configuration (class)")
for a description of the configuration fields.
**Yields**

- (config) --- Configure the Client client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-metrics_scope-v1/latest/Google-Cloud-Monitoring-MetricsScope-V1-MetricsScopes-Client-Configuration))
**Returns**

- ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-metrics_scope-v1/latest/Google-Cloud-Monitoring-MetricsScope-V1-MetricsScopes-Client-Configuration))
**Example**

```ruby
# 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::Configuration

Configure 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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-metrics_scope-v1/latest/Google-Cloud-Monitoring-MetricsScope-V1-MetricsScopes-Client#Google__Cloud__Monitoring__MetricsScope__V1__MetricsScopes__Client_configure_class_ "Google::Cloud::Monitoring::MetricsScope::V1::MetricsScopes::Client.configure (method)").

<br />

See [Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-metrics_scope-v1/latest/Google-Cloud-Monitoring-MetricsScope-V1-MetricsScopes-Client-Configuration "Google::Cloud::Monitoring::MetricsScope::V1::MetricsScopes::Client::Configuration (class)")
for a description of the configuration fields.
**Yields**

- (config) --- Configure the Client client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-metrics_scope-v1/latest/Google-Cloud-Monitoring-MetricsScope-V1-MetricsScopes-Client-Configuration))
**Returns**

- ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-metrics_scope-v1/latest/Google-Cloud-Monitoring-MetricsScope-V1-MetricsScopes-Client-Configuration))

### #create_monitored_project

    def create_monitored_project(request, options = nil) -> ::Gapic::Operation
    def create_monitored_project(parent: nil, monitored_project: nil) -> ::Gapic::Operation

Adds a `MonitoredProject` with the given project ID
to the specified `Metrics Scope`.
**Overloads**

    def create_monitored_project(request, options = nil) -> ::Gapic::Operation

Pass arguments to `create_monitored_project` via a request object, either of type [CreateMonitoredProjectRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-metrics_scope-v1/latest/Google-Cloud-Monitoring-MetricsScope-V1-CreateMonitoredProjectRequest "Google::Cloud::Monitoring::MetricsScope::V1::CreateMonitoredProjectRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Monitoring::MetricsScope::V1::CreateMonitoredProjectRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-metrics_scope-v1/latest/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::Operation

Pass arguments to `create_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). **Parameters**

- **parent** (::String) --- Required. The resource name of the existing `Metrics Scope` that will monitor this project. Example: `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}`
- **monitored_project** ([::Google::Cloud::Monitoring::MetricsScope::V1::MonitoredProject](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-metrics_scope-v1/latest/Google-Cloud-Monitoring-MetricsScope-V1-MonitoredProject), ::Hash) --- Required. The initial `MonitoredProject` configuration. Specify only the `monitored_project.name` field. All other fields are ignored. The `monitored_project.name` must be in the format: `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}/projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** (::Gapic::Operation)
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- (::Gapic::Operation)
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
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::Operation

Deletes a `MonitoredProject` from the specified `Metrics Scope`.
**Overloads**

    def delete_monitored_project(request, options = nil) -> ::Gapic::Operation

Pass arguments to `delete_monitored_project` via a request object, either of type [DeleteMonitoredProjectRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-metrics_scope-v1/latest/Google-Cloud-Monitoring-MetricsScope-V1-DeleteMonitoredProjectRequest "Google::Cloud::Monitoring::MetricsScope::V1::DeleteMonitoredProjectRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Monitoring::MetricsScope::V1::DeleteMonitoredProjectRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-metrics_scope-v1/latest/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::Operation

Pass arguments to `delete_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). **Parameter**

- **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](https://cloud.google.com/iam) permissions on both the `Metrics Scope`
  and on the `MonitoredProject`: `monitoring.metricsScopes.link`
**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** (::Gapic::Operation)
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- (::Gapic::Operation)
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
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::MetricsScope

Returns a specific `Metrics Scope`.
**Overloads**

    def get_metrics_scope(request, options = nil) -> ::Google::Cloud::Monitoring::MetricsScope::V1::MetricsScope

Pass arguments to `get_metrics_scope` via a request object, either of type [GetMetricsScopeRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-metrics_scope-v1/latest/Google-Cloud-Monitoring-MetricsScope-V1-GetMetricsScopeRequest "Google::Cloud::Monitoring::MetricsScope::V1::GetMetricsScopeRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Monitoring::MetricsScope::V1::GetMetricsScopeRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-metrics_scope-v1/latest/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::MetricsScope

Pass arguments to `get_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). **Parameter**

- **name** (::String) --- Required. The resource name of the `Metrics Scope`. Example: `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}`
**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** ([::Google::Cloud::Monitoring::MetricsScope::V1::MetricsScope](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-metrics_scope-v1/latest/Google-Cloud-Monitoring-MetricsScope-V1-MetricsScope))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Cloud::Monitoring::MetricsScope::V1::MetricsScope](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-metrics_scope-v1/latest/Google-Cloud-Monitoring-MetricsScope-V1-MetricsScope))
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
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| ... } -> Client

Create a new MetricsScopes client object.
**Yields**

- (config) --- Configure the MetricsScopes client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-metrics_scope-v1/latest/Google-Cloud-Monitoring-MetricsScope-V1-MetricsScopes-Client-Configuration))
**Returns**

- ([Client](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-metrics_scope-v1/latest/Google-Cloud-Monitoring-MetricsScope-V1-MetricsScopes-Client)) --- a new instance of Client
**Example**

```ruby
# 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::ListMetricsScopesByMonitoredProjectResponse

Returns 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.
**Overloads**

    def list_metrics_scopes_by_monitored_project(request, options = nil) -> ::Google::Cloud::Monitoring::MetricsScope::V1::ListMetricsScopesByMonitoredProjectResponse

Pass arguments to `list_metrics_scopes_by_monitored_project` via a request object, either of type [ListMetricsScopesByMonitoredProjectRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-metrics_scope-v1/latest/Google-Cloud-Monitoring-MetricsScope-V1-ListMetricsScopesByMonitoredProjectRequest "Google::Cloud::Monitoring::MetricsScope::V1::ListMetricsScopesByMonitoredProjectRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Monitoring::MetricsScope::V1::ListMetricsScopesByMonitoredProjectRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-metrics_scope-v1/latest/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::ListMetricsScopesByMonitoredProjectResponse

Pass arguments to `list_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). **Parameter**

- **monitored_resource_container** (::String) --- Required. The resource name of the `Monitored Project` being requested. Example: `projects/{MONITORED_PROJECT_ID_OR_NUMBER}`
**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** ([::Google::Cloud::Monitoring::MetricsScope::V1::ListMetricsScopesByMonitoredProjectResponse](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-metrics_scope-v1/latest/Google-Cloud-Monitoring-MetricsScope-V1-ListMetricsScopesByMonitoredProjectResponse))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Cloud::Monitoring::MetricsScope::V1::ListMetricsScopesByMonitoredProjectResponse](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-metrics_scope-v1/latest/Google-Cloud-Monitoring-MetricsScope-V1-ListMetricsScopesByMonitoredProjectResponse))
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
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() -> Logger

The logger used for request/response debug logging.
**Returns**

- (Logger)

### #operations_client

    def operations_client() -> ::Google::Cloud::Monitoring::MetricsScope::V1::MetricsScopes::Operations

Get the associated client for long-running operations.
**Returns**

- ([::Google::Cloud::Monitoring::MetricsScope::V1::MetricsScopes::Operations](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-monitoring-metrics_scope-v1/latest/Google-Cloud-Monitoring-MetricsScope-V1-MetricsScopes-Operations))

### #universe_domain

    def universe_domain() -> String

The effective universe domain
**Returns**

- (String)