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