diff --git a/CHANGELOG.md b/CHANGELOG.md index 41a2967..a73a78f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [1.3.1](https://github.com/googleapis/python-tpu/compare/v1.3.0...v1.3.1) (2022-02-11) + + +### Documentation + +* add generated snippets ([#79](https://github.com/googleapis/python-tpu/issues/79)) ([c09c807](https://github.com/googleapis/python-tpu/commit/c09c807b4f57798d4798589be0bf4c4d287e6073)) + ## [1.3.0](https://github.com/googleapis/python-tpu/compare/v1.2.1...v1.3.0) (2022-02-03) diff --git a/google/cloud/tpu_v1/services/tpu/async_client.py b/google/cloud/tpu_v1/services/tpu/async_client.py index bce04ec..29f4751 100644 --- a/google/cloud/tpu_v1/services/tpu/async_client.py +++ b/google/cloud/tpu_v1/services/tpu/async_client.py @@ -214,6 +214,26 @@ async def list_nodes( ) -> pagers.ListNodesAsyncPager: r"""Lists nodes. + .. code-block:: + + from google.cloud import tpu_v1 + + def sample_list_nodes(): + # Create a client + client = tpu_v1.TpuClient() + + # Initialize request argument(s) + request = tpu_v1.ListNodesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_nodes(request=request) + + # Handle the response + for response in page_result: + print(response) + Args: request (Union[google.cloud.tpu_v1.types.ListNodesRequest, dict]): The request object. Request for @@ -292,6 +312,25 @@ async def get_node( ) -> cloud_tpu.Node: r"""Gets the details of a node. + .. code-block:: + + from google.cloud import tpu_v1 + + def sample_get_node(): + # Create a client + client = tpu_v1.TpuClient() + + # Initialize request argument(s) + request = tpu_v1.GetNodeRequest( + name="name_value", + ) + + # Make the request + response = client.get_node(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.tpu_v1.types.GetNodeRequest, dict]): The request object. Request for @@ -361,6 +400,34 @@ async def create_node( ) -> operation_async.AsyncOperation: r"""Creates a node. + .. code-block:: + + from google.cloud import tpu_v1 + + def sample_create_node(): + # Create a client + client = tpu_v1.TpuClient() + + # Initialize request argument(s) + node = tpu_v1.Node() + node.accelerator_type = "accelerator_type_value" + node.tensorflow_version = "tensorflow_version_value" + + request = tpu_v1.CreateNodeRequest( + parent="parent_value", + node=node, + ) + + # Make the request + operation = client.create_node(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + Args: request (Union[google.cloud.tpu_v1.types.CreateNodeRequest, dict]): The request object. Request for @@ -454,6 +521,29 @@ async def delete_node( ) -> operation_async.AsyncOperation: r"""Deletes a node. + .. code-block:: + + from google.cloud import tpu_v1 + + def sample_delete_node(): + # Create a client + client = tpu_v1.TpuClient() + + # Initialize request argument(s) + request = tpu_v1.DeleteNodeRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_node(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + Args: request (Union[google.cloud.tpu_v1.types.DeleteNodeRequest, dict]): The request object. Request for @@ -532,6 +622,28 @@ async def reimage_node( ) -> operation_async.AsyncOperation: r"""Reimages a node's OS. + .. code-block:: + + from google.cloud import tpu_v1 + + def sample_reimage_node(): + # Create a client + client = tpu_v1.TpuClient() + + # Initialize request argument(s) + request = tpu_v1.ReimageNodeRequest( + ) + + # Make the request + operation = client.reimage_node(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + Args: request (Union[google.cloud.tpu_v1.types.ReimageNodeRequest, dict]): The request object. Request for @@ -591,6 +703,28 @@ async def stop_node( ) -> operation_async.AsyncOperation: r"""Stops a node. + .. code-block:: + + from google.cloud import tpu_v1 + + def sample_stop_node(): + # Create a client + client = tpu_v1.TpuClient() + + # Initialize request argument(s) + request = tpu_v1.StopNodeRequest( + ) + + # Make the request + operation = client.stop_node(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + Args: request (Union[google.cloud.tpu_v1.types.StopNodeRequest, dict]): The request object. Request for @@ -650,6 +784,28 @@ async def start_node( ) -> operation_async.AsyncOperation: r"""Starts a node. + .. code-block:: + + from google.cloud import tpu_v1 + + def sample_start_node(): + # Create a client + client = tpu_v1.TpuClient() + + # Initialize request argument(s) + request = tpu_v1.StartNodeRequest( + ) + + # Make the request + operation = client.start_node(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + Args: request (Union[google.cloud.tpu_v1.types.StartNodeRequest, dict]): The request object. Request for @@ -710,6 +866,26 @@ async def list_tensor_flow_versions( ) -> pagers.ListTensorFlowVersionsAsyncPager: r"""List TensorFlow versions supported by this API. + .. code-block:: + + from google.cloud import tpu_v1 + + def sample_list_tensor_flow_versions(): + # Create a client + client = tpu_v1.TpuClient() + + # Initialize request argument(s) + request = tpu_v1.ListTensorFlowVersionsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_tensor_flow_versions(request=request) + + # Handle the response + for response in page_result: + print(response) + Args: request (Union[google.cloud.tpu_v1.types.ListTensorFlowVersionsRequest, dict]): The request object. Request for @@ -788,6 +964,25 @@ async def get_tensor_flow_version( ) -> cloud_tpu.TensorFlowVersion: r"""Gets TensorFlow Version. + .. code-block:: + + from google.cloud import tpu_v1 + + def sample_get_tensor_flow_version(): + # Create a client + client = tpu_v1.TpuClient() + + # Initialize request argument(s) + request = tpu_v1.GetTensorFlowVersionRequest( + name="name_value", + ) + + # Make the request + response = client.get_tensor_flow_version(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.tpu_v1.types.GetTensorFlowVersionRequest, dict]): The request object. Request for @@ -857,6 +1052,26 @@ async def list_accelerator_types( ) -> pagers.ListAcceleratorTypesAsyncPager: r"""Lists accelerator types supported by this API. + .. code-block:: + + from google.cloud import tpu_v1 + + def sample_list_accelerator_types(): + # Create a client + client = tpu_v1.TpuClient() + + # Initialize request argument(s) + request = tpu_v1.ListAcceleratorTypesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_accelerator_types(request=request) + + # Handle the response + for response in page_result: + print(response) + Args: request (Union[google.cloud.tpu_v1.types.ListAcceleratorTypesRequest, dict]): The request object. Request for @@ -935,6 +1150,25 @@ async def get_accelerator_type( ) -> cloud_tpu.AcceleratorType: r"""Gets AcceleratorType. + .. code-block:: + + from google.cloud import tpu_v1 + + def sample_get_accelerator_type(): + # Create a client + client = tpu_v1.TpuClient() + + # Initialize request argument(s) + request = tpu_v1.GetAcceleratorTypeRequest( + name="name_value", + ) + + # Make the request + response = client.get_accelerator_type(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.tpu_v1.types.GetAcceleratorTypeRequest, dict]): The request object. Request for diff --git a/google/cloud/tpu_v1/services/tpu/client.py b/google/cloud/tpu_v1/services/tpu/client.py index fc1be83..0c52858 100644 --- a/google/cloud/tpu_v1/services/tpu/client.py +++ b/google/cloud/tpu_v1/services/tpu/client.py @@ -449,6 +449,27 @@ def list_nodes( ) -> pagers.ListNodesPager: r"""Lists nodes. + + .. code-block:: + + from google.cloud import tpu_v1 + + def sample_list_nodes(): + # Create a client + client = tpu_v1.TpuClient() + + # Initialize request argument(s) + request = tpu_v1.ListNodesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_nodes(request=request) + + # Handle the response + for response in page_result: + print(response) + Args: request (Union[google.cloud.tpu_v1.types.ListNodesRequest, dict]): The request object. Request for @@ -527,6 +548,26 @@ def get_node( ) -> cloud_tpu.Node: r"""Gets the details of a node. + + .. code-block:: + + from google.cloud import tpu_v1 + + def sample_get_node(): + # Create a client + client = tpu_v1.TpuClient() + + # Initialize request argument(s) + request = tpu_v1.GetNodeRequest( + name="name_value", + ) + + # Make the request + response = client.get_node(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.tpu_v1.types.GetNodeRequest, dict]): The request object. Request for @@ -596,6 +637,35 @@ def create_node( ) -> operation.Operation: r"""Creates a node. + + .. code-block:: + + from google.cloud import tpu_v1 + + def sample_create_node(): + # Create a client + client = tpu_v1.TpuClient() + + # Initialize request argument(s) + node = tpu_v1.Node() + node.accelerator_type = "accelerator_type_value" + node.tensorflow_version = "tensorflow_version_value" + + request = tpu_v1.CreateNodeRequest( + parent="parent_value", + node=node, + ) + + # Make the request + operation = client.create_node(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + Args: request (Union[google.cloud.tpu_v1.types.CreateNodeRequest, dict]): The request object. Request for @@ -689,6 +759,30 @@ def delete_node( ) -> operation.Operation: r"""Deletes a node. + + .. code-block:: + + from google.cloud import tpu_v1 + + def sample_delete_node(): + # Create a client + client = tpu_v1.TpuClient() + + # Initialize request argument(s) + request = tpu_v1.DeleteNodeRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_node(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + Args: request (Union[google.cloud.tpu_v1.types.DeleteNodeRequest, dict]): The request object. Request for @@ -767,6 +861,29 @@ def reimage_node( ) -> operation.Operation: r"""Reimages a node's OS. + + .. code-block:: + + from google.cloud import tpu_v1 + + def sample_reimage_node(): + # Create a client + client = tpu_v1.TpuClient() + + # Initialize request argument(s) + request = tpu_v1.ReimageNodeRequest( + ) + + # Make the request + operation = client.reimage_node(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + Args: request (Union[google.cloud.tpu_v1.types.ReimageNodeRequest, dict]): The request object. Request for @@ -827,6 +944,29 @@ def stop_node( ) -> operation.Operation: r"""Stops a node. + + .. code-block:: + + from google.cloud import tpu_v1 + + def sample_stop_node(): + # Create a client + client = tpu_v1.TpuClient() + + # Initialize request argument(s) + request = tpu_v1.StopNodeRequest( + ) + + # Make the request + operation = client.stop_node(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + Args: request (Union[google.cloud.tpu_v1.types.StopNodeRequest, dict]): The request object. Request for @@ -887,6 +1027,29 @@ def start_node( ) -> operation.Operation: r"""Starts a node. + + .. code-block:: + + from google.cloud import tpu_v1 + + def sample_start_node(): + # Create a client + client = tpu_v1.TpuClient() + + # Initialize request argument(s) + request = tpu_v1.StartNodeRequest( + ) + + # Make the request + operation = client.start_node(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + Args: request (Union[google.cloud.tpu_v1.types.StartNodeRequest, dict]): The request object. Request for @@ -948,6 +1111,27 @@ def list_tensor_flow_versions( ) -> pagers.ListTensorFlowVersionsPager: r"""List TensorFlow versions supported by this API. + + .. code-block:: + + from google.cloud import tpu_v1 + + def sample_list_tensor_flow_versions(): + # Create a client + client = tpu_v1.TpuClient() + + # Initialize request argument(s) + request = tpu_v1.ListTensorFlowVersionsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_tensor_flow_versions(request=request) + + # Handle the response + for response in page_result: + print(response) + Args: request (Union[google.cloud.tpu_v1.types.ListTensorFlowVersionsRequest, dict]): The request object. Request for @@ -1028,6 +1212,26 @@ def get_tensor_flow_version( ) -> cloud_tpu.TensorFlowVersion: r"""Gets TensorFlow Version. + + .. code-block:: + + from google.cloud import tpu_v1 + + def sample_get_tensor_flow_version(): + # Create a client + client = tpu_v1.TpuClient() + + # Initialize request argument(s) + request = tpu_v1.GetTensorFlowVersionRequest( + name="name_value", + ) + + # Make the request + response = client.get_tensor_flow_version(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.tpu_v1.types.GetTensorFlowVersionRequest, dict]): The request object. Request for @@ -1097,6 +1301,27 @@ def list_accelerator_types( ) -> pagers.ListAcceleratorTypesPager: r"""Lists accelerator types supported by this API. + + .. code-block:: + + from google.cloud import tpu_v1 + + def sample_list_accelerator_types(): + # Create a client + client = tpu_v1.TpuClient() + + # Initialize request argument(s) + request = tpu_v1.ListAcceleratorTypesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_accelerator_types(request=request) + + # Handle the response + for response in page_result: + print(response) + Args: request (Union[google.cloud.tpu_v1.types.ListAcceleratorTypesRequest, dict]): The request object. Request for @@ -1175,6 +1400,26 @@ def get_accelerator_type( ) -> cloud_tpu.AcceleratorType: r"""Gets AcceleratorType. + + .. code-block:: + + from google.cloud import tpu_v1 + + def sample_get_accelerator_type(): + # Create a client + client = tpu_v1.TpuClient() + + # Initialize request argument(s) + request = tpu_v1.GetAcceleratorTypeRequest( + name="name_value", + ) + + # Make the request + response = client.get_accelerator_type(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.tpu_v1.types.GetAcceleratorTypeRequest, dict]): The request object. Request for diff --git a/google/cloud/tpu_v2alpha1/services/tpu/async_client.py b/google/cloud/tpu_v2alpha1/services/tpu/async_client.py index 5f8af1d..299e74e 100644 --- a/google/cloud/tpu_v2alpha1/services/tpu/async_client.py +++ b/google/cloud/tpu_v2alpha1/services/tpu/async_client.py @@ -213,6 +213,26 @@ async def list_nodes( ) -> pagers.ListNodesAsyncPager: r"""Lists nodes. + .. code-block:: + + from google.cloud import tpu_v2alpha1 + + def sample_list_nodes(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.ListNodesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_nodes(request=request) + + # Handle the response + for response in page_result: + print(response) + Args: request (Union[google.cloud.tpu_v2alpha1.types.ListNodesRequest, dict]): The request object. Request for @@ -291,6 +311,25 @@ async def get_node( ) -> cloud_tpu.Node: r"""Gets the details of a node. + .. code-block:: + + from google.cloud import tpu_v2alpha1 + + def sample_get_node(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.GetNodeRequest( + name="name_value", + ) + + # Make the request + response = client.get_node(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.tpu_v2alpha1.types.GetNodeRequest, dict]): The request object. Request for @@ -360,6 +399,34 @@ async def create_node( ) -> operation_async.AsyncOperation: r"""Creates a node. + .. code-block:: + + from google.cloud import tpu_v2alpha1 + + def sample_create_node(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + node = tpu_v2alpha1.Node() + node.accelerator_type = "accelerator_type_value" + node.runtime_version = "runtime_version_value" + + request = tpu_v2alpha1.CreateNodeRequest( + parent="parent_value", + node=node, + ) + + # Make the request + operation = client.create_node(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + Args: request (Union[google.cloud.tpu_v2alpha1.types.CreateNodeRequest, dict]): The request object. Request for @@ -454,6 +521,29 @@ async def delete_node( ) -> operation_async.AsyncOperation: r"""Deletes a node. + .. code-block:: + + from google.cloud import tpu_v2alpha1 + + def sample_delete_node(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.DeleteNodeRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_node(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + Args: request (Union[google.cloud.tpu_v2alpha1.types.DeleteNodeRequest, dict]): The request object. Request for @@ -534,6 +624,29 @@ async def stop_node( r"""Stops a node. This operation is only available with single TPU nodes. + + .. code-block:: + + from google.cloud import tpu_v2alpha1 + + def sample_stop_node(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.StopNodeRequest( + ) + + # Make the request + operation = client.stop_node(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + Args: request (Union[google.cloud.tpu_v2alpha1.types.StopNodeRequest, dict]): The request object. Request for @@ -594,6 +707,28 @@ async def start_node( ) -> operation_async.AsyncOperation: r"""Starts a node. + .. code-block:: + + from google.cloud import tpu_v2alpha1 + + def sample_start_node(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.StartNodeRequest( + ) + + # Make the request + operation = client.start_node(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + Args: request (Union[google.cloud.tpu_v2alpha1.types.StartNodeRequest, dict]): The request object. Request for @@ -656,6 +791,33 @@ async def update_node( ) -> operation_async.AsyncOperation: r"""Updates the configurations of a node. + .. code-block:: + + from google.cloud import tpu_v2alpha1 + + def sample_update_node(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + node = tpu_v2alpha1.Node() + node.accelerator_type = "accelerator_type_value" + node.runtime_version = "runtime_version_value" + + request = tpu_v2alpha1.UpdateNodeRequest( + node=node, + ) + + # Make the request + operation = client.update_node(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + Args: request (Union[google.cloud.tpu_v2alpha1.types.UpdateNodeRequest, dict]): The request object. Request for @@ -749,6 +911,26 @@ async def generate_service_identity( r"""Generates the Cloud TPU service identity for the project. + + .. code-block:: + + from google.cloud import tpu_v2alpha1 + + def sample_generate_service_identity(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.GenerateServiceIdentityRequest( + parent="parent_value", + ) + + # Make the request + response = client.generate_service_identity(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.tpu_v2alpha1.types.GenerateServiceIdentityRequest, dict]): The request object. Request for @@ -799,6 +981,26 @@ async def list_accelerator_types( ) -> pagers.ListAcceleratorTypesAsyncPager: r"""Lists accelerator types supported by this API. + .. code-block:: + + from google.cloud import tpu_v2alpha1 + + def sample_list_accelerator_types(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.ListAcceleratorTypesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_accelerator_types(request=request) + + # Handle the response + for response in page_result: + print(response) + Args: request (Union[google.cloud.tpu_v2alpha1.types.ListAcceleratorTypesRequest, dict]): The request object. Request for @@ -877,6 +1079,25 @@ async def get_accelerator_type( ) -> cloud_tpu.AcceleratorType: r"""Gets AcceleratorType. + .. code-block:: + + from google.cloud import tpu_v2alpha1 + + def sample_get_accelerator_type(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.GetAcceleratorTypeRequest( + name="name_value", + ) + + # Make the request + response = client.get_accelerator_type(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.tpu_v2alpha1.types.GetAcceleratorTypeRequest, dict]): The request object. Request for @@ -946,6 +1167,26 @@ async def list_runtime_versions( ) -> pagers.ListRuntimeVersionsAsyncPager: r"""Lists runtime versions supported by this API. + .. code-block:: + + from google.cloud import tpu_v2alpha1 + + def sample_list_runtime_versions(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.ListRuntimeVersionsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_runtime_versions(request=request) + + # Handle the response + for response in page_result: + print(response) + Args: request (Union[google.cloud.tpu_v2alpha1.types.ListRuntimeVersionsRequest, dict]): The request object. Request for @@ -1024,6 +1265,25 @@ async def get_runtime_version( ) -> cloud_tpu.RuntimeVersion: r"""Gets a runtime version. + .. code-block:: + + from google.cloud import tpu_v2alpha1 + + def sample_get_runtime_version(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.GetRuntimeVersionRequest( + name="name_value", + ) + + # Make the request + response = client.get_runtime_version(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.tpu_v2alpha1.types.GetRuntimeVersionRequest, dict]): The request object. Request for @@ -1092,6 +1352,25 @@ async def get_guest_attributes( ) -> cloud_tpu.GetGuestAttributesResponse: r"""Retrieves the guest attributes for the node. + .. code-block:: + + from google.cloud import tpu_v2alpha1 + + def sample_get_guest_attributes(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.GetGuestAttributesRequest( + name="name_value", + ) + + # Make the request + response = client.get_guest_attributes(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.tpu_v2alpha1.types.GetGuestAttributesRequest, dict]): The request object. Request for diff --git a/google/cloud/tpu_v2alpha1/services/tpu/client.py b/google/cloud/tpu_v2alpha1/services/tpu/client.py index 240aeb7..62d54bb 100644 --- a/google/cloud/tpu_v2alpha1/services/tpu/client.py +++ b/google/cloud/tpu_v2alpha1/services/tpu/client.py @@ -448,6 +448,27 @@ def list_nodes( ) -> pagers.ListNodesPager: r"""Lists nodes. + + .. code-block:: + + from google.cloud import tpu_v2alpha1 + + def sample_list_nodes(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.ListNodesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_nodes(request=request) + + # Handle the response + for response in page_result: + print(response) + Args: request (Union[google.cloud.tpu_v2alpha1.types.ListNodesRequest, dict]): The request object. Request for @@ -526,6 +547,26 @@ def get_node( ) -> cloud_tpu.Node: r"""Gets the details of a node. + + .. code-block:: + + from google.cloud import tpu_v2alpha1 + + def sample_get_node(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.GetNodeRequest( + name="name_value", + ) + + # Make the request + response = client.get_node(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.tpu_v2alpha1.types.GetNodeRequest, dict]): The request object. Request for @@ -595,6 +636,35 @@ def create_node( ) -> operation.Operation: r"""Creates a node. + + .. code-block:: + + from google.cloud import tpu_v2alpha1 + + def sample_create_node(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + node = tpu_v2alpha1.Node() + node.accelerator_type = "accelerator_type_value" + node.runtime_version = "runtime_version_value" + + request = tpu_v2alpha1.CreateNodeRequest( + parent="parent_value", + node=node, + ) + + # Make the request + operation = client.create_node(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + Args: request (Union[google.cloud.tpu_v2alpha1.types.CreateNodeRequest, dict]): The request object. Request for @@ -689,6 +759,30 @@ def delete_node( ) -> operation.Operation: r"""Deletes a node. + + .. code-block:: + + from google.cloud import tpu_v2alpha1 + + def sample_delete_node(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.DeleteNodeRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_node(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + Args: request (Union[google.cloud.tpu_v2alpha1.types.DeleteNodeRequest, dict]): The request object. Request for @@ -769,6 +863,30 @@ def stop_node( r"""Stops a node. This operation is only available with single TPU nodes. + + + .. code-block:: + + from google.cloud import tpu_v2alpha1 + + def sample_stop_node(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.StopNodeRequest( + ) + + # Make the request + operation = client.stop_node(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + Args: request (Union[google.cloud.tpu_v2alpha1.types.StopNodeRequest, dict]): The request object. Request for @@ -830,6 +948,29 @@ def start_node( ) -> operation.Operation: r"""Starts a node. + + .. code-block:: + + from google.cloud import tpu_v2alpha1 + + def sample_start_node(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.StartNodeRequest( + ) + + # Make the request + operation = client.start_node(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + Args: request (Union[google.cloud.tpu_v2alpha1.types.StartNodeRequest, dict]): The request object. Request for @@ -893,6 +1034,34 @@ def update_node( ) -> operation.Operation: r"""Updates the configurations of a node. + + .. code-block:: + + from google.cloud import tpu_v2alpha1 + + def sample_update_node(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + node = tpu_v2alpha1.Node() + node.accelerator_type = "accelerator_type_value" + node.runtime_version = "runtime_version_value" + + request = tpu_v2alpha1.UpdateNodeRequest( + node=node, + ) + + # Make the request + operation = client.update_node(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + Args: request (Union[google.cloud.tpu_v2alpha1.types.UpdateNodeRequest, dict]): The request object. Request for @@ -986,6 +1155,27 @@ def generate_service_identity( r"""Generates the Cloud TPU service identity for the project. + + + .. code-block:: + + from google.cloud import tpu_v2alpha1 + + def sample_generate_service_identity(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.GenerateServiceIdentityRequest( + parent="parent_value", + ) + + # Make the request + response = client.generate_service_identity(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.tpu_v2alpha1.types.GenerateServiceIdentityRequest, dict]): The request object. Request for @@ -1039,6 +1229,27 @@ def list_accelerator_types( ) -> pagers.ListAcceleratorTypesPager: r"""Lists accelerator types supported by this API. + + .. code-block:: + + from google.cloud import tpu_v2alpha1 + + def sample_list_accelerator_types(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.ListAcceleratorTypesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_accelerator_types(request=request) + + # Handle the response + for response in page_result: + print(response) + Args: request (Union[google.cloud.tpu_v2alpha1.types.ListAcceleratorTypesRequest, dict]): The request object. Request for @@ -1117,6 +1328,26 @@ def get_accelerator_type( ) -> cloud_tpu.AcceleratorType: r"""Gets AcceleratorType. + + .. code-block:: + + from google.cloud import tpu_v2alpha1 + + def sample_get_accelerator_type(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.GetAcceleratorTypeRequest( + name="name_value", + ) + + # Make the request + response = client.get_accelerator_type(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.tpu_v2alpha1.types.GetAcceleratorTypeRequest, dict]): The request object. Request for @@ -1186,6 +1417,27 @@ def list_runtime_versions( ) -> pagers.ListRuntimeVersionsPager: r"""Lists runtime versions supported by this API. + + .. code-block:: + + from google.cloud import tpu_v2alpha1 + + def sample_list_runtime_versions(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.ListRuntimeVersionsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_runtime_versions(request=request) + + # Handle the response + for response in page_result: + print(response) + Args: request (Union[google.cloud.tpu_v2alpha1.types.ListRuntimeVersionsRequest, dict]): The request object. Request for @@ -1264,6 +1516,26 @@ def get_runtime_version( ) -> cloud_tpu.RuntimeVersion: r"""Gets a runtime version. + + .. code-block:: + + from google.cloud import tpu_v2alpha1 + + def sample_get_runtime_version(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.GetRuntimeVersionRequest( + name="name_value", + ) + + # Make the request + response = client.get_runtime_version(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.tpu_v2alpha1.types.GetRuntimeVersionRequest, dict]): The request object. Request for @@ -1332,6 +1604,26 @@ def get_guest_attributes( ) -> cloud_tpu.GetGuestAttributesResponse: r"""Retrieves the guest attributes for the node. + + .. code-block:: + + from google.cloud import tpu_v2alpha1 + + def sample_get_guest_attributes(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.GetGuestAttributesRequest( + name="name_value", + ) + + # Make the request + response = client.get_guest_attributes(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.tpu_v2alpha1.types.GetGuestAttributesRequest, dict]): The request object. Request for diff --git a/samples/generated_samples/snippet_metadata_tpu_v1.json b/samples/generated_samples/snippet_metadata_tpu_v1.json new file mode 100644 index 0000000..db572e6 --- /dev/null +++ b/samples/generated_samples/snippet_metadata_tpu_v1.json @@ -0,0 +1,983 @@ +{ + "snippets": [ + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "CreateNode" + } + }, + "file": "tpu_generated_tpu_v1_tpu_create_node_async.py", + "regionTag": "tpu_generated_tpu_v1_Tpu_CreateNode_async", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "CreateNode" + } + }, + "file": "tpu_generated_tpu_v1_tpu_create_node_sync.py", + "regionTag": "tpu_generated_tpu_v1_Tpu_CreateNode_sync", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "DeleteNode" + } + }, + "file": "tpu_generated_tpu_v1_tpu_delete_node_async.py", + "regionTag": "tpu_generated_tpu_v1_Tpu_DeleteNode_async", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 45, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "start": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "DeleteNode" + } + }, + "file": "tpu_generated_tpu_v1_tpu_delete_node_sync.py", + "regionTag": "tpu_generated_tpu_v1_Tpu_DeleteNode_sync", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 45, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "start": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "GetAcceleratorType" + } + }, + "file": "tpu_generated_tpu_v1_tpu_get_accelerator_type_async.py", + "regionTag": "tpu_generated_tpu_v1_Tpu_GetAcceleratorType_async", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "GetAcceleratorType" + } + }, + "file": "tpu_generated_tpu_v1_tpu_get_accelerator_type_sync.py", + "regionTag": "tpu_generated_tpu_v1_Tpu_GetAcceleratorType_sync", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "GetNode" + } + }, + "file": "tpu_generated_tpu_v1_tpu_get_node_async.py", + "regionTag": "tpu_generated_tpu_v1_Tpu_GetNode_async", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "GetNode" + } + }, + "file": "tpu_generated_tpu_v1_tpu_get_node_sync.py", + "regionTag": "tpu_generated_tpu_v1_Tpu_GetNode_sync", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "GetTensorFlowVersion" + } + }, + "file": "tpu_generated_tpu_v1_tpu_get_tensor_flow_version_async.py", + "regionTag": "tpu_generated_tpu_v1_Tpu_GetTensorFlowVersion_async", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "GetTensorFlowVersion" + } + }, + "file": "tpu_generated_tpu_v1_tpu_get_tensor_flow_version_sync.py", + "regionTag": "tpu_generated_tpu_v1_Tpu_GetTensorFlowVersion_sync", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "ListAcceleratorTypes" + } + }, + "file": "tpu_generated_tpu_v1_tpu_list_accelerator_types_async.py", + "regionTag": "tpu_generated_tpu_v1_Tpu_ListAcceleratorTypes_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "ListAcceleratorTypes" + } + }, + "file": "tpu_generated_tpu_v1_tpu_list_accelerator_types_sync.py", + "regionTag": "tpu_generated_tpu_v1_Tpu_ListAcceleratorTypes_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "ListNodes" + } + }, + "file": "tpu_generated_tpu_v1_tpu_list_nodes_async.py", + "regionTag": "tpu_generated_tpu_v1_Tpu_ListNodes_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "ListNodes" + } + }, + "file": "tpu_generated_tpu_v1_tpu_list_nodes_sync.py", + "regionTag": "tpu_generated_tpu_v1_Tpu_ListNodes_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "ListTensorFlowVersions" + } + }, + "file": "tpu_generated_tpu_v1_tpu_list_tensor_flow_versions_async.py", + "regionTag": "tpu_generated_tpu_v1_Tpu_ListTensorFlowVersions_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "ListTensorFlowVersions" + } + }, + "file": "tpu_generated_tpu_v1_tpu_list_tensor_flow_versions_sync.py", + "regionTag": "tpu_generated_tpu_v1_Tpu_ListTensorFlowVersions_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "ReimageNode" + } + }, + "file": "tpu_generated_tpu_v1_tpu_reimage_node_async.py", + "regionTag": "tpu_generated_tpu_v1_Tpu_ReimageNode_async", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 44, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "start": 45, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "ReimageNode" + } + }, + "file": "tpu_generated_tpu_v1_tpu_reimage_node_sync.py", + "regionTag": "tpu_generated_tpu_v1_Tpu_ReimageNode_sync", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 44, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "start": 45, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "StartNode" + } + }, + "file": "tpu_generated_tpu_v1_tpu_start_node_async.py", + "regionTag": "tpu_generated_tpu_v1_Tpu_StartNode_async", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 44, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "start": 45, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "StartNode" + } + }, + "file": "tpu_generated_tpu_v1_tpu_start_node_sync.py", + "regionTag": "tpu_generated_tpu_v1_Tpu_StartNode_sync", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 44, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "start": 45, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "StopNode" + } + }, + "file": "tpu_generated_tpu_v1_tpu_stop_node_async.py", + "regionTag": "tpu_generated_tpu_v1_Tpu_StopNode_async", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 44, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "start": 45, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "StopNode" + } + }, + "file": "tpu_generated_tpu_v1_tpu_stop_node_sync.py", + "regionTag": "tpu_generated_tpu_v1_Tpu_StopNode_sync", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 44, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "start": 45, + "type": "RESPONSE_HANDLING" + } + ] + } + ] +} diff --git a/samples/generated_samples/snippet_metadata_tpu_v2alpha1.json b/samples/generated_samples/snippet_metadata_tpu_v2alpha1.json new file mode 100644 index 0000000..3d75482 --- /dev/null +++ b/samples/generated_samples/snippet_metadata_tpu_v2alpha1.json @@ -0,0 +1,1161 @@ +{ + "snippets": [ + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "CreateNode" + } + }, + "file": "tpu_generated_tpu_v2alpha1_tpu_create_node_async.py", + "regionTag": "tpu_generated_tpu_v2alpha1_Tpu_CreateNode_async", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "CreateNode" + } + }, + "file": "tpu_generated_tpu_v2alpha1_tpu_create_node_sync.py", + "regionTag": "tpu_generated_tpu_v2alpha1_Tpu_CreateNode_sync", + "segments": [ + { + "end": 53, + "start": 27, + "type": "FULL" + }, + { + "end": 53, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 50, + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 54, + "start": 51, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "DeleteNode" + } + }, + "file": "tpu_generated_tpu_v2alpha1_tpu_delete_node_async.py", + "regionTag": "tpu_generated_tpu_v2alpha1_Tpu_DeleteNode_async", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 45, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "start": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "DeleteNode" + } + }, + "file": "tpu_generated_tpu_v2alpha1_tpu_delete_node_sync.py", + "regionTag": "tpu_generated_tpu_v2alpha1_Tpu_DeleteNode_sync", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 45, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "start": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "GenerateServiceIdentity" + } + }, + "file": "tpu_generated_tpu_v2alpha1_tpu_generate_service_identity_async.py", + "regionTag": "tpu_generated_tpu_v2alpha1_Tpu_GenerateServiceIdentity_async", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "GenerateServiceIdentity" + } + }, + "file": "tpu_generated_tpu_v2alpha1_tpu_generate_service_identity_sync.py", + "regionTag": "tpu_generated_tpu_v2alpha1_Tpu_GenerateServiceIdentity_sync", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "GetAcceleratorType" + } + }, + "file": "tpu_generated_tpu_v2alpha1_tpu_get_accelerator_type_async.py", + "regionTag": "tpu_generated_tpu_v2alpha1_Tpu_GetAcceleratorType_async", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "GetAcceleratorType" + } + }, + "file": "tpu_generated_tpu_v2alpha1_tpu_get_accelerator_type_sync.py", + "regionTag": "tpu_generated_tpu_v2alpha1_Tpu_GetAcceleratorType_sync", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "GetGuestAttributes" + } + }, + "file": "tpu_generated_tpu_v2alpha1_tpu_get_guest_attributes_async.py", + "regionTag": "tpu_generated_tpu_v2alpha1_Tpu_GetGuestAttributes_async", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "GetGuestAttributes" + } + }, + "file": "tpu_generated_tpu_v2alpha1_tpu_get_guest_attributes_sync.py", + "regionTag": "tpu_generated_tpu_v2alpha1_Tpu_GetGuestAttributes_sync", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "GetNode" + } + }, + "file": "tpu_generated_tpu_v2alpha1_tpu_get_node_async.py", + "regionTag": "tpu_generated_tpu_v2alpha1_Tpu_GetNode_async", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "GetNode" + } + }, + "file": "tpu_generated_tpu_v2alpha1_tpu_get_node_sync.py", + "regionTag": "tpu_generated_tpu_v2alpha1_Tpu_GetNode_sync", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "GetRuntimeVersion" + } + }, + "file": "tpu_generated_tpu_v2alpha1_tpu_get_runtime_version_async.py", + "regionTag": "tpu_generated_tpu_v2alpha1_Tpu_GetRuntimeVersion_async", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "GetRuntimeVersion" + } + }, + "file": "tpu_generated_tpu_v2alpha1_tpu_get_runtime_version_sync.py", + "regionTag": "tpu_generated_tpu_v2alpha1_Tpu_GetRuntimeVersion_sync", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "ListAcceleratorTypes" + } + }, + "file": "tpu_generated_tpu_v2alpha1_tpu_list_accelerator_types_async.py", + "regionTag": "tpu_generated_tpu_v2alpha1_Tpu_ListAcceleratorTypes_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "ListAcceleratorTypes" + } + }, + "file": "tpu_generated_tpu_v2alpha1_tpu_list_accelerator_types_sync.py", + "regionTag": "tpu_generated_tpu_v2alpha1_Tpu_ListAcceleratorTypes_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "ListNodes" + } + }, + "file": "tpu_generated_tpu_v2alpha1_tpu_list_nodes_async.py", + "regionTag": "tpu_generated_tpu_v2alpha1_Tpu_ListNodes_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "ListNodes" + } + }, + "file": "tpu_generated_tpu_v2alpha1_tpu_list_nodes_sync.py", + "regionTag": "tpu_generated_tpu_v2alpha1_Tpu_ListNodes_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "ListRuntimeVersions" + } + }, + "file": "tpu_generated_tpu_v2alpha1_tpu_list_runtime_versions_async.py", + "regionTag": "tpu_generated_tpu_v2alpha1_Tpu_ListRuntimeVersions_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "ListRuntimeVersions" + } + }, + "file": "tpu_generated_tpu_v2alpha1_tpu_list_runtime_versions_sync.py", + "regionTag": "tpu_generated_tpu_v2alpha1_Tpu_ListRuntimeVersions_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "StartNode" + } + }, + "file": "tpu_generated_tpu_v2alpha1_tpu_start_node_async.py", + "regionTag": "tpu_generated_tpu_v2alpha1_Tpu_StartNode_async", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 44, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "start": 45, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "StartNode" + } + }, + "file": "tpu_generated_tpu_v2alpha1_tpu_start_node_sync.py", + "regionTag": "tpu_generated_tpu_v2alpha1_Tpu_StartNode_sync", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 44, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "start": 45, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "StopNode" + } + }, + "file": "tpu_generated_tpu_v2alpha1_tpu_stop_node_async.py", + "regionTag": "tpu_generated_tpu_v2alpha1_Tpu_StopNode_async", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 44, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "start": 45, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "StopNode" + } + }, + "file": "tpu_generated_tpu_v2alpha1_tpu_stop_node_sync.py", + "regionTag": "tpu_generated_tpu_v2alpha1_Tpu_StopNode_sync", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 44, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "start": 45, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "UpdateNode" + } + }, + "file": "tpu_generated_tpu_v2alpha1_tpu_update_node_async.py", + "regionTag": "tpu_generated_tpu_v2alpha1_Tpu_UpdateNode_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 49, + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 50, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "Tpu" + }, + "shortName": "UpdateNode" + } + }, + "file": "tpu_generated_tpu_v2alpha1_tpu_update_node_sync.py", + "regionTag": "tpu_generated_tpu_v2alpha1_Tpu_UpdateNode_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 49, + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 50, + "type": "RESPONSE_HANDLING" + } + ] + } + ] +} diff --git a/samples/generated_samples/tpu_generated_tpu_v1_tpu_create_node_async.py b/samples/generated_samples/tpu_generated_tpu_v1_tpu_create_node_async.py new file mode 100644 index 0000000..1fd45c7 --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v1_tpu_create_node_async.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateNode +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v1_Tpu_CreateNode_async] +from google.cloud import tpu_v1 + + +async def sample_create_node(): + # Create a client + client = tpu_v1.TpuAsyncClient() + + # Initialize request argument(s) + node = tpu_v1.Node() + node.accelerator_type = "accelerator_type_value" + node.tensorflow_version = "tensorflow_version_value" + + request = tpu_v1.CreateNodeRequest( + parent="parent_value", + node=node, + ) + + # Make the request + operation = client.create_node(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END tpu_generated_tpu_v1_Tpu_CreateNode_async] diff --git a/samples/generated_samples/tpu_generated_tpu_v1_tpu_create_node_sync.py b/samples/generated_samples/tpu_generated_tpu_v1_tpu_create_node_sync.py new file mode 100644 index 0000000..2ed4927 --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v1_tpu_create_node_sync.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateNode +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v1_Tpu_CreateNode_sync] +from google.cloud import tpu_v1 + + +def sample_create_node(): + # Create a client + client = tpu_v1.TpuClient() + + # Initialize request argument(s) + node = tpu_v1.Node() + node.accelerator_type = "accelerator_type_value" + node.tensorflow_version = "tensorflow_version_value" + + request = tpu_v1.CreateNodeRequest( + parent="parent_value", + node=node, + ) + + # Make the request + operation = client.create_node(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END tpu_generated_tpu_v1_Tpu_CreateNode_sync] diff --git a/samples/generated_samples/tpu_generated_tpu_v1_tpu_delete_node_async.py b/samples/generated_samples/tpu_generated_tpu_v1_tpu_delete_node_async.py new file mode 100644 index 0000000..ee6383a --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v1_tpu_delete_node_async.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteNode +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v1_Tpu_DeleteNode_async] +from google.cloud import tpu_v1 + + +async def sample_delete_node(): + # Create a client + client = tpu_v1.TpuAsyncClient() + + # Initialize request argument(s) + request = tpu_v1.DeleteNodeRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_node(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END tpu_generated_tpu_v1_Tpu_DeleteNode_async] diff --git a/samples/generated_samples/tpu_generated_tpu_v1_tpu_delete_node_sync.py b/samples/generated_samples/tpu_generated_tpu_v1_tpu_delete_node_sync.py new file mode 100644 index 0000000..e5472bd --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v1_tpu_delete_node_sync.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteNode +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v1_Tpu_DeleteNode_sync] +from google.cloud import tpu_v1 + + +def sample_delete_node(): + # Create a client + client = tpu_v1.TpuClient() + + # Initialize request argument(s) + request = tpu_v1.DeleteNodeRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_node(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END tpu_generated_tpu_v1_Tpu_DeleteNode_sync] diff --git a/samples/generated_samples/tpu_generated_tpu_v1_tpu_get_accelerator_type_async.py b/samples/generated_samples/tpu_generated_tpu_v1_tpu_get_accelerator_type_async.py new file mode 100644 index 0000000..cf90cbe --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v1_tpu_get_accelerator_type_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetAcceleratorType +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v1_Tpu_GetAcceleratorType_async] +from google.cloud import tpu_v1 + + +async def sample_get_accelerator_type(): + # Create a client + client = tpu_v1.TpuAsyncClient() + + # Initialize request argument(s) + request = tpu_v1.GetAcceleratorTypeRequest( + name="name_value", + ) + + # Make the request + response = await client.get_accelerator_type(request=request) + + # Handle the response + print(response) + +# [END tpu_generated_tpu_v1_Tpu_GetAcceleratorType_async] diff --git a/samples/generated_samples/tpu_generated_tpu_v1_tpu_get_accelerator_type_sync.py b/samples/generated_samples/tpu_generated_tpu_v1_tpu_get_accelerator_type_sync.py new file mode 100644 index 0000000..c8d25da --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v1_tpu_get_accelerator_type_sync.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetAcceleratorType +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v1_Tpu_GetAcceleratorType_sync] +from google.cloud import tpu_v1 + + +def sample_get_accelerator_type(): + # Create a client + client = tpu_v1.TpuClient() + + # Initialize request argument(s) + request = tpu_v1.GetAcceleratorTypeRequest( + name="name_value", + ) + + # Make the request + response = client.get_accelerator_type(request=request) + + # Handle the response + print(response) + +# [END tpu_generated_tpu_v1_Tpu_GetAcceleratorType_sync] diff --git a/samples/generated_samples/tpu_generated_tpu_v1_tpu_get_node_async.py b/samples/generated_samples/tpu_generated_tpu_v1_tpu_get_node_async.py new file mode 100644 index 0000000..e9ed972 --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v1_tpu_get_node_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetNode +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v1_Tpu_GetNode_async] +from google.cloud import tpu_v1 + + +async def sample_get_node(): + # Create a client + client = tpu_v1.TpuAsyncClient() + + # Initialize request argument(s) + request = tpu_v1.GetNodeRequest( + name="name_value", + ) + + # Make the request + response = await client.get_node(request=request) + + # Handle the response + print(response) + +# [END tpu_generated_tpu_v1_Tpu_GetNode_async] diff --git a/samples/generated_samples/tpu_generated_tpu_v1_tpu_get_node_sync.py b/samples/generated_samples/tpu_generated_tpu_v1_tpu_get_node_sync.py new file mode 100644 index 0000000..440d4c9 --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v1_tpu_get_node_sync.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetNode +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v1_Tpu_GetNode_sync] +from google.cloud import tpu_v1 + + +def sample_get_node(): + # Create a client + client = tpu_v1.TpuClient() + + # Initialize request argument(s) + request = tpu_v1.GetNodeRequest( + name="name_value", + ) + + # Make the request + response = client.get_node(request=request) + + # Handle the response + print(response) + +# [END tpu_generated_tpu_v1_Tpu_GetNode_sync] diff --git a/samples/generated_samples/tpu_generated_tpu_v1_tpu_get_tensor_flow_version_async.py b/samples/generated_samples/tpu_generated_tpu_v1_tpu_get_tensor_flow_version_async.py new file mode 100644 index 0000000..489323b --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v1_tpu_get_tensor_flow_version_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetTensorFlowVersion +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v1_Tpu_GetTensorFlowVersion_async] +from google.cloud import tpu_v1 + + +async def sample_get_tensor_flow_version(): + # Create a client + client = tpu_v1.TpuAsyncClient() + + # Initialize request argument(s) + request = tpu_v1.GetTensorFlowVersionRequest( + name="name_value", + ) + + # Make the request + response = await client.get_tensor_flow_version(request=request) + + # Handle the response + print(response) + +# [END tpu_generated_tpu_v1_Tpu_GetTensorFlowVersion_async] diff --git a/samples/generated_samples/tpu_generated_tpu_v1_tpu_get_tensor_flow_version_sync.py b/samples/generated_samples/tpu_generated_tpu_v1_tpu_get_tensor_flow_version_sync.py new file mode 100644 index 0000000..fb58539 --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v1_tpu_get_tensor_flow_version_sync.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetTensorFlowVersion +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v1_Tpu_GetTensorFlowVersion_sync] +from google.cloud import tpu_v1 + + +def sample_get_tensor_flow_version(): + # Create a client + client = tpu_v1.TpuClient() + + # Initialize request argument(s) + request = tpu_v1.GetTensorFlowVersionRequest( + name="name_value", + ) + + # Make the request + response = client.get_tensor_flow_version(request=request) + + # Handle the response + print(response) + +# [END tpu_generated_tpu_v1_Tpu_GetTensorFlowVersion_sync] diff --git a/samples/generated_samples/tpu_generated_tpu_v1_tpu_list_accelerator_types_async.py b/samples/generated_samples/tpu_generated_tpu_v1_tpu_list_accelerator_types_async.py new file mode 100644 index 0000000..d726561 --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v1_tpu_list_accelerator_types_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListAcceleratorTypes +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v1_Tpu_ListAcceleratorTypes_async] +from google.cloud import tpu_v1 + + +async def sample_list_accelerator_types(): + # Create a client + client = tpu_v1.TpuAsyncClient() + + # Initialize request argument(s) + request = tpu_v1.ListAcceleratorTypesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_accelerator_types(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END tpu_generated_tpu_v1_Tpu_ListAcceleratorTypes_async] diff --git a/samples/generated_samples/tpu_generated_tpu_v1_tpu_list_accelerator_types_sync.py b/samples/generated_samples/tpu_generated_tpu_v1_tpu_list_accelerator_types_sync.py new file mode 100644 index 0000000..3b60857 --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v1_tpu_list_accelerator_types_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListAcceleratorTypes +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v1_Tpu_ListAcceleratorTypes_sync] +from google.cloud import tpu_v1 + + +def sample_list_accelerator_types(): + # Create a client + client = tpu_v1.TpuClient() + + # Initialize request argument(s) + request = tpu_v1.ListAcceleratorTypesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_accelerator_types(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END tpu_generated_tpu_v1_Tpu_ListAcceleratorTypes_sync] diff --git a/samples/generated_samples/tpu_generated_tpu_v1_tpu_list_nodes_async.py b/samples/generated_samples/tpu_generated_tpu_v1_tpu_list_nodes_async.py new file mode 100644 index 0000000..c3c5927 --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v1_tpu_list_nodes_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListNodes +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v1_Tpu_ListNodes_async] +from google.cloud import tpu_v1 + + +async def sample_list_nodes(): + # Create a client + client = tpu_v1.TpuAsyncClient() + + # Initialize request argument(s) + request = tpu_v1.ListNodesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_nodes(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END tpu_generated_tpu_v1_Tpu_ListNodes_async] diff --git a/samples/generated_samples/tpu_generated_tpu_v1_tpu_list_nodes_sync.py b/samples/generated_samples/tpu_generated_tpu_v1_tpu_list_nodes_sync.py new file mode 100644 index 0000000..fc2b66d --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v1_tpu_list_nodes_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListNodes +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v1_Tpu_ListNodes_sync] +from google.cloud import tpu_v1 + + +def sample_list_nodes(): + # Create a client + client = tpu_v1.TpuClient() + + # Initialize request argument(s) + request = tpu_v1.ListNodesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_nodes(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END tpu_generated_tpu_v1_Tpu_ListNodes_sync] diff --git a/samples/generated_samples/tpu_generated_tpu_v1_tpu_list_tensor_flow_versions_async.py b/samples/generated_samples/tpu_generated_tpu_v1_tpu_list_tensor_flow_versions_async.py new file mode 100644 index 0000000..9fdabc4 --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v1_tpu_list_tensor_flow_versions_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListTensorFlowVersions +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v1_Tpu_ListTensorFlowVersions_async] +from google.cloud import tpu_v1 + + +async def sample_list_tensor_flow_versions(): + # Create a client + client = tpu_v1.TpuAsyncClient() + + # Initialize request argument(s) + request = tpu_v1.ListTensorFlowVersionsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_tensor_flow_versions(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END tpu_generated_tpu_v1_Tpu_ListTensorFlowVersions_async] diff --git a/samples/generated_samples/tpu_generated_tpu_v1_tpu_list_tensor_flow_versions_sync.py b/samples/generated_samples/tpu_generated_tpu_v1_tpu_list_tensor_flow_versions_sync.py new file mode 100644 index 0000000..f4a3333 --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v1_tpu_list_tensor_flow_versions_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListTensorFlowVersions +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v1_Tpu_ListTensorFlowVersions_sync] +from google.cloud import tpu_v1 + + +def sample_list_tensor_flow_versions(): + # Create a client + client = tpu_v1.TpuClient() + + # Initialize request argument(s) + request = tpu_v1.ListTensorFlowVersionsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_tensor_flow_versions(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END tpu_generated_tpu_v1_Tpu_ListTensorFlowVersions_sync] diff --git a/samples/generated_samples/tpu_generated_tpu_v1_tpu_reimage_node_async.py b/samples/generated_samples/tpu_generated_tpu_v1_tpu_reimage_node_async.py new file mode 100644 index 0000000..0b1190c --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v1_tpu_reimage_node_async.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ReimageNode +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v1_Tpu_ReimageNode_async] +from google.cloud import tpu_v1 + + +async def sample_reimage_node(): + # Create a client + client = tpu_v1.TpuAsyncClient() + + # Initialize request argument(s) + request = tpu_v1.ReimageNodeRequest( + ) + + # Make the request + operation = client.reimage_node(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END tpu_generated_tpu_v1_Tpu_ReimageNode_async] diff --git a/samples/generated_samples/tpu_generated_tpu_v1_tpu_reimage_node_sync.py b/samples/generated_samples/tpu_generated_tpu_v1_tpu_reimage_node_sync.py new file mode 100644 index 0000000..1ddcda3 --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v1_tpu_reimage_node_sync.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ReimageNode +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v1_Tpu_ReimageNode_sync] +from google.cloud import tpu_v1 + + +def sample_reimage_node(): + # Create a client + client = tpu_v1.TpuClient() + + # Initialize request argument(s) + request = tpu_v1.ReimageNodeRequest( + ) + + # Make the request + operation = client.reimage_node(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END tpu_generated_tpu_v1_Tpu_ReimageNode_sync] diff --git a/samples/generated_samples/tpu_generated_tpu_v1_tpu_start_node_async.py b/samples/generated_samples/tpu_generated_tpu_v1_tpu_start_node_async.py new file mode 100644 index 0000000..1bd7637 --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v1_tpu_start_node_async.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for StartNode +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v1_Tpu_StartNode_async] +from google.cloud import tpu_v1 + + +async def sample_start_node(): + # Create a client + client = tpu_v1.TpuAsyncClient() + + # Initialize request argument(s) + request = tpu_v1.StartNodeRequest( + ) + + # Make the request + operation = client.start_node(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END tpu_generated_tpu_v1_Tpu_StartNode_async] diff --git a/samples/generated_samples/tpu_generated_tpu_v1_tpu_start_node_sync.py b/samples/generated_samples/tpu_generated_tpu_v1_tpu_start_node_sync.py new file mode 100644 index 0000000..e781ca3 --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v1_tpu_start_node_sync.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for StartNode +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v1_Tpu_StartNode_sync] +from google.cloud import tpu_v1 + + +def sample_start_node(): + # Create a client + client = tpu_v1.TpuClient() + + # Initialize request argument(s) + request = tpu_v1.StartNodeRequest( + ) + + # Make the request + operation = client.start_node(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END tpu_generated_tpu_v1_Tpu_StartNode_sync] diff --git a/samples/generated_samples/tpu_generated_tpu_v1_tpu_stop_node_async.py b/samples/generated_samples/tpu_generated_tpu_v1_tpu_stop_node_async.py new file mode 100644 index 0000000..16046a7 --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v1_tpu_stop_node_async.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for StopNode +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v1_Tpu_StopNode_async] +from google.cloud import tpu_v1 + + +async def sample_stop_node(): + # Create a client + client = tpu_v1.TpuAsyncClient() + + # Initialize request argument(s) + request = tpu_v1.StopNodeRequest( + ) + + # Make the request + operation = client.stop_node(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END tpu_generated_tpu_v1_Tpu_StopNode_async] diff --git a/samples/generated_samples/tpu_generated_tpu_v1_tpu_stop_node_sync.py b/samples/generated_samples/tpu_generated_tpu_v1_tpu_stop_node_sync.py new file mode 100644 index 0000000..977cf73 --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v1_tpu_stop_node_sync.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for StopNode +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v1_Tpu_StopNode_sync] +from google.cloud import tpu_v1 + + +def sample_stop_node(): + # Create a client + client = tpu_v1.TpuClient() + + # Initialize request argument(s) + request = tpu_v1.StopNodeRequest( + ) + + # Make the request + operation = client.stop_node(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END tpu_generated_tpu_v1_Tpu_StopNode_sync] diff --git a/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_create_node_async.py b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_create_node_async.py new file mode 100644 index 0000000..2ba3bf0 --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_create_node_async.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateNode +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v2alpha1_Tpu_CreateNode_async] +from google.cloud import tpu_v2alpha1 + + +async def sample_create_node(): + # Create a client + client = tpu_v2alpha1.TpuAsyncClient() + + # Initialize request argument(s) + node = tpu_v2alpha1.Node() + node.accelerator_type = "accelerator_type_value" + node.runtime_version = "runtime_version_value" + + request = tpu_v2alpha1.CreateNodeRequest( + parent="parent_value", + node=node, + ) + + # Make the request + operation = client.create_node(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END tpu_generated_tpu_v2alpha1_Tpu_CreateNode_async] diff --git a/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_create_node_sync.py b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_create_node_sync.py new file mode 100644 index 0000000..6d996ea --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_create_node_sync.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateNode +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v2alpha1_Tpu_CreateNode_sync] +from google.cloud import tpu_v2alpha1 + + +def sample_create_node(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + node = tpu_v2alpha1.Node() + node.accelerator_type = "accelerator_type_value" + node.runtime_version = "runtime_version_value" + + request = tpu_v2alpha1.CreateNodeRequest( + parent="parent_value", + node=node, + ) + + # Make the request + operation = client.create_node(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END tpu_generated_tpu_v2alpha1_Tpu_CreateNode_sync] diff --git a/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_delete_node_async.py b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_delete_node_async.py new file mode 100644 index 0000000..53547e0 --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_delete_node_async.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteNode +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v2alpha1_Tpu_DeleteNode_async] +from google.cloud import tpu_v2alpha1 + + +async def sample_delete_node(): + # Create a client + client = tpu_v2alpha1.TpuAsyncClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.DeleteNodeRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_node(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END tpu_generated_tpu_v2alpha1_Tpu_DeleteNode_async] diff --git a/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_delete_node_sync.py b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_delete_node_sync.py new file mode 100644 index 0000000..5987aff --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_delete_node_sync.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteNode +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v2alpha1_Tpu_DeleteNode_sync] +from google.cloud import tpu_v2alpha1 + + +def sample_delete_node(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.DeleteNodeRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_node(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END tpu_generated_tpu_v2alpha1_Tpu_DeleteNode_sync] diff --git a/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_generate_service_identity_async.py b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_generate_service_identity_async.py new file mode 100644 index 0000000..bc0a410 --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_generate_service_identity_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GenerateServiceIdentity +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v2alpha1_Tpu_GenerateServiceIdentity_async] +from google.cloud import tpu_v2alpha1 + + +async def sample_generate_service_identity(): + # Create a client + client = tpu_v2alpha1.TpuAsyncClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.GenerateServiceIdentityRequest( + parent="parent_value", + ) + + # Make the request + response = await client.generate_service_identity(request=request) + + # Handle the response + print(response) + +# [END tpu_generated_tpu_v2alpha1_Tpu_GenerateServiceIdentity_async] diff --git a/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_generate_service_identity_sync.py b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_generate_service_identity_sync.py new file mode 100644 index 0000000..79c6413 --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_generate_service_identity_sync.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GenerateServiceIdentity +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v2alpha1_Tpu_GenerateServiceIdentity_sync] +from google.cloud import tpu_v2alpha1 + + +def sample_generate_service_identity(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.GenerateServiceIdentityRequest( + parent="parent_value", + ) + + # Make the request + response = client.generate_service_identity(request=request) + + # Handle the response + print(response) + +# [END tpu_generated_tpu_v2alpha1_Tpu_GenerateServiceIdentity_sync] diff --git a/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_get_accelerator_type_async.py b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_get_accelerator_type_async.py new file mode 100644 index 0000000..9259606 --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_get_accelerator_type_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetAcceleratorType +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v2alpha1_Tpu_GetAcceleratorType_async] +from google.cloud import tpu_v2alpha1 + + +async def sample_get_accelerator_type(): + # Create a client + client = tpu_v2alpha1.TpuAsyncClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.GetAcceleratorTypeRequest( + name="name_value", + ) + + # Make the request + response = await client.get_accelerator_type(request=request) + + # Handle the response + print(response) + +# [END tpu_generated_tpu_v2alpha1_Tpu_GetAcceleratorType_async] diff --git a/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_get_accelerator_type_sync.py b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_get_accelerator_type_sync.py new file mode 100644 index 0000000..c1c671d --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_get_accelerator_type_sync.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetAcceleratorType +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v2alpha1_Tpu_GetAcceleratorType_sync] +from google.cloud import tpu_v2alpha1 + + +def sample_get_accelerator_type(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.GetAcceleratorTypeRequest( + name="name_value", + ) + + # Make the request + response = client.get_accelerator_type(request=request) + + # Handle the response + print(response) + +# [END tpu_generated_tpu_v2alpha1_Tpu_GetAcceleratorType_sync] diff --git a/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_get_guest_attributes_async.py b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_get_guest_attributes_async.py new file mode 100644 index 0000000..be0b15c --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_get_guest_attributes_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetGuestAttributes +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v2alpha1_Tpu_GetGuestAttributes_async] +from google.cloud import tpu_v2alpha1 + + +async def sample_get_guest_attributes(): + # Create a client + client = tpu_v2alpha1.TpuAsyncClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.GetGuestAttributesRequest( + name="name_value", + ) + + # Make the request + response = await client.get_guest_attributes(request=request) + + # Handle the response + print(response) + +# [END tpu_generated_tpu_v2alpha1_Tpu_GetGuestAttributes_async] diff --git a/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_get_guest_attributes_sync.py b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_get_guest_attributes_sync.py new file mode 100644 index 0000000..bd67ba3 --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_get_guest_attributes_sync.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetGuestAttributes +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v2alpha1_Tpu_GetGuestAttributes_sync] +from google.cloud import tpu_v2alpha1 + + +def sample_get_guest_attributes(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.GetGuestAttributesRequest( + name="name_value", + ) + + # Make the request + response = client.get_guest_attributes(request=request) + + # Handle the response + print(response) + +# [END tpu_generated_tpu_v2alpha1_Tpu_GetGuestAttributes_sync] diff --git a/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_get_node_async.py b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_get_node_async.py new file mode 100644 index 0000000..70d2162 --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_get_node_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetNode +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v2alpha1_Tpu_GetNode_async] +from google.cloud import tpu_v2alpha1 + + +async def sample_get_node(): + # Create a client + client = tpu_v2alpha1.TpuAsyncClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.GetNodeRequest( + name="name_value", + ) + + # Make the request + response = await client.get_node(request=request) + + # Handle the response + print(response) + +# [END tpu_generated_tpu_v2alpha1_Tpu_GetNode_async] diff --git a/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_get_node_sync.py b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_get_node_sync.py new file mode 100644 index 0000000..46cdfa9 --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_get_node_sync.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetNode +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v2alpha1_Tpu_GetNode_sync] +from google.cloud import tpu_v2alpha1 + + +def sample_get_node(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.GetNodeRequest( + name="name_value", + ) + + # Make the request + response = client.get_node(request=request) + + # Handle the response + print(response) + +# [END tpu_generated_tpu_v2alpha1_Tpu_GetNode_sync] diff --git a/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_get_runtime_version_async.py b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_get_runtime_version_async.py new file mode 100644 index 0000000..b624fb6 --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_get_runtime_version_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetRuntimeVersion +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v2alpha1_Tpu_GetRuntimeVersion_async] +from google.cloud import tpu_v2alpha1 + + +async def sample_get_runtime_version(): + # Create a client + client = tpu_v2alpha1.TpuAsyncClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.GetRuntimeVersionRequest( + name="name_value", + ) + + # Make the request + response = await client.get_runtime_version(request=request) + + # Handle the response + print(response) + +# [END tpu_generated_tpu_v2alpha1_Tpu_GetRuntimeVersion_async] diff --git a/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_get_runtime_version_sync.py b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_get_runtime_version_sync.py new file mode 100644 index 0000000..03a69a5 --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_get_runtime_version_sync.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetRuntimeVersion +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v2alpha1_Tpu_GetRuntimeVersion_sync] +from google.cloud import tpu_v2alpha1 + + +def sample_get_runtime_version(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.GetRuntimeVersionRequest( + name="name_value", + ) + + # Make the request + response = client.get_runtime_version(request=request) + + # Handle the response + print(response) + +# [END tpu_generated_tpu_v2alpha1_Tpu_GetRuntimeVersion_sync] diff --git a/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_list_accelerator_types_async.py b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_list_accelerator_types_async.py new file mode 100644 index 0000000..88593f5 --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_list_accelerator_types_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListAcceleratorTypes +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v2alpha1_Tpu_ListAcceleratorTypes_async] +from google.cloud import tpu_v2alpha1 + + +async def sample_list_accelerator_types(): + # Create a client + client = tpu_v2alpha1.TpuAsyncClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.ListAcceleratorTypesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_accelerator_types(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END tpu_generated_tpu_v2alpha1_Tpu_ListAcceleratorTypes_async] diff --git a/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_list_accelerator_types_sync.py b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_list_accelerator_types_sync.py new file mode 100644 index 0000000..eaee6bf --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_list_accelerator_types_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListAcceleratorTypes +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v2alpha1_Tpu_ListAcceleratorTypes_sync] +from google.cloud import tpu_v2alpha1 + + +def sample_list_accelerator_types(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.ListAcceleratorTypesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_accelerator_types(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END tpu_generated_tpu_v2alpha1_Tpu_ListAcceleratorTypes_sync] diff --git a/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_list_nodes_async.py b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_list_nodes_async.py new file mode 100644 index 0000000..1a9f75c --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_list_nodes_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListNodes +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v2alpha1_Tpu_ListNodes_async] +from google.cloud import tpu_v2alpha1 + + +async def sample_list_nodes(): + # Create a client + client = tpu_v2alpha1.TpuAsyncClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.ListNodesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_nodes(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END tpu_generated_tpu_v2alpha1_Tpu_ListNodes_async] diff --git a/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_list_nodes_sync.py b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_list_nodes_sync.py new file mode 100644 index 0000000..e152cb8 --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_list_nodes_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListNodes +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v2alpha1_Tpu_ListNodes_sync] +from google.cloud import tpu_v2alpha1 + + +def sample_list_nodes(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.ListNodesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_nodes(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END tpu_generated_tpu_v2alpha1_Tpu_ListNodes_sync] diff --git a/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_list_runtime_versions_async.py b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_list_runtime_versions_async.py new file mode 100644 index 0000000..c6e73ad --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_list_runtime_versions_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListRuntimeVersions +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v2alpha1_Tpu_ListRuntimeVersions_async] +from google.cloud import tpu_v2alpha1 + + +async def sample_list_runtime_versions(): + # Create a client + client = tpu_v2alpha1.TpuAsyncClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.ListRuntimeVersionsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_runtime_versions(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END tpu_generated_tpu_v2alpha1_Tpu_ListRuntimeVersions_async] diff --git a/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_list_runtime_versions_sync.py b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_list_runtime_versions_sync.py new file mode 100644 index 0000000..fc2c73b --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_list_runtime_versions_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListRuntimeVersions +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v2alpha1_Tpu_ListRuntimeVersions_sync] +from google.cloud import tpu_v2alpha1 + + +def sample_list_runtime_versions(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.ListRuntimeVersionsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_runtime_versions(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END tpu_generated_tpu_v2alpha1_Tpu_ListRuntimeVersions_sync] diff --git a/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_start_node_async.py b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_start_node_async.py new file mode 100644 index 0000000..8405dea --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_start_node_async.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for StartNode +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v2alpha1_Tpu_StartNode_async] +from google.cloud import tpu_v2alpha1 + + +async def sample_start_node(): + # Create a client + client = tpu_v2alpha1.TpuAsyncClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.StartNodeRequest( + ) + + # Make the request + operation = client.start_node(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END tpu_generated_tpu_v2alpha1_Tpu_StartNode_async] diff --git a/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_start_node_sync.py b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_start_node_sync.py new file mode 100644 index 0000000..44aa583 --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_start_node_sync.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for StartNode +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v2alpha1_Tpu_StartNode_sync] +from google.cloud import tpu_v2alpha1 + + +def sample_start_node(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.StartNodeRequest( + ) + + # Make the request + operation = client.start_node(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END tpu_generated_tpu_v2alpha1_Tpu_StartNode_sync] diff --git a/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_stop_node_async.py b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_stop_node_async.py new file mode 100644 index 0000000..e1c0d2e --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_stop_node_async.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for StopNode +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v2alpha1_Tpu_StopNode_async] +from google.cloud import tpu_v2alpha1 + + +async def sample_stop_node(): + # Create a client + client = tpu_v2alpha1.TpuAsyncClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.StopNodeRequest( + ) + + # Make the request + operation = client.stop_node(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END tpu_generated_tpu_v2alpha1_Tpu_StopNode_async] diff --git a/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_stop_node_sync.py b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_stop_node_sync.py new file mode 100644 index 0000000..199c1fa --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_stop_node_sync.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for StopNode +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v2alpha1_Tpu_StopNode_sync] +from google.cloud import tpu_v2alpha1 + + +def sample_stop_node(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + request = tpu_v2alpha1.StopNodeRequest( + ) + + # Make the request + operation = client.stop_node(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END tpu_generated_tpu_v2alpha1_Tpu_StopNode_sync] diff --git a/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_update_node_async.py b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_update_node_async.py new file mode 100644 index 0000000..3541aff --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_update_node_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateNode +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v2alpha1_Tpu_UpdateNode_async] +from google.cloud import tpu_v2alpha1 + + +async def sample_update_node(): + # Create a client + client = tpu_v2alpha1.TpuAsyncClient() + + # Initialize request argument(s) + node = tpu_v2alpha1.Node() + node.accelerator_type = "accelerator_type_value" + node.runtime_version = "runtime_version_value" + + request = tpu_v2alpha1.UpdateNodeRequest( + node=node, + ) + + # Make the request + operation = client.update_node(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END tpu_generated_tpu_v2alpha1_Tpu_UpdateNode_async] diff --git a/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_update_node_sync.py b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_update_node_sync.py new file mode 100644 index 0000000..7fc7723 --- /dev/null +++ b/samples/generated_samples/tpu_generated_tpu_v2alpha1_tpu_update_node_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateNode +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-tpu + + +# [START tpu_generated_tpu_v2alpha1_Tpu_UpdateNode_sync] +from google.cloud import tpu_v2alpha1 + + +def sample_update_node(): + # Create a client + client = tpu_v2alpha1.TpuClient() + + # Initialize request argument(s) + node = tpu_v2alpha1.Node() + node.accelerator_type = "accelerator_type_value" + node.runtime_version = "runtime_version_value" + + request = tpu_v2alpha1.UpdateNodeRequest( + node=node, + ) + + # Make the request + operation = client.update_node(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END tpu_generated_tpu_v2alpha1_Tpu_UpdateNode_sync] diff --git a/setup.py b/setup.py index 6ff0dcf..42ad8d5 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ name = "google-cloud-tpu" description = "Cloud TPU API client library" -version = "1.3.0" +version = "1.3.1" release_status = "Development Status :: 5 - Production/Stable" url = "https://github.com/googleapis/python-tpu" dependencies = [