Cloud AutoML V1beta1 Client - Class AutoMlClient (1.4.17)

Reference documentation and code samples for the Cloud AutoML V1beta1 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 kebab-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. Sample code to get started:

$autoMlClient = new Google\Cloud\AutoMl\V1beta1\AutoMlClient();
try {
    $formattedParent = $autoMlClient->locationName('[PROJECT]', '[LOCATION]');
    $dataset = new Google\Cloud\AutoMl\V1beta1\Dataset();
    $response = $autoMlClient->createDataset($formattedParent, $dataset);
} finally {
    $autoMlClient->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

annotationSpecName

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

Parameters
NameDescription
project string
location string
dataset string
annotationSpec string
Returns
TypeDescription
stringThe formatted annotation_spec resource.

columnSpecName

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

Parameters
NameDescription
project string
location string
dataset string
tableSpec string
columnSpec string
Returns
TypeDescription
stringThe formatted column_spec resource.

datasetName

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

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

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.

modelName

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

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

modelEvaluationName

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

Parameters
NameDescription
project string
location string
model string
modelEvaluation string
Returns
TypeDescription
stringThe formatted model_evaluation resource.

tableSpecName

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

Parameters
NameDescription
project string
location string
dataset string
tableSpec string
Returns
TypeDescription
stringThe formatted table_spec 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

  • annotationSpec: projects/{project}/locations/{location}/datasets/{dataset}/annotationSpecs/{annotation_spec}
  • columnSpec: projects/{project}/locations/{location}/datasets/{dataset}/tableSpecs/{table_spec}/columnSpecs/{column_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}
  • tableSpec: projects/{project}/locations/{location}/datasets/{dataset}/tableSpecs/{table_spec}

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.

createDataset

Creates a dataset.

Parameters
NameDescription
parent string

Required. The resource name of the project to create the dataset for.

dataset Google\Cloud\AutoMl\V1beta1\Dataset

Required. The dataset 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\Cloud\AutoMl\V1beta1\Dataset
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AutoMl\V1beta1\AutoMlClient;
use Google\Cloud\AutoMl\V1beta1\Dataset;

/**
 * @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 any non-scalar elements to be passed along with the request.
    $dataset = new Dataset();

    // Call the API and handle any network failures.
    try {
        /** @var Dataset $response */
        $response = $autoMlClient->createDataset($formattedParent, $dataset);
        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 = 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.

Parameters
NameDescription
parent string

Required. Resource name of the parent project where the model is being created.

model Google\Cloud\AutoMl\V1beta1\Model

Required. The model 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\AutoMl\V1beta1\AutoMlClient;
use Google\Cloud\AutoMl\V1beta1\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 any non-scalar elements to be passed along with the request.
    $model = new Model();

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $autoMlClient->createModel($formattedParent, $model);
        $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());
    }
}

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

Parameters
NameDescription
name string

Required. The resource name of the dataset to delete.

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\AutoMl\V1beta1\AutoMlClient;
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();

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $autoMlClient->deleteDataset($formattedName);
        $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 = 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.

Parameters
NameDescription
name string

Required. Resource name of the model being deleted.

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\AutoMl\V1beta1\AutoMlClient;
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();

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $autoMlClient->deleteModel($formattedName);
        $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 = 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.

Parameters
NameDescription
name string

Required. Resource name of the model to deploy.

optionalArgs array

Optional.

↳ imageObjectDetectionModelDeploymentMetadata ImageObjectDetectionModelDeploymentMetadata

Model deployment metadata specific to Image Object Detection.

↳ imageClassificationModelDeploymentMetadata ImageClassificationModelDeploymentMetadata

Model deployment metadata specific to Image Classification.

↳ 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\AutoMl\V1beta1\AutoMlClient;
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();

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $autoMlClient->deployModel($formattedName);
        $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 = 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.

Parameters
NameDescription
name string

Required. The resource name of the dataset.

outputConfig Google\Cloud\AutoMl\V1beta1\OutputConfig

Required. The desired output location.

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\AutoMl\V1beta1\AutoMlClient;
use Google\Cloud\AutoMl\V1beta1\OutputConfig;
use Google\Rpc\Status;

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

    // Prepare any non-scalar elements to be passed along with the request.
    $outputConfig = new OutputConfig();

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $autoMlClient->exportData($formattedName, $outputConfig);
        $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 = AutoMlClient::datasetName('[PROJECT]', '[LOCATION]', '[DATASET]');

    export_data_sample($formattedName);
}

