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

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. Sample code to get started:

$tensorboardServiceClient = new TensorboardServiceClient();
try {
    $formattedParent = $tensorboardServiceClient->tensorboardExperimentName('[PROJECT]', '[LOCATION]', '[TENSORBOARD]', '[EXPERIMENT]');
    $requests = [];
    $response = $tensorboardServiceClient->batchCreateTensorboardRuns($formattedParent, $requests);
} finally {
    $tensorboardServiceClient->close();
}

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.

Methods

locationName

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

Parameters
NameDescription
project string
location string
Returns
TypeDescription
stringThe formatted location resource.

tensorboardName

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

Parameters
NameDescription
project string
location string
tensorboard string
Returns
TypeDescription
stringThe formatted tensorboard resource.

tensorboardExperimentName

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

Parameters
NameDescription
project string
location string
tensorboard string
experiment string
Returns
TypeDescription
stringThe formatted tensorboard_experiment resource.

tensorboardRunName

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

Parameters
NameDescription
project string
location string
tensorboard string
experiment string
run string
Returns
TypeDescription
stringThe formatted tensorboard_run resource.

tensorboardTimeSeriesName

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

Parameters
NameDescription
project string
location string
tensorboard string
experiment string
run string
timeSeries string
Returns
TypeDescription
stringThe formatted tensorboard_time_series resource.

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
NameDescription
formattedName string

The formatted name string

template string

Optional name of template to match

Returns
TypeDescription
arrayAn associative array from name component IDs to component values.

getOperationsClient

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

Returns
TypeDescription
Google\ApiCore\LongRunning\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
NameDescription
operationName string

The name of the long running operation

methodName string

The name of the method used to start the operation

Returns
TypeDescription
Google\ApiCore\OperationResponse

__construct

Constructor.

Parameters
NameDescription
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.

batchCreateTensorboardRuns

Batch create TensorboardRuns.

Parameters
NameDescription
parent string

Required. 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.

requests array<Google\Cloud\AIPlatform\V1\CreateTensorboardRunRequest>

Required. The request message specifying the TensorboardRuns to create. A maximum of 1000 TensorboardRuns can be created in a batch.

optionalArgs 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
TypeDescription
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());
    }
}

