use of com.google.monitoring.v3.DeleteServiceRequest in project java-monitoring by googleapis.
the class ServiceMonitoringServiceClient method deleteService.
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Soft delete this `Service`.
*
* <p>Sample code:
*
* <pre>{@code
* try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
* ServiceMonitoringServiceClient.create()) {
* ServiceName name = ServiceName.ofProjectServiceName("[PROJECT]", "[SERVICE]");
* serviceMonitoringServiceClient.deleteService(name);
* }
* }</pre>
*
* @param name Required. Resource name of the `Service` to delete. The format is:
* <p>projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deleteService(ServiceName name) {
DeleteServiceRequest request = DeleteServiceRequest.newBuilder().setName(name == null ? null : name.toString()).build();
deleteService(request);
}
use of com.google.monitoring.v3.DeleteServiceRequest in project java-monitoring by googleapis.
the class ServiceMonitoringServiceClient method deleteService.
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Soft delete this `Service`.
*
* <p>Sample code:
*
* <pre>{@code
* try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
* ServiceMonitoringServiceClient.create()) {
* String name = ServiceName.ofProjectServiceName("[PROJECT]", "[SERVICE]").toString();
* serviceMonitoringServiceClient.deleteService(name);
* }
* }</pre>
*
* @param name Required. Resource name of the `Service` to delete. The format is:
* <p>projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deleteService(String name) {
DeleteServiceRequest request = DeleteServiceRequest.newBuilder().setName(name).build();
deleteService(request);
}
use of com.google.monitoring.v3.DeleteServiceRequest in project java-monitoring by googleapis.
the class ServiceMonitoringServiceClientTest method deleteServiceTest.
@Test
public void deleteServiceTest() throws Exception {
Empty expectedResponse = Empty.newBuilder().build();
mockServiceMonitoringService.addResponse(expectedResponse);
ServiceName name = ServiceName.ofProjectServiceName("[PROJECT]", "[SERVICE]");
client.deleteService(name);
List<AbstractMessage> actualRequests = mockServiceMonitoringService.getRequests();
Assert.assertEquals(1, actualRequests.size());
DeleteServiceRequest actualRequest = ((DeleteServiceRequest) actualRequests.get(0));
Assert.assertEquals(name.toString(), actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.monitoring.v3.DeleteServiceRequest in project java-monitoring by googleapis.
the class ServiceMonitoringServiceClientTest method deleteServiceTest2.
@Test
public void deleteServiceTest2() throws Exception {
Empty expectedResponse = Empty.newBuilder().build();
mockServiceMonitoringService.addResponse(expectedResponse);
String name = "name3373707";
client.deleteService(name);
List<AbstractMessage> actualRequests = mockServiceMonitoringService.getRequests();
Assert.assertEquals(1, actualRequests.size());
DeleteServiceRequest actualRequest = ((DeleteServiceRequest) actualRequests.get(0));
Assert.assertEquals(name, actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations