Skip to content
This repository was archived by the owner on Dec 31, 2023. It is now read-only.

Commit 2340cc9

Browse files
gcf-owl-bot[bot]busunkim96parthea
authored
docs: add generated snippets (#276)
* chore: use gapic-generator-python 0.63.2 docs: add generated snippets PiperOrigin-RevId: 427792504 Source-Link: googleapis/googleapis@55b9e1e Source-Link: https://github.com/googleapis/googleapis-gen/commit/bf4e86b753f42cb0edb1fd51fbe840d7da0a1cde Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYmY0ZTg2Yjc1M2Y0MmNiMGVkYjFmZDUxZmJlODQwZDdkYTBhMWNkZSJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: use gapic-generator-python 0.63.4 chore: fix snippet region tag format chore: fix docstring code block formatting PiperOrigin-RevId: 430730865 Source-Link: googleapis/googleapis@ea58002 Source-Link: https://github.com/googleapis/googleapis-gen/commit/ca893ff8af25fc7fe001de1405a517d80446ecca Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiY2E4OTNmZjhhZjI1ZmM3ZmUwMDFkZTE0MDVhNTE3ZDgwNDQ2ZWNjYSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: delete duplicates * restore async_client.py Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>
1 parent d2874b5 commit 2340cc9

File tree

109 files changed

+10161
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+10161
-0
lines changed

google/cloud/monitoring_v3/services/alert_policy_service/async_client.py

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,27 @@ async def list_alert_policies(
237237
r"""Lists the existing alerting policies for the
238238
workspace.
239239
240+
241+
.. code-block:: python
242+
243+
from google.cloud import monitoring_v3
244+
245+
def sample_list_alert_policies():
246+
# Create a client
247+
client = monitoring_v3.AlertPolicyServiceClient()
248+
249+
# Initialize request argument(s)
250+
request = monitoring_v3.ListAlertPoliciesRequest(
251+
name="name_value",
252+
)
253+
254+
# Make the request
255+
page_result = client.list_alert_policies(request=request)
256+
257+
# Handle the response
258+
for response in page_result:
259+
print(response)
260+
240261
Args:
241262
request (Union[google.cloud.monitoring_v3.types.ListAlertPoliciesRequest, dict]):
242263
The request object. The protocol for the
@@ -336,6 +357,25 @@ async def get_alert_policy(
336357
) -> alert.AlertPolicy:
337358
r"""Gets a single alerting policy.
338359
360+
.. code-block:: python
361+
362+
from google.cloud import monitoring_v3
363+
364+
def sample_get_alert_policy():
365+
# Create a client
366+
client = monitoring_v3.AlertPolicyServiceClient()
367+
368+
# Initialize request argument(s)
369+
request = monitoring_v3.GetAlertPolicyRequest(
370+
name="name_value",
371+
)
372+
373+
# Make the request
374+
response = client.get_alert_policy(request=request)
375+
376+
# Handle the response
377+
print(response)
378+
339379
Args:
340380
request (Union[google.cloud.monitoring_v3.types.GetAlertPolicyRequest, dict]):
341381
The request object. The protocol for the
@@ -424,6 +464,25 @@ async def create_alert_policy(
424464
) -> alert.AlertPolicy:
425465
r"""Creates a new alerting policy.
426466
467+
.. code-block:: python
468+
469+
from google.cloud import monitoring_v3
470+
471+
def sample_create_alert_policy():
472+
# Create a client
473+
client = monitoring_v3.AlertPolicyServiceClient()
474+
475+
# Initialize request argument(s)
476+
request = monitoring_v3.CreateAlertPolicyRequest(
477+
name="name_value",
478+
)
479+
480+
# Make the request
481+
response = client.create_alert_policy(request=request)
482+
483+
# Handle the response
484+
print(response)
485+
427486
Args:
428487
request (Union[google.cloud.monitoring_v3.types.CreateAlertPolicyRequest, dict]):
429488
The request object. The protocol for the
@@ -524,6 +583,22 @@ async def delete_alert_policy(
524583
) -> None:
525584
r"""Deletes an alerting policy.
526585
586+
.. code-block:: python
587+
588+
from google.cloud import monitoring_v3
589+
590+
def sample_delete_alert_policy():
591+
# Create a client
592+
client = monitoring_v3.AlertPolicyServiceClient()
593+
594+
# Initialize request argument(s)
595+
request = monitoring_v3.DeleteAlertPolicyRequest(
596+
name="name_value",
597+
)
598+
599+
# Make the request
600+
client.delete_alert_policy(request=request)
601+
527602
Args:
528603
request (Union[google.cloud.monitoring_v3.types.DeleteAlertPolicyRequest, dict]):
529604
The request object. The protocol for the
@@ -607,6 +682,25 @@ async def update_alert_policy(
607682
current alerting policy by specifying the fields to be updated
608683
via ``updateMask``. Returns the updated alerting policy.
609684
685+
686+
.. code-block:: python
687+
688+
from google.cloud import monitoring_v3
689+
690+
def sample_update_alert_policy():
691+
# Create a client
692+
client = monitoring_v3.AlertPolicyServiceClient()
693+
694+
# Initialize request argument(s)
695+
request = monitoring_v3.UpdateAlertPolicyRequest(
696+
)
697+
698+
# Make the request
699+
response = client.update_alert_policy(request=request)
700+
701+
# Handle the response
702+
print(response)
703+
610704
Args:
611705
request (Union[google.cloud.monitoring_v3.types.UpdateAlertPolicyRequest, dict]):
612706
The request object. The protocol for the

google/cloud/monitoring_v3/services/alert_policy_service/client.py

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,27 @@ def list_alert_policies(
444444
r"""Lists the existing alerting policies for the
445445
workspace.
446446
447+
448+
.. code-block:: python
449+
450+
from google.cloud import monitoring_v3
451+
452+
def sample_list_alert_policies():
453+
# Create a client
454+
client = monitoring_v3.AlertPolicyServiceClient()
455+
456+
# Initialize request argument(s)
457+
request = monitoring_v3.ListAlertPoliciesRequest(
458+
name="name_value",
459+
)
460+
461+
# Make the request
462+
page_result = client.list_alert_policies(request=request)
463+
464+
# Handle the response
465+
for response in page_result:
466+
print(response)
467+
447468
Args:
448469
request (Union[google.cloud.monitoring_v3.types.ListAlertPoliciesRequest, dict]):
449470
The request object. The protocol for the
@@ -534,6 +555,25 @@ def get_alert_policy(
534555
) -> alert.AlertPolicy:
535556
r"""Gets a single alerting policy.
536557
558+
.. code-block:: python
559+
560+
from google.cloud import monitoring_v3
561+
562+
def sample_get_alert_policy():
563+
# Create a client
564+
client = monitoring_v3.AlertPolicyServiceClient()
565+
566+
# Initialize request argument(s)
567+
request = monitoring_v3.GetAlertPolicyRequest(
568+
name="name_value",
569+
)
570+
571+
# Make the request
572+
response = client.get_alert_policy(request=request)
573+
574+
# Handle the response
575+
print(response)
576+
537577
Args:
538578
request (Union[google.cloud.monitoring_v3.types.GetAlertPolicyRequest, dict]):
539579
The request object. The protocol for the
@@ -613,6 +653,25 @@ def create_alert_policy(
613653
) -> alert.AlertPolicy:
614654
r"""Creates a new alerting policy.
615655
656+
.. code-block:: python
657+
658+
from google.cloud import monitoring_v3
659+
660+
def sample_create_alert_policy():
661+
# Create a client
662+
client = monitoring_v3.AlertPolicyServiceClient()
663+
664+
# Initialize request argument(s)
665+
request = monitoring_v3.CreateAlertPolicyRequest(
666+
name="name_value",
667+
)
668+
669+
# Make the request
670+
response = client.create_alert_policy(request=request)
671+
672+
# Handle the response
673+
print(response)
674+
616675
Args:
617676
request (Union[google.cloud.monitoring_v3.types.CreateAlertPolicyRequest, dict]):
618677
The request object. The protocol for the
@@ -713,6 +772,22 @@ def delete_alert_policy(
713772
) -> None:
714773
r"""Deletes an alerting policy.
715774
775+
.. code-block:: python
776+
777+
from google.cloud import monitoring_v3
778+
779+
def sample_delete_alert_policy():
780+
# Create a client
781+
client = monitoring_v3.AlertPolicyServiceClient()
782+
783+
# Initialize request argument(s)
784+
request = monitoring_v3.DeleteAlertPolicyRequest(
785+
name="name_value",
786+
)
787+
788+
# Make the request
789+
client.delete_alert_policy(request=request)
790+
716791
Args:
717792
request (Union[google.cloud.monitoring_v3.types.DeleteAlertPolicyRequest, dict]):
718793
The request object. The protocol for the
@@ -787,6 +862,25 @@ def update_alert_policy(
787862
current alerting policy by specifying the fields to be updated
788863
via ``updateMask``. Returns the updated alerting policy.
789864
865+
866+
.. code-block:: python
867+
868+
from google.cloud import monitoring_v3
869+
870+
def sample_update_alert_policy():
871+
# Create a client
872+
client = monitoring_v3.AlertPolicyServiceClient()
873+
874+
# Initialize request argument(s)
875+
request = monitoring_v3.UpdateAlertPolicyRequest(
876+
)
877+
878+
# Make the request
879+
response = client.update_alert_policy(request=request)
880+
881+
# Handle the response
882+
print(response)
883+
790884
Args:
791885
request (Union[google.cloud.monitoring_v3.types.UpdateAlertPolicyRequest, dict]):
792886
The request object. The protocol for the

0 commit comments

Comments
 (0)