/**
 * 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.

Parameters
NameDescription
parent string

Required. 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.

requests array<Google\Cloud\AIPlatform\V1\CreateTensorboardTimeSeriesRequest>

Required. The request message specifying the TensorboardTimeSeries to create. A maximum of 1000 TensorboardTimeSeries can be created in a batch.

optionalArgs 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
TypeDescription
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());
    }
}

/**
 * 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.

Parameters
NameDescription
tensorboard string

Required. 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 must be sub resources of this Tensorboard.

timeSeries string[]

Required. The resource names of the TensorboardTimeSeries to read data from. Format: projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}/timeSeries/{time_series}

optionalArgs 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
TypeDescription
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());
    }
}

/**
 * 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.

Parameters
NameDescription
parent string

Required. The resource name of the Location to create the Tensorboard in. Format: projects/{project}/locations/{location}

tensorboard Google\Cloud\AIPlatform\V1\Tensorboard

Required. The Tensorboard to create.

optionalArgs 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
TypeDescription
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());
    }
}

/**
 * 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.

Parameters
NameDescription
parent string

Required. The resource name of the Tensorboard to create the TensorboardExperiment in. Format: projects/{project}/locations/{location}/tensorboards/{tensorboard}

tensorboardExperimentId string

Required. 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]-/.

optionalArgs array

Optional.

↳ tensorboardExperiment TensorboardExperiment

The TensorboardExperiment to create.

↳ 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
TypeDescription
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());
    }
}

/**
 * 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.

Parameters
NameDescription
parent string

Required. The resource name of the TensorboardExperiment to create the TensorboardRun in. Format: projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}

tensorboardRun Google\Cloud\AIPlatform\V1\TensorboardRun

Required. The TensorboardRun to create.

tensorboardRunId string

Required. 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]-/.

optionalArgs 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
TypeDescription
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());
    }
}

/**
 * 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.

Parameters
NameDescription
parent string

Required. The resource name of the TensorboardRun to create the TensorboardTimeSeries in. Format: projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}

tensorboardTimeSeries Google\Cloud\AIPlatform\V1\TensorboardTimeSeries

Required. The TensorboardTimeSeries to create.

optionalArgs array

Optional.

↳ tensorboardTimeSeriesId string

Optional. The user specified unique ID to use for the TensorboardTimeSeries, which becomes the final component of the TensorboardTimeSeries's resource name. This value should match "[a-z0-9][a-z0-9-]{0, 127}"

↳ 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
TypeDescription
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());
    }
}

/**
 * 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.

Parameters
NameDescription
name string

Required. The name of the Tensorboard to be deleted. Format: projects/{project}/locations/{location}/tensorboards/{tensorboard}

optionalArgs 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
TypeDescription
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());
    }
}

/**
 * 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.

Parameters
NameDescription
name string

Required. The name of the TensorboardExperiment to be deleted. Format: projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}

optionalArgs 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
TypeDescription
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());
    }
}

/**
 * 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.

Parameters
NameDescription
name string

Required. The name of the TensorboardRun to be deleted. Format: projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}

optionalArgs 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
TypeDescription
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());
    }
}

/**
 * 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.

Parameters
NameDescription
name string

Required. The name of the TensorboardTimeSeries to be deleted. Format: projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}/timeSeries/{time_series}

optionalArgs 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
TypeDescription
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());
    }
}

/**
 * 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.

Parameters
NameDescription
tensorboardTimeSeries string

Required. The resource name of the TensorboardTimeSeries to export data from. Format: projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}/timeSeries/{time_series}

optionalArgs array

Optional.

↳ filter string

Exports the TensorboardTimeSeries' data that match the filter expression.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ orderBy string

Field to use to sort the TensorboardTimeSeries' data. By default, TensorboardTimeSeries' data is returned in a pseudo random order.

↳ 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
TypeDescription
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());
    }
}

/**
 * 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.

Parameters
NameDescription
name string

Required. The name of the Tensorboard resource. Format: projects/{project}/locations/{location}/tensorboards/{tensorboard}

optionalArgs 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
TypeDescription
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());
    }
}

/**
 * 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.

Parameters
NameDescription
name string

Required. The name of the TensorboardExperiment resource. Format: projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}

optionalArgs 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
TypeDescription
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());
    }
}

/**
 * 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.

Parameters
NameDescription
name string

Required. The name of the TensorboardRun resource. Format: projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}

optionalArgs 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
TypeDescription
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());
    }
}

/**
 * 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.

Parameters
NameDescription
name string

Required. The name of the TensorboardTimeSeries resource. Format: projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}/timeSeries/{time_series}

optionalArgs 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
TypeDescription
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());
    }
}

/**
 * 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.

Parameters
NameDescription
parent string

Required. The resource name of the Tensorboard to list TensorboardExperiments. Format: projects/{project}/locations/{location}/tensorboards/{tensorboard}

optionalArgs array

Optional.

↳ filter string

Lists the TensorboardExperiments that match the filter expression.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ orderBy string

Field to use to sort the list.

↳ readMask FieldMask

Mask specifying which fields to read.

↳ 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
TypeDescription
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());
    }
}

/**
 * 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.

Parameters
NameDescription
parent string

Required. The resource name of the TensorboardExperiment to list TensorboardRuns. Format: projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}

optionalArgs array

Optional.

↳ filter string

Lists the TensorboardRuns that match the filter expression.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ orderBy string

Field to use to sort the list.

↳ readMask FieldMask

Mask specifying which fields to read.

↳ 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
TypeDescription
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());
    }
}

/**
 * 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.

Parameters
NameDescription
parent string

Required. The resource name of the TensorboardRun to list TensorboardTimeSeries. Format: projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}

optionalArgs array

Optional.

↳ filter string

Lists the TensorboardTimeSeries that match the filter expression.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ orderBy string

Field to use to sort the list.

↳ readMask FieldMask

Mask specifying which fields to read.

↳ 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
TypeDescription
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());
    }
}

/**
 * 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.

Parameters
NameDescription
parent string

Required. The resource name of the Location to list Tensorboards. Format: projects/{project}/locations/{location}

optionalArgs array

Optional.

↳ filter string

Lists the Tensorboards that match the filter expression.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ orderBy string

Field to use to sort the list.

↳ readMask FieldMask

Mask specifying which fields to read.

↳ 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
TypeDescription
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());
    }
}

/**
 * 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
NameDescription
timeSeries string

Required. The resource name of the TensorboardTimeSeries to list Blobs. Format: projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}/timeSeries/{time_series}

optionalArgs array

Optional.

↳ blobIds string[]

IDs of the blobs to read.

↳ timeoutMillis int

Timeout to use for this call.

Returns
TypeDescription
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());
    }
}

/**
 * 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);
}

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.

Parameters
NameDescription
tensorboardTimeSeries string

Required. The resource name of the TensorboardTimeSeries to read data from. Format: projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}/timeSeries/{time_series}

optionalArgs array

Optional.

↳ maxDataPoints int

The maximum number of TensorboardTimeSeries' data to return. This value should be a positive integer. This value can be set to -1 to return all data.

↳ filter string

Reads the TensorboardTimeSeries' data that match the filter expression.

↳ 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
TypeDescription
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());
    }
}

/**
 * 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.

Parameters
NameDescription
tensorboard string

Required. The name of the Tensorboard resource. Format: projects/{project}/locations/{location}/tensorboards/{tensorboard}

optionalArgs 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
TypeDescription
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());
    }
}

/**
 * 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.

Parameters
NameDescription
updateMask Google\Protobuf\FieldMask

Required. Field mask is used to specify the fields to be overwritten in the Tensorboard resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field is overwritten if it's in the mask. If the user does not provide a mask then all fields are overwritten if new values are specified.

tensorboard Google\Cloud\AIPlatform\V1\Tensorboard

Required. The Tensorboard's name field is used to identify the Tensorboard to be updated. Format: projects/{project}/locations/{location}/tensorboards/{tensorboard}

optionalArgs 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
TypeDescription
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());
    }
}

/**
 * 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.

Parameters
NameDescription
updateMask Google\Protobuf\FieldMask

Required. Field mask is used to specify the fields to be overwritten in the TensorboardExperiment resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field is overwritten if it's in the mask. If the user does not provide a mask then all fields are overwritten if new values are specified.

tensorboardExperiment Google\Cloud\AIPlatform\V1\TensorboardExperiment

Required. The TensorboardExperiment's name field is used to identify the TensorboardExperiment to be updated. Format: projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}

optionalArgs 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
TypeDescription
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.

Parameters
NameDescription
updateMask Google\Protobuf\FieldMask

Required. Field mask is used to specify the fields to be overwritten in the TensorboardRun resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field is overwritten if it's in the mask. If the user does not provide a mask then all fields are overwritten if new values are specified.

tensorboardRun Google\Cloud\AIPlatform\V1\TensorboardRun

Required. The TensorboardRun's name field is used to identify the TensorboardRun to be updated. Format: projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}

optionalArgs 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
TypeDescription
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());
    }
}

/**
 * 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.

Parameters
NameDescription
updateMask Google\Protobuf\FieldMask

Required. Field mask is used to specify the fields to be overwritten in the TensorboardTimeSeries resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field is overwritten if it's in the mask. If the user does not provide a mask then all fields are overwritten if new values are specified.

tensorboardTimeSeries Google\Cloud\AIPlatform\V1\TensorboardTimeSeries

Required. The TensorboardTimeSeries' name field is used to identify the TensorboardTimeSeries to be updated. Format: projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}/timeSeries/{time_series}

optionalArgs 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
TypeDescription
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());
    }
}

/**
 * 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.

Parameters
NameDescription
tensorboardExperiment string

Required. The resource name of the TensorboardExperiment to write data to. Format: projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}

writeRunDataRequests array<Google\Cloud\AIPlatform\V1\WriteTensorboardRunDataRequest>

Required. Requests containing per-run TensorboardTimeSeries data to write.

optionalArgs 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
TypeDescription
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());
    }
}

/**
 * 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.

Parameters
NameDescription
tensorboardRun string

Required. The resource name of the TensorboardRun to write data to. Format: projects/{project}/locations/{location}/tensorboards/{tensorboard}/experiments/{experiment}/runs/{run}

timeSeriesData array<Google\Cloud\AIPlatform\V1\TimeSeriesData>

Required. The TensorboardTimeSeries data to write. Values with in a time series are indexed by their step value. Repeated writes to the same step will overwrite the existing value for that step. The upper limit of data points per write request is 5000.

optionalArgs 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
TypeDescription
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());
    }
}

/**
 * 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.

Parameters
NameDescription
optionalArgs array

Optional.

↳ name string

Resource name for the location.

↳ 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
TypeDescription
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.

Parameters
NameDescription
optionalArgs array

Optional.

↳ name string

The resource that owns the locations collection, if applicable.

↳ filter string

The standard list filter.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ 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
TypeDescription
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.

Parameters
NameDescription
resource string

REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.

optionalArgs array

Optional.

↳ options GetPolicyOptions

OPTIONAL: A GetPolicyOptions object for specifying options to GetIamPolicy.

↳ 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
TypeDescription
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());
    }
}

/**
 * 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.

Parameters
NameDescription
resource string

REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.

policy Google\Cloud\Iam\V1\Policy

REQUIRED: The complete policy to be applied to the resource. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.

optionalArgs array

Optional.

↳ updateMask FieldMask

OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only the fields in the mask will be modified. If no mask is provided, the following default mask is used: paths: "bindings, etag"

↳ 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
TypeDescription
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());
    }
}

/**
 * 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.

Parameters
NameDescription
resource string

REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.

permissions string[]

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.

optionalArgs 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
TypeDescription
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());
    }
}

/**
 * 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);
}

Constants

SERVICE_NAME

Value: 'google.cloud.aiplatform.v1.TensorboardService'

The name of the service.

SERVICE_ADDRESS

Value: 'aiplatform.googleapis.com'

The default address of the service.

DEFAULT_SERVICE_PORT

Value: 443

The default port of the service.

CODEGEN_NAME

Value: 'gapic'

The name of the code generator, to be included in the agent header.