Search in sources :

Example 1 with DeleteServiceLevelObjectiveRequest

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()));
}
Also used : Empty(com.google.protobuf.Empty) ServiceLevelObjectiveName(com.google.monitoring.v3.ServiceLevelObjectiveName) AbstractMessage(com.google.protobuf.AbstractMessage) DeleteServiceLevelObjectiveRequest(com.google.monitoring.v3.DeleteServiceLevelObjectiveRequest) Test(org.junit.Test)

Example 2 with DeleteServiceLevelObjectiveRequest

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);
}
Also used : DeleteServiceLevelObjectiveRequest(com.google.monitoring.v3.DeleteServiceLevelObjectiveRequest)

Example 3 with DeleteServiceLevelObjectiveRequest

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);
}
Also used : DeleteServiceLevelObjectiveRequest(com.google.monitoring.v3.DeleteServiceLevelObjectiveRequest)

Example 4 with DeleteServiceLevelObjectiveRequest

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()));
}
Also used : Empty(com.google.protobuf.Empty) AbstractMessage(com.google.protobuf.AbstractMessage) DeleteServiceLevelObjectiveRequest(com.google.monitoring.v3.DeleteServiceLevelObjectiveRequest) Test(org.junit.Test)

Aggregations

DeleteServiceLevelObjectiveRequest (com.google.monitoring.v3.DeleteServiceLevelObjectiveRequest)4 AbstractMessage (com.google.protobuf.AbstractMessage)2 Empty (com.google.protobuf.Empty)2 Test (org.junit.Test)2 ServiceLevelObjectiveName (com.google.monitoring.v3.ServiceLevelObjectiveName)1