NotificationChannelServiceClient(
transport=None,
channel=None,
credentials=None,
client_config=None,
client_info=None,
client_options=None,
)
The Notification Channel API provides access to configuration that controls how messages related to incidents are sent.
Methods
NotificationChannelServiceClient
NotificationChannelServiceClient(
transport=None,
channel=None,
credentials=None,
client_config=None,
client_info=None,
client_options=None,
)
Constructor.
Parameters | |
---|---|
Name | Description |
channel |
grpc.Channel
DEPRECATED. A |
credentials |
google.auth.credentials.Credentials
The authorization credentials to attach to requests. These credentials identify this application to the service. If none are specified, the client will attempt to ascertain the credentials from the environment. This argument is mutually exclusive with providing a transport instance to |
client_config |
dict
DEPRECATED. A dictionary of call options for each method. If not specified, the default configuration is used. |
client_info |
google.api_core.gapic_v1.client_info.ClientInfo
The client info used to send a user-agent string along with API requests. If |
client_options |
Union[dict, google.api_core.client_options.ClientOptions]
Client options used to set user options on the client. API Endpoint should be set through client_options. |
create_notification_channel
create_notification_channel(name, notification_channel, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Creates a new notification channel, representing a single notification endpoint such as an email address, SMS number, or PagerDuty service.
.. rubric:: Example
from google.cloud import monitoring_v3
client = monitoring_v3.NotificationChannelServiceClient()
name = client.project_path('[PROJECT]')
TODO: Initialize
notification_channel
:notification_channel = {}
response = client.create_notification_channel(name, notification_channel)
Parameters | |
---|---|
Name | Description |
name |
str
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 |
notification_channel |
Union[dict, NotificationChannel]
The definition of the |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
delete_notification_channel
delete_notification_channel(name, force=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Deletes a notification channel.
.. rubric:: Example
from google.cloud import monitoring_v3
client = monitoring_v3.NotificationChannelServiceClient()
name = client.notification_channel_path('[PROJECT]', '[NOTIFICATION_CHANNEL]')
client.delete_notification_channel(name)
Parameters | |
---|---|
Name | Description |
name |
str
The channel for which to execute the request. The format is |
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. |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
from_service_account_file
from_service_account_file(filename, *args, **kwargs)
Creates an instance of this client using the provided credentials file.
Parameter | |
---|---|
Name | Description |
filename |
str
The path to the service account private key json file. |
Returns | |
---|---|
Type | Description |
NotificationChannelServiceClient | The constructed client. |
from_service_account_json
from_service_account_json(filename, *args, **kwargs)
Creates an instance of this client using the provided credentials file.
Parameter | |
---|---|
Name | Description |
filename |
str
The path to the service account private key json file. |
Returns | |
---|---|
Type | Description |
NotificationChannelServiceClient | The constructed client. |
get_notification_channel
get_notification_channel(name, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
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.
.. rubric:: Example
from google.cloud import monitoring_v3
client = monitoring_v3.NotificationChannelServiceClient()
name = client.notification_channel_path('[PROJECT]', '[NOTIFICATION_CHANNEL]')
response = client.get_notification_channel(name)
Parameters | |
---|---|
Name | Description |
name |
str
The channel for which to execute the request. The format is |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
get_notification_channel_descriptor
get_notification_channel_descriptor(name, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Gets a single channel descriptor. The descriptor indicates which fields are expected / permitted for a notification channel of the given type.
.. rubric:: Example
from google.cloud import monitoring_v3
client = monitoring_v3.NotificationChannelServiceClient()
name = client.notification_channel_descriptor_path('[PROJECT]', '[CHANNEL_DESCRIPTOR]')
response = client.get_notification_channel_descriptor(name)
Parameters | |
---|---|
Name | Description |
name |
str
The channel type for which to execute the request. The format is |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
get_notification_channel_verification_code
get_notification_channel_verification_code(name, expire_time=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
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.
.. rubric:: Example
from google.cloud import monitoring_v3
client = monitoring_v3.NotificationChannelServiceClient()
name = client.notification_channel_path('[PROJECT]', '[NOTIFICATION_CHANNEL]')
response = client.get_notification_channel_verification_code(name)
Parameters | |
---|---|
Name | Description |
name |
str
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. |
expire_time |
Union[dict, Timestamp]
The desired expiration time. If specified, the API will guarantee that the returned code will not be valid after the specified timestamp; however, the API cannot guarantee that the returned code will be valid for at least as long as the requested time (the API puts an upper bound on the amount of time for which a code may be valid). If omitted, a default expiration will be used, which may be less than the max permissible expiration (so specifying an expiration may extend the code's lifetime over omitting an expiration, even though the API does impose an upper limit on the maximum expiration that is permitted). If a dict is provided, it must be of the same form as the protobuf message Timestamp |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
list_notification_channel_descriptors
list_notification_channel_descriptors(name, page_size=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Lists the descriptors for supported channel types. The use of descriptors makes it possible for new channel types to be dynamically added.
.. rubric:: Example
from google.cloud import monitoring_v3
client = monitoring_v3.NotificationChannelServiceClient()
name = client.project_path('[PROJECT]')
Iterate over all results
for element in client.list_notification_channel_descriptors(name): ... # process element ... pass
Alternatively:
Iterate over results one page at a time
for page in client.list_notification_channel_descriptors(name).pages: ... for element in page: ... # process element ... pass
Parameters | |
---|---|
Name | Description |
name |
str
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 |
page_size |
int
The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page. |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
list_notification_channels
list_notification_channels(name, filter_=None, order_by=None, page_size=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Lists the notification channels that have been created for the project.
.. rubric:: Example
from google.cloud import monitoring_v3
client = monitoring_v3.NotificationChannelServiceClient()
name = client.project_path('[PROJECT]')
Iterate over all results
for element in client.list_notification_channels(name): ... # process element ... pass
Alternatively:
Iterate over results one page at a time
for page in client.list_notification_channels(name).pages: ... for element in page: ... # process element ... pass
Parameters | |
---|---|
Name | Description |
name |
str
The project on which to execute the request. The format is |
filter_ |
str
If provided, this field specifies the criteria that must be met by notification channels to be included in the response. For more details, see |
order_by |
str
A comma-separated list of fields by which to sort the result. Supports the same set of fields as in |
page_size |
int
The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page. |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
notification_channel_descriptor_path
notification_channel_descriptor_path(project, channel_descriptor)
Return a fully-qualified notification_channel_descriptor string.
notification_channel_path
notification_channel_path(project, notification_channel)
Return a fully-qualified notification_channel string.
project_path
project_path(project)
Return a fully-qualified project string.
send_notification_channel_verification_code
send_notification_channel_verification_code(name, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Causes a verification code to be delivered to the channel. The code can
then be supplied in VerifyNotificationChannel
to verify the channel.
.. rubric:: Example
from google.cloud import monitoring_v3
client = monitoring_v3.NotificationChannelServiceClient()
name = client.notification_channel_path('[PROJECT]', '[NOTIFICATION_CHANNEL]')
client.send_notification_channel_verification_code(name)
Parameters | |
---|---|
Name | Description |
name |
str
The notification channel to which to send a verification code. |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
update_notification_channel
update_notification_channel(notification_channel, update_mask=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Updates a notification channel. Fields not specified in the field mask remain unchanged.
.. rubric:: Example
from google.cloud import monitoring_v3
client = monitoring_v3.NotificationChannelServiceClient()
TODO: Initialize
notification_channel
:notification_channel = {}
response = client.update_notification_channel(notification_channel)
Parameters | |
---|---|
Name | Description |
notification_channel |
Union[dict, 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 |
Union[dict, FieldMask]
The fields to update. If a dict is provided, it must be of the same form as the protobuf message FieldMask |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
verify_notification_channel
verify_notification_channel(name, code, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Verifies a NotificationChannel
by proving receipt of the code
delivered to the channel as a result of calling
SendNotificationChannelVerificationCode
.
.. rubric:: Example
from google.cloud import monitoring_v3
client = monitoring_v3.NotificationChannelServiceClient()
name = client.notification_channel_path('[PROJECT]', '[NOTIFICATION_CHANNEL]')
TODO: Initialize
code
:code = ''
response = client.verify_notification_channel(name, code)
Parameters | |
---|---|
Name | Description |
name |
str
The notification channel to verify. |
code |
str
The verification code that was delivered to the channel as a result of invoking the |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Exceptions | |
---|---|
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |