Google Cloud Notebooks V1 Client - Class NotebookServiceClient (1.0.0)

Reference documentation and code samples for the Google Cloud Notebooks V1 Client class NotebookServiceClient.

Service Description: API v1 service for Cloud AI Platform Notebooks.

This class provides the ability to make remote calls to the backing service through method calls that map to API methods.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parseName method to extract the individual identifiers contained within formatted names that are returned by the API.

Namespace

Google \ Cloud \ Notebooks \ V1 \ Client

Methods

__construct

Constructor.

Parameters
Name Description
options array

Optional. Options for configuring the service API wrapper.

↳ apiEndpoint string

The address of the API remote host. May optionally include the port, formatted as "

↳ credentials string|array|FetchAuthTokenInterface|CredentialsWrapper

The credentials to be used by the client to authorize API calls. This option accepts either a path to a credentials file, or a decoded credentials file as a PHP array. Advanced usage: In addition, this option can also accept a pre-constructed Google\Auth\FetchAuthTokenInterface object or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored.

↳ credentialsConfig array

Options used to configure credentials, including auth token caching, for the client. For a full list of supporting configuration options, see Google\ApiCore\CredentialsWrapper::build() .

↳ disableRetries bool

Determines whether or not retries defined by the client configuration should be disabled. Defaults to false.

↳ clientConfig string|array

Client method configuration, including retry settings. This option can be either a path to a JSON file, or a PHP array containing the decoded JSON data. By default this settings points to the default client config file, which is provided in the resources folder.

↳ transport string|TransportInterface

The transport used for executing network requests. May be either the string rest or grpc. Defaults to grpc if gRPC support is detected on the system. Advanced usage: Additionally, it is possible to pass in an already instantiated Google\ApiCore\Transport\TransportInterface object. Note that when this object is provided, any settings in $transportConfig, and any $apiEndpoint setting, will be ignored.

↳ transportConfig array

Configuration options that will be used to construct the transport. Options for each supported transport type should be passed in a key for that transport. For example: $transportConfig = [ 'grpc' => [...], 'rest' => [...], ]; See the Google\ApiCore\Transport\GrpcTransport::build() and Google\ApiCore\Transport\RestTransport::build() methods for the supported options.

↳ clientCertSource callable

A callable which returns the client cert as a string. This can be used to provide a certificate and private key to the transport layer for mTLS.

createEnvironment

Parameters
Name Description
request Google\Cloud\Notebooks\V1\CreateEnvironmentRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;
use Google\Cloud\Notebooks\V1\CreateEnvironmentRequest;
use Google\Cloud\Notebooks\V1\Environment;
use Google\Rpc\Status;

/**
 * @param string $parent        Format: `projects/{project_id}/locations/{location}`
 * @param string $environmentId User-defined unique ID of this environment. The `environment_id` must
 *                              be 1 to 63 characters long and contain only lowercase letters,
 *                              numeric characters, and dashes. The first character must be a lowercase
 *                              letter and the last character cannot be a dash.
 */
