Cloud AutoML V1 Client - Class AutoMlClient (2.0.0-RC1)

Reference documentation and code samples for the Cloud AutoML V1 Client class AutoMlClient.

Service Description: AutoML Server API.

The resource names are assigned by the server. The server never reuses names that it has created after the resources with those names are deleted.

An ID of a resource is the last element of the item's resource name. For projects/{project_id}/locations/{location_id}/datasets/{dataset_id}, then the id for the item is {dataset_id}.

Currently the only supported location_id is "us-central1".

On any input that is documented to expect a string parameter in snake_case or dash-case, either of those cases is accepted.

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

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

Namespace

Google \ Cloud \ AutoMl \ V1 \ Client

Methods

__construct

Constructor.

Parameters
Name Description
options array

Optional. Options for configuring the service API wrapper.

↳ apiEndpoint string

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

↳ credentials string|array|FetchAuthTokenInterface|CredentialsWrapper

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

↳ credentialsConfig array

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

↳ disableRetries bool

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

↳ clientConfig string|array

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

↳ transport string|TransportInterface

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

↳ transportConfig array

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

↳ clientCertSource callable

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

createDataset

Creates a dataset.

The async variant is Google\Cloud\AutoMl\V1\Client\AutoMlClient::createDatasetAsync() .

Parameters
Name Description
request Google\Cloud\AutoMl\V1\CreateDatasetRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AutoMl\V1\Client\AutoMlClient;
use Google\Cloud\AutoMl\V1\CreateDatasetRequest;
use Google\Cloud\AutoMl\V1\Dataset;
use Google\Rpc\Status;

/**
 * @param string $formattedParent The resource name of the project to create the dataset for. Please see
 *                                {@see AutoMlClient::locationName()} for help formatting this field.
 */
function create_dataset_sample(string $formattedParent): void
{
    // Create a client.
    $autoMlClient = new AutoMlClient();

    // Prepare the request message.
    $dataset = new Dataset();
    $request = (new CreateDatasetRequest())
        ->setParent($formattedParent)
        ->setDataset($dataset);

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

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

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AutoMlClient::locationName('[PROJECT]', '[LOCATION]');

    create_dataset_sample($formattedParent);
}

createModel

Creates a model.

Returns a Model in the response field when it completes. When you create a model, several model evaluations are created for it: a global evaluation, and one evaluation for each annotation spec.

The async variant is Google\Cloud\AutoMl\V1\Client\AutoMlClient::createModelAsync() .

Parameters
Name Description
request Google\Cloud\AutoMl\V1\CreateModelRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AutoMl\V1\Client\AutoMlClient;
use Google\Cloud\AutoMl\V1\CreateModelRequest;
use Google\Cloud\AutoMl\V1\Model;
use Google\Rpc\Status;

/**
 * @param string $formattedParent Resource name of the parent project where the model is being created. Please see
 *                                {@see AutoMlClient::locationName()} for help formatting this field.
 */
function create_model_sample(string $formattedParent): void
{
    // Create a client.
    $autoMlClient = new AutoMlClient();

    // Prepare the request message.
    $model = new Model();
    $request = (new CreateModelRequest())
        ->setParent($formattedParent)
        ->setModel($model);

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

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

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AutoMlClient::locationName('[PROJECT]', '[LOCATION]');

    create_model_sample($formattedParent);
}

deleteDataset

Deletes a dataset and all of its contents.

Returns empty response in the response field when it completes, and delete_details in the metadata field.

The async variant is Google\Cloud\AutoMl\V1\Client\AutoMlClient::deleteDatasetAsync() .

Parameters
Name Description
request Google\Cloud\AutoMl\V1\DeleteDatasetRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AutoMl\V1\Client\AutoMlClient;
use Google\Cloud\AutoMl\V1\DeleteDatasetRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The resource name of the dataset to delete. Please see
 *                              {@see AutoMlClient::datasetName()} for help formatting this field.
 */
function delete_dataset_sample(string $formattedName): void
{
    // Create a client.
    $autoMlClient = new AutoMlClient();

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

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

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

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AutoMlClient::datasetName('[PROJECT]', '[LOCATION]', '[DATASET]');

    delete_dataset_sample($formattedName);
}

deleteModel

Deletes a model.

Returns google.protobuf.Empty in the response field when it completes, and delete_details in the metadata field.

The async variant is Google\Cloud\AutoMl\V1\Client\AutoMlClient::deleteModelAsync() .

