Google Cloud Ai Platform V1 Client - Class TensorboardServiceClient (1.13.1)

Reference documentation and code samples for the Google Cloud Ai Platform V1 Client class TensorboardServiceClient.

Service Description: TensorboardService

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 \ AIPlatform \ 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.

↳ logger false|LoggerInterface

A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the 'GOOGLE_SDK_PHP_LOGGING' environment flag

batchCreateTensorboardRuns

Batch create TensorboardRuns.

The async variant is TensorboardServiceClient::batchCreateTensorboardRunsAsync() .

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\BatchCreateTensorboardRunsRequest

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\AIPlatform\V1\BatchCreateTensorboardRunsResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\BatchCreateTensorboardRunsRequest;
use Google\Cloud\AIPlatform\V1\BatchCreateTensorboardRunsResponse;
use Google\Cloud\AIPlatform\V1\Client\TensorboardServiceClient;
use Google\Cloud\AIPlatform\V1\CreateTensorboardRunRequest;
use Google\Cloud\AIPlatform\V1\TensorboardRun;

/**
 * @param string $formattedParent                   The resource name of the TensorboardExperiment to create the
 *                                                  TensorboardRuns in. Format:
 *                                                  `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}`
 *                                                  The parent field in the CreateTensorboardRunRequest messages must match
 *                                                  this field. Please see
 *                                                  {@see TensorboardServiceClient::tensorboardExperimentName()} for help formatting this field.
 * @param string $formattedRequestsParent           The resource name of the TensorboardExperiment to create the
 *                                                  TensorboardRun in. Format:
 *                                                  `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}`
 *                                                  Please see {@see TensorboardServiceClient::tensorboardRunName()} for help formatting this field.
 * @param string $requestsTensorboardRunDisplayName User provided name of this TensorboardRun.
 *                                                  This value must be unique among all TensorboardRuns
 *                                                  belonging to the same parent TensorboardExperiment.
 * @param string $requestsTensorboardRunId          The ID to use for the Tensorboard run, which becomes the final
 *                                                  component of the Tensorboard run's resource name.
 *
 *                                                  This value should be 1-128 characters, and valid characters
 *                                                  are `/[a-z][0-9]-/`.
 */