exportEvaluatedExamples

Exports examples on which the model was evaluated (i.e. which were in the TEST set of the dataset the model was created from), together with their ground truth annotations and the annotations created (predicted) by the model.

The examples, ground truth and predictions are exported in the state they were at the moment the model was evaluated.

This export is available only for 30 days since the model evaluation is created.

Currently only available for Tables.

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

Parameters
NameDescription
name string

Required. The resource name of the model whose evaluated examples are to be exported.

outputConfig Google\Cloud\AutoMl\V1beta1\ExportEvaluatedExamplesOutputConfig

Required. The desired output location and configuration.

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\AutoMl\V1beta1\AutoMlClient;
use Google\Cloud\AutoMl\V1beta1\ExportEvaluatedExamplesOutputConfig;
use Google\Rpc\Status;

/**
 * @param string $formattedName The resource name of the model whose evaluated examples are to
 *                              be exported. Please see
 *                              {@see AutoMlClient::modelName()} for help formatting this field.
 */
function export_evaluated_examples_sample(string $formattedName): void
{
    // Create a client.
    $autoMlClient = new AutoMlClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $outputConfig = new ExportEvaluatedExamplesOutputConfig();

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $autoMlClient->exportEvaluatedExamples($formattedName, $outputConfig);
        $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 = AutoMlClient::modelName('[PROJECT]', '[LOCATION]', '[MODEL]');

    export_evaluated_examples_sample($formattedName);
}

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.

Parameters
NameDescription
name string

Required. The resource name of the model to export.

outputConfig Google\Cloud\AutoMl\V1beta1\ModelExportOutputConfig

Required. The desired output location and configuration.

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\AutoMl\V1beta1\AutoMlClient;
use Google\Cloud\AutoMl\V1beta1\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.
 */
function export_model_sample(string $formattedName): void
{
    // Create a client.
    $autoMlClient = new AutoMlClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $outputConfig = new ModelExportOutputConfig();

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $autoMlClient->exportModel($formattedName, $outputConfig);
        $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 = AutoMlClient::modelName('[PROJECT]', '[LOCATION]', '[MODEL]');

    export_model_sample($formattedName);
}

getAnnotationSpec

Gets an annotation spec.

Parameters
NameDescription
name string

Required. The resource name of the annotation spec to retrieve.

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\AutoMl\V1beta1\AnnotationSpec
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AutoMl\V1beta1\AnnotationSpec;
use Google\Cloud\AutoMl\V1beta1\AutoMlClient;

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

    // Call the API and handle any network failures.
    try {
        /** @var AnnotationSpec $response */
        $response = $autoMlClient->getAnnotationSpec($formattedName);
        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 = AutoMlClient::annotationSpecName(
        '[PROJECT]',
        '[LOCATION]',
        '[DATASET]',
        '[ANNOTATION_SPEC]'
    );

    get_annotation_spec_sample($formattedName);
}

getColumnSpec

Gets a column spec.

Parameters
NameDescription
name string

Required. The resource name of the column spec to retrieve.

optionalArgs array

Optional.

↳ fieldMask 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\Cloud\AutoMl\V1beta1\ColumnSpec
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AutoMl\V1beta1\AutoMlClient;
use Google\Cloud\AutoMl\V1beta1\ColumnSpec;

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

    // Call the API and handle any network failures.
    try {
        /** @var ColumnSpec $response */
        $response = $autoMlClient->getColumnSpec($formattedName);
        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 = AutoMlClient::columnSpecName(
        '[PROJECT]',
        '[LOCATION]',
        '[DATASET]',
        '[TABLE_SPEC]',
        '[COLUMN_SPEC]'
    );

    get_column_spec_sample($formattedName);
}

getDataset

Gets a dataset.

Parameters
NameDescription
name string

