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

Commit dd62813

Browse files
docs: add generated snippets (#130)
* 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 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent a0cab1c commit dd62813

File tree

128 files changed

+14008
-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.

128 files changed

+14008
-0
lines changed

‎google/cloud/notebooks_v1/services/managed_notebook_service/async_client.py

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,26 @@ async def list_runtimes(
223223
) -> pagers.ListRuntimesAsyncPager:
224224
r"""Lists Runtimes in a given project and location.
225225
226+
.. code-block::
227+
228+
from google.cloud import notebooks_v1
229+
230+
def sample_list_runtimes():
231+
# Create a client
232+
client = notebooks_v1.ManagedNotebookServiceClient()
233+
234+
# Initialize request argument(s)
235+
request = notebooks_v1.ListRuntimesRequest(
236+
parent="parent_value",
237+
)
238+
239+
# Make the request
240+
page_result = client.list_runtimes(request=request)
241+
242+
# Handle the response
243+
for response in page_result:
244+
print(response)
245+
226246
Args:
227247
request (Union[google.cloud.notebooks_v1.types.ListRuntimesRequest, dict]):
228248
The request object. Request for listing Managed Notebook
@@ -304,6 +324,26 @@ async def get_runtime(
304324
r"""Gets details of a single Runtime. The location must
305325
be a regional endpoint rather than zonal.
306326
327+
328+
.. code-block::
329+
330+
from google.cloud import notebooks_v1
331+
332+
def sample_get_runtime():
333+
# Create a client
334+
client = notebooks_v1.ManagedNotebookServiceClient()
335+
336+
# Initialize request argument(s)
337+
request = notebooks_v1.GetRuntimeRequest(
338+
name="name_value",
339+
)
340+
341+
# Make the request
342+
response = client.get_runtime(request=request)
343+
344+
# Handle the response
345+
print(response)
346+
307347
Args:
308348
request (Union[google.cloud.notebooks_v1.types.GetRuntimeRequest, dict]):
309349
The request object. Request for getting a Managed
@@ -378,6 +418,31 @@ async def create_runtime(
378418
r"""Creates a new Runtime in a given project and
379419
location.
380420
421+
422+
.. code-block::
423+
424+
from google.cloud import notebooks_v1
425+
426+
def sample_create_runtime():
427+
# Create a client
428+
client = notebooks_v1.ManagedNotebookServiceClient()
429+
430+
# Initialize request argument(s)
431+
request = notebooks_v1.CreateRuntimeRequest(
432+
parent="parent_value",
433+
runtime_id="runtime_id_value",
434+
)
435+
436+
# Make the request
437+
operation = client.create_runtime(request=request)
438+
439+
print("Waiting for operation to complete...")
440+
441+
response = operation.result()
442+
443+
# Handle the response
444+
print(response)
445+
381446
Args:
382447
request (Union[google.cloud.notebooks_v1.types.CreateRuntimeRequest, dict]):
383448
The request object. Request for creating a Managed
@@ -476,6 +541,29 @@ async def delete_runtime(
476541
) -> operation_async.AsyncOperation:
477542
r"""Deletes a single Runtime.
478543
544+
.. code-block::
545+
546+
from google.cloud import notebooks_v1
547+
548+
def sample_delete_runtime():
549+
# Create a client
550+
client = notebooks_v1.ManagedNotebookServiceClient()
551+
552+
# Initialize request argument(s)
553+
request = notebooks_v1.DeleteRuntimeRequest(
554+
name="name_value",
555+
)
556+
557+
# Make the request
558+
operation = client.delete_runtime(request=request)
559+
560+
print("Waiting for operation to complete...")
561+
562+
response = operation.result()
563+
564+
# Handle the response
565+
print(response)
566+
479567
Args:
480568
request (Union[google.cloud.notebooks_v1.types.DeleteRuntimeRequest, dict]):
481569
The request object. Request for deleting a Managed
@@ -572,6 +660,30 @@ async def start_runtime(
572660
https://cloud.google.com/compute/docs/instances/stop-start-instance
573661
https://cloud.google.com/compute/docs/instances/suspend-resume-instance
574662
663+
664+
.. code-block::
665+
666+
from google.cloud import notebooks_v1
667+
668+
def sample_start_runtime():
669+
# Create a client
670+
client = notebooks_v1.ManagedNotebookServiceClient()
671+
672+
# Initialize request argument(s)
673+
request = notebooks_v1.StartRuntimeRequest(
674+
name="name_value",
675+
)
676+
677+
# Make the request
678+
operation = client.start_runtime(request=request)
679+
680+
print("Waiting for operation to complete...")
681+
682+
response = operation.result()
683+
684+
# Handle the response
685+
print(response)
686+
575687
Args:
576688
request (Union[google.cloud.notebooks_v1.types.StartRuntimeRequest, dict]):
577689
The request object. Request for starting a Managed
@@ -658,6 +770,30 @@ async def stop_runtime(
658770
https://cloud.google.com/compute/docs/instances/stop-start-instance
659771
https://cloud.google.com/compute/docs/instances/suspend-resume-instance
660772
773+
774+
.. code-block::
775+
776+
from google.cloud import notebooks_v1
777+
778+
def sample_stop_runtime():
779+
# Create a client
780+
client = notebooks_v1.ManagedNotebookServiceClient()
781+
782+
# Initialize request argument(s)
783+
request = notebooks_v1.StopRuntimeRequest(
784+
name="name_value",
785+
)
786+
787+
# Make the request
788+
operation = client.stop_runtime(request=request)
789+
790+
print("Waiting for operation to complete...")
791+
792+
response = operation.result()
793+
794+
# Handle the response
795+
print(response)
796+
661797
Args:
662798
request (Union[google.cloud.notebooks_v1.types.StopRuntimeRequest, dict]):
663799
The request object. Request for stopping a Managed
@@ -740,6 +876,29 @@ async def switch_runtime(
740876
) -> operation_async.AsyncOperation:
741877
r"""Switch a Managed Notebook Runtime.
742878
879+
.. code-block::
880+
881+
from google.cloud import notebooks_v1
882+
883+
def sample_switch_runtime():
884+
# Create a client
885+
client = notebooks_v1.ManagedNotebookServiceClient()
886+
887+
# Initialize request argument(s)
888+
request = notebooks_v1.SwitchRuntimeRequest(
889+
name="name_value",
890+
)
891+
892+
# Make the request
893+
operation = client.switch_runtime(request=request)
894+
895+
print("Waiting for operation to complete...")
896+
897+
response = operation.result()
898+
899+
# Handle the response
900+
print(response)
901+
743902
Args:
744903
request (Union[google.cloud.notebooks_v1.types.SwitchRuntimeRequest, dict]):
745904
The request object. Request for switching a Managed
@@ -822,6 +981,29 @@ async def reset_runtime(
822981
) -> operation_async.AsyncOperation:
823982
r"""Resets a Managed Notebook Runtime.
824983
984+
.. code-block::
985+
986+
from google.cloud import notebooks_v1
987+
988+
def sample_reset_runtime():
989+
# Create a client
990+
client = notebooks_v1.ManagedNotebookServiceClient()
991+
992+
# Initialize request argument(s)
993+
request = notebooks_v1.ResetRuntimeRequest(
994+
name="name_value",
995+
)
996+
997+
# Make the request
998+
operation = client.reset_runtime(request=request)
999+
1000+
print("Waiting for operation to complete...")
1001+
1002+
response = operation.result()
1003+
1004+
# Handle the response
1005+
print(response)
1006+
8251007
Args:
8261008
request (Union[google.cloud.notebooks_v1.types.ResetRuntimeRequest, dict]):
8271009
The request object. Request for reseting a Managed
@@ -904,6 +1086,30 @@ async def report_runtime_event(
9041086
) -> operation_async.AsyncOperation:
9051087
r"""Report and process a runtime event.
9061088
1089+
.. code-block::
1090+
1091+
from google.cloud import notebooks_v1
1092+
1093+
def sample_report_runtime_event():
1094+
# Create a client
1095+
client = notebooks_v1.ManagedNotebookServiceClient()
1096+
1097+
# Initialize request argument(s)
1098+
request = notebooks_v1.ReportRuntimeEventRequest(
1099+
name="name_value",
1100+
vm_id="vm_id_value",
1101+
)
1102+
1103+
# Make the request
1104+
operation = client.report_runtime_event(request=request)
1105+
1106+
print("Waiting for operation to complete...")
1107+
1108+
response = operation.result()
1109+
1110+
# Handle the response
1111+
print(response)
1112+
9071113
Args:
9081114
request (Union[google.cloud.notebooks_v1.types.ReportRuntimeEventRequest, dict]):
9091115
The request object. Request for reporting a Managed

0 commit comments

Comments
 (0)