Parameters
Name Description
request Google\Cloud\AutoMl\V1\DeleteModelRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AutoMl\V1\Client\AutoMlClient;
use Google\Cloud\AutoMl\V1\DeleteModelRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName Resource name of the model being deleted. Please see
 *                              {@see AutoMlClient::modelName()} for help formatting this field.
 */
function delete_model_sample(string $formattedName): void
{
    // Create a client.
    $autoMlClient = new AutoMlClient();

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

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

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

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AutoMlClient::modelName('[PROJECT]', '[LOCATION]', '[MODEL]');

    delete_model_sample($formattedName);
}

deployModel

Deploys a model. If a model is already deployed, deploying it with the same parameters has no effect. Deploying with different parametrs (as e.g. changing node_number) will reset the deployment state without pausing the model's availability.

Only applicable for Text Classification, Image Object Detection , Tables, and Image Segmentation; all other domains manage deployment automatically.

Returns an empty response in the response field when it completes.

The async variant is Google\Cloud\AutoMl\V1\Client\AutoMlClient::deployModelAsync() .

Parameters
Name Description
request Google\Cloud\AutoMl\V1\DeployModelRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AutoMl\V1\Client\AutoMlClient;
use Google\Cloud\AutoMl\V1\DeployModelRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName Resource name of the model to deploy. Please see
 *                              {@see AutoMlClient::modelName()} for help formatting this field.
 */
function deploy_model_sample(string $formattedName): void
{
    // Create a client.
    $autoMlClient = new AutoMlClient();

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

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

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

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AutoMlClient::modelName('[PROJECT]', '[LOCATION]', '[MODEL]');

    deploy_model_sample($formattedName);
}

exportData

Exports dataset's data to the provided output location.

Returns an empty response in the response field when it completes.

The async variant is Google\Cloud\AutoMl\V1\Client\AutoMlClient::exportDataAsync() .

Parameters
Name Description
request Google\Cloud\AutoMl\V1\ExportDataRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AutoMl\V1\Client\AutoMlClient;
use Google\Cloud\AutoMl\V1\ExportDataRequest;
use Google\Cloud\AutoMl\V1\GcsDestination;
use Google\Cloud\AutoMl\V1\OutputConfig;
use Google\Rpc\Status;

/**
 * @param string $formattedName                             The resource name of the dataset. Please see
 *                                                          {@see AutoMlClient::datasetName()} for help formatting this field.
 * @param string $outputConfigGcsDestinationOutputUriPrefix Google Cloud Storage URI to output directory, up to 2000
 *                                                          characters long.
 *                                                          Accepted forms:
 *                                                          * Prefix path: gs://bucket/directory
 *                                                          The requesting user must have write permission to the bucket.
 *                                                          The directory is created if it doesn't exist.
 */
function export_data_sample(
    string $formattedName,
    string $outputConfigGcsDestinationOutputUriPrefix
): void {
    // Create a client.
    $autoMlClient = new AutoMlClient();

    // Prepare the request message.
    $outputConfigGcsDestination = (new GcsDestination())
        ->setOutputUriPrefix($outputConfigGcsDestinationOutputUriPrefix);
    $outputConfig = (new OutputConfig())
        ->setGcsDestination($outputConfigGcsDestination);
    $request = (new ExportDataRequest())
        ->setName($formattedName)
        ->setOutputConfig($outputConfig);

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

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

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AutoMlClient::datasetName('[PROJECT]', '[LOCATION]', '[DATASET]');
    $outputConfigGcsDestinationOutputUriPrefix = '[OUTPUT_URI_PREFIX]';

    export_data_sample($formattedName, $outputConfigGcsDestinationOutputUriPrefix);
}

exportModel

Exports a trained, "export-able", model to a user specified Google Cloud Storage location. A model is considered export-able if and only if it has an export format defined for it in ModelExportOutputConfig.

Returns an empty response in the response field when it completes.

The async variant is Google\Cloud\AutoMl\V1\Client\AutoMlClient::exportModelAsync() .

Parameters
Name Description
request Google\Cloud\AutoMl\V1\ExportModelRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AutoMl\V1\Client\AutoMlClient;
use Google\Cloud\AutoMl\V1\ExportModelRequest;
use Google\Cloud\AutoMl\V1\GcsDestination;
use Google\Cloud\AutoMl\V1\ModelExportOutputConfig;
use Google\Rpc\Status;

