Search in sources :

Example 1 with SendNotificationChannelVerificationCodeRequest

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

the class NotificationChannelServiceClientTest method sendNotificationChannelVerificationCodeTest.

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

Example 2 with SendNotificationChannelVerificationCodeRequest

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

the class NotificationChannelServiceClientTest method sendNotificationChannelVerificationCodeTest2.

@Test
public void sendNotificationChannelVerificationCodeTest2() throws Exception {
    Empty expectedResponse = Empty.newBuilder().build();
    mockNotificationChannelService.addResponse(expectedResponse);
    String name = "name3373707";
    client.sendNotificationChannelVerificationCode(name);
    List<AbstractMessage> actualRequests = mockNotificationChannelService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    SendNotificationChannelVerificationCodeRequest actualRequest = ((SendNotificationChannelVerificationCodeRequest) 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) SendNotificationChannelVerificationCodeRequest(com.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest) Test(org.junit.Test)

Example 3 with SendNotificationChannelVerificationCodeRequest

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

the class NotificationChannelServiceClient method sendNotificationChannelVerificationCode.

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
 * Causes a verification code to be delivered to the channel. The code can then be supplied in
 * `VerifyNotificationChannel` to verify the channel.
 *
 * <p>Sample code:
 *
 * <pre>{@code
 * try (NotificationChannelServiceClient notificationChannelServiceClient =
 *     NotificationChannelServiceClient.create()) {
 *   NotificationChannelName name =
 *       NotificationChannelName.ofProjectNotificationChannelName(
 *           "[PROJECT]", "[NOTIFICATION_CHANNEL]");
 *   notificationChannelServiceClient.sendNotificationChannelVerificationCode(name);
 * }
 * }</pre>
 *
 * @param name Required. The notification channel to which to send a verification code.
 * @throws com.google.api.gax.rpc.ApiException if the remote call fails
 */
public final void sendNotificationChannelVerificationCode(NotificationChannelName name) {
    SendNotificationChannelVerificationCodeRequest request = SendNotificationChannelVerificationCodeRequest.newBuilder().setName(name == null ? null : name.toString()).build();
    sendNotificationChannelVerificationCode(request);
}
Also used : SendNotificationChannelVerificationCodeRequest(com.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest)

Example 4 with SendNotificationChannelVerificationCodeRequest

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

the class NotificationChannelServiceClient method sendNotificationChannelVerificationCode.

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
 * Causes a verification code to be delivered to the channel. The code can then be supplied in
 * `VerifyNotificationChannel` to verify the channel.
 *
 * <p>Sample code:
 *
 * <pre>{@code
 * try (NotificationChannelServiceClient notificationChannelServiceClient =
 *     NotificationChannelServiceClient.create()) {
 *   String name =
 *       NotificationChannelName.ofProjectNotificationChannelName(
 *               "[PROJECT]", "[NOTIFICATION_CHANNEL]")
 *           .toString();
 *   notificationChannelServiceClient.sendNotificationChannelVerificationCode(name);
 * }
 * }</pre>
 *
 * @param name Required. The notification channel to which to send a verification code.
 * @throws com.google.api.gax.rpc.ApiException if the remote call fails
 */
public final void sendNotificationChannelVerificationCode(String name) {
    SendNotificationChannelVerificationCodeRequest request = SendNotificationChannelVerificationCodeRequest.newBuilder().setName(name).build();
    sendNotificationChannelVerificationCode(request);
}
Also used : SendNotificationChannelVerificationCodeRequest(com.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest)

Aggregations

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