Search in sources :

Example 1 with DeleteUptimeCheckConfigRequest

use of com.google.monitoring.v3.DeleteUptimeCheckConfigRequest in project java-monitoring by googleapis.

the class UptimeCheckServiceClient method deleteUptimeCheckConfig.

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
 * Deletes an Uptime check configuration. Note that this method will fail if the Uptime check
 * configuration is referenced by an alert policy or other dependent configs that would be
 * rendered invalid by the deletion.
 *
 * <p>Sample code:
 *
 * <pre>{@code
 * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
 *   UptimeCheckConfigName name =
 *       UptimeCheckConfigName.ofProjectUptimeCheckConfigName(
 *           "[PROJECT]", "[UPTIME_CHECK_CONFIG]");
 *   uptimeCheckServiceClient.deleteUptimeCheckConfig(name);
 * }
 * }</pre>
 *
 * @param name Required. The Uptime check configuration to delete. The format is:
 *     <p>projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID]
 * @throws com.google.api.gax.rpc.ApiException if the remote call fails
 */
public final void deleteUptimeCheckConfig(UptimeCheckConfigName name) {
    DeleteUptimeCheckConfigRequest request = DeleteUptimeCheckConfigRequest.newBuilder().setName(name == null ? null : name.toString()).build();
    deleteUptimeCheckConfig(request);
}
Also used : DeleteUptimeCheckConfigRequest(com.google.monitoring.v3.DeleteUptimeCheckConfigRequest)

Example 2 with DeleteUptimeCheckConfigRequest

use of com.google.monitoring.v3.DeleteUptimeCheckConfigRequest in project java-monitoring by googleapis.

the class UptimeCheckServiceClientTest method deleteUptimeCheckConfigTest.

@Test
public void deleteUptimeCheckConfigTest() throws Exception {
    Empty expectedResponse = Empty.newBuilder().build();
    mockUptimeCheckService.addResponse(expectedResponse);
    UptimeCheckConfigName name = UptimeCheckConfigName.ofProjectUptimeCheckConfigName("[PROJECT]", "[UPTIME_CHECK_CONFIG]");
    client.deleteUptimeCheckConfig(name);
    List<AbstractMessage> actualRequests = mockUptimeCheckService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    DeleteUptimeCheckConfigRequest actualRequest = ((DeleteUptimeCheckConfigRequest) actualRequests.get(0));
    Assert.assertEquals(name.toString(), actualRequest.getName());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : DeleteUptimeCheckConfigRequest(com.google.monitoring.v3.DeleteUptimeCheckConfigRequest) Empty(com.google.protobuf.Empty) AbstractMessage(com.google.protobuf.AbstractMessage) UptimeCheckConfigName(com.google.monitoring.v3.UptimeCheckConfigName) Test(org.junit.Test)

Example 3 with DeleteUptimeCheckConfigRequest

use of com.google.monitoring.v3.DeleteUptimeCheckConfigRequest in project java-monitoring by googleapis.

the class UptimeCheckServiceClient method deleteUptimeCheckConfig.

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
 * Deletes an Uptime check configuration. Note that this method will fail if the Uptime check
 * configuration is referenced by an alert policy or other dependent configs that would be
 * rendered invalid by the deletion.
 *
 * <p>Sample code:
 *
 * <pre>{@code
 * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
 *   String name =
 *       UptimeCheckConfigName.ofProjectUptimeCheckConfigName("[PROJECT]", "[UPTIME_CHECK_CONFIG]")
 *           .toString();
 *   uptimeCheckServiceClient.deleteUptimeCheckConfig(name);
 * }
 * }</pre>
 *
 * @param name Required. The Uptime check configuration to delete. The format is:
 *     <p>projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID]
 * @throws com.google.api.gax.rpc.ApiException if the remote call fails
 */
public final void deleteUptimeCheckConfig(String name) {
    DeleteUptimeCheckConfigRequest request = DeleteUptimeCheckConfigRequest.newBuilder().setName(name).build();
    deleteUptimeCheckConfig(request);
}
Also used : DeleteUptimeCheckConfigRequest(com.google.monitoring.v3.DeleteUptimeCheckConfigRequest)

Example 4 with DeleteUptimeCheckConfigRequest

use of com.google.monitoring.v3.DeleteUptimeCheckConfigRequest in project java-monitoring by googleapis.

the class UptimeCheckServiceClientTest method deleteUptimeCheckConfigTest2.

@Test
public void deleteUptimeCheckConfigTest2() throws Exception {
    Empty expectedResponse = Empty.newBuilder().build();
    mockUptimeCheckService.addResponse(expectedResponse);
    String name = "name3373707";
    client.deleteUptimeCheckConfig(name);
    List<AbstractMessage> actualRequests = mockUptimeCheckService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    DeleteUptimeCheckConfigRequest actualRequest = ((DeleteUptimeCheckConfigRequest) actualRequests.get(0));
    Assert.assertEquals(name, actualRequest.getName());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : DeleteUptimeCheckConfigRequest(com.google.monitoring.v3.DeleteUptimeCheckConfigRequest) Empty(com.google.protobuf.Empty) AbstractMessage(com.google.protobuf.AbstractMessage) Test(org.junit.Test)

Aggregations

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