/**
 * @param string $formattedName                             The resource name of the model to export. Please see
 *                                                          {@see AutoMlClient::modelName()} for help formatting this field.
 * @param string $outputConfigGcsDestinationOutputUriPrefix Google Cloud Storage URI to output directory, up to 2000
 *                                                          characters long.
 *                                                          Accepted forms:
 *                                                          * Prefix path: gs://bucket/directory
 *                                                          The requesting user must have write permission to the bucket.
 *                                                          The directory is created if it doesn't exist.
 */
function export_model_sample(
    string $formattedName,
    string $outputConfigGcsDestinationOutputUriPrefix
): void {
    // Create a client.
    $autoMlClient = new AutoMlClient();

    // Prepare the request message.
    $outputConfigGcsDestination = (new GcsDestination())
        ->setOutputUriPrefix($outputConfigGcsDestinationOutputUriPrefix);
    $outputConfig = (new ModelExportOutputConfig())
        ->setGcsDestination($outputConfigGcsDestination);
    $request = (new ExportModelRequest())
        ->setName($formattedName)
        ->setOutputConfig($outputConfig);

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

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

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AutoMlClient::modelName('[PROJECT]', '[LOCATION]', '[MODEL]');
    $outputConfigGcsDestinationOutputUriPrefix = '[OUTPUT_URI_PREFIX]';

    export_model_sample($formattedName, $outputConfigGcsDestinationOutputUriPrefix);
}

getAnnotationSpec

Gets an annotation spec.

The async variant is Google\Cloud\AutoMl\V1\Client\AutoMlClient::getAnnotationSpecAsync() .

Parameters
Name Description
request Google\Cloud\AutoMl\V1\GetAnnotationSpecRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\Cloud\AutoMl\V1\AnnotationSpec
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AutoMl\V1\AnnotationSpec;
use Google\Cloud\AutoMl\V1\Client\AutoMlClient;
use Google\Cloud\AutoMl\V1\GetAnnotationSpecRequest;

/**
 * @param string $formattedName The resource name of the annotation spec to retrieve. Please see
 *                              {@see AutoMlClient::annotationSpecName()} for help formatting this field.
 */
function get_annotation_spec_sample(string $formattedName): void
{
    // Create a client.
    $autoMlClient = new AutoMlClient();

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

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

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AutoMlClient::annotationSpecName(
        '[PROJECT]',
        '[LOCATION]',
        '[DATASET]',
        '[ANNOTATION_SPEC]'
    );

    get_annotation_spec_sample($formattedName);
}

getDataset

Parameters
Name Description
request Google\Cloud\AutoMl\V1\GetDatasetRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\Cloud\AutoMl\V1\Dataset
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AutoMl\V1\Client\AutoMlClient;
use Google\Cloud\AutoMl\V1\Dataset;
use Google\Cloud\AutoMl\V1\GetDatasetRequest;

/**
 * @param string $formattedName The resource name of the dataset to retrieve. Please see
 *                              {@see AutoMlClient::datasetName()} for help formatting this field.
 */
function get_dataset_sample(string $formattedName): void
{
    // Create a client.
    $autoMlClient = new AutoMlClient();

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

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

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AutoMlClient::datasetName('[PROJECT]', '[LOCATION]', '[DATASET]');

    get_dataset_sample($formattedName);
}

getModel

Parameters
Name Description
request Google\Cloud\AutoMl\V1\GetModelRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\Cloud\AutoMl\V1\Model
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AutoMl\V1\Client\AutoMlClient;
use Google\Cloud\AutoMl\V1\GetModelRequest;
use Google\Cloud\AutoMl\V1\Model;

/**
 * @param string $formattedName Resource name of the model. Please see
 *                              {@see AutoMlClient::modelName()} for help formatting this field.
 */
function get_model_sample(string $formattedName): void
{
    // Create a client.
    $autoMlClient = new AutoMlClient();

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

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

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AutoMlClient::modelName('[PROJECT]', '[LOCATION]', '[MODEL]');

    get_model_sample($formattedName);
}

getModelEvaluation

Gets a model evaluation.

The async variant is Google\Cloud\AutoMl\V1\Client\AutoMlClient::getModelEvaluationAsync() .

Parameters
Name Description
request Google\Cloud\AutoMl\V1\GetModelEvaluationRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\Cloud\AutoMl\V1\ModelEvaluation
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AutoMl\V1\Client\AutoMlClient;
use Google\Cloud\AutoMl\V1\GetModelEvaluationRequest;
use Google\Cloud\AutoMl\V1\ModelEvaluation;

/**
 * @param string $formattedName Resource name for the model evaluation. Please see
 *                              {@see AutoMlClient::modelEvaluationName()} for help formatting this field.
 */
