Class NotebookServiceAsyncClient (1.4.4)

NotebookServiceAsyncClient(*, credentials: Optional[google.auth.credentials.Credentials] = None, transport: Union[str, google.cloud.notebooks_v1beta1.services.notebook_service.transports.base.NotebookServiceTransport] = 'grpc_asyncio', client_options: Optional[google.api_core.client_options.ClientOptions] = None, client_info: google.api_core.gapic_v1.client_info.ClientInfo = <google.api_core.gapic_v1.client_info.ClientInfo object>)

API v1beta1 service for Cloud AI Platform Notebooks.

Properties

transport

Returns the transport used by the client instance.

Returns
TypeDescription
NotebookServiceTransportThe transport used by the client instance.

Methods

NotebookServiceAsyncClient

NotebookServiceAsyncClient(*, credentials: Optional[google.auth.credentials.Credentials] = None, transport: Union[str, google.cloud.notebooks_v1beta1.services.notebook_service.transports.base.NotebookServiceTransport] = 'grpc_asyncio', client_options: Optional[google.api_core.client_options.ClientOptions] = None, client_info: google.api_core.gapic_v1.client_info.ClientInfo = <google.api_core.gapic_v1.client_info.ClientInfo object>)

Instantiates the notebook service client.

Parameters
NameDescription
credentials Optional[google.auth.credentials.Credentials]

The authorization credentials to attach to requests. These credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment.

transport Union[str, .NotebookServiceTransport]

The transport to use. If set to None, a transport is chosen automatically.

client_options ClientOptions

Custom options for the client. It won't take effect if a transport instance is provided. (1) The api_endpoint property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT environment variable can also be used to override the endpoint: "always" (always use the default mTLS endpoint), "never" (always use the default regular endpoint) and "auto" (auto switch to the default mTLS endpoint if client certificate is present, this is the default value). However, the api_endpoint property takes precedence if provided. (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is "true", then the client_cert_source property can be used to provide client certificate for mutual TLS transport. If not provided, the default SSL client certificate will be used if present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not set, no client certificate will be used.

Exceptions
TypeDescription
google.auth.exceptions.MutualTlsChannelErrorIf mutual TLS transport creation failed for any reason.

common_billing_account_path

common_billing_account_path(billing_account: str)

Returns a fully-qualified billing_account string.

common_folder_path

common_folder_path(folder: str)

Returns a fully-qualified folder string.

common_location_path

common_location_path(project: str, location: str)

Returns a fully-qualified location string.

common_organization_path

common_organization_path(organization: str)

Returns a fully-qualified organization string.

common_project_path

common_project_path(project: str)

Returns a fully-qualified project string.

create_environment

