@Generated(value="by gapic-generator") public class NotificationChannelServiceClient extends Object implements com.google.api.gax.core.BackgroundResource
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
NotificationChannelDescriptorName name = NotificationChannelDescriptorName.of("[PROJECT]", "[CHANNEL_DESCRIPTOR]");
NotificationChannelDescriptor response = notificationChannelServiceClient.getNotificationChannelDescriptor(name);
}
Note: close() needs to be called on the notificationChannelServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of NotificationChannelServiceSettings to create(). For example:
To customize credentials:
NotificationChannelServiceSettings notificationChannelServiceSettings =
NotificationChannelServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
NotificationChannelServiceClient notificationChannelServiceClient =
NotificationChannelServiceClient.create(notificationChannelServiceSettings);
To customize the endpoint:
NotificationChannelServiceSettings notificationChannelServiceSettings =
NotificationChannelServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
NotificationChannelServiceClient notificationChannelServiceClient =
NotificationChannelServiceClient.create(notificationChannelServiceSettings);
Modifier and Type | Class and Description |
---|---|
static class |
NotificationChannelServiceClient.ListNotificationChannelDescriptorsFixedSizeCollection |
static class |
NotificationChannelServiceClient.ListNotificationChannelDescriptorsPage |
static class |
NotificationChannelServiceClient.ListNotificationChannelDescriptorsPagedResponse |
static class |
NotificationChannelServiceClient.ListNotificationChannelsFixedSizeCollection |
static class |
NotificationChannelServiceClient.ListNotificationChannelsPage |
static class |
NotificationChannelServiceClient.ListNotificationChannelsPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
NotificationChannelServiceClient(NotificationChannelServiceSettings settings)
Constructs an instance of NotificationChannelServiceClient, using the given settings.
|
protected |
NotificationChannelServiceClient(NotificationChannelServiceStub stub) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static NotificationChannelServiceClient |
create()
Constructs an instance of NotificationChannelServiceClient with default settings.
|
static NotificationChannelServiceClient |
create(NotificationChannelServiceSettings settings)
Constructs an instance of NotificationChannelServiceClient, using the given settings.
|
static NotificationChannelServiceClient |
create(NotificationChannelServiceStub stub)
Constructs an instance of NotificationChannelServiceClient, using the given stub for making
calls.
|
NotificationChannel |
createNotificationChannel(CreateNotificationChannelRequest request)
Creates a new notification channel, representing a single notification endpoint such as an
email address, SMS number, or PagerDuty service.
|
NotificationChannel |
createNotificationChannel(ProjectName name,
NotificationChannel notificationChannel)
Creates a new notification channel, representing a single notification endpoint such as an
email address, SMS number, or PagerDuty service.
|
NotificationChannel |
createNotificationChannel(String name,
NotificationChannel notificationChannel)
Creates a new notification channel, representing a single notification endpoint such as an
email address, SMS number, or PagerDuty service.
|
com.google.api.gax.rpc.UnaryCallable<CreateNotificationChannelRequest,NotificationChannel> |
createNotificationChannelCallable()
Creates a new notification channel, representing a single notification endpoint such as an
email address, SMS number, or PagerDuty service.
|
void |
deleteNotificationChannel(DeleteNotificationChannelRequest request)
Deletes a notification channel.
|
void |
deleteNotificationChannel(NotificationChannelName name,
boolean force)
Deletes a notification channel.
|
void |
deleteNotificationChannel(String name,
boolean force)
Deletes a notification channel.
|
com.google.api.gax.rpc.UnaryCallable<DeleteNotificationChannelRequest,Empty> |
deleteNotificationChannelCallable()
Deletes a notification channel.
|
NotificationChannel |
getNotificationChannel(GetNotificationChannelRequest request)
Gets a single notification channel.
|
NotificationChannel |
getNotificationChannel(NotificationChannelName name)
Gets a single notification channel.
|
NotificationChannel |
getNotificationChannel(String name)
Gets a single notification channel.
|
com.google.api.gax.rpc.UnaryCallable<GetNotificationChannelRequest,NotificationChannel> |
getNotificationChannelCallable()
Gets a single notification channel.
|
NotificationChannelDescriptor |
getNotificationChannelDescriptor(GetNotificationChannelDescriptorRequest request)
Gets a single channel descriptor.
|
NotificationChannelDescriptor |
getNotificationChannelDescriptor(NotificationChannelDescriptorName name)
Gets a single channel descriptor.
|
NotificationChannelDescriptor |
getNotificationChannelDescriptor(String name)
Gets a single channel descriptor.
|
com.google.api.gax.rpc.UnaryCallable<GetNotificationChannelDescriptorRequest,NotificationChannelDescriptor> |
getNotificationChannelDescriptorCallable()
Gets a single channel descriptor.
|
GetNotificationChannelVerificationCodeResponse |
getNotificationChannelVerificationCode(GetNotificationChannelVerificationCodeRequest request)
Requests a verification code for an already verified channel that can then be used in a call to
VerifyNotificationChannel() on a different channel with an equivalent identity in the same or
in a different project.
|
GetNotificationChannelVerificationCodeResponse |
getNotificationChannelVerificationCode(NotificationChannelName name)
Requests a verification code for an already verified channel that can then be used in a call to
VerifyNotificationChannel() on a different channel with an equivalent identity in the same or
in a different project.
|
GetNotificationChannelVerificationCodeResponse |
getNotificationChannelVerificationCode(String name)
Requests a verification code for an already verified channel that can then be used in a call to
VerifyNotificationChannel() on a different channel with an equivalent identity in the same or
in a different project.
|
com.google.api.gax.rpc.UnaryCallable<GetNotificationChannelVerificationCodeRequest,GetNotificationChannelVerificationCodeResponse> |
getNotificationChannelVerificationCodeCallable()
Requests a verification code for an already verified channel that can then be used in a call to
VerifyNotificationChannel() on a different channel with an equivalent identity in the same or
in a different project.
|
NotificationChannelServiceSettings |
getSettings() |
NotificationChannelServiceStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
NotificationChannelServiceClient.ListNotificationChannelDescriptorsPagedResponse |
listNotificationChannelDescriptors(ListNotificationChannelDescriptorsRequest request)
Lists the descriptors for supported channel types.
|
NotificationChannelServiceClient.ListNotificationChannelDescriptorsPagedResponse |
listNotificationChannelDescriptors(ProjectName name)
Lists the descriptors for supported channel types.
|
NotificationChannelServiceClient.ListNotificationChannelDescriptorsPagedResponse |
listNotificationChannelDescriptors(String name)
Lists the descriptors for supported channel types.
|
com.google.api.gax.rpc.UnaryCallable<ListNotificationChannelDescriptorsRequest,ListNotificationChannelDescriptorsResponse> |
listNotificationChannelDescriptorsCallable()
Lists the descriptors for supported channel types.
|
com.google.api.gax.rpc.UnaryCallable<ListNotificationChannelDescriptorsRequest,NotificationChannelServiceClient.ListNotificationChannelDescriptorsPagedResponse> |
listNotificationChannelDescriptorsPagedCallable()
Lists the descriptors for supported channel types.
|
NotificationChannelServiceClient.ListNotificationChannelsPagedResponse |
listNotificationChannels(ListNotificationChannelsRequest request)
Lists the notification channels that have been created for the project.
|
NotificationChannelServiceClient.ListNotificationChannelsPagedResponse |
listNotificationChannels(ProjectName name)
Lists the notification channels that have been created for the project.
|
NotificationChannelServiceClient.ListNotificationChannelsPagedResponse |
listNotificationChannels(String name)
Lists the notification channels that have been created for the project.
|
com.google.api.gax.rpc.UnaryCallable<ListNotificationChannelsRequest,ListNotificationChannelsResponse> |
listNotificationChannelsCallable()
Lists the notification channels that have been created for the project.
|
com.google.api.gax.rpc.UnaryCallable<ListNotificationChannelsRequest,NotificationChannelServiceClient.ListNotificationChannelsPagedResponse> |
listNotificationChannelsPagedCallable()
Lists the notification channels that have been created for the project.
|
void |
sendNotificationChannelVerificationCode(NotificationChannelName name)
Causes a verification code to be delivered to the channel.
|
void |
sendNotificationChannelVerificationCode(SendNotificationChannelVerificationCodeRequest request)
Causes a verification code to be delivered to the channel.
|
void |
sendNotificationChannelVerificationCode(String name)
Causes a verification code to be delivered to the channel.
|
com.google.api.gax.rpc.UnaryCallable<SendNotificationChannelVerificationCodeRequest,Empty> |
sendNotificationChannelVerificationCodeCallable()
Causes a verification code to be delivered to the channel.
|
void |
shutdown() |
void |
shutdownNow() |
NotificationChannel |
updateNotificationChannel(FieldMask updateMask,
NotificationChannel notificationChannel)
Updates a notification channel.
|
NotificationChannel |
updateNotificationChannel(UpdateNotificationChannelRequest request)
Updates a notification channel.
|
com.google.api.gax.rpc.UnaryCallable<UpdateNotificationChannelRequest,NotificationChannel> |
updateNotificationChannelCallable()
Updates a notification channel.
|
NotificationChannel |
verifyNotificationChannel(NotificationChannelName name,
String code)
Verifies a `NotificationChannel` by proving receipt of the code delivered to the channel as a
result of calling `SendNotificationChannelVerificationCode`.
|
NotificationChannel |
verifyNotificationChannel(String name,
String code)
Verifies a `NotificationChannel` by proving receipt of the code delivered to the channel as a
result of calling `SendNotificationChannelVerificationCode`.
|
NotificationChannel |
verifyNotificationChannel(VerifyNotificationChannelRequest request)
Verifies a `NotificationChannel` by proving receipt of the code delivered to the channel as a
result of calling `SendNotificationChannelVerificationCode`.
|
com.google.api.gax.rpc.UnaryCallable<VerifyNotificationChannelRequest,NotificationChannel> |
verifyNotificationChannelCallable()
Verifies a `NotificationChannel` by proving receipt of the code delivered to the channel as a
result of calling `SendNotificationChannelVerificationCode`.
|
protected NotificationChannelServiceClient(NotificationChannelServiceSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected NotificationChannelServiceClient(NotificationChannelServiceStub stub)
public static final NotificationChannelServiceClient create() throws IOException
IOException
public static final NotificationChannelServiceClient create(NotificationChannelServiceSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final NotificationChannelServiceClient create(NotificationChannelServiceStub stub)
public final NotificationChannelServiceSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public NotificationChannelServiceStub getStub()
public final NotificationChannelServiceClient.ListNotificationChannelDescriptorsPagedResponse listNotificationChannelDescriptors(ProjectName name)
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
ProjectName name = ProjectName.of("[PROJECT]");
for (NotificationChannelDescriptor element : notificationChannelServiceClient.listNotificationChannelDescriptors(name).iterateAll()) {
// doThingsWith(element);
}
}
name
- The REST resource name of the parent from which to retrieve the notification
channel descriptors. The expected syntax is:
projects/[PROJECT_ID]
Note that this names the parent container in which to look for the descriptors; to retrieve a single descriptor by name, use the [GetNotificationChannelDescriptor][google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor] operation, instead.
com.google.api.gax.rpc.ApiException
- if the remote call failspublic final NotificationChannelServiceClient.ListNotificationChannelDescriptorsPagedResponse listNotificationChannelDescriptors(String name)
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
ProjectName name = ProjectName.of("[PROJECT]");
for (NotificationChannelDescriptor element : notificationChannelServiceClient.listNotificationChannelDescriptors(name.toString()).iterateAll()) {
// doThingsWith(element);
}
}
name
- The REST resource name of the parent from which to retrieve the notification
channel descriptors. The expected syntax is:
projects/[PROJECT_ID]
Note that this names the parent container in which to look for the descriptors; to retrieve a single descriptor by name, use the [GetNotificationChannelDescriptor][google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor] operation, instead.
com.google.api.gax.rpc.ApiException
- if the remote call failspublic final NotificationChannelServiceClient.ListNotificationChannelDescriptorsPagedResponse listNotificationChannelDescriptors(ListNotificationChannelDescriptorsRequest request)
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
ProjectName name = ProjectName.of("[PROJECT]");
ListNotificationChannelDescriptorsRequest request = ListNotificationChannelDescriptorsRequest.newBuilder()
.setName(name.toString())
.build();
for (NotificationChannelDescriptor element : notificationChannelServiceClient.listNotificationChannelDescriptors(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListNotificationChannelDescriptorsRequest,NotificationChannelServiceClient.ListNotificationChannelDescriptorsPagedResponse> listNotificationChannelDescriptorsPagedCallable()
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
ProjectName name = ProjectName.of("[PROJECT]");
ListNotificationChannelDescriptorsRequest request = ListNotificationChannelDescriptorsRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<ListNotificationChannelDescriptorsPagedResponse> future = notificationChannelServiceClient.listNotificationChannelDescriptorsPagedCallable().futureCall(request);
// Do something
for (NotificationChannelDescriptor element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListNotificationChannelDescriptorsRequest,ListNotificationChannelDescriptorsResponse> listNotificationChannelDescriptorsCallable()
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
ProjectName name = ProjectName.of("[PROJECT]");
ListNotificationChannelDescriptorsRequest request = ListNotificationChannelDescriptorsRequest.newBuilder()
.setName(name.toString())
.build();
while (true) {
ListNotificationChannelDescriptorsResponse response = notificationChannelServiceClient.listNotificationChannelDescriptorsCallable().call(request);
for (NotificationChannelDescriptor element : response.getChannelDescriptorsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final NotificationChannelDescriptor getNotificationChannelDescriptor(NotificationChannelDescriptorName name)
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
NotificationChannelDescriptorName name = NotificationChannelDescriptorName.of("[PROJECT]", "[CHANNEL_DESCRIPTOR]");
NotificationChannelDescriptor response = notificationChannelServiceClient.getNotificationChannelDescriptor(name);
}
name
- The channel type for which to execute the request. The format is
`projects/[PROJECT_ID]/notificationChannelDescriptors/{channel_type}`.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final NotificationChannelDescriptor getNotificationChannelDescriptor(String name)
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
NotificationChannelDescriptorName name = NotificationChannelDescriptorName.of("[PROJECT]", "[CHANNEL_DESCRIPTOR]");
NotificationChannelDescriptor response = notificationChannelServiceClient.getNotificationChannelDescriptor(name.toString());
}
name
- The channel type for which to execute the request. The format is
`projects/[PROJECT_ID]/notificationChannelDescriptors/{channel_type}`.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final NotificationChannelDescriptor getNotificationChannelDescriptor(GetNotificationChannelDescriptorRequest request)
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
NotificationChannelDescriptorName name = NotificationChannelDescriptorName.of("[PROJECT]", "[CHANNEL_DESCRIPTOR]");
GetNotificationChannelDescriptorRequest request = GetNotificationChannelDescriptorRequest.newBuilder()
.setName(name.toString())
.build();
NotificationChannelDescriptor response = notificationChannelServiceClient.getNotificationChannelDescriptor(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetNotificationChannelDescriptorRequest,NotificationChannelDescriptor> getNotificationChannelDescriptorCallable()
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
NotificationChannelDescriptorName name = NotificationChannelDescriptorName.of("[PROJECT]", "[CHANNEL_DESCRIPTOR]");
GetNotificationChannelDescriptorRequest request = GetNotificationChannelDescriptorRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<NotificationChannelDescriptor> future = notificationChannelServiceClient.getNotificationChannelDescriptorCallable().futureCall(request);
// Do something
NotificationChannelDescriptor response = future.get();
}
public final NotificationChannelServiceClient.ListNotificationChannelsPagedResponse listNotificationChannels(ProjectName name)
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
ProjectName name = ProjectName.of("[PROJECT]");
for (NotificationChannel element : notificationChannelServiceClient.listNotificationChannels(name).iterateAll()) {
// doThingsWith(element);
}
}
name
- The project on which to execute the request. The format is `projects/[PROJECT_ID]`.
That is, this names the container in which to look for the notification channels; it does
not name a specific channel. To query a specific channel by REST resource name, use the
[`GetNotificationChannel`][google.monitoring.v3.NotificationChannelService.GetNotificationChannel]
operation.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final NotificationChannelServiceClient.ListNotificationChannelsPagedResponse listNotificationChannels(String name)
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
ProjectName name = ProjectName.of("[PROJECT]");
for (NotificationChannel element : notificationChannelServiceClient.listNotificationChannels(name.toString()).iterateAll()) {
// doThingsWith(element);
}
}
name
- The project on which to execute the request. The format is `projects/[PROJECT_ID]`.
That is, this names the container in which to look for the notification channels; it does
not name a specific channel. To query a specific channel by REST resource name, use the
[`GetNotificationChannel`][google.monitoring.v3.NotificationChannelService.GetNotificationChannel]
operation.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final NotificationChannelServiceClient.ListNotificationChannelsPagedResponse listNotificationChannels(ListNotificationChannelsRequest request)
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
ProjectName name = ProjectName.of("[PROJECT]");
ListNotificationChannelsRequest request = ListNotificationChannelsRequest.newBuilder()
.setName(name.toString())
.build();
for (NotificationChannel element : notificationChannelServiceClient.listNotificationChannels(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListNotificationChannelsRequest,NotificationChannelServiceClient.ListNotificationChannelsPagedResponse> listNotificationChannelsPagedCallable()
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
ProjectName name = ProjectName.of("[PROJECT]");
ListNotificationChannelsRequest request = ListNotificationChannelsRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<ListNotificationChannelsPagedResponse> future = notificationChannelServiceClient.listNotificationChannelsPagedCallable().futureCall(request);
// Do something
for (NotificationChannel element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListNotificationChannelsRequest,ListNotificationChannelsResponse> listNotificationChannelsCallable()
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
ProjectName name = ProjectName.of("[PROJECT]");
ListNotificationChannelsRequest request = ListNotificationChannelsRequest.newBuilder()
.setName(name.toString())
.build();
while (true) {
ListNotificationChannelsResponse response = notificationChannelServiceClient.listNotificationChannelsCallable().call(request);
for (NotificationChannel element : response.getNotificationChannelsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final NotificationChannel getNotificationChannel(NotificationChannelName name)
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
NotificationChannel response = notificationChannelServiceClient.getNotificationChannel(name);
}
name
- The channel for which to execute the request. The format is
`projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]`.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final NotificationChannel getNotificationChannel(String name)
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
NotificationChannel response = notificationChannelServiceClient.getNotificationChannel(name.toString());
}
name
- The channel for which to execute the request. The format is
`projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]`.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final NotificationChannel getNotificationChannel(GetNotificationChannelRequest request)
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
GetNotificationChannelRequest request = GetNotificationChannelRequest.newBuilder()
.setName(name.toString())
.build();
NotificationChannel response = notificationChannelServiceClient.getNotificationChannel(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetNotificationChannelRequest,NotificationChannel> getNotificationChannelCallable()
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
GetNotificationChannelRequest request = GetNotificationChannelRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<NotificationChannel> future = notificationChannelServiceClient.getNotificationChannelCallable().futureCall(request);
// Do something
NotificationChannel response = future.get();
}
public final NotificationChannel createNotificationChannel(ProjectName name, NotificationChannel notificationChannel)
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
ProjectName name = ProjectName.of("[PROJECT]");
NotificationChannel notificationChannel = NotificationChannel.newBuilder().build();
NotificationChannel response = notificationChannelServiceClient.createNotificationChannel(name, notificationChannel);
}
name
- The project on which to execute the request. The format is:
projects/[PROJECT_ID]
Note that this names the container into which the channel will be written. This does not name the newly created channel. The resulting channel's name will have a normalized version of this field as a prefix, but will add `/notificationChannels/[CHANNEL_ID]` to identify the channel.
notificationChannel
- The definition of the `NotificationChannel` to create.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final NotificationChannel createNotificationChannel(String name, NotificationChannel notificationChannel)
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
ProjectName name = ProjectName.of("[PROJECT]");
NotificationChannel notificationChannel = NotificationChannel.newBuilder().build();
NotificationChannel response = notificationChannelServiceClient.createNotificationChannel(name.toString(), notificationChannel);
}
name
- The project on which to execute the request. The format is:
projects/[PROJECT_ID]
Note that this names the container into which the channel will be written. This does not name the newly created channel. The resulting channel's name will have a normalized version of this field as a prefix, but will add `/notificationChannels/[CHANNEL_ID]` to identify the channel.
notificationChannel
- The definition of the `NotificationChannel` to create.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final NotificationChannel createNotificationChannel(CreateNotificationChannelRequest request)
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
ProjectName name = ProjectName.of("[PROJECT]");
NotificationChannel notificationChannel = NotificationChannel.newBuilder().build();
CreateNotificationChannelRequest request = CreateNotificationChannelRequest.newBuilder()
.setName(name.toString())
.setNotificationChannel(notificationChannel)
.build();
NotificationChannel response = notificationChannelServiceClient.createNotificationChannel(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<CreateNotificationChannelRequest,NotificationChannel> createNotificationChannelCallable()
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
ProjectName name = ProjectName.of("[PROJECT]");
NotificationChannel notificationChannel = NotificationChannel.newBuilder().build();
CreateNotificationChannelRequest request = CreateNotificationChannelRequest.newBuilder()
.setName(name.toString())
.setNotificationChannel(notificationChannel)
.build();
ApiFuture<NotificationChannel> future = notificationChannelServiceClient.createNotificationChannelCallable().futureCall(request);
// Do something
NotificationChannel response = future.get();
}
public final NotificationChannel updateNotificationChannel(FieldMask updateMask, NotificationChannel notificationChannel)
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
FieldMask updateMask = FieldMask.newBuilder().build();
NotificationChannel notificationChannel = NotificationChannel.newBuilder().build();
NotificationChannel response = notificationChannelServiceClient.updateNotificationChannel(updateMask, notificationChannel);
}
updateMask
- The fields to update.notificationChannel
- A description of the changes to be applied to the specified
notification channel. The description must provide a definition for fields to be updated;
the names of these fields should also be included in the `update_mask`.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final NotificationChannel updateNotificationChannel(UpdateNotificationChannelRequest request)
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
NotificationChannel notificationChannel = NotificationChannel.newBuilder().build();
UpdateNotificationChannelRequest request = UpdateNotificationChannelRequest.newBuilder()
.setNotificationChannel(notificationChannel)
.build();
NotificationChannel response = notificationChannelServiceClient.updateNotificationChannel(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<UpdateNotificationChannelRequest,NotificationChannel> updateNotificationChannelCallable()
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
NotificationChannel notificationChannel = NotificationChannel.newBuilder().build();
UpdateNotificationChannelRequest request = UpdateNotificationChannelRequest.newBuilder()
.setNotificationChannel(notificationChannel)
.build();
ApiFuture<NotificationChannel> future = notificationChannelServiceClient.updateNotificationChannelCallable().futureCall(request);
// Do something
NotificationChannel response = future.get();
}
public final void deleteNotificationChannel(NotificationChannelName name, boolean force)
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
boolean force = false;
notificationChannelServiceClient.deleteNotificationChannel(name, force);
}
name
- The channel for which to execute the request. The format is
`projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]`.force
- If true, the notification channel will be deleted regardless of its use in alert
policies (the policies will be updated to remove the channel). If false, channels that are
still referenced by an existing alerting policy will fail to be deleted in a delete
operation.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final void deleteNotificationChannel(String name, boolean force)
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
boolean force = false;
notificationChannelServiceClient.deleteNotificationChannel(name.toString(), force);
}
name
- The channel for which to execute the request. The format is
`projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]`.force
- If true, the notification channel will be deleted regardless of its use in alert
policies (the policies will be updated to remove the channel). If false, channels that are
still referenced by an existing alerting policy will fail to be deleted in a delete
operation.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final void deleteNotificationChannel(DeleteNotificationChannelRequest request)
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
DeleteNotificationChannelRequest request = DeleteNotificationChannelRequest.newBuilder()
.setName(name.toString())
.build();
notificationChannelServiceClient.deleteNotificationChannel(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<DeleteNotificationChannelRequest,Empty> deleteNotificationChannelCallable()
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
DeleteNotificationChannelRequest request = DeleteNotificationChannelRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<Void> future = notificationChannelServiceClient.deleteNotificationChannelCallable().futureCall(request);
// Do something
future.get();
}
public final void sendNotificationChannelVerificationCode(NotificationChannelName name)
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
notificationChannelServiceClient.sendNotificationChannelVerificationCode(name);
}
name
- The notification channel to which to send a verification code.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final void sendNotificationChannelVerificationCode(String name)
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
notificationChannelServiceClient.sendNotificationChannelVerificationCode(name.toString());
}
name
- The notification channel to which to send a verification code.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final void sendNotificationChannelVerificationCode(SendNotificationChannelVerificationCodeRequest request)
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
SendNotificationChannelVerificationCodeRequest request = SendNotificationChannelVerificationCodeRequest.newBuilder()
.setName(name.toString())
.build();
notificationChannelServiceClient.sendNotificationChannelVerificationCode(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<SendNotificationChannelVerificationCodeRequest,Empty> sendNotificationChannelVerificationCodeCallable()
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
SendNotificationChannelVerificationCodeRequest request = SendNotificationChannelVerificationCodeRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<Void> future = notificationChannelServiceClient.sendNotificationChannelVerificationCodeCallable().futureCall(request);
// Do something
future.get();
}
public final GetNotificationChannelVerificationCodeResponse getNotificationChannelVerificationCode(NotificationChannelName name)
There is no guarantee that the verification codes returned by this method will be of a similar structure or form as the ones that are delivered to the channel via SendNotificationChannelVerificationCode; while VerifyNotificationChannel() will recognize both the codes delivered via SendNotificationChannelVerificationCode() and returned from GetNotificationChannelVerificationCode(), it is typically the case that the verification codes delivered via SendNotificationChannelVerificationCode() will be shorter and also have a shorter expiration (e.g. codes such as "G-123456") whereas GetVerificationCode() will typically return a much longer, websafe base 64 encoded string that has a longer expiration time.
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
GetNotificationChannelVerificationCodeResponse response = notificationChannelServiceClient.getNotificationChannelVerificationCode(name);
}
name
- The notification channel for which a verification code is to be generated and
retrieved. This must name a channel that is already verified; if the specified channel is
not verified, the request will fail.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final GetNotificationChannelVerificationCodeResponse getNotificationChannelVerificationCode(String name)
There is no guarantee that the verification codes returned by this method will be of a similar structure or form as the ones that are delivered to the channel via SendNotificationChannelVerificationCode; while VerifyNotificationChannel() will recognize both the codes delivered via SendNotificationChannelVerificationCode() and returned from GetNotificationChannelVerificationCode(), it is typically the case that the verification codes delivered via SendNotificationChannelVerificationCode() will be shorter and also have a shorter expiration (e.g. codes such as "G-123456") whereas GetVerificationCode() will typically return a much longer, websafe base 64 encoded string that has a longer expiration time.
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
GetNotificationChannelVerificationCodeResponse response = notificationChannelServiceClient.getNotificationChannelVerificationCode(name.toString());
}
name
- The notification channel for which a verification code is to be generated and
retrieved. This must name a channel that is already verified; if the specified channel is
not verified, the request will fail.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final GetNotificationChannelVerificationCodeResponse getNotificationChannelVerificationCode(GetNotificationChannelVerificationCodeRequest request)
There is no guarantee that the verification codes returned by this method will be of a similar structure or form as the ones that are delivered to the channel via SendNotificationChannelVerificationCode; while VerifyNotificationChannel() will recognize both the codes delivered via SendNotificationChannelVerificationCode() and returned from GetNotificationChannelVerificationCode(), it is typically the case that the verification codes delivered via SendNotificationChannelVerificationCode() will be shorter and also have a shorter expiration (e.g. codes such as "G-123456") whereas GetVerificationCode() will typically return a much longer, websafe base 64 encoded string that has a longer expiration time.
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
GetNotificationChannelVerificationCodeRequest request = GetNotificationChannelVerificationCodeRequest.newBuilder()
.setName(name.toString())
.build();
GetNotificationChannelVerificationCodeResponse response = notificationChannelServiceClient.getNotificationChannelVerificationCode(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetNotificationChannelVerificationCodeRequest,GetNotificationChannelVerificationCodeResponse> getNotificationChannelVerificationCodeCallable()
There is no guarantee that the verification codes returned by this method will be of a similar structure or form as the ones that are delivered to the channel via SendNotificationChannelVerificationCode; while VerifyNotificationChannel() will recognize both the codes delivered via SendNotificationChannelVerificationCode() and returned from GetNotificationChannelVerificationCode(), it is typically the case that the verification codes delivered via SendNotificationChannelVerificationCode() will be shorter and also have a shorter expiration (e.g. codes such as "G-123456") whereas GetVerificationCode() will typically return a much longer, websafe base 64 encoded string that has a longer expiration time.
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
GetNotificationChannelVerificationCodeRequest request = GetNotificationChannelVerificationCodeRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<GetNotificationChannelVerificationCodeResponse> future = notificationChannelServiceClient.getNotificationChannelVerificationCodeCallable().futureCall(request);
// Do something
GetNotificationChannelVerificationCodeResponse response = future.get();
}
public final NotificationChannel verifyNotificationChannel(NotificationChannelName name, String code)
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
String code = "";
NotificationChannel response = notificationChannelServiceClient.verifyNotificationChannel(name, code);
}
name
- The notification channel to verify.code
- The verification code that was delivered to the channel as a result of invoking the
`SendNotificationChannelVerificationCode` API method or that was retrieved from a verified
channel via `GetNotificationChannelVerificationCode`. For example, one might have
"G-123456" or "TKNZGhhd2EyN3I1MnRnMjRv" (in general, one is only guaranteed that the code
is valid UTF-8; one should not make any assumptions regarding the structure or format of
the code).com.google.api.gax.rpc.ApiException
- if the remote call failspublic final NotificationChannel verifyNotificationChannel(String name, String code)
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
String code = "";
NotificationChannel response = notificationChannelServiceClient.verifyNotificationChannel(name.toString(), code);
}
name
- The notification channel to verify.code
- The verification code that was delivered to the channel as a result of invoking the
`SendNotificationChannelVerificationCode` API method or that was retrieved from a verified
channel via `GetNotificationChannelVerificationCode`. For example, one might have
"G-123456" or "TKNZGhhd2EyN3I1MnRnMjRv" (in general, one is only guaranteed that the code
is valid UTF-8; one should not make any assumptions regarding the structure or format of
the code).com.google.api.gax.rpc.ApiException
- if the remote call failspublic final NotificationChannel verifyNotificationChannel(VerifyNotificationChannelRequest request)
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
String code = "";
VerifyNotificationChannelRequest request = VerifyNotificationChannelRequest.newBuilder()
.setName(name.toString())
.setCode(code)
.build();
NotificationChannel response = notificationChannelServiceClient.verifyNotificationChannel(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<VerifyNotificationChannelRequest,NotificationChannel> verifyNotificationChannelCallable()
Sample code:
try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
String code = "";
VerifyNotificationChannelRequest request = VerifyNotificationChannelRequest.newBuilder()
.setName(name.toString())
.setCode(code)
.build();
ApiFuture<NotificationChannel> future = notificationChannelServiceClient.verifyNotificationChannelCallable().futureCall(request);
// Do something
NotificationChannel response = future.get();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isShutdown()
isShutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isTerminated()
isTerminated
in interface com.google.api.gax.core.BackgroundResource
public void shutdownNow()
shutdownNow
in interface com.google.api.gax.core.BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface com.google.api.gax.core.BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.