function get_model_evaluation_sample(string $formattedName): void
{
    // Create a client.
    $autoMlClient = new AutoMlClient();

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

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

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AutoMlClient::modelEvaluationName(
        '[PROJECT]',
        '[LOCATION]',
        '[MODEL]',
        '[MODEL_EVALUATION]'
    );

    get_model_evaluation_sample($formattedName);
}

importData

Imports data into a dataset.

For Tables this method can only be called on an empty Dataset.

For Tables:

  • A schema_inference_version parameter must be explicitly set. Returns an empty response in the response field when it completes.

The async variant is Google\Cloud\AutoMl\V1\Client\AutoMlClient::importDataAsync() .

Parameters
Name Description
request Google\Cloud\AutoMl\V1\ImportDataRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AutoMl\V1\Client\AutoMlClient;
use Google\Cloud\AutoMl\V1\ImportDataRequest;
use Google\Cloud\AutoMl\V1\InputConfig;
use Google\Rpc\Status;

/**
 * @param string $formattedName Dataset name. Dataset must already exist. All imported
 *                              annotations and examples will be added. Please see
 *                              {@see AutoMlClient::datasetName()} for help formatting this field.
 */
function import_data_sample(string $formattedName): void
{
    // Create a client.
    $autoMlClient = new AutoMlClient();

    // Prepare the request message.
    $inputConfig = new InputConfig();
    $request = (new ImportDataRequest())
        ->setName($formattedName)
        ->setInputConfig($inputConfig);

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

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

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AutoMlClient::datasetName('[PROJECT]', '[LOCATION]', '[DATASET]');

    import_data_sample($formattedName);
}

listDatasets

Lists datasets in a project.

The async variant is Google\Cloud\AutoMl\V1\Client\AutoMlClient::listDatasetsAsync() .

Parameters
Name Description
request Google\Cloud\AutoMl\V1\ListDatasetsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\AutoMl\V1\Client\AutoMlClient;
use Google\Cloud\AutoMl\V1\Dataset;
use Google\Cloud\AutoMl\V1\ListDatasetsRequest;

/**
 * @param string $formattedParent The resource name of the project from which to list datasets. Please see
 *                                {@see AutoMlClient::locationName()} for help formatting this field.
 */
function list_datasets_sample(string $formattedParent): void
{
    // Create a client.
    $autoMlClient = new AutoMlClient();

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

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

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

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AutoMlClient::locationName('[PROJECT]', '[LOCATION]');

    list_datasets_sample($formattedParent);
}

listModelEvaluations

Lists model evaluations.

The async variant is Google\Cloud\AutoMl\V1\Client\AutoMlClient::listModelEvaluationsAsync() .

Parameters
Name Description
request Google\Cloud\AutoMl\V1\ListModelEvaluationsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\AutoMl\V1\Client\AutoMlClient;
use Google\Cloud\AutoMl\V1\ListModelEvaluationsRequest;
use Google\Cloud\AutoMl\V1\ModelEvaluation;

/**
 * @param string $formattedParent Resource name of the model to list the model evaluations for.
 *                                If modelId is set as "-", this will list model evaluations from across all
 *                                models of the parent location. Please see
 *                                {@see AutoMlClient::modelName()} for help formatting this field.
 * @param string $filter          An expression for filtering the results of the request.
 *
 *                                * `annotation_spec_id` - for =, !=  or existence. See example below for
 *                                the last.
 *
 *                                Some examples of using the filter are:
 *
 *                                * `annotation_spec_id!=4` --> The model evaluation was done for
 *                                annotation spec with ID different than 4.
 *                                * `NOT annotation_spec_id:*` --> The model evaluation was done for
 *                                aggregate of all annotation specs.
 */
function list_model_evaluations_sample(string $formattedParent, string $filter): void
{
    // Create a client.
    $autoMlClient = new AutoMlClient();

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

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

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

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AutoMlClient::modelName('[PROJECT]', '[LOCATION]', '[MODEL]');
    $filter = '[FILTER]';

    list_model_evaluations_sample($formattedParent, $filter);
}

listModels

Parameters
Name Description
request Google\Cloud\AutoMl\V1\ListModelsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\AutoMl\V1\Client\AutoMlClient;
use Google\Cloud\AutoMl\V1\ListModelsRequest;
use Google\Cloud\AutoMl\V1\Model;

/**
 * @param string $formattedParent Resource name of the project, from which to list the models. Please see
 *                                {@see AutoMlClient::locationName()} for help formatting this field.
 */
