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);
}
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()));
}
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);
}
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()));
}
Aggregations