use of com.google.monitoring.v3.DeleteMetricDescriptorRequest in project google-cloud-java by GoogleCloudPlatform.
the class MetricServiceClientTest method deleteMetricDescriptorTest.
@Test
@SuppressWarnings("all")
public void deleteMetricDescriptorTest() {
Empty expectedResponse = Empty.newBuilder().build();
mockMetricService.addResponse(expectedResponse);
MetricDescriptorName name = MetricDescriptorName.create("[PROJECT]", "[METRIC_DESCRIPTOR]");
client.deleteMetricDescriptor(name);
List<GeneratedMessageV3> actualRequests = mockMetricService.getRequests();
Assert.assertEquals(1, actualRequests.size());
DeleteMetricDescriptorRequest actualRequest = (DeleteMetricDescriptorRequest) actualRequests.get(0);
Assert.assertEquals(name, actualRequest.getNameAsMetricDescriptorName());
}
use of com.google.monitoring.v3.DeleteMetricDescriptorRequest in project google-cloud-java by GoogleCloudPlatform.
the class MetricServiceClient method deleteMetricDescriptor.
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Deletes a metric descriptor. Only user-created [custom metrics](/monitoring/custom-metrics) can
* be deleted.
*
* <p>Sample code:
*
* <pre><code>
* try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
* MetricDescriptorName name = MetricDescriptorName.create("[PROJECT]", "[METRIC_DESCRIPTOR]");
* metricServiceClient.deleteMetricDescriptor(name);
* }
* </code></pre>
*
* @param name The metric descriptor on which to execute the request. The format is
* `"projects/{project_id_or_number}/metricDescriptors/{metric_id}"`. An example of
* `{metric_id}` is: `"custom.googleapis.com/my_test_metric"`.
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
*/
public final void deleteMetricDescriptor(MetricDescriptorName name) {
DeleteMetricDescriptorRequest request = DeleteMetricDescriptorRequest.newBuilder().setNameWithMetricDescriptorName(name).build();
deleteMetricDescriptor(request);
}
Aggregations