function batch_create_tensorboard_runs_sample(
    string $formattedParent,
    string $formattedRequestsParent,
    string $requestsTensorboardRunDisplayName,
    string $requestsTensorboardRunId
): void {
    // Create a client.
    $tensorboardServiceClient = new TensorboardServiceClient();

    // Prepare the request message.
    $requestsTensorboardRun = (new TensorboardRun())
        ->setDisplayName($requestsTensorboardRunDisplayName);
    $createTensorboardRunRequest = (new CreateTensorboardRunRequest())
        ->setParent($formattedRequestsParent)
        ->setTensorboardRun($requestsTensorboardRun)
        ->setTensorboardRunId($requestsTensorboardRunId);
    $requests = [$createTensorboardRunRequest,];
    $request = (new BatchCreateTensorboardRunsRequest())
        ->setParent($formattedParent)
        ->setRequests($requests);

    // Call the API and handle any network failures.
    try {
        /** @var BatchCreateTensorboardRunsResponse $response */
        $response = $tensorboardServiceClient->batchCreateTensorboardRuns($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
{
    $formattedParent = TensorboardServiceClient::tensorboardExperimentName(
        '[PROJECT]',
        '[LOCATION]',
        '[TENSORBOARD]',
        '[EXPERIMENT]'
    );
    $formattedRequestsParent = TensorboardServiceClient::tensorboardRunName(
        '[PROJECT]',
        '[LOCATION]',
        '[TENSORBOARD]',
        '[EXPERIMENT]',
        '[RUN]'
    );
    $requestsTensorboardRunDisplayName = '[DISPLAY_NAME]';
    $requestsTensorboardRunId = '[TENSORBOARD_RUN_ID]';

    batch_create_tensorboard_runs_sample(
        $formattedParent,
        $formattedRequestsParent,
        $requestsTensorboardRunDisplayName,
        $requestsTensorboardRunId
    );
}

batchCreateTensorboardTimeSeries

Batch create TensorboardTimeSeries that belong to a TensorboardExperiment.

The async variant is TensorboardServiceClient::batchCreateTensorboardTimeSeriesAsync() .

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\BatchCreateTensorboardTimeSeriesRequest

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\AIPlatform\V1\BatchCreateTensorboardTimeSeriesResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\BatchCreateTensorboardTimeSeriesRequest;
use Google\Cloud\AIPlatform\V1\BatchCreateTensorboardTimeSeriesResponse;
use Google\Cloud\AIPlatform\V1\Client\TensorboardServiceClient;
use Google\Cloud\AIPlatform\V1\CreateTensorboardTimeSeriesRequest;
use Google\Cloud\AIPlatform\V1\TensorboardTimeSeries;
use Google\Cloud\AIPlatform\V1\TensorboardTimeSeries\ValueType;

/**
 * @param string $formattedParent                          The resource name of the TensorboardExperiment to create the
 *                                                         TensorboardTimeSeries in.
 *                                                         Format:
 *                                                         `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}`
 *                                                         The TensorboardRuns referenced by the parent fields in the
 *                                                         CreateTensorboardTimeSeriesRequest messages must be sub resources of this
 *                                                         TensorboardExperiment. Please see
 *                                                         {@see TensorboardServiceClient::tensorboardExperimentName()} for help formatting this field.
 * @param string $formattedRequestsParent                  The resource name of the TensorboardRun to create the
 *                                                         TensorboardTimeSeries in.
 *                                                         Format:
 *                                                         `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}`
 *                                                         Please see {@see TensorboardServiceClient::tensorboardTimeSeriesName()} for help formatting this field.
 * @param string $requestsTensorboardTimeSeriesDisplayName User provided name of this TensorboardTimeSeries.
 *                                                         This value should be unique among all TensorboardTimeSeries resources
 *                                                         belonging to the same TensorboardRun resource (parent resource).
 * @param int    $requestsTensorboardTimeSeriesValueType   Immutable. Type of TensorboardTimeSeries value.
 */
function batch_create_tensorboard_time_series_sample(
    string $formattedParent,
    string $formattedRequestsParent,
    string $requestsTensorboardTimeSeriesDisplayName,
    int $requestsTensorboardTimeSeriesValueType
): void {
    // Create a client.
    $tensorboardServiceClient = new TensorboardServiceClient();

    // Prepare the request message.
    $requestsTensorboardTimeSeries = (new TensorboardTimeSeries())
        ->setDisplayName($requestsTensorboardTimeSeriesDisplayName)
        ->setValueType($requestsTensorboardTimeSeriesValueType);
    $createTensorboardTimeSeriesRequest = (new CreateTensorboardTimeSeriesRequest())
        ->setParent($formattedRequestsParent)
        ->setTensorboardTimeSeries($requestsTensorboardTimeSeries);
    $requests = [$createTensorboardTimeSeriesRequest,];
    $request = (new BatchCreateTensorboardTimeSeriesRequest())
        ->setParent($formattedParent)
        ->setRequests($requests);

    // Call the API and handle any network failures.
    try {
        /** @var BatchCreateTensorboardTimeSeriesResponse $response */
        $response = $tensorboardServiceClient->batchCreateTensorboardTimeSeries($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
{
    $formattedParent = TensorboardServiceClient::tensorboardExperimentName(
        '[PROJECT]',
        '[LOCATION]',
        '[TENSORBOARD]',
        '[EXPERIMENT]'
    );
    $formattedRequestsParent = TensorboardServiceClient::tensorboardTimeSeriesName(
        '[PROJECT]',
        '[LOCATION]',
        '[TENSORBOARD]',
        '[EXPERIMENT]',
        '[RUN]',
        '[TIME_SERIES]'
    );
    $requestsTensorboardTimeSeriesDisplayName = '[DISPLAY_NAME]';
    $requestsTensorboardTimeSeriesValueType = ValueType::VALUE_TYPE_UNSPECIFIED;

    batch_create_tensorboard_time_series_sample(
        $formattedParent,
        $formattedRequestsParent,
        $requestsTensorboardTimeSeriesDisplayName,
        $requestsTensorboardTimeSeriesValueType
    );
}

batchReadTensorboardTimeSeriesData

Reads multiple TensorboardTimeSeries' data. The data point number limit is 1000 for scalars, 100 for tensors and blob references. If the number of data points stored is less than the limit, all data is returned.

Otherwise, the number limit of data points is randomly selected from this time series and returned.

The async variant is TensorboardServiceClient::batchReadTensorboardTimeSeriesDataAsync() .

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\BatchReadTensorboardTimeSeriesDataRequest

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\AIPlatform\V1\BatchReadTensorboardTimeSeriesDataResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\BatchReadTensorboardTimeSeriesDataRequest;
use Google\Cloud\AIPlatform\V1\BatchReadTensorboardTimeSeriesDataResponse;
use Google\Cloud\AIPlatform\V1\Client\TensorboardServiceClient;

/**
 * @param string $formattedTensorboard       The resource name of the Tensorboard containing
 *                                           TensorboardTimeSeries to read data from. Format:
 *                                           `projects/{project}/locations/{location}/tensorboards/{tensorboard}`.
 *                                           The TensorboardTimeSeries referenced by
 *                                           [time_series][google.cloud.aiplatform.v1.BatchReadTensorboardTimeSeriesDataRequest.time_series]
 *                                           must be sub resources of this Tensorboard. Please see
 *                                           {@see TensorboardServiceClient::tensorboardName()} for help formatting this field.
 * @param string $formattedTimeSeriesElement The resource names of the TensorboardTimeSeries to read data
 *                                           from. Format:
 *                                           `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}/timeSeries/{time_series}`
 *                                           Please see {@see TensorboardServiceClient::tensorboardTimeSeriesName()} for help formatting this field.
 */
function batch_read_tensorboard_time_series_data_sample(
    string $formattedTensorboard,
    string $formattedTimeSeriesElement
): void {
    // Create a client.
    $tensorboardServiceClient = new TensorboardServiceClient();

    // Prepare the request message.
    $formattedTimeSeries = [$formattedTimeSeriesElement,];
    $request = (new BatchReadTensorboardTimeSeriesDataRequest())
        ->setTensorboard($formattedTensorboard)
        ->setTimeSeries($formattedTimeSeries);

    // Call the API and handle any network failures.
    try {
        /** @var BatchReadTensorboardTimeSeriesDataResponse $response */
        $response = $tensorboardServiceClient->batchReadTensorboardTimeSeriesData($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
{
    $formattedTensorboard = TensorboardServiceClient::tensorboardName(
        '[PROJECT]',
        '[LOCATION]',
        '[TENSORBOARD]'
    );
    $formattedTimeSeriesElement = TensorboardServiceClient::tensorboardTimeSeriesName(
        '[PROJECT]',
        '[LOCATION]',
        '[TENSORBOARD]',
        '[EXPERIMENT]',
        '[RUN]',
        '[TIME_SERIES]'
    );

    batch_read_tensorboard_time_series_data_sample($formattedTensorboard, $formattedTimeSeriesElement);
}

createTensorboard

Creates a Tensorboard.

The async variant is TensorboardServiceClient::createTensorboardAsync() .

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\CreateTensorboardRequest

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\AIPlatform\V1\Client\TensorboardServiceClient;
use Google\Cloud\AIPlatform\V1\CreateTensorboardRequest;
use Google\Cloud\AIPlatform\V1\Tensorboard;
use Google\Rpc\Status;

/**
 * @param string $formattedParent        The resource name of the Location to create the Tensorboard in.
 *                                       Format: `projects/{project}/locations/{location}`
 *                                       Please see {@see TensorboardServiceClient::tensorboardName()} for help formatting this field.
 * @param string $tensorboardDisplayName User provided name of this Tensorboard.
 */
function create_tensorboard_sample(string $formattedParent, string $tensorboardDisplayName): void
{
    // Create a client.
    $tensorboardServiceClient = new TensorboardServiceClient();

    // Prepare the request message.
    $tensorboard = (new Tensorboard())
        ->setDisplayName($tensorboardDisplayName);
    $request = (new CreateTensorboardRequest())
        ->setParent($formattedParent)
        ->setTensorboard($tensorboard);

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

        if ($response->operationSucceeded()) {
            /** @var Tensorboard $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 = TensorboardServiceClient::tensorboardName(
        '[PROJECT]',
        '[LOCATION]',
        '[TENSORBOARD]'
    );
    $tensorboardDisplayName = '[DISPLAY_NAME]';

    create_tensorboard_sample($formattedParent, $tensorboardDisplayName);
}

createTensorboardExperiment

Creates a TensorboardExperiment.

The async variant is TensorboardServiceClient::createTensorboardExperimentAsync() .

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\CreateTensorboardExperimentRequest

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\AIPlatform\V1\TensorboardExperiment
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\TensorboardServiceClient;
use Google\Cloud\AIPlatform\V1\CreateTensorboardExperimentRequest;
use Google\Cloud\AIPlatform\V1\TensorboardExperiment;

/**
 * @param string $formattedParent         The resource name of the Tensorboard to create the
 *                                        TensorboardExperiment in. Format:
 *                                        `projects/{project}/locations/{location}/tensorboards/{tensorboard}`
 *                                        Please see {@see TensorboardServiceClient::tensorboardExperimentName()} for help formatting this field.
 * @param string $tensorboardExperimentId The ID to use for the Tensorboard experiment, which becomes the
 *                                        final component of the Tensorboard experiment's resource name.
 *
 *                                        This value should be 1-128 characters, and valid characters
 *                                        are `/[a-z][0-9]-/`.
 */
function create_tensorboard_experiment_sample(
    string $formattedParent,
    string $tensorboardExperimentId
): void {
    // Create a client.
    $tensorboardServiceClient = new TensorboardServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var TensorboardExperiment $response */
        $response = $tensorboardServiceClient->createTensorboardExperiment($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
{
    $formattedParent = TensorboardServiceClient::tensorboardExperimentName(
        '[PROJECT]',
        '[LOCATION]',
        '[TENSORBOARD]',
        '[EXPERIMENT]'
    );
    $tensorboardExperimentId = '[TENSORBOARD_EXPERIMENT_ID]';

    create_tensorboard_experiment_sample($formattedParent, $tensorboardExperimentId);
}

createTensorboardRun

Creates a TensorboardRun.

The async variant is TensorboardServiceClient::createTensorboardRunAsync() .

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\CreateTensorboardRunRequest

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\AIPlatform\V1\TensorboardRun
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\TensorboardServiceClient;
use Google\Cloud\AIPlatform\V1\CreateTensorboardRunRequest;
use Google\Cloud\AIPlatform\V1\TensorboardRun;

/**
 * @param string $formattedParent           The resource name of the TensorboardExperiment to create the
 *                                          TensorboardRun in. Format:
 *                                          `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}`
 *                                          Please see {@see TensorboardServiceClient::tensorboardRunName()} for help formatting this field.
 * @param string $tensorboardRunDisplayName User provided name of this TensorboardRun.
 *                                          This value must be unique among all TensorboardRuns
 *                                          belonging to the same parent TensorboardExperiment.
 * @param string $tensorboardRunId          The ID to use for the Tensorboard run, which becomes the final
 *                                          component of the Tensorboard run's resource name.
 *
 *                                          This value should be 1-128 characters, and valid characters
 *                                          are `/[a-z][0-9]-/`.
 */
function create_tensorboard_run_sample(
    string $formattedParent,
    string $tensorboardRunDisplayName,
    string $tensorboardRunId
): void {
    // Create a client.
    $tensorboardServiceClient = new TensorboardServiceClient();

    // Prepare the request message.
    $tensorboardRun = (new TensorboardRun())
        ->setDisplayName($tensorboardRunDisplayName);
    $request = (new CreateTensorboardRunRequest())
        ->setParent($formattedParent)
        ->setTensorboardRun($tensorboardRun)
        ->setTensorboardRunId($tensorboardRunId);

    // Call the API and handle any network failures.
    try {
        /** @var TensorboardRun $response */
        $response = $tensorboardServiceClient->createTensorboardRun($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
{
    $formattedParent = TensorboardServiceClient::tensorboardRunName(
        '[PROJECT]',
        '[LOCATION]',
        '[TENSORBOARD]',
        '[EXPERIMENT]',
        '[RUN]'
    );
    $tensorboardRunDisplayName = '[DISPLAY_NAME]';
    $tensorboardRunId = '[TENSORBOARD_RUN_ID]';

    create_tensorboard_run_sample($formattedParent, $tensorboardRunDisplayName, $tensorboardRunId);
}

createTensorboardTimeSeries

Creates a TensorboardTimeSeries.

The async variant is TensorboardServiceClient::createTensorboardTimeSeriesAsync() .

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\CreateTensorboardTimeSeriesRequest

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\AIPlatform\V1\TensorboardTimeSeries
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\TensorboardServiceClient;
use Google\Cloud\AIPlatform\V1\CreateTensorboardTimeSeriesRequest;
use Google\Cloud\AIPlatform\V1\TensorboardTimeSeries;
use Google\Cloud\AIPlatform\V1\TensorboardTimeSeries\ValueType;

/**
 * @param string $formattedParent                  The resource name of the TensorboardRun to create the
 *                                                 TensorboardTimeSeries in.
 *                                                 Format:
 *                                                 `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}`
 *                                                 Please see {@see TensorboardServiceClient::tensorboardTimeSeriesName()} for help formatting this field.
 * @param string $tensorboardTimeSeriesDisplayName User provided name of this TensorboardTimeSeries.
 *                                                 This value should be unique among all TensorboardTimeSeries resources
 *                                                 belonging to the same TensorboardRun resource (parent resource).
 * @param int    $tensorboardTimeSeriesValueType   Immutable. Type of TensorboardTimeSeries value.
 */
function create_tensorboard_time_series_sample(
    string $formattedParent,
    string $tensorboardTimeSeriesDisplayName,
    int $tensorboardTimeSeriesValueType
): void {
    // Create a client.
    $tensorboardServiceClient = new TensorboardServiceClient();

    // Prepare the request message.
    $tensorboardTimeSeries = (new TensorboardTimeSeries())
        ->setDisplayName($tensorboardTimeSeriesDisplayName)
        ->setValueType($tensorboardTimeSeriesValueType);
    $request = (new CreateTensorboardTimeSeriesRequest())
        ->setParent($formattedParent)
        ->setTensorboardTimeSeries($tensorboardTimeSeries);

    // Call the API and handle any network failures.
    try {
        /** @var TensorboardTimeSeries $response */
        $response = $tensorboardServiceClient->createTensorboardTimeSeries($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
{
    $formattedParent = TensorboardServiceClient::tensorboardTimeSeriesName(
        '[PROJECT]',
        '[LOCATION]',
        '[TENSORBOARD]',
        '[EXPERIMENT]',
        '[RUN]',
        '[TIME_SERIES]'
    );
    $tensorboardTimeSeriesDisplayName = '[DISPLAY_NAME]';
    $tensorboardTimeSeriesValueType = ValueType::VALUE_TYPE_UNSPECIFIED;

    create_tensorboard_time_series_sample(
        $formattedParent,
        $tensorboardTimeSeriesDisplayName,
        $tensorboardTimeSeriesValueType
    );
}

deleteTensorboard

Deletes a Tensorboard.

The async variant is TensorboardServiceClient::deleteTensorboardAsync() .

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\DeleteTensorboardRequest

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\AIPlatform\V1\Client\TensorboardServiceClient;
use Google\Cloud\AIPlatform\V1\DeleteTensorboardRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the Tensorboard to be deleted.
 *                              Format:
 *                              `projects/{project}/locations/{location}/tensorboards/{tensorboard}`
 *                              Please see {@see TensorboardServiceClient::tensorboardName()} for help formatting this field.
 */
function delete_tensorboard_sample(string $formattedName): void
{
    // Create a client.
    $tensorboardServiceClient = new TensorboardServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $tensorboardServiceClient->deleteTensorboard($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 = TensorboardServiceClient::tensorboardName(
        '[PROJECT]',
        '[LOCATION]',
        '[TENSORBOARD]'
    );

    delete_tensorboard_sample($formattedName);
}

deleteTensorboardExperiment

Deletes a TensorboardExperiment.

The async variant is TensorboardServiceClient::deleteTensorboardExperimentAsync() .

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\DeleteTensorboardExperimentRequest

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\AIPlatform\V1\Client\TensorboardServiceClient;
use Google\Cloud\AIPlatform\V1\DeleteTensorboardExperimentRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the TensorboardExperiment to be deleted.
 *                              Format:
 *                              `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}`
 *                              Please see {@see TensorboardServiceClient::tensorboardExperimentName()} for help formatting this field.
 */
function delete_tensorboard_experiment_sample(string $formattedName): void
{
    // Create a client.
    $tensorboardServiceClient = new TensorboardServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $tensorboardServiceClient->deleteTensorboardExperiment($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 = TensorboardServiceClient::tensorboardExperimentName(
        '[PROJECT]',
        '[LOCATION]',
        '[TENSORBOARD]',
        '[EXPERIMENT]'
    );

    delete_tensorboard_experiment_sample($formattedName);
}

deleteTensorboardRun

Deletes a TensorboardRun.

The async variant is TensorboardServiceClient::deleteTensorboardRunAsync() .

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\DeleteTensorboardRunRequest

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\AIPlatform\V1\Client\TensorboardServiceClient;
use Google\Cloud\AIPlatform\V1\DeleteTensorboardRunRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the TensorboardRun to be deleted.
 *                              Format:
 *                              `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}`
 *                              Please see {@see TensorboardServiceClient::tensorboardRunName()} for help formatting this field.
 */
function delete_tensorboard_run_sample(string $formattedName): void
{
    // Create a client.
    $tensorboardServiceClient = new TensorboardServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $tensorboardServiceClient->deleteTensorboardRun($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 = TensorboardServiceClient::tensorboardRunName(
        '[PROJECT]',
        '[LOCATION]',
        '[TENSORBOARD]',
        '[EXPERIMENT]',
        '[RUN]'
    );

    delete_tensorboard_run_sample($formattedName);
}

deleteTensorboardTimeSeries

Deletes a TensorboardTimeSeries.

The async variant is TensorboardServiceClient::deleteTensorboardTimeSeriesAsync() .

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\DeleteTensorboardTimeSeriesRequest

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\AIPlatform\V1\Client\TensorboardServiceClient;
use Google\Cloud\AIPlatform\V1\DeleteTensorboardTimeSeriesRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the TensorboardTimeSeries to be deleted.
 *                              Format:
 *                              `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}/timeSeries/{time_series}`
 *                              Please see {@see TensorboardServiceClient::tensorboardTimeSeriesName()} for help formatting this field.
 */
function delete_tensorboard_time_series_sample(string $formattedName): void
{
    // Create a client.
    $tensorboardServiceClient = new TensorboardServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $tensorboardServiceClient->deleteTensorboardTimeSeries($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 = TensorboardServiceClient::tensorboardTimeSeriesName(
        '[PROJECT]',
        '[LOCATION]',
        '[TENSORBOARD]',
        '[EXPERIMENT]',
        '[RUN]',
        '[TIME_SERIES]'
    );

    delete_tensorboard_time_series_sample($formattedName);
}

exportTensorboardTimeSeriesData

Exports a TensorboardTimeSeries' data. Data is returned in paginated responses.

The async variant is TensorboardServiceClient::exportTensorboardTimeSeriesDataAsync() .

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\ExportTensorboardTimeSeriesDataRequest

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\AIPlatform\V1\Client\TensorboardServiceClient;
use Google\Cloud\AIPlatform\V1\ExportTensorboardTimeSeriesDataRequest;
use Google\Cloud\AIPlatform\V1\TimeSeriesDataPoint;

/**
 * @param string $formattedTensorboardTimeSeries The resource name of the TensorboardTimeSeries to export data
 *                                               from. Format:
 *                                               `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}/timeSeries/{time_series}`
 *                                               Please see {@see TensorboardServiceClient::tensorboardTimeSeriesName()} for help formatting this field.
 */
function export_tensorboard_time_series_data_sample(string $formattedTensorboardTimeSeries): void
{
    // Create a client.
    $tensorboardServiceClient = new TensorboardServiceClient();

    // Prepare the request message.
    $request = (new ExportTensorboardTimeSeriesDataRequest())
        ->setTensorboardTimeSeries($formattedTensorboardTimeSeries);

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

        /** @var TimeSeriesDataPoint $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
{
    $formattedTensorboardTimeSeries = TensorboardServiceClient::tensorboardTimeSeriesName(
        '[PROJECT]',
        '[LOCATION]',
        '[TENSORBOARD]',
        '[EXPERIMENT]',
        '[RUN]',
        '[TIME_SERIES]'
    );

    export_tensorboard_time_series_data_sample($formattedTensorboardTimeSeries);
}

getTensorboard

Gets a Tensorboard.

The async variant is TensorboardServiceClient::getTensorboardAsync() .

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\GetTensorboardRequest

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\AIPlatform\V1\Tensorboard
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\TensorboardServiceClient;
use Google\Cloud\AIPlatform\V1\GetTensorboardRequest;
use Google\Cloud\AIPlatform\V1\Tensorboard;

/**
 * @param string $formattedName The name of the Tensorboard resource.
 *                              Format:
 *                              `projects/{project}/locations/{location}/tensorboards/{tensorboard}`
 *                              Please see {@see TensorboardServiceClient::tensorboardName()} for help formatting this field.
 */
function get_tensorboard_sample(string $formattedName): void
{
    // Create a client.
    $tensorboardServiceClient = new TensorboardServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Tensorboard $response */
        $response = $tensorboardServiceClient->getTensorboard($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 = TensorboardServiceClient::tensorboardName(
        '[PROJECT]',
        '[LOCATION]',
        '[TENSORBOARD]'
    );

    get_tensorboard_sample($formattedName);
}

getTensorboardExperiment

Gets a TensorboardExperiment.

The async variant is TensorboardServiceClient::getTensorboardExperimentAsync() .

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\GetTensorboardExperimentRequest

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\AIPlatform\V1\TensorboardExperiment
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\TensorboardServiceClient;
use Google\Cloud\AIPlatform\V1\GetTensorboardExperimentRequest;
use Google\Cloud\AIPlatform\V1\TensorboardExperiment;

/**
 * @param string $formattedName The name of the TensorboardExperiment resource.
 *                              Format:
 *                              `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}`
 *                              Please see {@see TensorboardServiceClient::tensorboardExperimentName()} for help formatting this field.
 */
function get_tensorboard_experiment_sample(string $formattedName): void
{
    // Create a client.
    $tensorboardServiceClient = new TensorboardServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var TensorboardExperiment $response */
        $response = $tensorboardServiceClient->getTensorboardExperiment($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 = TensorboardServiceClient::tensorboardExperimentName(
        '[PROJECT]',
        '[LOCATION]',
        '[TENSORBOARD]',
        '[EXPERIMENT]'
    );

    get_tensorboard_experiment_sample($formattedName);
}

getTensorboardRun

Gets a TensorboardRun.

The async variant is TensorboardServiceClient::getTensorboardRunAsync() .

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\GetTensorboardRunRequest

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\AIPlatform\V1\TensorboardRun
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\TensorboardServiceClient;
use Google\Cloud\AIPlatform\V1\GetTensorboardRunRequest;
use Google\Cloud\AIPlatform\V1\TensorboardRun;

/**
 * @param string $formattedName The name of the TensorboardRun resource.
 *                              Format:
 *                              `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}`
 *                              Please see {@see TensorboardServiceClient::tensorboardRunName()} for help formatting this field.
 */
function get_tensorboard_run_sample(string $formattedName): void
{
    // Create a client.
    $tensorboardServiceClient = new TensorboardServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var TensorboardRun $response */
        $response = $tensorboardServiceClient->getTensorboardRun($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 = TensorboardServiceClient::tensorboardRunName(
        '[PROJECT]',
        '[LOCATION]',
        '[TENSORBOARD]',
        '[EXPERIMENT]',
        '[RUN]'
    );

    get_tensorboard_run_sample($formattedName);
}

getTensorboardTimeSeries

Gets a TensorboardTimeSeries.

The async variant is TensorboardServiceClient::getTensorboardTimeSeriesAsync() .

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\GetTensorboardTimeSeriesRequest

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\AIPlatform\V1\TensorboardTimeSeries
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\TensorboardServiceClient;
use Google\Cloud\AIPlatform\V1\GetTensorboardTimeSeriesRequest;
use Google\Cloud\AIPlatform\V1\TensorboardTimeSeries;

/**
 * @param string $formattedName The name of the TensorboardTimeSeries resource.
 *                              Format:
 *                              `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}/timeSeries/{time_series}`
 *                              Please see {@see TensorboardServiceClient::tensorboardTimeSeriesName()} for help formatting this field.
 */
function get_tensorboard_time_series_sample(string $formattedName): void
{
    // Create a client.
    $tensorboardServiceClient = new TensorboardServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var TensorboardTimeSeries $response */
        $response = $tensorboardServiceClient->getTensorboardTimeSeries($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 = TensorboardServiceClient::tensorboardTimeSeriesName(
        '[PROJECT]',
        '[LOCATION]',
        '[TENSORBOARD]',
        '[EXPERIMENT]',
        '[RUN]',
        '[TIME_SERIES]'
    );

    get_tensorboard_time_series_sample($formattedName);
}

listTensorboardExperiments

Lists TensorboardExperiments in a Location.

The async variant is TensorboardServiceClient::listTensorboardExperimentsAsync() .

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\ListTensorboardExperimentsRequest

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\AIPlatform\V1\Client\TensorboardServiceClient;
use Google\Cloud\AIPlatform\V1\ListTensorboardExperimentsRequest;
use Google\Cloud\AIPlatform\V1\TensorboardExperiment;

/**
 * @param string $formattedParent The resource name of the Tensorboard to list
 *                                TensorboardExperiments. Format:
 *                                `projects/{project}/locations/{location}/tensorboards/{tensorboard}`
 *                                Please see {@see TensorboardServiceClient::tensorboardName()} for help formatting this field.
 */
function list_tensorboard_experiments_sample(string $formattedParent): void
{
    // Create a client.
    $tensorboardServiceClient = new TensorboardServiceClient();

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

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

        /** @var TensorboardExperiment $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 = TensorboardServiceClient::tensorboardName(
        '[PROJECT]',
        '[LOCATION]',
        '[TENSORBOARD]'
    );

    list_tensorboard_experiments_sample($formattedParent);
}

listTensorboardRuns

Lists TensorboardRuns in a Location.

The async variant is TensorboardServiceClient::listTensorboardRunsAsync() .

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\ListTensorboardRunsRequest

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\AIPlatform\V1\Client\TensorboardServiceClient;
use Google\Cloud\AIPlatform\V1\ListTensorboardRunsRequest;
use Google\Cloud\AIPlatform\V1\TensorboardRun;

/**
 * @param string $formattedParent The resource name of the TensorboardExperiment to list
 *                                TensorboardRuns. Format:
 *                                `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}`
 *                                Please see {@see TensorboardServiceClient::tensorboardExperimentName()} for help formatting this field.
 */
function list_tensorboard_runs_sample(string $formattedParent): void
{
    // Create a client.
    $tensorboardServiceClient = new TensorboardServiceClient();

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

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

        /** @var TensorboardRun $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 = TensorboardServiceClient::tensorboardExperimentName(
        '[PROJECT]',
        '[LOCATION]',
        '[TENSORBOARD]',
        '[EXPERIMENT]'
    );

    list_tensorboard_runs_sample($formattedParent);
}

listTensorboardTimeSeries

Lists TensorboardTimeSeries in a Location.

The async variant is TensorboardServiceClient::listTensorboardTimeSeriesAsync() .

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\ListTensorboardTimeSeriesRequest

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\AIPlatform\V1\Client\TensorboardServiceClient;
use Google\Cloud\AIPlatform\V1\ListTensorboardTimeSeriesRequest;
use Google\Cloud\AIPlatform\V1\TensorboardTimeSeries;

/**
 * @param string $formattedParent The resource name of the TensorboardRun to list
 *                                TensorboardTimeSeries. Format:
 *                                `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}`
 *                                Please see {@see TensorboardServiceClient::tensorboardRunName()} for help formatting this field.
 */
function list_tensorboard_time_series_sample(string $formattedParent): void
{
    // Create a client.
    $tensorboardServiceClient = new TensorboardServiceClient();

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

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

        /** @var TensorboardTimeSeries $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 = TensorboardServiceClient::tensorboardRunName(
        '[PROJECT]',
        '[LOCATION]',
        '[TENSORBOARD]',
        '[EXPERIMENT]',
        '[RUN]'
    );

    list_tensorboard_time_series_sample($formattedParent);
}

listTensorboards

Lists Tensorboards in a Location.

The async variant is TensorboardServiceClient::listTensorboardsAsync() .

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\ListTensorboardsRequest

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\AIPlatform\V1\Client\TensorboardServiceClient;
use Google\Cloud\AIPlatform\V1\ListTensorboardsRequest;
use Google\Cloud\AIPlatform\V1\Tensorboard;

/**
 * @param string $formattedParent The resource name of the Location to list Tensorboards.
 *                                Format:
 *                                `projects/{project}/locations/{location}`
 *                                Please see {@see TensorboardServiceClient::locationName()} for help formatting this field.
 */
function list_tensorboards_sample(string $formattedParent): void
{
    // Create a client.
    $tensorboardServiceClient = new TensorboardServiceClient();

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

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

        /** @var Tensorboard $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 = TensorboardServiceClient::locationName('[PROJECT]', '[LOCATION]');

    list_tensorboards_sample($formattedParent);
}

readTensorboardBlobData

Gets bytes of TensorboardBlobs.

This is to allow reading blob data stored in consumer project's Cloud Storage bucket without users having to obtain Cloud Storage access permission.

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\ReadTensorboardBlobDataRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ timeoutMillis int

Timeout to use for this call.

Returns
Type Description
Google\ApiCore\ServerStream
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\ServerStream;
use Google\Cloud\AIPlatform\V1\Client\TensorboardServiceClient;
use Google\Cloud\AIPlatform\V1\ReadTensorboardBlobDataRequest;
use Google\Cloud\AIPlatform\V1\ReadTensorboardBlobDataResponse;

/**
 * @param string $formattedTimeSeries The resource name of the TensorboardTimeSeries to list Blobs.
 *                                    Format:
 *                                    `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}/timeSeries/{time_series}`
 *                                    Please see {@see TensorboardServiceClient::tensorboardTimeSeriesName()} for help formatting this field.
 */
function read_tensorboard_blob_data_sample(string $formattedTimeSeries): void
{
    // Create a client.
    $tensorboardServiceClient = new TensorboardServiceClient();

    // Prepare the request message.
    $request = (new ReadTensorboardBlobDataRequest())
        ->setTimeSeries($formattedTimeSeries);

    // Call the API and handle any network failures.
    try {
        /** @var ServerStream $stream */
        $stream = $tensorboardServiceClient->readTensorboardBlobData($request);

        /** @var ReadTensorboardBlobDataResponse $element */
        foreach ($stream->readAll() 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
{
    $formattedTimeSeries = TensorboardServiceClient::tensorboardTimeSeriesName(
        '[PROJECT]',
        '[LOCATION]',
        '[TENSORBOARD]',
        '[EXPERIMENT]',
        '[RUN]',
        '[TIME_SERIES]'
    );

    read_tensorboard_blob_data_sample($formattedTimeSeries);
}

readTensorboardSize

Returns the storage size for a given TensorBoard instance.

The async variant is TensorboardServiceClient::readTensorboardSizeAsync() .

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\ReadTensorboardSizeRequest

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\AIPlatform\V1\ReadTensorboardSizeResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\TensorboardServiceClient;
use Google\Cloud\AIPlatform\V1\ReadTensorboardSizeRequest;
use Google\Cloud\AIPlatform\V1\ReadTensorboardSizeResponse;

/**
 * @param string $formattedTensorboard The name of the Tensorboard resource.
 *                                     Format:
 *                                     `projects/{project}/locations/{location}/tensorboards/{tensorboard}`
 *                                     Please see {@see TensorboardServiceClient::tensorboardName()} for help formatting this field.
 */
function read_tensorboard_size_sample(string $formattedTensorboard): void
{
    // Create a client.
    $tensorboardServiceClient = new TensorboardServiceClient();

    // Prepare the request message.
    $request = (new ReadTensorboardSizeRequest())
        ->setTensorboard($formattedTensorboard);

    // Call the API and handle any network failures.
    try {
        /** @var ReadTensorboardSizeResponse $response */
        $response = $tensorboardServiceClient->readTensorboardSize($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
{
    $formattedTensorboard = TensorboardServiceClient::tensorboardName(
        '[PROJECT]',
        '[LOCATION]',
        '[TENSORBOARD]'
    );

    read_tensorboard_size_sample($formattedTensorboard);
}

readTensorboardTimeSeriesData

Reads a TensorboardTimeSeries' data. By default, if the number of data points stored is less than 1000, all data is returned. Otherwise, 1000 data points is randomly selected from this time series and returned.

This value can be changed by changing max_data_points, which can't be greater than 10k.

The async variant is TensorboardServiceClient::readTensorboardTimeSeriesDataAsync() .

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\ReadTensorboardTimeSeriesDataRequest

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\AIPlatform\V1\ReadTensorboardTimeSeriesDataResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\TensorboardServiceClient;
use Google\Cloud\AIPlatform\V1\ReadTensorboardTimeSeriesDataRequest;
use Google\Cloud\AIPlatform\V1\ReadTensorboardTimeSeriesDataResponse;

/**
 * @param string $formattedTensorboardTimeSeries The resource name of the TensorboardTimeSeries to read data from.
 *                                               Format:
 *                                               `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}/timeSeries/{time_series}`
 *                                               Please see {@see TensorboardServiceClient::tensorboardTimeSeriesName()} for help formatting this field.
 */
function read_tensorboard_time_series_data_sample(string $formattedTensorboardTimeSeries): void
{
    // Create a client.
    $tensorboardServiceClient = new TensorboardServiceClient();

    // Prepare the request message.
    $request = (new ReadTensorboardTimeSeriesDataRequest())
        ->setTensorboardTimeSeries($formattedTensorboardTimeSeries);

    // Call the API and handle any network failures.
    try {
        /** @var ReadTensorboardTimeSeriesDataResponse $response */
        $response = $tensorboardServiceClient->readTensorboardTimeSeriesData($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
{
    $formattedTensorboardTimeSeries = TensorboardServiceClient::tensorboardTimeSeriesName(
        '[PROJECT]',
        '[LOCATION]',
        '[TENSORBOARD]',
        '[EXPERIMENT]',
        '[RUN]',
        '[TIME_SERIES]'
    );

    read_tensorboard_time_series_data_sample($formattedTensorboardTimeSeries);
}

readTensorboardUsage

Returns a list of monthly active users for a given TensorBoard instance.

The async variant is TensorboardServiceClient::readTensorboardUsageAsync() .

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\ReadTensorboardUsageRequest

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\AIPlatform\V1\ReadTensorboardUsageResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\TensorboardServiceClient;
use Google\Cloud\AIPlatform\V1\ReadTensorboardUsageRequest;
use Google\Cloud\AIPlatform\V1\ReadTensorboardUsageResponse;

/**
 * @param string $formattedTensorboard The name of the Tensorboard resource.
 *                                     Format:
 *                                     `projects/{project}/locations/{location}/tensorboards/{tensorboard}`
 *                                     Please see {@see TensorboardServiceClient::tensorboardName()} for help formatting this field.
 */
function read_tensorboard_usage_sample(string $formattedTensorboard): void
{
    // Create a client.
    $tensorboardServiceClient = new TensorboardServiceClient();

    // Prepare the request message.
    $request = (new ReadTensorboardUsageRequest())
        ->setTensorboard($formattedTensorboard);

    // Call the API and handle any network failures.
    try {
        /** @var ReadTensorboardUsageResponse $response */
        $response = $tensorboardServiceClient->readTensorboardUsage($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
{
    $formattedTensorboard = TensorboardServiceClient::tensorboardName(
        '[PROJECT]',
        '[LOCATION]',
        '[TENSORBOARD]'
    );

    read_tensorboard_usage_sample($formattedTensorboard);
}

updateTensorboard

Updates a Tensorboard.

The async variant is TensorboardServiceClient::updateTensorboardAsync() .

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\UpdateTensorboardRequest

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\AIPlatform\V1\Client\TensorboardServiceClient;
use Google\Cloud\AIPlatform\V1\Tensorboard;
use Google\Cloud\AIPlatform\V1\UpdateTensorboardRequest;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;

/**
 * @param string $tensorboardDisplayName User provided name of this Tensorboard.
 */
function update_tensorboard_sample(string $tensorboardDisplayName): void
{
    // Create a client.
    $tensorboardServiceClient = new TensorboardServiceClient();

    // Prepare the request message.
    $updateMask = new FieldMask();
    $tensorboard = (new Tensorboard())
        ->setDisplayName($tensorboardDisplayName);
    $request = (new UpdateTensorboardRequest())
        ->setUpdateMask($updateMask)
        ->setTensorboard($tensorboard);

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

        if ($response->operationSucceeded()) {
            /** @var Tensorboard $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
{
    $tensorboardDisplayName = '[DISPLAY_NAME]';

    update_tensorboard_sample($tensorboardDisplayName);
}

updateTensorboardExperiment

Updates a TensorboardExperiment.

The async variant is TensorboardServiceClient::updateTensorboardExperimentAsync() .

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\UpdateTensorboardExperimentRequest

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\AIPlatform\V1\TensorboardExperiment
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\TensorboardServiceClient;
use Google\Cloud\AIPlatform\V1\TensorboardExperiment;
use Google\Cloud\AIPlatform\V1\UpdateTensorboardExperimentRequest;
use Google\Protobuf\FieldMask;

/**
 * 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 update_tensorboard_experiment_sample(): void
{
    // Create a client.
    $tensorboardServiceClient = new TensorboardServiceClient();

    // Prepare the request message.
    $updateMask = new FieldMask();
    $tensorboardExperiment = new TensorboardExperiment();
    $request = (new UpdateTensorboardExperimentRequest())
        ->setUpdateMask($updateMask)
        ->setTensorboardExperiment($tensorboardExperiment);

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

updateTensorboardRun

Updates a TensorboardRun.

The async variant is TensorboardServiceClient::updateTensorboardRunAsync() .

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\UpdateTensorboardRunRequest

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\AIPlatform\V1\TensorboardRun
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\TensorboardServiceClient;
use Google\Cloud\AIPlatform\V1\TensorboardRun;
use Google\Cloud\AIPlatform\V1\UpdateTensorboardRunRequest;
use Google\Protobuf\FieldMask;

/**
 * @param string $tensorboardRunDisplayName User provided name of this TensorboardRun.
 *                                          This value must be unique among all TensorboardRuns
 *                                          belonging to the same parent TensorboardExperiment.
 */
function update_tensorboard_run_sample(string $tensorboardRunDisplayName): void
{
    // Create a client.
    $tensorboardServiceClient = new TensorboardServiceClient();

    // Prepare the request message.
    $updateMask = new FieldMask();
    $tensorboardRun = (new TensorboardRun())
        ->setDisplayName($tensorboardRunDisplayName);
    $request = (new UpdateTensorboardRunRequest())
        ->setUpdateMask($updateMask)
        ->setTensorboardRun($tensorboardRun);

    // Call the API and handle any network failures.
    try {
        /** @var TensorboardRun $response */
        $response = $tensorboardServiceClient->updateTensorboardRun($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
{
    $tensorboardRunDisplayName = '[DISPLAY_NAME]';

    update_tensorboard_run_sample($tensorboardRunDisplayName);
}

updateTensorboardTimeSeries

Updates a TensorboardTimeSeries.

The async variant is TensorboardServiceClient::updateTensorboardTimeSeriesAsync() .

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\UpdateTensorboardTimeSeriesRequest

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\AIPlatform\V1\TensorboardTimeSeries
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\TensorboardServiceClient;
use Google\Cloud\AIPlatform\V1\TensorboardTimeSeries;
use Google\Cloud\AIPlatform\V1\TensorboardTimeSeries\ValueType;
use Google\Cloud\AIPlatform\V1\UpdateTensorboardTimeSeriesRequest;
use Google\Protobuf\FieldMask;

/**
 * @param string $tensorboardTimeSeriesDisplayName User provided name of this TensorboardTimeSeries.
 *                                                 This value should be unique among all TensorboardTimeSeries resources
 *                                                 belonging to the same TensorboardRun resource (parent resource).
 * @param int    $tensorboardTimeSeriesValueType   Immutable. Type of TensorboardTimeSeries value.
 */
function update_tensorboard_time_series_sample(
    string $tensorboardTimeSeriesDisplayName,
    int $tensorboardTimeSeriesValueType
): void {
    // Create a client.
    $tensorboardServiceClient = new TensorboardServiceClient();

    // Prepare the request message.
    $updateMask = new FieldMask();
    $tensorboardTimeSeries = (new TensorboardTimeSeries())
        ->setDisplayName($tensorboardTimeSeriesDisplayName)
        ->setValueType($tensorboardTimeSeriesValueType);
    $request = (new UpdateTensorboardTimeSeriesRequest())
        ->setUpdateMask($updateMask)
        ->setTensorboardTimeSeries($tensorboardTimeSeries);

    // Call the API and handle any network failures.
    try {
        /** @var TensorboardTimeSeries $response */
        $response = $tensorboardServiceClient->updateTensorboardTimeSeries($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
{
    $tensorboardTimeSeriesDisplayName = '[DISPLAY_NAME]';
    $tensorboardTimeSeriesValueType = ValueType::VALUE_TYPE_UNSPECIFIED;

    update_tensorboard_time_series_sample(
        $tensorboardTimeSeriesDisplayName,
        $tensorboardTimeSeriesValueType
    );
}

writeTensorboardExperimentData

Write time series data points of multiple TensorboardTimeSeries in multiple TensorboardRun's. If any data fail to be ingested, an error is returned.

The async variant is TensorboardServiceClient::writeTensorboardExperimentDataAsync() .

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\WriteTensorboardExperimentDataRequest

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\AIPlatform\V1\WriteTensorboardExperimentDataResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\TensorboardServiceClient;
use Google\Cloud\AIPlatform\V1\TensorboardTimeSeries\ValueType;
use Google\Cloud\AIPlatform\V1\TimeSeriesData;
use Google\Cloud\AIPlatform\V1\TimeSeriesDataPoint;
use Google\Cloud\AIPlatform\V1\WriteTensorboardExperimentDataRequest;
use Google\Cloud\AIPlatform\V1\WriteTensorboardExperimentDataResponse;
use Google\Cloud\AIPlatform\V1\WriteTensorboardRunDataRequest;

/**
 * @param string $formattedTensorboardExperiment                            The resource name of the TensorboardExperiment to write data to.
 *                                                                          Format:
 *                                                                          `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}`
 *                                                                          Please see {@see TensorboardServiceClient::tensorboardExperimentName()} for help formatting this field.
 * @param string $formattedWriteRunDataRequestsTensorboardRun               The resource name of the TensorboardRun to write data to.
 *                                                                          Format:
 *                                                                          `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}`
 *                                                                          Please see {@see TensorboardServiceClient::tensorboardRunName()} for help formatting this field.
 * @param string $writeRunDataRequestsTimeSeriesDataTensorboardTimeSeriesId The ID of the TensorboardTimeSeries, which will become the final
 *                                                                          component of the TensorboardTimeSeries' resource name
 * @param int    $writeRunDataRequestsTimeSeriesDataValueType               Immutable. The value type of this time series. All the values in
 *                                                                          this time series data must match this value type.
 */
function write_tensorboard_experiment_data_sample(
    string $formattedTensorboardExperiment,
    string $formattedWriteRunDataRequestsTensorboardRun,
    string $writeRunDataRequestsTimeSeriesDataTensorboardTimeSeriesId,
    int $writeRunDataRequestsTimeSeriesDataValueType
): void {
    // Create a client.
    $tensorboardServiceClient = new TensorboardServiceClient();

    // Prepare the request message.
    $writeRunDataRequestsTimeSeriesDataValues = [new TimeSeriesDataPoint()];
    $timeSeriesData = (new TimeSeriesData())
        ->setTensorboardTimeSeriesId($writeRunDataRequestsTimeSeriesDataTensorboardTimeSeriesId)
        ->setValueType($writeRunDataRequestsTimeSeriesDataValueType)
        ->setValues($writeRunDataRequestsTimeSeriesDataValues);
    $writeRunDataRequestsTimeSeriesData = [$timeSeriesData,];
    $writeTensorboardRunDataRequest = (new WriteTensorboardRunDataRequest())
        ->setTensorboardRun($formattedWriteRunDataRequestsTensorboardRun)
        ->setTimeSeriesData($writeRunDataRequestsTimeSeriesData);
    $writeRunDataRequests = [$writeTensorboardRunDataRequest,];
    $request = (new WriteTensorboardExperimentDataRequest())
        ->setTensorboardExperiment($formattedTensorboardExperiment)
        ->setWriteRunDataRequests($writeRunDataRequests);

    // Call the API and handle any network failures.
    try {
        /** @var WriteTensorboardExperimentDataResponse $response */
        $response = $tensorboardServiceClient->writeTensorboardExperimentData($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
{
    $formattedTensorboardExperiment = TensorboardServiceClient::tensorboardExperimentName(
        '[PROJECT]',
        '[LOCATION]',
        '[TENSORBOARD]',
        '[EXPERIMENT]'
    );
    $formattedWriteRunDataRequestsTensorboardRun = TensorboardServiceClient::tensorboardRunName(
        '[PROJECT]',
        '[LOCATION]',
        '[TENSORBOARD]',
        '[EXPERIMENT]',
        '[RUN]'
    );
    $writeRunDataRequestsTimeSeriesDataTensorboardTimeSeriesId = '[TENSORBOARD_TIME_SERIES_ID]';
    $writeRunDataRequestsTimeSeriesDataValueType = ValueType::VALUE_TYPE_UNSPECIFIED;

    write_tensorboard_experiment_data_sample(
        $formattedTensorboardExperiment,
        $formattedWriteRunDataRequestsTensorboardRun,
        $writeRunDataRequestsTimeSeriesDataTensorboardTimeSeriesId,
        $writeRunDataRequestsTimeSeriesDataValueType
    );
}

writeTensorboardRunData

Write time series data points into multiple TensorboardTimeSeries under a TensorboardRun. If any data fail to be ingested, an error is returned.

The async variant is TensorboardServiceClient::writeTensorboardRunDataAsync() .

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\WriteTensorboardRunDataRequest

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\AIPlatform\V1\WriteTensorboardRunDataResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\TensorboardServiceClient;
use Google\Cloud\AIPlatform\V1\TensorboardTimeSeries\ValueType;
use Google\Cloud\AIPlatform\V1\TimeSeriesData;
use Google\Cloud\AIPlatform\V1\TimeSeriesDataPoint;
use Google\Cloud\AIPlatform\V1\WriteTensorboardRunDataRequest;
use Google\Cloud\AIPlatform\V1\WriteTensorboardRunDataResponse;

/**
 * @param string $formattedTensorboardRun               The resource name of the TensorboardRun to write data to.
 *                                                      Format:
 *                                                      `projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}`
 *                                                      Please see {@see TensorboardServiceClient::tensorboardRunName()} for help formatting this field.
 * @param string $timeSeriesDataTensorboardTimeSeriesId The ID of the TensorboardTimeSeries, which will become the final
 *                                                      component of the TensorboardTimeSeries' resource name
 * @param int    $timeSeriesDataValueType               Immutable. The value type of this time series. All the values in
 *                                                      this time series data must match this value type.
 */
function write_tensorboard_run_data_sample(
    string $formattedTensorboardRun,
    string $timeSeriesDataTensorboardTimeSeriesId,
    int $timeSeriesDataValueType
): void {
    // Create a client.
    $tensorboardServiceClient = new TensorboardServiceClient();

    // Prepare the request message.
    $timeSeriesDataValues = [new TimeSeriesDataPoint()];
    $timeSeriesData = (new TimeSeriesData())
        ->setTensorboardTimeSeriesId($timeSeriesDataTensorboardTimeSeriesId)
        ->setValueType($timeSeriesDataValueType)
        ->setValues($timeSeriesDataValues);
    $timeSeriesData = [$timeSeriesData,];
    $request = (new WriteTensorboardRunDataRequest())
        ->setTensorboardRun($formattedTensorboardRun)
        ->setTimeSeriesData($timeSeriesData);

    // Call the API and handle any network failures.
    try {
        /** @var WriteTensorboardRunDataResponse $response */
        $response = $tensorboardServiceClient->writeTensorboardRunData($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
{
    $formattedTensorboardRun = TensorboardServiceClient::tensorboardRunName(
        '[PROJECT]',
        '[LOCATION]',
        '[TENSORBOARD]',
        '[EXPERIMENT]',
        '[RUN]'
    );
    $timeSeriesDataTensorboardTimeSeriesId = '[TENSORBOARD_TIME_SERIES_ID]';
    $timeSeriesDataValueType = ValueType::VALUE_TYPE_UNSPECIFIED;

    write_tensorboard_run_data_sample(
        $formattedTensorboardRun,
        $timeSeriesDataTensorboardTimeSeriesId,
        $timeSeriesDataValueType
    );
}

getLocation

Gets information about a location.

The async variant is TensorboardServiceClient::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\AIPlatform\V1\Client\TensorboardServiceClient;
use Google\Cloud\Location\GetLocationRequest;
use Google\Cloud\Location\Location;

/**
 * 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.
    $tensorboardServiceClient = new TensorboardServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Location $response */
        $response = $tensorboardServiceClient->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 TensorboardServiceClient::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\AIPlatform\V1\Client\TensorboardServiceClient;
use Google\Cloud\Location\ListLocationsRequest;
use Google\Cloud\Location\Location;

/**
 * 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.
    $tensorboardServiceClient = new TensorboardServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $tensorboardServiceClient->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 TensorboardServiceClient::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\AIPlatform\V1\Client\TensorboardServiceClient;
use Google\Cloud\Iam\V1\GetIamPolicyRequest;
use Google\Cloud\Iam\V1\Policy;

/**
 * @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.
    $tensorboardServiceClient = new TensorboardServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Policy $response */
        $response = $tensorboardServiceClient->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 TensorboardServiceClient::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\AIPlatform\V1\Client\TensorboardServiceClient;
use Google\Cloud\Iam\V1\Policy;
use Google\Cloud\Iam\V1\SetIamPolicyRequest;

/**
 * @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.
    $tensorboardServiceClient = new TensorboardServiceClient();

    // 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 = $tensorboardServiceClient->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 TensorboardServiceClient::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\AIPlatform\V1\Client\TensorboardServiceClient;
use Google\Cloud\Iam\V1\TestIamPermissionsRequest;
use Google\Cloud\Iam\V1\TestIamPermissionsResponse;

/**
 * @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.
    $tensorboardServiceClient = new TensorboardServiceClient();

    // 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 = $tensorboardServiceClient->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);
}

batchCreateTensorboardRunsAsync

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\BatchCreateTensorboardRunsRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\AIPlatform\V1\BatchCreateTensorboardRunsResponse>

batchCreateTensorboardTimeSeriesAsync

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\BatchCreateTensorboardTimeSeriesRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\AIPlatform\V1\BatchCreateTensorboardTimeSeriesResponse>

batchReadTensorboardTimeSeriesDataAsync

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\BatchReadTensorboardTimeSeriesDataRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\AIPlatform\V1\BatchReadTensorboardTimeSeriesDataResponse>

createTensorboardAsync

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\CreateTensorboardRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

createTensorboardExperimentAsync

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\CreateTensorboardExperimentRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\AIPlatform\V1\TensorboardExperiment>

createTensorboardRunAsync

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\CreateTensorboardRunRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\AIPlatform\V1\TensorboardRun>

createTensorboardTimeSeriesAsync

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\CreateTensorboardTimeSeriesRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\AIPlatform\V1\TensorboardTimeSeries>

deleteTensorboardAsync

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\DeleteTensorboardRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

deleteTensorboardExperimentAsync

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\DeleteTensorboardExperimentRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

deleteTensorboardRunAsync

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\DeleteTensorboardRunRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

deleteTensorboardTimeSeriesAsync

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\DeleteTensorboardTimeSeriesRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

exportTensorboardTimeSeriesDataAsync

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\ExportTensorboardTimeSeriesDataRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

getTensorboardAsync

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\GetTensorboardRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\AIPlatform\V1\Tensorboard>

getTensorboardExperimentAsync

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\GetTensorboardExperimentRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\AIPlatform\V1\TensorboardExperiment>

getTensorboardRunAsync

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\GetTensorboardRunRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\AIPlatform\V1\TensorboardRun>

getTensorboardTimeSeriesAsync

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\GetTensorboardTimeSeriesRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\AIPlatform\V1\TensorboardTimeSeries>

listTensorboardExperimentsAsync

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\ListTensorboardExperimentsRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

listTensorboardRunsAsync

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\ListTensorboardRunsRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

listTensorboardTimeSeriesAsync

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\ListTensorboardTimeSeriesRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

listTensorboardsAsync

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\ListTensorboardsRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

readTensorboardSizeAsync

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\ReadTensorboardSizeRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\AIPlatform\V1\ReadTensorboardSizeResponse>

readTensorboardTimeSeriesDataAsync

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\ReadTensorboardTimeSeriesDataRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\AIPlatform\V1\ReadTensorboardTimeSeriesDataResponse>

readTensorboardUsageAsync

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\ReadTensorboardUsageRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\AIPlatform\V1\ReadTensorboardUsageResponse>

updateTensorboardAsync

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\UpdateTensorboardRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

updateTensorboardExperimentAsync

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\UpdateTensorboardExperimentRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\AIPlatform\V1\TensorboardExperiment>

updateTensorboardRunAsync

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\UpdateTensorboardRunRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\AIPlatform\V1\TensorboardRun>

updateTensorboardTimeSeriesAsync

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\UpdateTensorboardTimeSeriesRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\AIPlatform\V1\TensorboardTimeSeries>

writeTensorboardExperimentDataAsync

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\WriteTensorboardExperimentDataRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\AIPlatform\V1\WriteTensorboardExperimentDataResponse>

writeTensorboardRunDataAsync

Parameters
Name Description
request Google\Cloud\AIPlatform\V1\WriteTensorboardRunDataRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\AIPlatform\V1\WriteTensorboardRunDataResponse>

getLocationAsync

Parameters
Name Description
request Google\Cloud\Location\GetLocationRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Location\Location>

listLocationsAsync

Parameters
Name Description
request Google\Cloud\Location\ListLocationsRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

getIamPolicyAsync

Parameters
Name Description
request Google\Cloud\Iam\V1\GetIamPolicyRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Iam\V1\Policy>

setIamPolicyAsync

Parameters
Name Description
request Google\Cloud\Iam\V1\SetIamPolicyRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Iam\V1\Policy>

testIamPermissionsAsync

Parameters
Name Description
request Google\Cloud\Iam\V1\TestIamPermissionsRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Iam\V1\TestIamPermissionsResponse>

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::locationName

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

Parameters
Name Description
project string
location string
Returns
Type Description
string The formatted location 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::tensorboardExperimentName

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

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

static::tensorboardRunName

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

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

static::tensorboardTimeSeriesName

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

Parameters
Name Description
project string
location string
tensorboard string
experiment string
run string
timeSeries string
Returns
Type Description
string The formatted tensorboard_time_series 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

  • location: projects/{project}/locations/{location}
  • tensorboard: projects/{project}/locations/{location}/tensorboards/{tensorboard}
  • tensorboardExperiment: projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}
  • tensorboardRun: projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}
  • tensorboardTimeSeries: projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}/timeSeries/{time_series}

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.