# Class MetricsScopesClient (0.87.0)

0.87.0 (latest) 0.85.0 0.82.0 0.81.0 0.79.0 0.77.0 0.76.0 0.74.0 0.72.0 0.70.0 0.69.0 0.68.0 0.67.0 0.66.0 0.64.0 0.62.0 0.61.0 0.58.0 0.57.0 0.56.0 0.54.0 0.53.0 0.52.0 0.51.0 0.50.0 0.49.0 0.48.0 0.47.0 0.46.0 0.45.0 0.43.0 0.42.0 0.41.0 0.40.0 0.39.0 0.38.0 0.37.0 0.36.0 0.35.0 0.34.0 0.33.0 0.31.0 0.30.0 0.29.0 0.28.0 0.27.0 0.26.0 0.25.0 0.24.0 0.23.0 0.22.0 0.21.0 0.18.0 0.17.0 0.16.0 0.15.0 0.14.0 0.13.0 0.12.0 0.11.0 0.10.0 0.9.0 0.8.0 0.7.0 0.6.0 0.5.0 0.3.0 0.2.0 0.1.0

|---|---|
| [GitHub Repository](https://github.com/googleapis/google-cloud-java/tree/main/java-monitoring-metricsscope/google-cloud-monitoring-metricsscope/src/main/java/com/google/monitoring/metricsscope/v1/MetricsScopesClient.java) | [Product Reference](https://cloud.google.com/monitoring/api/ref_v3/rest/v1/locations.global.metricsScopes) |

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

This class provides the ability to make remote calls to the backing service through method
calls that map to API methods. Sample code to get started:


     // This snippet has been automatically generated and should be regarded as a code template only.
     // It will require modifications to work:
     // - It may require correct/in-range values for request initialization.
     // - It may require specifying regional endpoints when creating the service client as shown in
     // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
     try (MetricsScopesClient metricsScopesClient = MetricsScopesClient.create()) {
       MetricsScopeName name = MetricsScopeName.of("[METRICS_SCOPE]");
       MetricsScope response = metricsScopesClient.getMetricsScope(name);
     }
     
Note: close() needs to be called on the MetricsScopesClient object to clean up resources such
as threads. In the example above, try-with-resources is used, which automatically calls close().

| Method | Description | Method Variants |
|---|---|---|
| GetMetricsScope | Returns a specific `Metrics Scope`. | Request object method variants only take one parameter, a request object, which must be constructed before the call. - getMetricsScope(GetMetricsScopeRequest request) "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. - getMetricsScope(MetricsScopeName name) - getMetricsScope(String name) Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. - getMetricsScopeCallable() |
| ListMetricsScopesByMonitoredProject | 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. | Request object method variants only take one parameter, a request object, which must be constructed before the call. - listMetricsScopesByMonitoredProject(ListMetricsScopesByMonitoredProjectRequest request) Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. - listMetricsScopesByMonitoredProjectCallable() |
| CreateMonitoredProject | Adds a `MonitoredProject` with the given project ID to the specified `Metrics Scope`. | Request object method variants only take one parameter, a request object, which must be constructed before the call. - createMonitoredProjectAsync(CreateMonitoredProjectRequest request) Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service. - createMonitoredProjectAsync(MetricsScopeName parent, MonitoredProject monitoredProject) - createMonitoredProjectAsync(String parent, MonitoredProject monitoredProject) Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. - createMonitoredProjectOperationCallable() - createMonitoredProjectCallable() |
| DeleteMonitoredProject | Deletes a `MonitoredProject` from the specified `Metrics Scope`. | Request object method variants only take one parameter, a request object, which must be constructed before the call. - deleteMonitoredProjectAsync(DeleteMonitoredProjectRequest request) Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service. - deleteMonitoredProjectAsync(MonitoredProjectName name) - deleteMonitoredProjectAsync(String name) Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. - deleteMonitoredProjectOperationCallable() - deleteMonitoredProjectCallable() |
[Methods]

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with
these names, this class includes a format method for each type of name, and additionally a parse
method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of MetricsScopesSettings to
create(). For example:

To customize credentials:


     // This snippet has been automatically generated and should be regarded as a code template only.
     // It will require modifications to work:
     // - It may require correct/in-range values for request initialization.
     // - It may require specifying regional endpoints when creating the service client as shown in
     // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
     MetricsScopesSettings metricsScopesSettings =
         MetricsScopesSettings.newBuilder()
             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
             .build();
     MetricsScopesClient metricsScopesClient = MetricsScopesClient.create(metricsScopesSettings);
     
To customize the endpoint:


     // This snippet has been automatically generated and should be regarded as a code template only.
     // It will require modifications to work:
     // - It may require correct/in-range values for request initialization.
     // - It may require specifying regional endpoints when creating the service client as shown in
     // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
     MetricsScopesSettings metricsScopesSettings =
         MetricsScopesSettings.newBuilder().setEndpoint(myEndpoint).build();
     MetricsScopesClient metricsScopesClient = MetricsScopesClient.create(metricsScopesSettings);
     
Please refer to the GitHub repository's samples for more quickstart code snippets.

## Inheritance

[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> MetricsScopesClient

## Static Methods

### create()

    public static final MetricsScopesClient create()

Constructs an instance of MetricsScopesClient with default settings.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.MetricsScopesClient` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` |   |

### create(MetricsScopesSettings settings)

    public static final MetricsScopesClient create(MetricsScopesSettings settings)

Constructs an instance of MetricsScopesClient, using the given settings. The channels are
created based on the settings passed in, or defaults for any settings that are not set.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `settings` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.MetricsScopesSettings` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.MetricsScopesClient` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` |   |

### create(MetricsScopesStub stub)

    public static final MetricsScopesClient create(MetricsScopesStub stub)

Constructs an instance of MetricsScopesClient, using the given stub for making calls. This is
for advanced usage - prefer using create(MetricsScopesSettings).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `stub` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.stub.MetricsScopesStub` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.MetricsScopesClient` |   |

## Constructors

### MetricsScopesClient(MetricsScopesSettings settings)

    protected MetricsScopesClient(MetricsScopesSettings settings)

Constructs an instance of MetricsScopesClient, using the given settings. This is protected so
that it is easy to make a subclass, but otherwise, the static factory methods should be
preferred.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `settings` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.MetricsScopesSettings` |

### MetricsScopesClient(MetricsScopesStub stub)

    protected MetricsScopesClient(MetricsScopesStub stub)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `stub` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.stub.MetricsScopesStub` |

## Methods

### awaitTermination(long duration, TimeUnit unit)

    public boolean awaitTermination(long duration, TimeUnit unit)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `duration` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |
| `unit` | `https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/TimeUnit.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/InterruptedException.html` |   |

### close()

    public final void close()

### createMonitoredProjectAsync(CreateMonitoredProjectRequest request)

    public final OperationFuture<MonitoredProject,OperationMetadata> createMonitoredProjectAsync(CreateMonitoredProjectRequest request)

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

Sample code:


     // This snippet has been automatically generated and should be regarded as a code template only.
     // It will require modifications to work:
     // - It may require correct/in-range values for request initialization.
     // - It may require specifying regional endpoints when creating the service client as shown in
     // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
     try (MetricsScopesClient metricsScopesClient = MetricsScopesClient.create()) {
       CreateMonitoredProjectRequest request =
           CreateMonitoredProjectRequest.newBuilder()
               .setParent(MetricsScopeName.of("[METRICS_SCOPE]").toString())
               .setMonitoredProject(MonitoredProject.newBuilder().build())
               .build();
       MonitoredProject response = metricsScopesClient.createMonitoredProjectAsync(request).get();
     }
     
| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest` The request object containing all of the parameters for the API call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.longrunning.OperationFuture.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.MonitoredProject,https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.OperationMetadata>` |   |

### createMonitoredProjectAsync(MetricsScopeName parent, MonitoredProject monitoredProject)

    public final OperationFuture<MonitoredProject,OperationMetadata> createMonitoredProjectAsync(MetricsScopeName parent, MonitoredProject monitoredProject)

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

Sample code:


     // This snippet has been automatically generated and should be regarded as a code template only.
     // It will require modifications to work:
     // - It may require correct/in-range values for request initialization.
     // - It may require specifying regional endpoints when creating the service client as shown in
     // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
     try (MetricsScopesClient metricsScopesClient = MetricsScopesClient.create()) {
       MetricsScopeName parent = MetricsScopeName.of("[METRICS_SCOPE]");
       MonitoredProject monitoredProject = MonitoredProject.newBuilder().build();
       MonitoredProject response =
           metricsScopesClient.createMonitoredProjectAsync(parent, monitoredProject).get();
     }
     
| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `parent` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.MetricsScopeName` Required. The resource name of the existing `Metrics Scope` that will monitor this project. Example: `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}` |
| `monitoredProject` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.MonitoredProject` 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}` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.longrunning.OperationFuture.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.MonitoredProject,https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.OperationMetadata>` |   |

### createMonitoredProjectAsync(String parent, MonitoredProject monitoredProject)

    public final OperationFuture<MonitoredProject,OperationMetadata> createMonitoredProjectAsync(String parent, MonitoredProject monitoredProject)

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

Sample code:


     // This snippet has been automatically generated and should be regarded as a code template only.
     // It will require modifications to work:
     // - It may require correct/in-range values for request initialization.
     // - It may require specifying regional endpoints when creating the service client as shown in
     // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
     try (MetricsScopesClient metricsScopesClient = MetricsScopesClient.create()) {
       String parent = MetricsScopeName.of("[METRICS_SCOPE]").toString();
       MonitoredProject monitoredProject = MonitoredProject.newBuilder().build();
       MonitoredProject response =
           metricsScopesClient.createMonitoredProjectAsync(parent, monitoredProject).get();
     }
     
| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `parent` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` Required. The resource name of the existing `Metrics Scope` that will monitor this project. Example: `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}` |
| `monitoredProject` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.MonitoredProject` 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}` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.longrunning.OperationFuture.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.MonitoredProject,https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.OperationMetadata>` |   |

### createMonitoredProjectCallable()

    public final UnaryCallable<CreateMonitoredProjectRequest,Operation> createMonitoredProjectCallable()

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

Sample code:


     // This snippet has been automatically generated and should be regarded as a code template only.
     // It will require modifications to work:
     // - It may require correct/in-range values for request initialization.
     // - It may require specifying regional endpoints when creating the service client as shown in
     // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
     try (MetricsScopesClient metricsScopesClient = MetricsScopesClient.create()) {
       CreateMonitoredProjectRequest request =
           CreateMonitoredProjectRequest.newBuilder()
               .setParent(MetricsScopeName.of("[METRICS_SCOPE]").toString())
               .setMonitoredProject(MonitoredProject.newBuilder().build())
               .build();
       ApiFuture<Operation> future =
           metricsScopesClient.createMonitoredProjectCallable().futureCall(request);
       // Do something.
       Operation response = future.get();
     }
     
| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.UnaryCallable.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest,https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.longrunning.Operation.html>` |   |

### createMonitoredProjectOperationCallable()

    public final OperationCallable<CreateMonitoredProjectRequest,MonitoredProject,OperationMetadata> createMonitoredProjectOperationCallable()

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

Sample code:


     // This snippet has been automatically generated and should be regarded as a code template only.
     // It will require modifications to work:
     // - It may require correct/in-range values for request initialization.
     // - It may require specifying regional endpoints when creating the service client as shown in
     // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
     try (MetricsScopesClient metricsScopesClient = MetricsScopesClient.create()) {
       CreateMonitoredProjectRequest request =
           CreateMonitoredProjectRequest.newBuilder()
               .setParent(MetricsScopeName.of("[METRICS_SCOPE]").toString())
               .setMonitoredProject(MonitoredProject.newBuilder().build())
               .build();
       OperationFuture<MonitoredProject, OperationMetadata> future =
           metricsScopesClient.createMonitoredProjectOperationCallable().futureCall(request);
       // Do something.
       MonitoredProject response = future.get();
     }
     
| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.OperationCallable.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.CreateMonitoredProjectRequest,https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.MonitoredProject,https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.OperationMetadata>` |   |

### deleteMonitoredProjectAsync(DeleteMonitoredProjectRequest request)

    public final OperationFuture<Empty,OperationMetadata> deleteMonitoredProjectAsync(DeleteMonitoredProjectRequest request)

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

Sample code:


     // This snippet has been automatically generated and should be regarded as a code template only.
     // It will require modifications to work:
     // - It may require correct/in-range values for request initialization.
     // - It may require specifying regional endpoints when creating the service client as shown in
     // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
     try (MetricsScopesClient metricsScopesClient = MetricsScopesClient.create()) {
       DeleteMonitoredProjectRequest request =
           DeleteMonitoredProjectRequest.newBuilder()
               .setName(MonitoredProjectName.of("[METRICS_SCOPE]", "[PROJECT]").toString())
               .build();
       metricsScopesClient.deleteMonitoredProjectAsync(request).get();
     }
     
| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest` The request object containing all of the parameters for the API call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.longrunning.OperationFuture.html<https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Empty.html,https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.OperationMetadata>` |   |

### deleteMonitoredProjectAsync(MonitoredProjectName name)

    public final OperationFuture<Empty,OperationMetadata> deleteMonitoredProjectAsync(MonitoredProjectName name)

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

Sample code:


     // This snippet has been automatically generated and should be regarded as a code template only.
     // It will require modifications to work:
     // - It may require correct/in-range values for request initialization.
     // - It may require specifying regional endpoints when creating the service client as shown in
     // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
     try (MetricsScopesClient metricsScopesClient = MetricsScopesClient.create()) {
       MonitoredProjectName name = MonitoredProjectName.of("[METRICS_SCOPE]", "[PROJECT]");
       metricsScopesClient.deleteMonitoredProjectAsync(name).get();
     }
     
| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `name` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.MonitoredProjectName` 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` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.longrunning.OperationFuture.html<https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Empty.html,https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.OperationMetadata>` |   |

### deleteMonitoredProjectAsync(String name)

    public final OperationFuture<Empty,OperationMetadata> deleteMonitoredProjectAsync(String name)

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

Sample code:


     // This snippet has been automatically generated and should be regarded as a code template only.
     // It will require modifications to work:
     // - It may require correct/in-range values for request initialization.
     // - It may require specifying regional endpoints when creating the service client as shown in
     // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
     try (MetricsScopesClient metricsScopesClient = MetricsScopesClient.create()) {
       String name = MonitoredProjectName.of("[METRICS_SCOPE]", "[PROJECT]").toString();
       metricsScopesClient.deleteMonitoredProjectAsync(name).get();
     }
     
| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `name` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` 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` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.longrunning.OperationFuture.html<https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Empty.html,https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.OperationMetadata>` |   |

### deleteMonitoredProjectCallable()

    public final UnaryCallable<DeleteMonitoredProjectRequest,Operation> deleteMonitoredProjectCallable()

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

Sample code:


     // This snippet has been automatically generated and should be regarded as a code template only.
     // It will require modifications to work:
     // - It may require correct/in-range values for request initialization.
     // - It may require specifying regional endpoints when creating the service client as shown in
     // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
     try (MetricsScopesClient metricsScopesClient = MetricsScopesClient.create()) {
       DeleteMonitoredProjectRequest request =
           DeleteMonitoredProjectRequest.newBuilder()
               .setName(MonitoredProjectName.of("[METRICS_SCOPE]", "[PROJECT]").toString())
               .build();
       ApiFuture<Operation> future =
           metricsScopesClient.deleteMonitoredProjectCallable().futureCall(request);
       // Do something.
       future.get();
     }
     
| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.UnaryCallable.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest,https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.longrunning.Operation.html>` |   |

### deleteMonitoredProjectOperationCallable()

    public final OperationCallable<DeleteMonitoredProjectRequest,Empty,OperationMetadata> deleteMonitoredProjectOperationCallable()

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

Sample code:


     // This snippet has been automatically generated and should be regarded as a code template only.
     // It will require modifications to work:
     // - It may require correct/in-range values for request initialization.
     // - It may require specifying regional endpoints when creating the service client as shown in
     // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
     try (MetricsScopesClient metricsScopesClient = MetricsScopesClient.create()) {
       DeleteMonitoredProjectRequest request =
           DeleteMonitoredProjectRequest.newBuilder()
               .setName(MonitoredProjectName.of("[METRICS_SCOPE]", "[PROJECT]").toString())
               .build();
       OperationFuture<Empty, OperationMetadata> future =
           metricsScopesClient.deleteMonitoredProjectOperationCallable().futureCall(request);
       // Do something.
       future.get();
     }
     
| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.OperationCallable.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.DeleteMonitoredProjectRequest,https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Empty.html,https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.OperationMetadata>` |   |

### getMetricsScope(GetMetricsScopeRequest request)

    public final MetricsScope getMetricsScope(GetMetricsScopeRequest request)

Returns a specific `Metrics Scope`.

Sample code:


     // This snippet has been automatically generated and should be regarded as a code template only.
     // It will require modifications to work:
     // - It may require correct/in-range values for request initialization.
     // - It may require specifying regional endpoints when creating the service client as shown in
     // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
     try (MetricsScopesClient metricsScopesClient = MetricsScopesClient.create()) {
       GetMetricsScopeRequest request =
           GetMetricsScopeRequest.newBuilder()
               .setName(MetricsScopeName.of("[METRICS_SCOPE]").toString())
               .build();
       MetricsScope response = metricsScopesClient.getMetricsScope(request);
     }
     
| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest` The request object containing all of the parameters for the API call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.MetricsScope` |   |

### getMetricsScope(MetricsScopeName name)

    public final MetricsScope getMetricsScope(MetricsScopeName name)

Returns a specific `Metrics Scope`.

Sample code:


     // This snippet has been automatically generated and should be regarded as a code template only.
     // It will require modifications to work:
     // - It may require correct/in-range values for request initialization.
     // - It may require specifying regional endpoints when creating the service client as shown in
     // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
     try (MetricsScopesClient metricsScopesClient = MetricsScopesClient.create()) {
       MetricsScopeName name = MetricsScopeName.of("[METRICS_SCOPE]");
       MetricsScope response = metricsScopesClient.getMetricsScope(name);
     }
     
| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `name` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.MetricsScopeName` Required. The resource name of the `Metrics Scope`. Example: `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.MetricsScope` |   |

### getMetricsScope(String name)

    public final MetricsScope getMetricsScope(String name)

Returns a specific `Metrics Scope`.

Sample code:


     // This snippet has been automatically generated and should be regarded as a code template only.
     // It will require modifications to work:
     // - It may require correct/in-range values for request initialization.
     // - It may require specifying regional endpoints when creating the service client as shown in
     // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
     try (MetricsScopesClient metricsScopesClient = MetricsScopesClient.create()) {
       String name = MetricsScopeName.of("[METRICS_SCOPE]").toString();
       MetricsScope response = metricsScopesClient.getMetricsScope(name);
     }
     
| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `name` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` Required. The resource name of the `Metrics Scope`. Example: `locations/global/metricsScopes/{SCOPING_PROJECT_ID_OR_NUMBER}` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.MetricsScope` |   |

### getMetricsScopeCallable()

    public final UnaryCallable<GetMetricsScopeRequest,MetricsScope> getMetricsScopeCallable()

Returns a specific `Metrics Scope`.

Sample code:


     // This snippet has been automatically generated and should be regarded as a code template only.
     // It will require modifications to work:
     // - It may require correct/in-range values for request initialization.
     // - It may require specifying regional endpoints when creating the service client as shown in
     // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
     try (MetricsScopesClient metricsScopesClient = MetricsScopesClient.create()) {
       GetMetricsScopeRequest request =
           GetMetricsScopeRequest.newBuilder()
               .setName(MetricsScopeName.of("[METRICS_SCOPE]").toString())
               .build();
       ApiFuture<MetricsScope> future =
           metricsScopesClient.getMetricsScopeCallable().futureCall(request);
       // Do something.
       MetricsScope response = future.get();
     }
     
| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.UnaryCallable.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.GetMetricsScopeRequest,https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.MetricsScope>` |   |

### getOperationsClient()

    public final OperationsClient getOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.longrunning.OperationsClient.html` |   |

### getSettings()

    public final MetricsScopesSettings getSettings()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.MetricsScopesSettings` |   |

### getStub()

    public MetricsScopesStub getStub()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.stub.MetricsScopesStub` |   |

### isShutdown()

    public boolean isShutdown()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### isTerminated()

    public boolean isTerminated()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### listMetricsScopesByMonitoredProject(ListMetricsScopesByMonitoredProjectRequest request)

    public final ListMetricsScopesByMonitoredProjectResponse listMetricsScopesByMonitoredProject(ListMetricsScopesByMonitoredProjectRequest request)

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.

Sample code:


     // This snippet has been automatically generated and should be regarded as a code template only.
     // It will require modifications to work:
     // - It may require correct/in-range values for request initialization.
     // - It may require specifying regional endpoints when creating the service client as shown in
     // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
     try (MetricsScopesClient metricsScopesClient = MetricsScopesClient.create()) {
       ListMetricsScopesByMonitoredProjectRequest request =
           ListMetricsScopesByMonitoredProjectRequest.newBuilder()
               .setMonitoredResourceContainer("monitoredResourceContainer884669850")
               .build();
       ListMetricsScopesByMonitoredProjectResponse response =
           metricsScopesClient.listMetricsScopesByMonitoredProject(request);
     }
     
| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest` The request object containing all of the parameters for the API call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse` |   |

### listMetricsScopesByMonitoredProjectCallable()

    public final UnaryCallable<ListMetricsScopesByMonitoredProjectRequest,ListMetricsScopesByMonitoredProjectResponse> listMetricsScopesByMonitoredProjectCallable()

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.

Sample code:


     // This snippet has been automatically generated and should be regarded as a code template only.
     // It will require modifications to work:
     // - It may require correct/in-range values for request initialization.
     // - It may require specifying regional endpoints when creating the service client as shown in
     // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
     try (MetricsScopesClient metricsScopesClient = MetricsScopesClient.create()) {
       ListMetricsScopesByMonitoredProjectRequest request =
           ListMetricsScopesByMonitoredProjectRequest.newBuilder()
               .setMonitoredResourceContainer("monitoredResourceContainer884669850")
               .build();
       ApiFuture<ListMetricsScopesByMonitoredProjectResponse> future =
           metricsScopesClient.listMetricsScopesByMonitoredProjectCallable().futureCall(request);
       // Do something.
       ListMetricsScopesByMonitoredProjectResponse response = future.get();
     }
     
| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.UnaryCallable.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectRequest,https://docs.cloud.google.com/java/docs/reference/google-cloud-monitoring-metricsscope/latest/com.google.monitoring.metricsscope.v1.ListMetricsScopesByMonitoredProjectResponse>` |   |

### shutdown()

    public void shutdown()

### shutdownNow()

    public void shutdownNow()