Required. The resource name of the dataset to retrieve.

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\AutoMl\V1beta1\Dataset
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AutoMl\V1beta1\AutoMlClient;
use Google\Cloud\AutoMl\V1beta1\Dataset;

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

    // Call the API and handle any network failures.
    try {
        /** @var Dataset $response */
        $response = $autoMlClient->getDataset($formattedName);
        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 = AutoMlClient::datasetName('[PROJECT]', '[LOCATION]', '[DATASET]');

    get_dataset_sample($formattedName);
}

getModel

Gets a model.

Parameters
NameDescription
name string

Required. Resource name of the model.

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\AutoMl\V1beta1\Model
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AutoMl\V1beta1\AutoMlClient;
use Google\Cloud\AutoMl\V1beta1\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();

    // Call the API and handle any network failures.
    try {
        /** @var Model $response */
        $response = $autoMlClient->getModel($formattedName);
        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 = AutoMlClient::modelName('[PROJECT]', '[LOCATION]', '[MODEL]');

    get_model_sample($formattedName);
}

getModelEvaluation

Gets a model evaluation.

Parameters
NameDescription
name string

Required. Resource name for the model evaluation.

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\AutoMl\V1beta1\ModelEvaluation
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AutoMl\V1beta1\AutoMlClient;
use Google\Cloud\AutoMl\V1beta1\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();

    // Call the API and handle any network failures.
    try {
        /** @var ModelEvaluation $response */
        $response = $autoMlClient->getModelEvaluation($formattedName);
        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 = AutoMlClient::modelEvaluationName(
        '[PROJECT]',
        '[LOCATION]',
        '[MODEL]',
        '[MODEL_EVALUATION]'
    );

    get_model_evaluation_sample($formattedName);
}

getTableSpec

Gets a table spec.

Parameters
NameDescription
name string

Required. The resource name of the table spec to retrieve.

optionalArgs array

Optional.

↳ fieldMask 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\Cloud\AutoMl\V1beta1\TableSpec
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AutoMl\V1beta1\AutoMlClient;
use Google\Cloud\AutoMl\V1beta1\TableSpec;

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

    // Call the API and handle any network failures.
    try {
        /** @var TableSpec $response */
        $response = $autoMlClient->getTableSpec($formattedName);
        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 = AutoMlClient::tableSpecName(
        '[PROJECT]',
        '[LOCATION]',
        '[DATASET]',
        '[TABLE_SPEC]'
    );

    get_table_spec_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.
Parameters
NameDescription
name string

Required. Dataset name. Dataset must already exist. All imported annotations and examples will be added.

inputConfig Google\Cloud\AutoMl\V1beta1\InputConfig

Required. The desired input location and its domain specific semantics, if any.

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\AutoMl\V1beta1\AutoMlClient;
use Google\Cloud\AutoMl\V1beta1\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 any non-scalar elements to be passed along with the request.
    $inputConfig = new InputConfig();

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $autoMlClient->importData($formattedName, $inputConfig);
        $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 = AutoMlClient::datasetName('[PROJECT]', '[LOCATION]', '[DATASET]');

    import_data_sample($formattedName);
}

listColumnSpecs

Lists column specs in a table spec.

Parameters
NameDescription
parent string

Required. The resource name of the table spec to list column specs from.

optionalArgs array

Optional.

↳ fieldMask FieldMask

Mask specifying which fields to read.

↳ filter string

Filter expression, see go/filtering.

↳ 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\AutoMl\V1beta1\AutoMlClient;
use Google\Cloud\AutoMl\V1beta1\ColumnSpec;

/**
 * @param string $formattedParent The resource name of the table spec to list column specs from. Please see
 *                                {@see AutoMlClient::tableSpecName()} for help formatting this field.
 */
