Class NotificationChannelServiceClient (2.12.0)

The Notification Channel API provides access to configuration that controls how messages related to incidents are sent.

Equality

Instances of this class created via copy-construction or copy-assignment always compare equal. Instances created with equal std::shared_ptr<*Connection> objects compare equal. Objects that compare equal share the same underlying resources.

Performance

Creating a new instance of this class is a relatively expensive operation, new objects establish new connections to the service. In contrast, copy-construction, move-construction, and the corresponding assignment operations are relatively efficient as the copies share all underlying resources.

Thread Safety

Concurrent access to different instances of this class, even if they compare equal, is guaranteed to work. Two or more threads operating on the same instance of this class is not guaranteed to work. Since copy-construction and move-construction is a relatively efficient operation, consider using such a copy when using this class from multiple threads.

Constructors

NotificationChannelServiceClient(NotificationChannelServiceClient const &)

Copy and move support

Parameter
Name Description
NotificationChannelServiceClient const &

NotificationChannelServiceClient(NotificationChannelServiceClient &&)

Copy and move support

Parameter
Name Description
NotificationChannelServiceClient &&

NotificationChannelServiceClient(std::shared_ptr< NotificationChannelServiceConnection >, Options)

Parameters
Name Description
connection std::shared_ptr< NotificationChannelServiceConnection >
opts Options

Operators

operator=(NotificationChannelServiceClient const &)

Copy and move support

Parameter
Name Description
NotificationChannelServiceClient const &
Returns
Type Description
NotificationChannelServiceClient &

operator=(NotificationChannelServiceClient &&)

Copy and move support

Parameter
Name Description
NotificationChannelServiceClient &&
Returns
Type Description
NotificationChannelServiceClient &

Functions

ListNotificationChannelDescriptors(std::string const &, Options)

Lists the descriptors for supported channel types.

The use of descriptors makes it possible for new channel types to be dynamically added.

Parameters
Name Description
name std::string const &

Required. The REST resource name of the parent from which to retrieve the notification channel descriptors. The expected syntax is:
projects/[PROJECT_ID_OR_NUMBER]
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.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::monitoring::v3::NotificationChannelDescriptor >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.monitoring.v3.NotificationChannelDescriptor, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

ListNotificationChannelDescriptors(google::monitoring::v3::ListNotificationChannelDescriptorsRequest, Options)

Lists the descriptors for supported channel types.

The use of descriptors makes it possible for new channel types to be dynamically added.

Parameters
Name Description
request google::monitoring::v3::ListNotificationChannelDescriptorsRequest

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.monitoring.v3.ListNotificationChannelDescriptorsRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::monitoring::v3::NotificationChannelDescriptor >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.monitoring.v3.NotificationChannelDescriptor, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

GetNotificationChannelDescriptor(std::string const &, Options)

Gets a single channel descriptor.

The descriptor indicates which fields are expected / permitted for a notification channel of the given type.

Parameters
Name Description
name std::string const &

Required. The channel type for which to execute the request. The format is:
projects/[PROJECT_ID_OR_NUMBER]/notificationChannelDescriptors/[CHANNEL_TYPE]

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::monitoring::v3::NotificationChannelDescriptor >

the result of the RPC. The response message type (google.monitoring.v3.NotificationChannelDescriptor) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

GetNotificationChannelDescriptor(google::monitoring::v3::GetNotificationChannelDescriptorRequest const &, Options)

Gets a single channel descriptor.

The descriptor indicates which fields are expected / permitted for a notification channel of the given type.

Parameters
Name Description
request google::monitoring::v3::GetNotificationChannelDescriptorRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.monitoring.v3.GetNotificationChannelDescriptorRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::monitoring::v3::NotificationChannelDescriptor >

the result of the RPC. The response message type (google.monitoring.v3.NotificationChannelDescriptor) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

ListNotificationChannels(std::string const &, Options)

Lists the notification channels that have been created for the project.

Parameters
Name Description
name std::string const &

Required. The project on which to execute the request. The format is:
projects/[PROJECT_ID_OR_NUMBER]
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.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::monitoring::v3::NotificationChannel >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.monitoring.v3.NotificationChannel, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

ListNotificationChannels(google::monitoring::v3::ListNotificationChannelsRequest, Options)

Lists the notification channels that have been created for the project.

Parameters
Name Description
request google::monitoring::v3::ListNotificationChannelsRequest

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.monitoring.v3.ListNotificationChannelsRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::monitoring::v3::NotificationChannel >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.monitoring.v3.NotificationChannel, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

GetNotificationChannel(std::string const &, Options)

Gets a single notification channel.

The channel includes the relevant configuration details with which the channel was created. However, the response may truncate or omit passwords, API keys, or other private key matter and thus the response may not be 100% identical to the information that was supplied in the call to the create method.

Parameters
Name Description
name std::string const &

Required. The channel for which to execute the request. The format is:
projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::monitoring::v3::NotificationChannel >

the result of the RPC. The response message type (google.monitoring.v3.NotificationChannel) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

GetNotificationChannel(google::monitoring::v3::GetNotificationChannelRequest const &, Options)

Gets a single notification channel.

The channel includes the relevant configuration details with which the channel was created. However, the response may truncate or omit passwords, API keys, or other private key matter and thus the response may not be 100% identical to the information that was supplied in the call to the create method.

Parameters
Name Description
request google::monitoring::v3::GetNotificationChannelRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.monitoring.v3.GetNotificationChannelRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::monitoring::v3::NotificationChannel >

the result of the RPC. The response message type (google.monitoring.v3.NotificationChannel) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

CreateNotificationChannel(std::string const &, google::monitoring::v3::NotificationChannel const &, Options)