create_environment(request: Optional[Union[google.cloud.notebooks_v1beta1.types.service.CreateEnvironmentRequest, dict]] = None, *, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Creates a new Environment.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import notebooks_v1beta1

async def sample_create_environment():
    # Create a client
    client = notebooks_v1beta1.NotebookServiceAsyncClient()

    # Initialize request argument(s)
    environment = notebooks_v1beta1.Environment()
    environment.vm_image.image_name = "image_name_value"
    environment.vm_image.project = "project_value"

    request = notebooks_v1beta1.CreateEnvironmentRequest(
        parent="parent_value",
        environment_id="environment_id_value",
        environment=environment,
    )

    # Make the request
    operation = client.create_environment(request=request)

    print("Waiting for operation to complete...")

    response = await operation.result()

    # Handle the response
    print(response)
Parameters
NameDescription
request Union[google.cloud.notebooks_v1beta1.types.CreateEnvironmentRequest, dict]

The request object. Request for creating a notebook environment.

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

Returns
TypeDescription
google.api_core.operation_async.AsyncOperationAn object representing a long-running operation. The result type for the operation will be Environment Definition of a software environment that is used to start a notebook instance.

create_instance

create_instance(request: Optional[Union[google.cloud.notebooks_v1beta1.types.service.CreateInstanceRequest, dict]] = None, *, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Creates a new Instance in a given project and location.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import notebooks_v1beta1

async def sample_create_instance():
    # Create a client
    client = notebooks_v1beta1.NotebookServiceAsyncClient()

    # Initialize request argument(s)
    instance = notebooks_v1beta1.Instance()
    instance.vm_image.image_name = "image_name_value"
    instance.vm_image.project = "project_value"
    instance.machine_type = "machine_type_value"

    request = notebooks_v1beta1.CreateInstanceRequest(
        parent="parent_value",
        instance_id="instance_id_value",
        instance=instance,
    )

    # Make the request
    operation = client.create_instance(request=request)

    print("Waiting for operation to complete...")

    response = await operation.result()

    # Handle the response
    print(response)
Parameters
NameDescription
request Union[google.cloud.notebooks_v1beta1.types.CreateInstanceRequest, dict]

The request object. Request for creating a notebook instance.

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

Returns
TypeDescription
google.api_core.operation_async.AsyncOperationAn object representing a long-running operation. The result type for the operation will be Instance The definition of a notebook instance.

delete_environment

delete_environment(request: Optional[Union[google.cloud.notebooks_v1beta1.types.service.DeleteEnvironmentRequest, dict]] = None, *, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Deletes a single Environment.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import notebooks_v1beta1

async def sample_delete_environment():
    # Create a client
    client = notebooks_v1beta1.NotebookServiceAsyncClient()

    # Initialize request argument(s)
    request = notebooks_v1beta1.DeleteEnvironmentRequest(
        name="name_value",
    )

    # Make the request
    operation = client.delete_environment(request=request)

    print("Waiting for operation to complete...")

    response = await operation.result()

    # Handle the response
    print(response)
Parameters
NameDescription
request Union[google.cloud.notebooks_v1beta1.types.DeleteEnvironmentRequest, dict]

The request object. Request for deleting a notebook environment.

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

Returns
TypeDescription
google.api_core.operation_async.AsyncOperationAn object representing a long-running operation. The result type for the operation will be google.protobuf.empty_pb2.Empty A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }

delete_instance

delete_instance(request: Optional[Union[google.cloud.notebooks_v1beta1.types.service.DeleteInstanceRequest, dict]] = None, *, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Deletes a single Instance.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import notebooks_v1beta1

async def sample_delete_instance():
    # Create a client
    client = notebooks_v1beta1.NotebookServiceAsyncClient()

    # Initialize request argument(s)
    request = notebooks_v1beta1.DeleteInstanceRequest(
        name="name_value",
    )

    # Make the request
    operation = client.delete_instance(request=request)

    print("Waiting for operation to complete...")

    response = await operation.result()

    # Handle the response
    print(response)
Parameters
NameDescription
request Union[google.cloud.notebooks_v1beta1.types.DeleteInstanceRequest, dict]

The request object. Request for deleting a notebook instance.

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

Returns
TypeDescription
google.api_core.operation_async.AsyncOperationAn object representing a long-running operation. The result type for the operation will be google.protobuf.empty_pb2.Empty A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }

environment_path

environment_path(project: str, environment: str)

Returns a fully-qualified environment string.

from_service_account_file

from_service_account_file(filename: str, *args, **kwargs)

Creates an instance of this client using the provided credentials file.

Parameter
NameDescription
filename str

The path to the service account private key json file.

Returns
TypeDescription
NotebookServiceAsyncClientThe constructed client.

from_service_account_info

from_service_account_info(info: dict, *args, **kwargs)

Creates an instance of this client using the provided credentials info.

Parameter
NameDescription
info dict

The service account private key info.

Returns
TypeDescription
NotebookServiceAsyncClientThe constructed client.

from_service_account_json

from_service_account_json(filename: str, *args, **kwargs)

Creates an instance of this client using the provided credentials file.

Parameter
NameDescription
filename str

The path to the service account private key json file.

Returns
TypeDescription
NotebookServiceAsyncClientThe constructed client.

get_environment

get_environment(request: Optional[Union[google.cloud.notebooks_v1beta1.types.service.GetEnvironmentRequest, dict]] = None, *, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Gets details of a single Environment.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import notebooks_v1beta1

async def sample_get_environment():
    # Create a client
    client = notebooks_v1beta1.NotebookServiceAsyncClient()

    # Initialize request argument(s)
    request = notebooks_v1beta1.GetEnvironmentRequest(
        name="name_value",
    )

    # Make the request
    response = await client.get_environment(request=request)

    # Handle the response
    print(response)
Parameters
NameDescription
request Union[google.cloud.notebooks_v1beta1.types.GetEnvironmentRequest, dict]

The request object. Request for getting a notebook environment.

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

Returns
TypeDescription
google.cloud.notebooks_v1beta1.types.EnvironmentDefinition of a software environment that is used to start a notebook instance.

get_instance

get_instance(request: Optional[Union[google.cloud.notebooks_v1beta1.types.service.GetInstanceRequest, dict]] = None, *, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Gets details of a single Instance.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import notebooks_v1beta1

async def sample_get_instance():
    # Create a client
    client = notebooks_v1beta1.NotebookServiceAsyncClient()

    # Initialize request argument(s)
    request = notebooks_v1beta1.GetInstanceRequest(
        name="name_value",
    )

    # Make the request
    response = await client.get_instance(request=request)

    # Handle the response
    print(response)
Parameters
NameDescription
request Union[google.cloud.notebooks_v1beta1.types.GetInstanceRequest, dict]

The request object. Request for getting a notebook instance.

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

Returns
TypeDescription
google.cloud.notebooks_v1beta1.types.InstanceThe definition of a notebook instance.

get_mtls_endpoint_and_cert_source

get_mtls_endpoint_and_cert_source(
    client_options: Optional[google.api_core.client_options.ClientOptions] = None,
)

Return the API endpoint and client cert source for mutual TLS.

The client cert source is determined in the following order: (1) if GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is not "true", the client cert source is None. (2) if client_options.client_cert_source is provided, use the provided one; if the default client cert source exists, use the default one; otherwise the client cert source is None.

The API endpoint is determined in the following order: (1) if client_options.api_endpoint if provided, use the provided one. (2) if GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is "always", use the default mTLS endpoint; if the environment variabel is "never", use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint.

More details can be found at https://google.aip.dev/auth/4114.

Parameter
NameDescription
client_options google.api_core.client_options.ClientOptions

Custom options for the client. Only the api_endpoint and client_cert_source properties may be used in this method.

Exceptions
TypeDescription
google.auth.exceptions.MutualTLSChannelErrorIf any errors happen.
Returns
TypeDescription
Tuple[str, Callable[[], Tuple[bytes, bytes]]]returns the API endpoint and the client cert source to use.

get_transport_class

get_transport_class()

Returns an appropriate transport class.

instance_path

instance_path(project: str, instance: str)

Returns a fully-qualified instance string.

is_instance_upgradeable

is_instance_upgradeable(request: Optional[Union[google.cloud.notebooks_v1beta1.types.service.IsInstanceUpgradeableRequest, dict]] = None, *, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Check if a notebook instance is upgradable.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import notebooks_v1beta1

async def sample_is_instance_upgradeable():
    # Create a client
    client = notebooks_v1beta1.NotebookServiceAsyncClient()

    # Initialize request argument(s)
    request = notebooks_v1beta1.IsInstanceUpgradeableRequest(
        notebook_instance="notebook_instance_value",
    )

    # Make the request
    response = await client.is_instance_upgradeable(request=request)

    # Handle the response
    print(response)
Parameters
NameDescription
request Union[google.cloud.notebooks_v1beta1.types.IsInstanceUpgradeableRequest, dict]

The request object. Request for checking if a notebook instance is upgradeable.

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

Returns
TypeDescription
google.cloud.notebooks_v1beta1.types.IsInstanceUpgradeableResponseResponse for checking if a notebook instance is upgradeable.

list_environments

list_environments(request: Optional[Union[google.cloud.notebooks_v1beta1.types.service.ListEnvironmentsRequest, dict]] = None, *, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Lists environments in a project.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import notebooks_v1beta1

async def sample_list_environments():
    # Create a client
    client = notebooks_v1beta1.NotebookServiceAsyncClient()

    # Initialize request argument(s)
    request = notebooks_v1beta1.ListEnvironmentsRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_environments(request=request)

    # Handle the response
    async for response in page_result:
        print(response)
Parameters
NameDescription
request Union[google.cloud.notebooks_v1beta1.types.ListEnvironmentsRequest, dict]

The request object. Request for listing environments.

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

Returns
TypeDescription
google.cloud.notebooks_v1beta1.services.notebook_service.pagers.ListEnvironmentsAsyncPagerResponse for listing environments. Iterating over this object will yield results and resolve additional pages automatically.

list_instances

list_instances(request: Optional[Union[google.cloud.notebooks_v1beta1.types.service.ListInstancesRequest, dict]] = None, *, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Lists instances in a given project and location.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import notebooks_v1beta1

async def sample_list_instances():
    # Create a client
    client = notebooks_v1beta1.NotebookServiceAsyncClient()

    # Initialize request argument(s)
    request = notebooks_v1beta1.ListInstancesRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_instances(request=request)

    # Handle the response
    async for response in page_result:
        print(response)
Parameters
NameDescription
request Union[google.cloud.notebooks_v1beta1.types.ListInstancesRequest, dict]

The request object. Request for listing notebook instances.

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

Returns
TypeDescription
google.cloud.notebooks_v1beta1.services.notebook_service.pagers.ListInstancesAsyncPagerResponse for listing notebook instances. Iterating over this object will yield results and resolve additional pages automatically.

parse_common_billing_account_path

parse_common_billing_account_path(path: str)

Parse a billing_account path into its component segments.

parse_common_folder_path

parse_common_folder_path(path: str)

Parse a folder path into its component segments.

parse_common_location_path

parse_common_location_path(path: str)

Parse a location path into its component segments.

parse_common_organization_path

parse_common_organization_path(path: str)

Parse a organization path into its component segments.

parse_common_project_path

parse_common_project_path(path: str)

Parse a project path into its component segments.

parse_environment_path

parse_environment_path(path: str)

Parses a environment path into its component segments.

parse_instance_path

parse_instance_path(path: str)

Parses a instance path into its component segments.

register_instance

register_instance(request: Optional[Union[google.cloud.notebooks_v1beta1.types.service.RegisterInstanceRequest, dict]] = None, *, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Registers an existing legacy notebook instance to the Notebooks API server. Legacy instances are instances created with the legacy Compute Engine calls. They are not manageable by the Notebooks API out of the box. This call makes these instances manageable by the Notebooks API.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import notebooks_v1beta1

async def sample_register_instance():
    # Create a client
    client = notebooks_v1beta1.NotebookServiceAsyncClient()

    # Initialize request argument(s)
    request = notebooks_v1beta1.RegisterInstanceRequest(
        parent="parent_value",
        instance_id="instance_id_value",
    )

    # Make the request
    operation = client.register_instance(request=request)

    print("Waiting for operation to complete...")

    response = await operation.result()

    # Handle the response
    print(response)
Parameters
NameDescription
request Union[google.cloud.notebooks_v1beta1.types.RegisterInstanceRequest, dict]

The request object. Request for registering a notebook instance.

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

Returns
TypeDescription
google.api_core.operation_async.AsyncOperationAn object representing a long-running operation. The result type for the operation will be Instance The definition of a notebook instance.

report_instance_info

report_instance_info(request: Optional[Union[google.cloud.notebooks_v1beta1.types.service.ReportInstanceInfoRequest, dict]] = None, *, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Allows notebook instances to report their latest instance information to the Notebooks API server. The server will merge the reported information to the instance metadata store. Do not use this method directly.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import notebooks_v1beta1

async def sample_report_instance_info():
    # Create a client
    client = notebooks_v1beta1.NotebookServiceAsyncClient()

    # Initialize request argument(s)
    request = notebooks_v1beta1.ReportInstanceInfoRequest(
        name="name_value",
        vm_id="vm_id_value",
    )

    # Make the request
    operation = client.report_instance_info(request=request)

    print("Waiting for operation to complete...")

    response = await operation.result()

    # Handle the response
    print(response)
Parameters
NameDescription
request Union[google.cloud.notebooks_v1beta1.types.ReportInstanceInfoRequest, dict]

The request object. Request for notebook instances to report information to Notebooks API.

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

Returns
TypeDescription
google.api_core.operation_async.AsyncOperationAn object representing a long-running operation. The result type for the operation will be Instance The definition of a notebook instance.

reset_instance

reset_instance(request: Optional[Union[google.cloud.notebooks_v1beta1.types.service.ResetInstanceRequest, dict]] = None, *, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Resets a notebook instance.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import notebooks_v1beta1

async def sample_reset_instance():
    # Create a client
    client = notebooks_v1beta1.NotebookServiceAsyncClient()

    # Initialize request argument(s)
    request = notebooks_v1beta1.ResetInstanceRequest(
        name="name_value",
    )

    # Make the request
    operation = client.reset_instance(request=request)

    print("Waiting for operation to complete...")

    response = await operation.result()

    # Handle the response
    print(response)
Parameters
NameDescription
request Union[google.cloud.notebooks_v1beta1.types.ResetInstanceRequest, dict]

The request object. Request for reseting a notebook instance

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

Returns
TypeDescription
google.api_core.operation_async.AsyncOperationAn object representing a long-running operation. The result type for the operation will be Instance The definition of a notebook instance.

set_instance_accelerator

set_instance_accelerator(request: Optional[Union[google.cloud.notebooks_v1beta1.types.service.SetInstanceAcceleratorRequest, dict]] = None, *, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Updates the guest accelerators of a single Instance.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import notebooks_v1beta1

async def sample_set_instance_accelerator():
    # Create a client
    client = notebooks_v1beta1.NotebookServiceAsyncClient()

    # Initialize request argument(s)
    request = notebooks_v1beta1.SetInstanceAcceleratorRequest(
        name="name_value",
        type_="TPU_V3",
        core_count=1073,
    )

    # Make the request
    operation = client.set_instance_accelerator(request=request)

    print("Waiting for operation to complete...")

    response = await operation.result()

    # Handle the response
    print(response)
Parameters
NameDescription
request Union[google.cloud.notebooks_v1beta1.types.SetInstanceAcceleratorRequest, dict]

The request object. Request for setting instance accelerator.

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

Returns
TypeDescription
google.api_core.operation_async.AsyncOperationAn object representing a long-running operation. The result type for the operation will be Instance The definition of a notebook instance.

set_instance_labels

set_instance_labels(request: Optional[Union[google.cloud.notebooks_v1beta1.types.service.SetInstanceLabelsRequest, dict]] = None, *, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Updates the labels of an Instance.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import notebooks_v1beta1

async def sample_set_instance_labels():
    # Create a client
    client = notebooks_v1beta1.NotebookServiceAsyncClient()

    # Initialize request argument(s)
    request = notebooks_v1beta1.SetInstanceLabelsRequest(
        name="name_value",
    )

    # Make the request
    operation = client.set_instance_labels(request=request)

    print("Waiting for operation to complete...")

    response = await operation.result()

    # Handle the response
    print(response)
Parameters
NameDescription
request Union[google.cloud.notebooks_v1beta1.types.SetInstanceLabelsRequest, dict]

The request object. Request for setting instance labels.

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

Returns
TypeDescription
google.api_core.operation_async.AsyncOperationAn object representing a long-running operation. The result type for the operation will be Instance The definition of a notebook instance.

set_instance_machine_type

set_instance_machine_type(request: Optional[Union[google.cloud.notebooks_v1beta1.types.service.SetInstanceMachineTypeRequest, dict]] = None, *, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Updates the machine type of a single Instance.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import notebooks_v1beta1

async def sample_set_instance_machine_type():
    # Create a client
    client = notebooks_v1beta1.NotebookServiceAsyncClient()

    # Initialize request argument(s)
    request = notebooks_v1beta1.SetInstanceMachineTypeRequest(
        name="name_value",
        machine_type="machine_type_value",
    )

    # Make the request
    operation = client.set_instance_machine_type(request=request)

    print("Waiting for operation to complete...")

    response = await operation.result()

    # Handle the response
    print(response)
Parameters
NameDescription
request Union[google.cloud.notebooks_v1beta1.types.SetInstanceMachineTypeRequest, dict]

The request object. Request for setting instance machine type.

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

Returns
TypeDescription
google.api_core.operation_async.AsyncOperationAn object representing a long-running operation. The result type for the operation will be Instance The definition of a notebook instance.

start_instance

start_instance(request: Optional[Union[google.cloud.notebooks_v1beta1.types.service.StartInstanceRequest, dict]] = None, *, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Starts a notebook instance.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import notebooks_v1beta1

async def sample_start_instance():
    # Create a client
    client = notebooks_v1beta1.NotebookServiceAsyncClient()

    # Initialize request argument(s)
    request = notebooks_v1beta1.StartInstanceRequest(
        name="name_value",
    )

    # Make the request
    operation = client.start_instance(request=request)

    print("Waiting for operation to complete...")

    response = await operation.result()

    # Handle the response
    print(response)
Parameters
NameDescription
request Union[google.cloud.notebooks_v1beta1.types.StartInstanceRequest, dict]

The request object. Request for starting a notebook instance

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

Returns
TypeDescription
google.api_core.operation_async.AsyncOperationAn object representing a long-running operation. The result type for the operation will be Instance The definition of a notebook instance.

stop_instance

stop_instance(request: Optional[Union[google.cloud.notebooks_v1beta1.types.service.StopInstanceRequest, dict]] = None, *, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Stops a notebook instance.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import notebooks_v1beta1

async def sample_stop_instance():
    # Create a client
    client = notebooks_v1beta1.NotebookServiceAsyncClient()

    # Initialize request argument(s)
    request = notebooks_v1beta1.StopInstanceRequest(
        name="name_value",
    )

    # Make the request
    operation = client.stop_instance(request=request)

    print("Waiting for operation to complete...")

    response = await operation.result()

    # Handle the response
    print(response)
Parameters
NameDescription
request Union[google.cloud.notebooks_v1beta1.types.StopInstanceRequest, dict]

The request object. Request for stopping a notebook instance

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

Returns
TypeDescription
google.api_core.operation_async.AsyncOperationAn object representing a long-running operation. The result type for the operation will be Instance The definition of a notebook instance.

upgrade_instance

upgrade_instance(request: Optional[Union[google.cloud.notebooks_v1beta1.types.service.UpgradeInstanceRequest, dict]] = None, *, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Upgrades a notebook instance to the latest version.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import notebooks_v1beta1

async def sample_upgrade_instance():
    # Create a client
    client = notebooks_v1beta1.NotebookServiceAsyncClient()

    # Initialize request argument(s)
    request = notebooks_v1beta1.UpgradeInstanceRequest(
        name="name_value",
    )

    # Make the request
    operation = client.upgrade_instance(request=request)

    print("Waiting for operation to complete...")

    response = await operation.result()

    # Handle the response
    print(response)
Parameters
NameDescription
request Union[google.cloud.notebooks_v1beta1.types.UpgradeInstanceRequest, dict]

The request object. Request for upgrading a notebook instance

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

Returns
TypeDescription
google.api_core.operation_async.AsyncOperationAn object representing a long-running operation. The result type for the operation will be Instance The definition of a notebook instance.

upgrade_instance_internal

upgrade_instance_internal(request: Optional[Union[google.cloud.notebooks_v1beta1.types.service.UpgradeInstanceInternalRequest, dict]] = None, *, retry: Union[google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault] = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Allows notebook instances to call this endpoint to upgrade themselves. Do not use this method directly.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import notebooks_v1beta1

async def sample_upgrade_instance_internal():
    # Create a client
    client = notebooks_v1beta1.NotebookServiceAsyncClient()

    # Initialize request argument(s)
    request = notebooks_v1beta1.UpgradeInstanceInternalRequest(
        name="name_value",
        vm_id="vm_id_value",
    )

    # Make the request
    operation = client.upgrade_instance_internal(request=request)

    print("Waiting for operation to complete...")

    response = await operation.result()

    # Handle the response
    print(response)
Parameters
NameDescription
request Union[google.cloud.notebooks_v1beta1.types.UpgradeInstanceInternalRequest, dict]

The request object. Request for upgrading a notebook instance from within the VM

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

Returns
TypeDescription
google.api_core.operation_async.AsyncOperationAn object representing a long-running operation. The result type for the operation will be Instance The definition of a notebook instance.