function create_environment_sample(string $parent, string $environmentId): void
{
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $environment = new Environment();
    $request = (new CreateEnvironmentRequest())
        ->setParent($parent)
        ->setEnvironmentId($environmentId)
        ->setEnvironment($environment);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $notebookServiceClient->createEnvironment($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var Environment $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $parent = '[PARENT]';
    $environmentId = '[ENVIRONMENT_ID]';

    create_environment_sample($parent, $environmentId);
}

createExecution

Creates a new Execution in a given project and location.

The async variant is Google\Cloud\Notebooks\V1\Client\NotebookServiceClient::createExecutionAsync() .

Parameters
Name Description
request Google\Cloud\Notebooks\V1\CreateExecutionRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;
use Google\Cloud\Notebooks\V1\CreateExecutionRequest;
use Google\Cloud\Notebooks\V1\Execution;
use Google\Rpc\Status;

/**
 * @param string $formattedParent Format:
 *                                `parent=projects/{project_id}/locations/{location}`
 *                                Please see {@see NotebookServiceClient::executionName()} for help formatting this field.
 * @param string $executionId     User-defined unique ID of this execution.
 */
function create_execution_sample(string $formattedParent, string $executionId): void
{
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $execution = new Execution();
    $request = (new CreateExecutionRequest())
        ->setParent($formattedParent)
        ->setExecutionId($executionId)
        ->setExecution($execution);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $notebookServiceClient->createExecution($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var Execution $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = NotebookServiceClient::executionName('[PROJECT]', '[LOCATION]', '[EXECUTION]');
    $executionId = '[EXECUTION_ID]';

    create_execution_sample($formattedParent, $executionId);
}

createInstance

Creates a new Instance in a given project and location.

The async variant is Google\Cloud\Notebooks\V1\Client\NotebookServiceClient::createInstanceAsync() .

Parameters
Name Description
request Google\Cloud\Notebooks\V1\CreateInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;
use Google\Cloud\Notebooks\V1\CreateInstanceRequest;
use Google\Cloud\Notebooks\V1\Instance;
use Google\Rpc\Status;

/**
 * @param string $parent              Format:
 *                                    `parent=projects/{project_id}/locations/{location}`
 * @param string $instanceId          User-defined unique ID of this instance.
 * @param string $instanceMachineType The [Compute Engine machine
 *                                    type](https://cloud.google.com/compute/docs/machine-types) of this
 *                                    instance.
 */
function create_instance_sample(
    string $parent,
    string $instanceId,
    string $instanceMachineType
): void {
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $instance = (new Instance())
        ->setMachineType($instanceMachineType);
    $request = (new CreateInstanceRequest())
        ->setParent($parent)
        ->setInstanceId($instanceId)
        ->setInstance($instance);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $notebookServiceClient->createInstance($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var Instance $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $parent = '[PARENT]';
    $instanceId = '[INSTANCE_ID]';
    $instanceMachineType = '[MACHINE_TYPE]';

    create_instance_sample($parent, $instanceId, $instanceMachineType);
}

createSchedule

Creates a new Scheduled Notebook in a given project and location.

The async variant is Google\Cloud\Notebooks\V1\Client\NotebookServiceClient::createScheduleAsync() .

Parameters
Name Description
request Google\Cloud\Notebooks\V1\CreateScheduleRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;
use Google\Cloud\Notebooks\V1\CreateScheduleRequest;
use Google\Cloud\Notebooks\V1\Schedule;
use Google\Rpc\Status;

/**
 * @param string $formattedParent Format:
 *                                `parent=projects/{project_id}/locations/{location}`
 *                                Please see {@see NotebookServiceClient::scheduleName()} for help formatting this field.
 * @param string $scheduleId      User-defined unique ID of this schedule.
 */
function create_schedule_sample(string $formattedParent, string $scheduleId): void
{
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $schedule = new Schedule();
    $request = (new CreateScheduleRequest())
        ->setParent($formattedParent)
        ->setScheduleId($scheduleId)
        ->setSchedule($schedule);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $notebookServiceClient->createSchedule($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var Schedule $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = NotebookServiceClient::scheduleName('[PROJECT]', '[LOCATION]', '[SCHEDULE]');
    $scheduleId = '[SCHEDULE_ID]';

    create_schedule_sample($formattedParent, $scheduleId);
}

deleteEnvironment

Deletes a single Environment.

The async variant is Google\Cloud\Notebooks\V1\Client\NotebookServiceClient::deleteEnvironmentAsync() .

Parameters
Name Description
request Google\Cloud\Notebooks\V1\DeleteEnvironmentRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;
use Google\Cloud\Notebooks\V1\DeleteEnvironmentRequest;
use Google\Rpc\Status;

/**
 * @param string $name Format:
 *                     `projects/{project_id}/locations/{location}/environments/{environment_id}`
 */
function delete_environment_sample(string $name): void
{
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $request = (new DeleteEnvironmentRequest())
        ->setName($name);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $notebookServiceClient->deleteEnvironment($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            printf('Operation completed successfully.' . PHP_EOL);
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $name = '[NAME]';

    delete_environment_sample($name);
}

deleteExecution

Parameters
Name Description
request Google\Cloud\Notebooks\V1\DeleteExecutionRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;
use Google\Cloud\Notebooks\V1\DeleteExecutionRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName Format:
 *                              `projects/{project_id}/locations/{location}/executions/{execution_id}`
 *                              Please see {@see NotebookServiceClient::executionName()} for help formatting this field.
 */
function delete_execution_sample(string $formattedName): void
{
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $request = (new DeleteExecutionRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $notebookServiceClient->deleteExecution($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            printf('Operation completed successfully.' . PHP_EOL);
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = NotebookServiceClient::executionName('[PROJECT]', '[LOCATION]', '[EXECUTION]');

    delete_execution_sample($formattedName);
}

deleteInstance

Parameters
Name Description
request Google\Cloud\Notebooks\V1\DeleteInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;
use Google\Cloud\Notebooks\V1\DeleteInstanceRequest;
use Google\Rpc\Status;

/**
 * @param string $name Format:
 *                     `projects/{project_id}/locations/{location}/instances/{instance_id}`
 */
function delete_instance_sample(string $name): void
{
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $request = (new DeleteInstanceRequest())
        ->setName($name);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $notebookServiceClient->deleteInstance($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            printf('Operation completed successfully.' . PHP_EOL);
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $name = '[NAME]';

    delete_instance_sample($name);
}

deleteSchedule

Deletes schedule and all underlying jobs

The async variant is Google\Cloud\Notebooks\V1\Client\NotebookServiceClient::deleteScheduleAsync() .

Parameters
Name Description
request Google\Cloud\Notebooks\V1\DeleteScheduleRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;
use Google\Cloud\Notebooks\V1\DeleteScheduleRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName Format:
 *                              `projects/{project_id}/locations/{location}/schedules/{schedule_id}`
 *                              Please see {@see NotebookServiceClient::scheduleName()} for help formatting this field.
 */
function delete_schedule_sample(string $formattedName): void
{
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $request = (new DeleteScheduleRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $notebookServiceClient->deleteSchedule($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            printf('Operation completed successfully.' . PHP_EOL);
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = NotebookServiceClient::scheduleName('[PROJECT]', '[LOCATION]', '[SCHEDULE]');

    delete_schedule_sample($formattedName);
}

diagnoseInstance

Creates a Diagnostic File and runs Diagnostic Tool given an Instance.

The async variant is Google\Cloud\Notebooks\V1\Client\NotebookServiceClient::diagnoseInstanceAsync() .

Parameters
Name Description
request Google\Cloud\Notebooks\V1\DiagnoseInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;
use Google\Cloud\Notebooks\V1\DiagnoseInstanceRequest;
use Google\Cloud\Notebooks\V1\DiagnosticConfig;
use Google\Cloud\Notebooks\V1\Instance;
use Google\Rpc\Status;

/**
 * @param string $formattedName             Format:
 *                                          `projects/{project_id}/locations/{location}/instances/{instance_id}`
 *                                          Please see {@see NotebookServiceClient::instanceName()} for help formatting this field.
 * @param string $diagnosticConfigGcsBucket User Cloud Storage bucket location (REQUIRED).
 *                                          Must be formatted with path prefix (`gs://$GCS_BUCKET`).
 *
 *                                          Permissions:
 *                                          User Managed Notebooks:
 *                                          - storage.buckets.writer: Must be given to the project's service account
 *                                          attached to VM.
 *                                          Google Managed Notebooks:
 *                                          - storage.buckets.writer: Must be given to the project's service account or
 *                                          user credentials attached to VM depending on authentication mode.
 *
 *                                          Cloud Storage bucket Log file will be written to
 *                                          `gs://$GCS_BUCKET/$RELATIVE_PATH/$VM_DATE_$TIME.tar.gz`
 */
function diagnose_instance_sample(string $formattedName, string $diagnosticConfigGcsBucket): void
{
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $diagnosticConfig = (new DiagnosticConfig())
        ->setGcsBucket($diagnosticConfigGcsBucket);
    $request = (new DiagnoseInstanceRequest())
        ->setName($formattedName)
        ->setDiagnosticConfig($diagnosticConfig);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $notebookServiceClient->diagnoseInstance($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var Instance $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = NotebookServiceClient::instanceName('[PROJECT]', '[INSTANCE]');
    $diagnosticConfigGcsBucket = '[GCS_BUCKET]';

    diagnose_instance_sample($formattedName, $diagnosticConfigGcsBucket);
}

getEnvironment

Gets details of a single Environment.

The async variant is Google\Cloud\Notebooks\V1\Client\NotebookServiceClient::getEnvironmentAsync() .

Parameters
Name Description
request Google\Cloud\Notebooks\V1\GetEnvironmentRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Cloud\Notebooks\V1\Environment
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;
use Google\Cloud\Notebooks\V1\Environment;
use Google\Cloud\Notebooks\V1\GetEnvironmentRequest;

/**
 * @param string $name Format:
 *                     `projects/{project_id}/locations/{location}/environments/{environment_id}`
 */
function get_environment_sample(string $name): void
{
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $request = (new GetEnvironmentRequest())
        ->setName($name);

    // Call the API and handle any network failures.
    try {
        /** @var Environment $response */
        $response = $notebookServiceClient->getEnvironment($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $name = '[NAME]';

    get_environment_sample($name);
}

getExecution

Gets details of executions

The async variant is Google\Cloud\Notebooks\V1\Client\NotebookServiceClient::getExecutionAsync() .

Parameters
Name Description
request Google\Cloud\Notebooks\V1\GetExecutionRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Cloud\Notebooks\V1\Execution
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;
use Google\Cloud\Notebooks\V1\Execution;
use Google\Cloud\Notebooks\V1\GetExecutionRequest;

/**
 * @param string $formattedName Format:
 *                              `projects/{project_id}/locations/{location}/executions/{execution_id}`
 *                              Please see {@see NotebookServiceClient::executionName()} for help formatting this field.
 */
function get_execution_sample(string $formattedName): void
{
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $request = (new GetExecutionRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var Execution $response */
        $response = $notebookServiceClient->getExecution($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = NotebookServiceClient::executionName('[PROJECT]', '[LOCATION]', '[EXECUTION]');

    get_execution_sample($formattedName);
}

getInstance

Gets details of a single Instance.

The async variant is Google\Cloud\Notebooks\V1\Client\NotebookServiceClient::getInstanceAsync() .

Parameters
Name Description
request Google\Cloud\Notebooks\V1\GetInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Cloud\Notebooks\V1\Instance
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;
use Google\Cloud\Notebooks\V1\GetInstanceRequest;
use Google\Cloud\Notebooks\V1\Instance;

/**
 * @param string $name Format:
 *                     `projects/{project_id}/locations/{location}/instances/{instance_id}`
 */
function get_instance_sample(string $name): void
{
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $request = (new GetInstanceRequest())
        ->setName($name);

    // Call the API and handle any network failures.
    try {
        /** @var Instance $response */
        $response = $notebookServiceClient->getInstance($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $name = '[NAME]';

    get_instance_sample($name);
}

getInstanceHealth

Check if a notebook instance is healthy.

The async variant is Google\Cloud\Notebooks\V1\Client\NotebookServiceClient::getInstanceHealthAsync() .

Parameters
Name Description
request Google\Cloud\Notebooks\V1\GetInstanceHealthRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Cloud\Notebooks\V1\GetInstanceHealthResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;
use Google\Cloud\Notebooks\V1\GetInstanceHealthRequest;
use Google\Cloud\Notebooks\V1\GetInstanceHealthResponse;

/**
 * @param string $formattedName Format:
 *                              `projects/{project_id}/locations/{location}/instances/{instance_id}`
 *                              Please see {@see NotebookServiceClient::instanceName()} for help formatting this field.
 */
function get_instance_health_sample(string $formattedName): void
{
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $request = (new GetInstanceHealthRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var GetInstanceHealthResponse $response */
        $response = $notebookServiceClient->getInstanceHealth($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = NotebookServiceClient::instanceName('[PROJECT]', '[INSTANCE]');

    get_instance_health_sample($formattedName);
}

getSchedule

Parameters
Name Description
request Google\Cloud\Notebooks\V1\GetScheduleRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Cloud\Notebooks\V1\Schedule
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;
use Google\Cloud\Notebooks\V1\GetScheduleRequest;
use Google\Cloud\Notebooks\V1\Schedule;

/**
 * @param string $formattedName Format:
 *                              `projects/{project_id}/locations/{location}/schedules/{schedule_id}`
 *                              Please see {@see NotebookServiceClient::scheduleName()} for help formatting this field.
 */
function get_schedule_sample(string $formattedName): void
{
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $request = (new GetScheduleRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var Schedule $response */
        $response = $notebookServiceClient->getSchedule($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = NotebookServiceClient::scheduleName('[PROJECT]', '[LOCATION]', '[SCHEDULE]');

    get_schedule_sample($formattedName);
}

isInstanceUpgradeable

Check if a notebook instance is upgradable.

The async variant is Google\Cloud\Notebooks\V1\Client\NotebookServiceClient::isInstanceUpgradeableAsync() .

Parameters
Name Description
request Google\Cloud\Notebooks\V1\IsInstanceUpgradeableRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Cloud\Notebooks\V1\IsInstanceUpgradeableResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;
use Google\Cloud\Notebooks\V1\IsInstanceUpgradeableRequest;
use Google\Cloud\Notebooks\V1\IsInstanceUpgradeableResponse;

/**
 * @param string $notebookInstance Format:
 *                                 `projects/{project_id}/locations/{location}/instances/{instance_id}`
 */
function is_instance_upgradeable_sample(string $notebookInstance): void
{
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $request = (new IsInstanceUpgradeableRequest())
        ->setNotebookInstance($notebookInstance);

    // Call the API and handle any network failures.
    try {
        /** @var IsInstanceUpgradeableResponse $response */
        $response = $notebookServiceClient->isInstanceUpgradeable($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $notebookInstance = '[NOTEBOOK_INSTANCE]';

    is_instance_upgradeable_sample($notebookInstance);
}

listEnvironments

Lists environments in a project.

The async variant is Google\Cloud\Notebooks\V1\Client\NotebookServiceClient::listEnvironmentsAsync() .

Parameters
Name Description
request Google\Cloud\Notebooks\V1\ListEnvironmentsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;
use Google\Cloud\Notebooks\V1\Environment;
use Google\Cloud\Notebooks\V1\ListEnvironmentsRequest;

/**
 * @param string $parent Format: `projects/{project_id}/locations/{location}`
 */
function list_environments_sample(string $parent): void
{
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $request = (new ListEnvironmentsRequest())
        ->setParent($parent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $notebookServiceClient->listEnvironments($request);

        /** @var Environment $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $parent = '[PARENT]';

    list_environments_sample($parent);
}

listExecutions

Lists executions in a given project and location

The async variant is Google\Cloud\Notebooks\V1\Client\NotebookServiceClient::listExecutionsAsync() .

Parameters
Name Description
request Google\Cloud\Notebooks\V1\ListExecutionsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;
use Google\Cloud\Notebooks\V1\Execution;
use Google\Cloud\Notebooks\V1\ListExecutionsRequest;

/**
 * @param string $formattedParent Format:
 *                                `parent=projects/{project_id}/locations/{location}`
 *                                Please see {@see NotebookServiceClient::executionName()} for help formatting this field.
 */
function list_executions_sample(string $formattedParent): void
{
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $request = (new ListExecutionsRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $notebookServiceClient->listExecutions($request);

        /** @var Execution $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = NotebookServiceClient::executionName('[PROJECT]', '[LOCATION]', '[EXECUTION]');

    list_executions_sample($formattedParent);
}

listInstances

Lists instances in a given project and location.

The async variant is Google\Cloud\Notebooks\V1\Client\NotebookServiceClient::listInstancesAsync() .

Parameters
Name Description
request Google\Cloud\Notebooks\V1\ListInstancesRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;
use Google\Cloud\Notebooks\V1\Instance;
use Google\Cloud\Notebooks\V1\ListInstancesRequest;

/**
 * @param string $parent Format:
 *                       `parent=projects/{project_id}/locations/{location}`
 */
function list_instances_sample(string $parent): void
{
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $request = (new ListInstancesRequest())
        ->setParent($parent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $notebookServiceClient->listInstances($request);

        /** @var Instance $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $parent = '[PARENT]';

    list_instances_sample($parent);
}

listSchedules

Lists schedules in a given project and location.

The async variant is Google\Cloud\Notebooks\V1\Client\NotebookServiceClient::listSchedulesAsync() .

Parameters
Name Description
request Google\Cloud\Notebooks\V1\ListSchedulesRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;
use Google\Cloud\Notebooks\V1\ListSchedulesRequest;
use Google\Cloud\Notebooks\V1\Schedule;

/**
 * @param string $formattedParent Format:
 *                                `parent=projects/{project_id}/locations/{location}`
 *                                Please see {@see NotebookServiceClient::scheduleName()} for help formatting this field.
 */
function list_schedules_sample(string $formattedParent): void
{
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $request = (new ListSchedulesRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $notebookServiceClient->listSchedules($request);

        /** @var Schedule $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = NotebookServiceClient::scheduleName('[PROJECT]', '[LOCATION]', '[SCHEDULE]');

    list_schedules_sample($formattedParent);
}

registerInstance

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.

The async variant is Google\Cloud\Notebooks\V1\Client\NotebookServiceClient::registerInstanceAsync() .

Parameters
Name Description
request Google\Cloud\Notebooks\V1\RegisterInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;
use Google\Cloud\Notebooks\V1\Instance;
use Google\Cloud\Notebooks\V1\RegisterInstanceRequest;
use Google\Rpc\Status;

/**
 * @param string $parent     Format:
 *                           `parent=projects/{project_id}/locations/{location}`
 * @param string $instanceId User defined unique ID of this instance. The `instance_id` must
 *                           be 1 to 63 characters long and contain only lowercase letters,
 *                           numeric characters, and dashes. The first character must be a lowercase
 *                           letter and the last character cannot be a dash.
 */
function register_instance_sample(string $parent, string $instanceId): void
{
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $request = (new RegisterInstanceRequest())
        ->setParent($parent)
        ->setInstanceId($instanceId);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $notebookServiceClient->registerInstance($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var Instance $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $parent = '[PARENT]';
    $instanceId = '[INSTANCE_ID]';

    register_instance_sample($parent, $instanceId);
}

reportInstanceInfo

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.

The async variant is Google\Cloud\Notebooks\V1\Client\NotebookServiceClient::reportInstanceInfoAsync() .

Parameters
Name Description
request Google\Cloud\Notebooks\V1\ReportInstanceInfoRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;
use Google\Cloud\Notebooks\V1\Instance;
use Google\Cloud\Notebooks\V1\ReportInstanceInfoRequest;
use Google\Rpc\Status;

/**
 * @param string $name Format:
 *                     `projects/{project_id}/locations/{location}/instances/{instance_id}`
 * @param string $vmId The VM hardware token for authenticating the VM.
 *                     https://cloud.google.com/compute/docs/instances/verifying-instance-identity
 */
function report_instance_info_sample(string $name, string $vmId): void
{
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $request = (new ReportInstanceInfoRequest())
        ->setName($name)
        ->setVmId($vmId);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $notebookServiceClient->reportInstanceInfo($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var Instance $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $name = '[NAME]';
    $vmId = '[VM_ID]';

    report_instance_info_sample($name, $vmId);
}

resetInstance

Resets a notebook instance.

The async variant is Google\Cloud\Notebooks\V1\Client\NotebookServiceClient::resetInstanceAsync() .

Parameters
Name Description
request Google\Cloud\Notebooks\V1\ResetInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;
use Google\Cloud\Notebooks\V1\Instance;
use Google\Cloud\Notebooks\V1\ResetInstanceRequest;
use Google\Rpc\Status;

/**
 * @param string $name Format:
 *                     `projects/{project_id}/locations/{location}/instances/{instance_id}`
 */
function reset_instance_sample(string $name): void
{
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $request = (new ResetInstanceRequest())
        ->setName($name);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $notebookServiceClient->resetInstance($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var Instance $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $name = '[NAME]';

    reset_instance_sample($name);
}

rollbackInstance

Rollbacks a notebook instance to the previous version.

The async variant is Google\Cloud\Notebooks\V1\Client\NotebookServiceClient::rollbackInstanceAsync() .

Parameters
Name Description
request Google\Cloud\Notebooks\V1\RollbackInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;
use Google\Cloud\Notebooks\V1\Instance;
use Google\Cloud\Notebooks\V1\RollbackInstanceRequest;
use Google\Rpc\Status;

/**
 * @param string $name           Format:
 *                               `projects/{project_id}/locations/{location}/instances/{instance_id}`
 * @param string $targetSnapshot The snapshot for rollback.
 *                               Example: `projects/test-project/global/snapshots/krwlzipynril`.
 */
function rollback_instance_sample(string $name, string $targetSnapshot): void
{
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $request = (new RollbackInstanceRequest())
        ->setName($name)
        ->setTargetSnapshot($targetSnapshot);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $notebookServiceClient->rollbackInstance($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var Instance $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $name = '[NAME]';
    $targetSnapshot = '[TARGET_SNAPSHOT]';

    rollback_instance_sample($name, $targetSnapshot);
}

setInstanceAccelerator

Updates the guest accelerators of a single Instance.

The async variant is Google\Cloud\Notebooks\V1\Client\NotebookServiceClient::setInstanceAcceleratorAsync() .

Parameters
Name Description
request Google\Cloud\Notebooks\V1\SetInstanceAcceleratorRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;
use Google\Cloud\Notebooks\V1\Instance;
use Google\Cloud\Notebooks\V1\Instance\AcceleratorType;
use Google\Cloud\Notebooks\V1\SetInstanceAcceleratorRequest;
use Google\Rpc\Status;

/**
 * @param string $name      Format:
 *                          `projects/{project_id}/locations/{location}/instances/{instance_id}`
 * @param int    $type      Type of this accelerator.
 * @param int    $coreCount Count of cores of this accelerator. Note that not all combinations
 *                          of `type` and `core_count` are valid. Check [GPUs on
 *                          Compute Engine](https://cloud.google.com/compute/docs/gpus/#gpus-list) to
 *                          find a valid combination. TPUs are not supported.
 */
function set_instance_accelerator_sample(string $name, int $type, int $coreCount): void
{
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $request = (new SetInstanceAcceleratorRequest())
        ->setName($name)
        ->setType($type)
        ->setCoreCount($coreCount);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $notebookServiceClient->setInstanceAccelerator($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var Instance $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $name = '[NAME]';
    $type = AcceleratorType::ACCELERATOR_TYPE_UNSPECIFIED;
    $coreCount = 0;

    set_instance_accelerator_sample($name, $type, $coreCount);
}

setInstanceLabels

Replaces all the labels of an Instance.

The async variant is Google\Cloud\Notebooks\V1\Client\NotebookServiceClient::setInstanceLabelsAsync() .

Parameters
Name Description
request Google\Cloud\Notebooks\V1\SetInstanceLabelsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;
use Google\Cloud\Notebooks\V1\Instance;
use Google\Cloud\Notebooks\V1\SetInstanceLabelsRequest;
use Google\Rpc\Status;

/**
 * @param string $name Format:
 *                     `projects/{project_id}/locations/{location}/instances/{instance_id}`
 */
function set_instance_labels_sample(string $name): void
{
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $request = (new SetInstanceLabelsRequest())
        ->setName($name);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $notebookServiceClient->setInstanceLabels($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var Instance $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $name = '[NAME]';

    set_instance_labels_sample($name);
}

setInstanceMachineType

Updates the machine type of a single Instance.

The async variant is Google\Cloud\Notebooks\V1\Client\NotebookServiceClient::setInstanceMachineTypeAsync() .

Parameters
Name Description
request Google\Cloud\Notebooks\V1\SetInstanceMachineTypeRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;
use Google\Cloud\Notebooks\V1\Instance;
use Google\Cloud\Notebooks\V1\SetInstanceMachineTypeRequest;
use Google\Rpc\Status;

/**
 * @param string $name        Format:
 *                            `projects/{project_id}/locations/{location}/instances/{instance_id}`
 * @param string $machineType The [Compute Engine machine
 *                            type](https://cloud.google.com/compute/docs/machine-types).
 */
function set_instance_machine_type_sample(string $name, string $machineType): void
{
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $request = (new SetInstanceMachineTypeRequest())
        ->setName($name)
        ->setMachineType($machineType);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $notebookServiceClient->setInstanceMachineType($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var Instance $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $name = '[NAME]';
    $machineType = '[MACHINE_TYPE]';

    set_instance_machine_type_sample($name, $machineType);
}

startInstance

Starts a notebook instance.

The async variant is Google\Cloud\Notebooks\V1\Client\NotebookServiceClient::startInstanceAsync() .

Parameters
Name Description
request Google\Cloud\Notebooks\V1\StartInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;
use Google\Cloud\Notebooks\V1\Instance;
use Google\Cloud\Notebooks\V1\StartInstanceRequest;
use Google\Rpc\Status;

/**
 * @param string $name Format:
 *                     `projects/{project_id}/locations/{location}/instances/{instance_id}`
 */
function start_instance_sample(string $name): void
{
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $request = (new StartInstanceRequest())
        ->setName($name);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $notebookServiceClient->startInstance($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var Instance $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $name = '[NAME]';

    start_instance_sample($name);
}

stopInstance

Stops a notebook instance.

The async variant is Google\Cloud\Notebooks\V1\Client\NotebookServiceClient::stopInstanceAsync() .

Parameters
Name Description
request Google\Cloud\Notebooks\V1\StopInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;
use Google\Cloud\Notebooks\V1\Instance;
use Google\Cloud\Notebooks\V1\StopInstanceRequest;
use Google\Rpc\Status;

/**
 * @param string $name Format:
 *                     `projects/{project_id}/locations/{location}/instances/{instance_id}`
 */
function stop_instance_sample(string $name): void
{
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $request = (new StopInstanceRequest())
        ->setName($name);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $notebookServiceClient->stopInstance($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var Instance $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $name = '[NAME]';

    stop_instance_sample($name);
}

triggerSchedule

Triggers execution of an existing schedule.

The async variant is Google\Cloud\Notebooks\V1\Client\NotebookServiceClient::triggerScheduleAsync() .

Parameters
Name Description
request Google\Cloud\Notebooks\V1\TriggerScheduleRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;
use Google\Cloud\Notebooks\V1\Schedule;
use Google\Cloud\Notebooks\V1\TriggerScheduleRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName Format:
 *                              `parent=projects/{project_id}/locations/{location}/schedules/{schedule_id}`
 *                              Please see {@see NotebookServiceClient::scheduleName()} for help formatting this field.
 */
function trigger_schedule_sample(string $formattedName): void
{
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $request = (new TriggerScheduleRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $notebookServiceClient->triggerSchedule($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var Schedule $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = NotebookServiceClient::scheduleName('[PROJECT]', '[LOCATION]', '[SCHEDULE]');

    trigger_schedule_sample($formattedName);
}

updateInstanceConfig

Update Notebook Instance configurations.

The async variant is Google\Cloud\Notebooks\V1\Client\NotebookServiceClient::updateInstanceConfigAsync() .

Parameters
Name Description
request Google\Cloud\Notebooks\V1\UpdateInstanceConfigRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;
use Google\Cloud\Notebooks\V1\Instance;
use Google\Cloud\Notebooks\V1\UpdateInstanceConfigRequest;
use Google\Rpc\Status;

/**
 * @param string $name Format:
 *                     `projects/{project_id}/locations/{location}/instances/{instance_id}`
 */
function update_instance_config_sample(string $name): void
{
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $request = (new UpdateInstanceConfigRequest())
        ->setName($name);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $notebookServiceClient->updateInstanceConfig($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var Instance $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $name = '[NAME]';

    update_instance_config_sample($name);
}

updateInstanceMetadataItems

Add/update metadata items for an instance.

The async variant is Google\Cloud\Notebooks\V1\Client\NotebookServiceClient::updateInstanceMetadataItemsAsync() .

Parameters
Name Description
request Google\Cloud\Notebooks\V1\UpdateInstanceMetadataItemsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Cloud\Notebooks\V1\UpdateInstanceMetadataItemsResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;
use Google\Cloud\Notebooks\V1\UpdateInstanceMetadataItemsRequest;
use Google\Cloud\Notebooks\V1\UpdateInstanceMetadataItemsResponse;

/**
 * @param string $name Format:
 *                     `projects/{project_id}/locations/{location}/instances/{instance_id}`
 */
function update_instance_metadata_items_sample(string $name): void
{
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $request = (new UpdateInstanceMetadataItemsRequest())
        ->setName($name);

    // Call the API and handle any network failures.
    try {
        /** @var UpdateInstanceMetadataItemsResponse $response */
        $response = $notebookServiceClient->updateInstanceMetadataItems($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $name = '[NAME]';

    update_instance_metadata_items_sample($name);
}

updateShieldedInstanceConfig

Updates the Shielded instance configuration of a single Instance.

The async variant is Google\Cloud\Notebooks\V1\Client\NotebookServiceClient::updateShieldedInstanceConfigAsync() .

Parameters
Name Description
request Google\Cloud\Notebooks\V1\UpdateShieldedInstanceConfigRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;
use Google\Cloud\Notebooks\V1\Instance;
use Google\Cloud\Notebooks\V1\UpdateShieldedInstanceConfigRequest;
use Google\Rpc\Status;

/**
 * @param string $name Format:
 *                     `projects/{project_id}/locations/{location}/instances/{instance_id}`
 */
function update_shielded_instance_config_sample(string $name): void
{
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $request = (new UpdateShieldedInstanceConfigRequest())
        ->setName($name);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $notebookServiceClient->updateShieldedInstanceConfig($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var Instance $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $name = '[NAME]';

    update_shielded_instance_config_sample($name);
}

upgradeInstance

Upgrades a notebook instance to the latest version.

The async variant is Google\Cloud\Notebooks\V1\Client\NotebookServiceClient::upgradeInstanceAsync() .

Parameters
Name Description
request Google\Cloud\Notebooks\V1\UpgradeInstanceRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;
use Google\Cloud\Notebooks\V1\Instance;
use Google\Cloud\Notebooks\V1\UpgradeInstanceRequest;
use Google\Rpc\Status;

/**
 * @param string $name Format:
 *                     `projects/{project_id}/locations/{location}/instances/{instance_id}`
 */
function upgrade_instance_sample(string $name): void
{
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $request = (new UpgradeInstanceRequest())
        ->setName($name);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $notebookServiceClient->upgradeInstance($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var Instance $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $name = '[NAME]';

    upgrade_instance_sample($name);
}

upgradeInstanceInternal

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

The async variant is Google\Cloud\Notebooks\V1\Client\NotebookServiceClient::upgradeInstanceInternalAsync() .

Parameters
Name Description
request Google\Cloud\Notebooks\V1\UpgradeInstanceInternalRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;
use Google\Cloud\Notebooks\V1\Instance;
use Google\Cloud\Notebooks\V1\UpgradeInstanceInternalRequest;
use Google\Rpc\Status;

/**
 * @param string $name Format:
 *                     `projects/{project_id}/locations/{location}/instances/{instance_id}`
 * @param string $vmId The VM hardware token for authenticating the VM.
 *                     https://cloud.google.com/compute/docs/instances/verifying-instance-identity
 */
function upgrade_instance_internal_sample(string $name, string $vmId): void
{
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $request = (new UpgradeInstanceInternalRequest())
        ->setName($name)
        ->setVmId($vmId);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $notebookServiceClient->upgradeInstanceInternal($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var Instance $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $name = '[NAME]';
    $vmId = '[VM_ID]';

    upgrade_instance_internal_sample($name, $vmId);
}

getLocation

Gets information about a location.

The async variant is Google\Cloud\Notebooks\V1\Client\NotebookServiceClient::getLocationAsync() .

Parameters
Name Description
request Google\Cloud\Location\GetLocationRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Cloud\Location\Location
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Location\GetLocationRequest;
use Google\Cloud\Location\Location;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;

/**
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function get_location_sample(): void
{
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $request = new GetLocationRequest();

    // Call the API and handle any network failures.
    try {
        /** @var Location $response */
        $response = $notebookServiceClient->getLocation($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

listLocations

Lists information about the supported locations for this service.

The async variant is Google\Cloud\Notebooks\V1\Client\NotebookServiceClient::listLocationsAsync() .

Parameters
Name Description
request Google\Cloud\Location\ListLocationsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Location\ListLocationsRequest;
use Google\Cloud\Location\Location;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;

/**
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function list_locations_sample(): void
{
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $request = new ListLocationsRequest();

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $notebookServiceClient->listLocations($request);

        /** @var Location $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

getIamPolicy

Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.

The async variant is Google\Cloud\Notebooks\V1\Client\NotebookServiceClient::getIamPolicyAsync() .

Parameters
Name Description
request Google\Cloud\Iam\V1\GetIamPolicyRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Cloud\Iam\V1\Policy
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Iam\V1\GetIamPolicyRequest;
use Google\Cloud\Iam\V1\Policy;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;

/**
 * @param string $resource REQUIRED: The resource for which the policy is being requested.
 *                         See the operation documentation for the appropriate value for this field.
 */
function get_iam_policy_sample(string $resource): void
{
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $request = (new GetIamPolicyRequest())
        ->setResource($resource);

    // Call the API and handle any network failures.
    try {
        /** @var Policy $response */
        $response = $notebookServiceClient->getIamPolicy($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $resource = '[RESOURCE]';

    get_iam_policy_sample($resource);
}

setIamPolicy

Sets the access control policy on the specified resource. Replaces any existing policy.

Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors.

The async variant is Google\Cloud\Notebooks\V1\Client\NotebookServiceClient::setIamPolicyAsync() .

Parameters
Name Description
request Google\Cloud\Iam\V1\SetIamPolicyRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Cloud\Iam\V1\Policy
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Iam\V1\Policy;
use Google\Cloud\Iam\V1\SetIamPolicyRequest;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;

/**
 * @param string $resource REQUIRED: The resource for which the policy is being specified.
 *                         See the operation documentation for the appropriate value for this field.
 */
function set_iam_policy_sample(string $resource): void
{
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $policy = new Policy();
    $request = (new SetIamPolicyRequest())
        ->setResource($resource)
        ->setPolicy($policy);

    // Call the API and handle any network failures.
    try {
        /** @var Policy $response */
        $response = $notebookServiceClient->setIamPolicy($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $resource = '[RESOURCE]';

    set_iam_policy_sample($resource);
}

testIamPermissions

Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.

Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.

The async variant is Google\Cloud\Notebooks\V1\Client\NotebookServiceClient::testIamPermissionsAsync() .

Parameters
Name Description
request Google\Cloud\Iam\V1\TestIamPermissionsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
Type Description
Google\Cloud\Iam\V1\TestIamPermissionsResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Iam\V1\TestIamPermissionsRequest;
use Google\Cloud\Iam\V1\TestIamPermissionsResponse;
use Google\Cloud\Notebooks\V1\Client\NotebookServiceClient;

/**
 * @param string $resource           REQUIRED: The resource for which the policy detail is being requested.
 *                                   See the operation documentation for the appropriate value for this field.
 * @param string $permissionsElement The set of permissions to check for the `resource`. Permissions with
 *                                   wildcards (such as '*' or 'storage.*') are not allowed. For more
 *                                   information see
 *                                   [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
 */
function test_iam_permissions_sample(string $resource, string $permissionsElement): void
{
    // Create a client.
    $notebookServiceClient = new NotebookServiceClient();

    // Prepare the request message.
    $permissions = [$permissionsElement,];
    $request = (new TestIamPermissionsRequest())
        ->setResource($resource)
        ->setPermissions($permissions);

    // Call the API and handle any network failures.
    try {
        /** @var TestIamPermissionsResponse $response */
        $response = $notebookServiceClient->testIamPermissions($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample 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,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $resource = '[RESOURCE]';
    $permissionsElement = '[PERMISSIONS]';

    test_iam_permissions_sample($resource, $permissionsElement);
}

createEnvironmentAsync

Parameters
Name Description
request Google\Cloud\Notebooks\V1\CreateEnvironmentRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

createExecutionAsync

Parameters
Name Description
request Google\Cloud\Notebooks\V1\CreateExecutionRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

createInstanceAsync

Parameters
Name Description
request Google\Cloud\Notebooks\V1\CreateInstanceRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

createScheduleAsync

Parameters
Name Description
request Google\Cloud\Notebooks\V1\CreateScheduleRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

deleteEnvironmentAsync

Parameters
Name Description
request Google\Cloud\Notebooks\V1\DeleteEnvironmentRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

deleteExecutionAsync

Parameters
Name Description
request Google\Cloud\Notebooks\V1\DeleteExecutionRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

deleteInstanceAsync

Parameters
Name Description
request Google\Cloud\Notebooks\V1\DeleteInstanceRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

deleteScheduleAsync

Parameters
Name Description
request Google\Cloud\Notebooks\V1\DeleteScheduleRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

diagnoseInstanceAsync

Parameters
Name Description
request Google\Cloud\Notebooks\V1\DiagnoseInstanceRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

getEnvironmentAsync

Parameters
Name Description
request Google\Cloud\Notebooks\V1\GetEnvironmentRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

getExecutionAsync

Parameters
Name Description
request Google\Cloud\Notebooks\V1\GetExecutionRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

getInstanceAsync

Parameters
Name Description
request Google\Cloud\Notebooks\V1\GetInstanceRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

getInstanceHealthAsync

Parameters
Name Description
request Google\Cloud\Notebooks\V1\GetInstanceHealthRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

getScheduleAsync

Parameters
Name Description
request Google\Cloud\Notebooks\V1\GetScheduleRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

isInstanceUpgradeableAsync

Parameters
Name Description
request Google\Cloud\Notebooks\V1\IsInstanceUpgradeableRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

listEnvironmentsAsync

Parameters
Name Description
request Google\Cloud\Notebooks\V1\ListEnvironmentsRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

listExecutionsAsync

Parameters
Name Description
request Google\Cloud\Notebooks\V1\ListExecutionsRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

listInstancesAsync

Parameters
Name Description
request Google\Cloud\Notebooks\V1\ListInstancesRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

listSchedulesAsync

Parameters
Name Description
request Google\Cloud\Notebooks\V1\ListSchedulesRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

registerInstanceAsync

Parameters
Name Description
request Google\Cloud\Notebooks\V1\RegisterInstanceRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

reportInstanceInfoAsync

Parameters
Name Description
request Google\Cloud\Notebooks\V1\ReportInstanceInfoRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

resetInstanceAsync

Parameters
Name Description
request Google\Cloud\Notebooks\V1\ResetInstanceRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

rollbackInstanceAsync

Parameters
Name Description
request Google\Cloud\Notebooks\V1\RollbackInstanceRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

setInstanceAcceleratorAsync

Parameters
Name Description
request Google\Cloud\Notebooks\V1\SetInstanceAcceleratorRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

setInstanceLabelsAsync

Parameters
Name Description
request Google\Cloud\Notebooks\V1\SetInstanceLabelsRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

setInstanceMachineTypeAsync

Parameters
Name Description
request Google\Cloud\Notebooks\V1\SetInstanceMachineTypeRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

startInstanceAsync

Parameters
Name Description
request Google\Cloud\Notebooks\V1\StartInstanceRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

stopInstanceAsync

Parameters
Name Description
request Google\Cloud\Notebooks\V1\StopInstanceRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

triggerScheduleAsync

Parameters
Name Description
request Google\Cloud\Notebooks\V1\TriggerScheduleRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

updateInstanceConfigAsync

Parameters
Name Description
request Google\Cloud\Notebooks\V1\UpdateInstanceConfigRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

updateInstanceMetadataItemsAsync

Parameters
Name Description
request Google\Cloud\Notebooks\V1\UpdateInstanceMetadataItemsRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

updateShieldedInstanceConfigAsync

Parameters
Name Description
request Google\Cloud\Notebooks\V1\UpdateShieldedInstanceConfigRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

upgradeInstanceAsync

Parameters
Name Description
request Google\Cloud\Notebooks\V1\UpgradeInstanceRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

upgradeInstanceInternalAsync

Parameters
Name Description
request Google\Cloud\Notebooks\V1\UpgradeInstanceInternalRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

getLocationAsync

Parameters
Name Description
request Google\Cloud\Location\GetLocationRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

listLocationsAsync

Parameters
Name Description
request Google\Cloud\Location\ListLocationsRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

getIamPolicyAsync

Parameters
Name Description
request Google\Cloud\Iam\V1\GetIamPolicyRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

setIamPolicyAsync

Parameters
Name Description
request Google\Cloud\Iam\V1\SetIamPolicyRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

testIamPermissionsAsync

Parameters
Name Description
request Google\Cloud\Iam\V1\TestIamPermissionsRequest
optionalArgs = [] array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface

getOperationsClient

Return an OperationsClient object with the same endpoint as $this.

Returns
Type Description
Google\LongRunning\Client\OperationsClient

resumeOperation

Resume an existing long running operation that was previously started by a long running API method. If $methodName is not provided, or does not match a long running API method, then the operation can still be resumed, but the OperationResponse object will not deserialize the final response.

Parameters
Name Description
operationName string

The name of the long running operation

methodName string

The name of the method used to start the operation

Returns
Type Description
Google\ApiCore\OperationResponse

static::environmentName

Formats a string containing the fully-qualified path to represent a environment resource.

Parameters
Name Description
project string
environment string
Returns
Type Description
string The formatted environment resource.

static::executionName

Formats a string containing the fully-qualified path to represent a execution resource.

Parameters
Name Description
project string
location string
execution string
Returns
Type Description
string The formatted execution resource.

static::instanceName

Formats a string containing the fully-qualified path to represent a instance resource.

Parameters
Name Description
project string
instance string
Returns
Type Description
string The formatted instance resource.

static::scheduleName

Formats a string containing the fully-qualified path to represent a schedule resource.

Parameters
Name Description
project string
location string
schedule string
Returns
Type Description
string The formatted schedule resource.

static::tensorboardName

Formats a string containing the fully-qualified path to represent a tensorboard resource.

Parameters
Name Description
project string
location string
tensorboard string
Returns
Type Description
string The formatted tensorboard resource.

static::parseName

Parses a formatted name string and returns an associative array of the components in the name.

The following name formats are supported: Template: Pattern

  • environment: projects/{project}/environments/{environment}
  • execution: projects/{project}/location/{location}/executions/{execution}
  • instance: projects/{project}/instances/{instance}
  • schedule: projects/{project}/location/{location}/schedules/{schedule}
  • tensorboard: projects/{project}/locations/{location}/tensorboards/{tensorboard}

The optional $template argument can be supplied to specify a particular pattern, and must match one of the templates listed above. If no $template argument is provided, or if the $template argument does not match one of the templates listed, then parseName will check each of the supported templates, and return the first match.

Parameters
Name Description
formattedName string

The formatted name string

template string

Optional name of template to match

Returns
Type Description
array An associative array from name component IDs to component values.