Creates a new notification channel, representing a single notification endpoint such as an email address, SMS number, or PagerDuty service.

Parameters
Name Description
name std::string const &

Required. The project on which to execute the request. The format is:
projects/[PROJECT_ID_OR_NUMBER]
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.

notification_channel google::monitoring::v3::NotificationChannel const &

Required. The definition of the NotificationChannel to create.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::monitoring::v3::NotificationChannel >

the result of the RPC. The response message type (google.monitoring.v3.NotificationChannel) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

CreateNotificationChannel(google::monitoring::v3::CreateNotificationChannelRequest const &, Options)

Creates a new notification channel, representing a single notification endpoint such as an email address, SMS number, or PagerDuty service.

Parameters
Name Description
request google::monitoring::v3::CreateNotificationChannelRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.monitoring.v3.CreateNotificationChannelRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::monitoring::v3::NotificationChannel >

the result of the RPC. The response message type (google.monitoring.v3.NotificationChannel) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

UpdateNotificationChannel(google::protobuf::FieldMask const &, google::monitoring::v3::NotificationChannel const &, Options)

Updates a notification channel.

Fields not specified in the field mask remain unchanged.

Parameters
Name Description
update_mask google::protobuf::FieldMask const &

The fields to update.

notification_channel google::monitoring::v3::NotificationChannel const &

Required. 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.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::monitoring::v3::NotificationChannel >

the result of the RPC. The response message type (google.monitoring.v3.NotificationChannel) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

UpdateNotificationChannel(google::monitoring::v3::UpdateNotificationChannelRequest const &, Options)

Updates a notification channel.

Fields not specified in the field mask remain unchanged.

Parameters
Name Description
request google::monitoring::v3::UpdateNotificationChannelRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.monitoring.v3.UpdateNotificationChannelRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::monitoring::v3::NotificationChannel >

the result of the RPC. The response message type (google.monitoring.v3.NotificationChannel) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

DeleteNotificationChannel(std::string const &, bool, Options)

Deletes a notification channel.

Parameters
Name Description
name std::string const &

Required. The channel for which to execute the request. The format is:
projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]

force bool

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.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
Status

a Status object. If the request failed, the status contains the details of the failure.

DeleteNotificationChannel(google::monitoring::v3::DeleteNotificationChannelRequest const &, Options)

Deletes a notification channel.

Parameters
Name Description
request google::monitoring::v3::DeleteNotificationChannelRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.monitoring.v3.DeleteNotificationChannelRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
Status

a Status object. If the request failed, the status contains the details of the failure.

SendNotificationChannelVerificationCode(std::string const &, Options)

Causes a verification code to be delivered to the channel.

The code can then be supplied in VerifyNotificationChannel to verify the channel.

Parameters
Name Description
name std::string const &

Required. The notification channel to which to send a verification code.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
Status

a Status object. If the request failed, the status contains the details of the failure.

SendNotificationChannelVerificationCode(google::monitoring::v3::SendNotificationChannelVerificationCodeRequest const &, Options)

Causes a verification code to be delivered to the channel.

The code can then be supplied in VerifyNotificationChannel to verify the channel.

Parameters
Name Description
request google::monitoring::v3::SendNotificationChannelVerificationCodeRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.monitoring.v3.SendNotificationChannelVerificationCodeRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
Status

a Status object. If the request failed, the status contains the details of the failure.

GetNotificationChannelVerificationCode(std::string const &, Options)

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.

This makes it possible to copy a channel between projects without requiring manual reverification of the channel. If the channel is not in the verified state, this method will fail (in other words, this may only be used if the SendNotificationChannelVerificationCode and VerifyNotificationChannel paths have already been used to put the given channel into the verified state).

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.

Parameters
Name Description
name std::string const &

Required. 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.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::monitoring::v3::GetNotificationChannelVerificationCodeResponse >

the result of the RPC. The response message type (google.monitoring.v3.GetNotificationChannelVerificationCodeResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

GetNotificationChannelVerificationCode(google::monitoring::v3::GetNotificationChannelVerificationCodeRequest const &, Options)

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.

This makes it possible to copy a channel between projects without requiring manual reverification of the channel. If the channel is not in the verified state, this method will fail (in other words, this may only be used if the SendNotificationChannelVerificationCode and VerifyNotificationChannel paths have already been used to put the given channel into the verified state).

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.

Parameters
Name Description
request google::monitoring::v3::GetNotificationChannelVerificationCodeRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.monitoring.v3.GetNotificationChannelVerificationCodeRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::monitoring::v3::GetNotificationChannelVerificationCodeResponse >

the result of the RPC. The response message type (google.monitoring.v3.GetNotificationChannelVerificationCodeResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

VerifyNotificationChannel(std::string const &, std::string const &, Options)

Verifies a NotificationChannel by proving receipt of the code delivered to the channel as a result of calling SendNotificationChannelVerificationCode.

Parameters
Name Description
name std::string const &

Required. The notification channel to verify.

code std::string const &

Required. 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).

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::monitoring::v3::NotificationChannel >

the result of the RPC. The response message type (google.monitoring.v3.NotificationChannel) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

VerifyNotificationChannel(google::monitoring::v3::VerifyNotificationChannelRequest const &, Options)

Verifies a NotificationChannel by proving receipt of the code delivered to the channel as a result of calling SendNotificationChannelVerificationCode.

Parameters
Name Description
request google::monitoring::v3::VerifyNotificationChannelRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.monitoring.v3.VerifyNotificationChannelRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::monitoring::v3::NotificationChannel >

the result of the RPC. The response message type (google.monitoring.v3.NotificationChannel) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.