4444class AlertPolicyServiceClient (object ):
4545 """
4646 The AlertPolicyService API is used to manage (list, create, delete,
47- edit) alert policies in Stackdriver Monitoring. An alerting policy is
48- a description of the conditions under which some aspect of your
49- system is considered to be \ " unhealthy\ " and the ways to notify
50- people or services about this state. In addition to using this API, alert
51- policies can also be managed through
52- `Stackdriver Monitoring <https://cloud.google.com/monitoring/docs/>`_,
53- which can be reached by clicking the \ " Monitoring\ " tab in
54- `Cloud Console <https://console.cloud.google.com/>`_ .
47+ edit) alert policies in Stackdriver Monitoring. An alerting policy is a
48+ description of the conditions under which some aspect of your system is
49+ considered to be "unhealthy" and the ways to notify people or services
50+ about this state. In addition to using this API, alert policies can also
51+ be managed through `Stackdriver
52+ Monitoring <https://cloud.google.com/monitoring/docs/>`__, which can be
53+ reached by clicking the "Monitoring" tab in `Cloud
54+ Console <https://console.cloud.google.com/>`__ .
5555 """
5656
5757 SERVICE_ADDRESS = 'monitoring.googleapis.com:443'
@@ -178,9 +178,10 @@ def __init__(self,
178178 )
179179
180180 if client_info is None :
181- client_info = (
182- google .api_core .gapic_v1 .client_info .DEFAULT_CLIENT_INFO )
183- client_info .gapic_version = _GAPIC_LIBRARY_VERSION
181+ client_info = google .api_core .gapic_v1 .client_info .ClientInfo (
182+ gapic_version = _GAPIC_LIBRARY_VERSION , )
183+ else :
184+ client_info .gapic_version = _GAPIC_LIBRARY_VERSION
184185 self ._client_info = client_info
185186
186187 # Parse out the default settings for retry and timeout for each RPC
@@ -224,32 +225,30 @@ def list_alert_policies(self,
224225 >>> # Alternatively:
225226 >>>
226227 >>> # Iterate over results one page at a time
227- >>> for page in client.list_alert_policies(name, options=CallOptions(page_token=INITIAL_PAGE)) :
228+ >>> for page in client.list_alert_policies(name).pages :
228229 ... for element in page:
229230 ... # process element
230231 ... pass
231232
232233 Args:
233234 name (str): The project whose alert policies are to be listed. The format is
234235
235- projects/[PROJECT_ID]
236+ projects/[PROJECT_ID]
236237
237238 Note that this field names the parent container in which the alerting
238239 policies to be listed are stored. To retrieve a single alerting policy
239- by name, use the
240- ``GetAlertPolicy``
241- operation, instead.
242- filter_ (str): If provided, this field specifies the criteria that must be met by
243- alert policies to be included in the response.
244-
245- For more details, see [sorting and
246- filtering](/monitoring/api/v3/sorting-and-filtering).
240+ by name, use the ``GetAlertPolicy`` operation, instead.
241+ filter_ (str): If provided, this field specifies the criteria that must be met by alert
242+ policies to be included in the response.
243+
244+ For more details, see `sorting and
245+ filtering <https://cloud.google.com/monitoring/api/v3/sorting-and-filtering>`__.
247246 order_by (str): A comma-separated list of fields by which to sort the result. Supports
248247 the same set of field references as the ``filter`` field. Entries can be
249248 prefixed with a minus sign to sort by the field in descending order.
250249
251- For more details, see [ sorting and
252- filtering](/ monitoring/api/v3/sorting-and-filtering) .
250+ For more details, see ` sorting and
251+ filtering <https://cloud.google.com/ monitoring/api/v3/sorting-and-filtering>`__ .
253252 page_size (int): The maximum number of resources contained in the
254253 underlying API response. If page streaming is performed per-
255254 resource, this parameter does not affect the return value. If page
@@ -332,7 +331,7 @@ def get_alert_policy(self,
332331 Args:
333332 name (str): The alerting policy to retrieve. The format is
334333
335- projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID]
334+ projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID]
336335 retry (Optional[google.api_core.retry.Retry]): A retry object used
337336 to retry requests. If ``None`` is specified, requests will not
338337 be retried.
@@ -386,7 +385,7 @@ def create_alert_policy(self,
386385 >>>
387386 >>> name = client.project_path('[PROJECT]')
388387 >>>
389- >>> # TODO: Initialize `` alert_policy` `:
388+ >>> # TODO: Initialize `alert_policy`:
390389 >>> alert_policy = {}
391390 >>>
392391 >>> response = client.create_alert_policy(name, alert_policy)
@@ -400,9 +399,10 @@ def create_alert_policy(self,
400399 policy that is returned will have a name that contains a normalized
401400 representation of this name as a prefix but adds a suffix of the form
402401 ``/alertPolicies/[POLICY_ID]``, identifying the policy in the container.
403- alert_policy (Union[dict, ~google.cloud.monitoring_v3.types.AlertPolicy]): The requested alerting policy. You should omit the ``name`` field in this
404- policy. The name will be returned in the new policy, including
405- a new [ALERT_POLICY_ID] value.
402+ alert_policy (Union[dict, ~google.cloud.monitoring_v3.types.AlertPolicy]): The requested alerting policy. You should omit the ``name`` field in
403+ this policy. The name will be returned in the new policy, including a
404+ new [ALERT\_POLICY\_ID] value.
405+
406406 If a dict is provided, it must be of the same form as the protobuf
407407 message :class:`~google.cloud.monitoring_v3.types.AlertPolicy`
408408 retry (Optional[google.api_core.retry.Retry]): A retry object used
@@ -466,7 +466,7 @@ def delete_alert_policy(self,
466466 Args:
467467 name (str): The alerting policy to delete. The format is:
468468
469- projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID]
469+ projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID]
470470
471471 For more information, see ``AlertPolicy``.
472472 retry (Optional[google.api_core.retry.Retry]): A retry object used
@@ -511,49 +511,51 @@ def update_alert_policy(self,
511511 timeout = google .api_core .gapic_v1 .method .DEFAULT ,
512512 metadata = None ):
513513 """
514- Updates an alerting policy. You can either replace the entire policy with
515- a new one or replace only certain fields in the current alerting policy by
516- specifying the fields to be updated via ``updateMask``. Returns the
517- updated alerting policy.
514+ Updates an alerting policy. You can either replace the entire policy
515+ with a new one or replace only certain fields in the current alerting
516+ policy by specifying the fields to be updated via ``updateMask``.
517+ Returns the updated alerting policy.
518518
519519 Example:
520520 >>> from google.cloud import monitoring_v3
521521 >>>
522522 >>> client = monitoring_v3.AlertPolicyServiceClient()
523523 >>>
524- >>> # TODO: Initialize `` alert_policy` `:
524+ >>> # TODO: Initialize `alert_policy`:
525525 >>> alert_policy = {}
526526 >>>
527527 >>> response = client.update_alert_policy(alert_policy)
528528
529529 Args:
530530 alert_policy (Union[dict, ~google.cloud.monitoring_v3.types.AlertPolicy]): Required. The updated alerting policy or the updated values for the
531- fields listed in ``update_mask``.
532- If ``update_mask`` is not empty, any fields in this policy that are
533- not in ``update_mask`` are ignored.
531+ fields listed in ``update_mask``. If ``update_mask`` is not empty, any
532+ fields in this policy that are not in ``update_mask`` are ignored.
533+
534534 If a dict is provided, it must be of the same form as the protobuf
535535 message :class:`~google.cloud.monitoring_v3.types.AlertPolicy`
536536 update_mask (Union[dict, ~google.cloud.monitoring_v3.types.FieldMask]): Optional. A list of alerting policy field names. If this field is not
537537 empty, each listed field in the existing alerting policy is set to the
538- value of the corresponding field in the supplied policy (``alert_policy``),
539- or to the field's default value if the field is not in the supplied
540- alerting policy. Fields not listed retain their previous value.
538+ value of the corresponding field in the supplied policy
539+ (``alert_policy``), or to the field's default value if the field is not
540+ in the supplied alerting policy. Fields not listed retain their previous
541+ value.
541542
542- Examples of valid field masks include ``display_name``, ``documentation``,
543- ``documentation.content``, ``documentation.mime_type``, ``user_labels``,
544- ``user_label.nameofkey``, ``enabled``, ``conditions``, ``combiner``, etc.
543+ Examples of valid field masks include ``display_name``,
544+ ``documentation``, ``documentation.content``,
545+ ``documentation.mime_type``, ``user_labels``, ``user_label.nameofkey``,
546+ ``enabled``, ``conditions``, ``combiner``, etc.
545547
546548 If this field is empty, then the supplied alerting policy replaces the
547549 existing policy. It is the same as deleting the existing policy and
548550 adding the supplied policy, except for the following:
549551
550- + The new policy will have the same ``[ALERT_POLICY_ID]`` as the former
551- policy. This gives you continuity with the former policy in your
552- notifications and incidents.
553- + Conditions in the new policy will keep their former ``[CONDITION_ID]`` if
554- the supplied condition includes the `name` field with that
555- ` [CONDITION_ID]`. If the supplied condition omits the `name` field,
556- then a new `[CONDITION_ID]` is created.
552+ - The new policy will have the same ``[ALERT_POLICY_ID]`` as the former
553+ policy. This gives you continuity with the former policy in your
554+ notifications and incidents.
555+ - Conditions in the new policy will keep their former
556+ ``[CONDITION_ID]`` if the supplied condition includes the `` name``
557+ field with that `` [CONDITION_ID]`` . If the supplied condition omits
558+ the ``name`` field, then a new `` [CONDITION_ID]` ` is created.
557559
558560 If a dict is provided, it must be of the same form as the protobuf
559561 message :class:`~google.cloud.monitoring_v3.types.FieldMask`
0 commit comments