function list_column_specs_sample(string $formattedParent): void
{
    // Create a client.
    $autoMlClient = new AutoMlClient();

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

        /** @var ColumnSpec $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 = AutoMlClient::tableSpecName(
        '[PROJECT]',
        '[LOCATION]',
        '[DATASET]',
        '[TABLE_SPEC]'
    );

    list_column_specs_sample($formattedParent);
}

listDatasets

Lists datasets in a project.

Parameters
NameDescription
parent string

Required. The resource name of the project from which to list datasets.

optionalArgs array

Optional.

↳ filter string

An expression for filtering the results of the request. * dataset_metadata - for existence of the case (e.g. image_classification_dataset_metadata:*). Some examples of using the filter are: * translation_dataset_metadata:* --> The dataset has translation_dataset_metadata.

↳ 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\AutoMl\V1beta1\AutoMlClient;
use Google\Cloud\AutoMl\V1beta1\Dataset;

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

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

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

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

Parameters
NameDescription
parent string

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

optionalArgs array

Optional.

↳ filter string

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.

↳ 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\AutoMl\V1beta1\AutoMlClient;
use Google\Cloud\AutoMl\V1beta1\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.
 */
function list_model_evaluations_sample(string $formattedParent): void
{
    // Create a client.
    $autoMlClient = new AutoMlClient();

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

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

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

    list_model_evaluations_sample($formattedParent);
}

listModels

Lists models.

Parameters
NameDescription
parent string

Required. Resource name of the project, from which to list the models.

optionalArgs array

Optional.

↳ filter string

An expression for filtering the results of the request. * model_metadata - for existence of the case (e.g. video_classification_model_metadata:*). * dataset_id - for = or !=. Some examples of using the filter are: * image_classification_model_metadata:* --> The model has image_classification_model_metadata. * dataset_id=5 --> The model was created from a dataset with ID 5.

↳ 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\AutoMl\V1beta1\AutoMlClient;
use Google\Cloud\AutoMl\V1beta1\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();

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

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

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

listTableSpecs

Lists table specs in a dataset.

Parameters
NameDescription
parent string

Required. The resource name of the dataset to list table specs from.

optionalArgs array

Optional.

↳ fieldMask FieldMask

Mask specifying which fields to read.

↳ filter string

Filter expression, see go/filtering.

↳ 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\AutoMl\V1beta1\AutoMlClient;
use Google\Cloud\AutoMl\V1beta1\TableSpec;

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

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

        /** @var TableSpec $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 = AutoMlClient::datasetName('[PROJECT]', '[LOCATION]', '[DATASET]');

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

Parameters
NameDescription
name string

Required. Resource name of the model to undeploy.

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\AutoMl\V1beta1\AutoMlClient;
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();

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $autoMlClient->undeployModel($formattedName);
        $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 = AutoMlClient::modelName('[PROJECT]', '[LOCATION]', '[MODEL]');

    undeploy_model_sample($formattedName);
}

updateColumnSpec

Updates a column spec.

Parameters
NameDescription
columnSpec Google\Cloud\AutoMl\V1beta1\ColumnSpec

Required. The column spec which replaces the resource on the server.

optionalArgs array

Optional.

↳ updateMask FieldMask

The update mask applies to the resource.

↳ 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\AutoMl\V1beta1\ColumnSpec
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AutoMl\V1beta1\AutoMlClient;
use Google\Cloud\AutoMl\V1beta1\ColumnSpec;

/**
 * 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_column_spec_sample(): void
{
    // Create a client.
    $autoMlClient = new AutoMlClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $columnSpec = new ColumnSpec();

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

updateDataset

Updates a dataset.

Parameters
NameDescription
dataset Google\Cloud\AutoMl\V1beta1\Dataset

Required. The dataset which replaces the resource on the server.

optionalArgs array

Optional.

↳ updateMask FieldMask

The update mask applies to the resource.

↳ 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\AutoMl\V1beta1\Dataset
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AutoMl\V1beta1\AutoMlClient;
use Google\Cloud\AutoMl\V1beta1\Dataset;

/**
 * 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 any non-scalar elements to be passed along with the request.
    $dataset = new Dataset();

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

updateTableSpec

Updates a table spec.

Parameters
NameDescription
tableSpec Google\Cloud\AutoMl\V1beta1\TableSpec

Required. The table spec which replaces the resource on the server.

optionalArgs array

Optional.

↳ updateMask FieldMask

The update mask applies to the resource.

↳ 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\AutoMl\V1beta1\TableSpec
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AutoMl\V1beta1\AutoMlClient;
use Google\Cloud\AutoMl\V1beta1\TableSpec;

/**
 * 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_table_spec_sample(): void
{
    // Create a client.
    $autoMlClient = new AutoMlClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $tableSpec = new TableSpec();

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

Constants

SERVICE_NAME

Value: 'google.cloud.automl.v1beta1.AutoMl'

The name of the service.

SERVICE_ADDRESS

Value: 'automl.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.