function list_models_sample(string $formattedParent): void
{
    // Create a client.
    $autoMlClient = new AutoMlClient();

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

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

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

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = AutoMlClient::locationName('[PROJECT]', '[LOCATION]');

    list_models_sample($formattedParent);
}

undeployModel

Undeploys a model. If the model is not deployed this method has no effect.

Only applicable for Text Classification, Image Object Detection and Tables; all other domains manage deployment automatically.

Returns an empty response in the response field when it completes.

The async variant is Google\Cloud\AutoMl\V1\Client\AutoMlClient::undeployModelAsync() .

Parameters
Name Description
request Google\Cloud\AutoMl\V1\UndeployModelRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AutoMl\V1\Client\AutoMlClient;
use Google\Cloud\AutoMl\V1\UndeployModelRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName Resource name of the model to undeploy. Please see
 *                              {@see AutoMlClient::modelName()} for help formatting this field.
 */
function undeploy_model_sample(string $formattedName): void
{
    // Create a client.
    $autoMlClient = new AutoMlClient();

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

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

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

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = AutoMlClient::modelName('[PROJECT]', '[LOCATION]', '[MODEL]');

    undeploy_model_sample($formattedName);
}

updateDataset

Updates a dataset.

The async variant is Google\Cloud\AutoMl\V1\Client\AutoMlClient::updateDatasetAsync() .

Parameters
Name Description
request Google\Cloud\AutoMl\V1\UpdateDatasetRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\Cloud\AutoMl\V1\Dataset
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AutoMl\V1\Client\AutoMlClient;
use Google\Cloud\AutoMl\V1\Dataset;
use Google\Cloud\AutoMl\V1\UpdateDatasetRequest;
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_dataset_sample(): void
{
    // Create a client.
    $autoMlClient = new AutoMlClient();

    // Prepare the request message.
    $dataset = new Dataset();
    $updateMask = new FieldMask();
    $request = (new UpdateDatasetRequest())
        ->setDataset($dataset)
        ->setUpdateMask($updateMask);

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

updateModel

Parameters
Name Description
request Google\Cloud\AutoMl\V1\UpdateModelRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\Cloud\AutoMl\V1\Model
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AutoMl\V1\Client\AutoMlClient;
use Google\Cloud\AutoMl\V1\Model;
use Google\Cloud\AutoMl\V1\UpdateModelRequest;
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_model_sample(): void
{
    // Create a client.
    $autoMlClient = new AutoMlClient();

    // Prepare the request message.
    $model = new Model();
    $updateMask = new FieldMask();
    $request = (new UpdateModelRequest())
        ->setModel($model)
        ->setUpdateMask($updateMask);

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

createDatasetAsync

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

createModelAsync

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

deleteDatasetAsync

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

deleteModelAsync

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

deployModelAsync

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

exportDataAsync

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

exportModelAsync

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

getAnnotationSpecAsync

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

getDatasetAsync

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

getModelAsync

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

getModelEvaluationAsync

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

importDataAsync

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

listDatasetsAsync

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

listModelEvaluationsAsync

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

listModelsAsync

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

undeployModelAsync

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

updateDatasetAsync

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

updateModelAsync

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

getOperationsClient

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

Returns
Type Description
Google\LongRunning\Client\OperationsClient

resumeOperation

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

Parameters
Name Description
operationName string

The name of the long running operation

methodName string

The name of the method used to start the operation

Returns
Type Description
Google\ApiCore\OperationResponse

static::annotationSpecName

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

Parameters
Name Description
project string
location string
dataset string
annotationSpec string
Returns
Type Description
string The formatted annotation_spec resource.

static::datasetName

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

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

static::locationName

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

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

static::modelName

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

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

static::modelEvaluationName

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

Parameters
Name Description
project string
location string
model string
modelEvaluation string
Returns
Type Description
string The formatted model_evaluation resource.

static::parseName

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

The following name formats are supported: Template: Pattern

  • annotationSpec: projects/{project}/locations/{location}/datasets/{dataset}/annotationSpecs/{annotation_spec}
  • dataset: projects/{project}/locations/{location}/datasets/{dataset}
  • location: projects/{project}/locations/{location}
  • model: projects/{project}/locations/{location}/models/{model}
  • modelEvaluation: projects/{project}/locations/{location}/models/{model}/modelEvaluations/{model_evaluation}

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

Parameters
Name Description
formattedName string

The formatted name string

template string

Optional name of template to match

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