Google Cloud Ai Platform V1 Client - Class MetadataServiceClient (0.23.0)

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

Service Description: Service for reading and writing metadata entries.

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:

$metadataServiceClient = new MetadataServiceClient();
try {
    $formattedContext = $metadataServiceClient->contextName('[PROJECT]', '[LOCATION]', '[METADATA_STORE]', '[CONTEXT]');
    $response = $metadataServiceClient->addContextArtifactsAndExecutions($formattedContext);
} finally {
    $metadataServiceClient->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.

This service has a new (beta) implementation. See Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient to use the new surface.

Namespace

Google \ Cloud \ AIPlatform \ V1

Methods

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

addContextArtifactsAndExecutions

Adds a set of Artifacts and Executions to a Context. If any of the Artifacts or Executions have already been added to a Context, they are simply skipped.

Parameters
NameDescription
context string

Required. The resource name of the Context that the Artifacts and Executions belong to. Format: projects/{project}/locations/{location}/metadataStores/{metadatastore}/contexts/{context}

optionalArgs array

Optional.

↳ artifacts string[]

The resource names of the Artifacts to attribute to the Context. Format: projects/{project}/locations/{location}/metadataStores/{metadatastore}/artifacts/{artifact}

↳ executions string[]

The resource names of the Executions to associate with the Context. Format: projects/{project}/locations/{location}/metadataStores/{metadatastore}/executions/{execution}

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\AIPlatform\V1\AddContextArtifactsAndExecutionsResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\AddContextArtifactsAndExecutionsRequest;
use Google\Cloud\AIPlatform\V1\AddContextArtifactsAndExecutionsResponse;
use Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient;

/**
 * @param string $formattedContext The resource name of the Context that the Artifacts and
 *                                 Executions belong to. Format:
 *                                 `projects/{project}/locations/{location}/metadataStores/{metadatastore}/contexts/{context}`
 *                                 Please see {@see MetadataServiceClient::contextName()} for help formatting this field.
 */
function add_context_artifacts_and_executions_sample(string $formattedContext): void
{
    // Create a client.
    $metadataServiceClient = new MetadataServiceClient();

    // Prepare the request message.
    $request = (new AddContextArtifactsAndExecutionsRequest())
        ->setContext($formattedContext);

    // Call the API and handle any network failures.
    try {
        /** @var AddContextArtifactsAndExecutionsResponse $response */
        $response = $metadataServiceClient->addContextArtifactsAndExecutions($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
{
    $formattedContext = MetadataServiceClient::contextName(
        '[PROJECT]',
        '[LOCATION]',
        '[METADATA_STORE]',
        '[CONTEXT]'
    );

    add_context_artifacts_and_executions_sample($formattedContext);
}

addContextChildren

Adds a set of Contexts as children to a parent Context. If any of the child Contexts have already been added to the parent Context, they are simply skipped. If this call would create a cycle or cause any Context to have more than 10 parents, the request will fail with an INVALID_ARGUMENT error.

Parameters
NameDescription
context string

Required. The resource name of the parent Context.

Format: projects/{project}/locations/{location}/metadataStores/{metadatastore}/contexts/{context}

optionalArgs array

Optional.

↳ childContexts string[]

The resource names of the child Contexts.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\AIPlatform\V1\AddContextChildrenResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\AddContextChildrenRequest;
use Google\Cloud\AIPlatform\V1\AddContextChildrenResponse;
use Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient;

/**
 * @param string $formattedContext The resource name of the parent Context.
 *
 *                                 Format:
 *                                 `projects/{project}/locations/{location}/metadataStores/{metadatastore}/contexts/{context}`
 *                                 Please see {@see MetadataServiceClient::contextName()} for help formatting this field.
 */
function add_context_children_sample(string $formattedContext): void
{
    // Create a client.
    $metadataServiceClient = new MetadataServiceClient();

    // Prepare the request message.
    $request = (new AddContextChildrenRequest())
        ->setContext($formattedContext);

    // Call the API and handle any network failures.
    try {
        /** @var AddContextChildrenResponse $response */
        $response = $metadataServiceClient->addContextChildren($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
{
    $formattedContext = MetadataServiceClient::contextName(
        '[PROJECT]',
        '[LOCATION]',
        '[METADATA_STORE]',
        '[CONTEXT]'
    );

    add_context_children_sample($formattedContext);
}

addExecutionEvents

Adds Events to the specified Execution. An Event indicates whether an Artifact was used as an input or output for an Execution. If an Event already exists between the Execution and the Artifact, the Event is skipped.

Parameters
NameDescription
execution string

Required. The resource name of the Execution that the Events connect Artifacts with. Format: projects/{project}/locations/{location}/metadataStores/{metadatastore}/executions/{execution}

optionalArgs array

Optional.

↳ events Event[]

The Events to create and add.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\AIPlatform\V1\AddExecutionEventsResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\AddExecutionEventsRequest;
use Google\Cloud\AIPlatform\V1\AddExecutionEventsResponse;
use Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient;

/**
 * @param string $formattedExecution The resource name of the Execution that the Events connect
 *                                   Artifacts with.
 *                                   Format:
 *                                   `projects/{project}/locations/{location}/metadataStores/{metadatastore}/executions/{execution}`
 *                                   Please see {@see MetadataServiceClient::executionName()} for help formatting this field.
 */
function add_execution_events_sample(string $formattedExecution): void
{
    // Create a client.
    $metadataServiceClient = new MetadataServiceClient();

    // Prepare the request message.
    $request = (new AddExecutionEventsRequest())
        ->setExecution($formattedExecution);

    // Call the API and handle any network failures.
    try {
        /** @var AddExecutionEventsResponse $response */
        $response = $metadataServiceClient->addExecutionEvents($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
{
    $formattedExecution = MetadataServiceClient::executionName(
        '[PROJECT]',
        '[LOCATION]',
        '[METADATA_STORE]',
        '[EXECUTION]'
    );

    add_execution_events_sample($formattedExecution);
}

createArtifact

Creates an Artifact associated with a MetadataStore.

Parameters
NameDescription
parent string

Required. The resource name of the MetadataStore where the Artifact should be created. Format: projects/{project}/locations/{location}/metadataStores/{metadatastore}

artifact Google\Cloud\AIPlatform\V1\Artifact

Required. The Artifact to create.

optionalArgs array

Optional.

↳ artifactId string

The {artifact} portion of the resource name with the format: projects/{project}/locations/{location}/metadataStores/{metadatastore}/artifacts/{artifact} If not provided, the Artifact's ID will be a UUID generated by the service. Must be 4-128 characters in length. Valid characters are /[a-z][0-9]-/. Must be unique across all Artifacts in the parent MetadataStore. (Otherwise the request will fail with ALREADY_EXISTS, or PERMISSION_DENIED if the caller can't view the preexisting Artifact.)

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\AIPlatform\V1\Artifact
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Artifact;
use Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient;
use Google\Cloud\AIPlatform\V1\CreateArtifactRequest;

/**
 * @param string $formattedParent The resource name of the MetadataStore where the Artifact should
 *                                be created.
 *                                Format:
 *                                `projects/{project}/locations/{location}/metadataStores/{metadatastore}`
 *                                Please see {@see MetadataServiceClient::metadataStoreName()} for help formatting this field.
 */
function create_artifact_sample(string $formattedParent): void
{
    // Create a client.
    $metadataServiceClient = new MetadataServiceClient();

    // Prepare the request message.
    $artifact = new Artifact();
    $request = (new CreateArtifactRequest())
        ->setParent($formattedParent)
        ->setArtifact($artifact);

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

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

    create_artifact_sample($formattedParent);
}

createContext

Creates a Context associated with a MetadataStore.

Parameters
NameDescription
parent string

Required. The resource name of the MetadataStore where the Context should be created. Format: projects/{project}/locations/{location}/metadataStores/{metadatastore}

context Google\Cloud\AIPlatform\V1\Context

Required. The Context to create.

optionalArgs array

Optional.

↳ contextId string

The {context} portion of the resource name with the format: projects/{project}/locations/{location}/metadataStores/{metadatastore}/contexts/{context}. If not provided, the Context's ID will be a UUID generated by the service. Must be 4-128 characters in length. Valid characters are /[a-z][0-9]-/. Must be unique across all Contexts in the parent MetadataStore. (Otherwise the request will fail with ALREADY_EXISTS, or PERMISSION_DENIED if the caller can't view the preexisting Context.)

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\AIPlatform\V1\Context
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient;
use Google\Cloud\AIPlatform\V1\Context;
use Google\Cloud\AIPlatform\V1\CreateContextRequest;

/**
 * @param string $formattedParent The resource name of the MetadataStore where the Context should
 *                                be created. Format:
 *                                `projects/{project}/locations/{location}/metadataStores/{metadatastore}`
 *                                Please see {@see MetadataServiceClient::metadataStoreName()} for help formatting this field.
 */
function create_context_sample(string $formattedParent): void
{
    // Create a client.
    $metadataServiceClient = new MetadataServiceClient();

    // Prepare the request message.
    $context = new Context();
    $request = (new CreateContextRequest())
        ->setParent($formattedParent)
        ->setContext($context);

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

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

    create_context_sample($formattedParent);
}

createExecution

Creates an Execution associated with a MetadataStore.

Parameters
NameDescription
parent string

Required. The resource name of the MetadataStore where the Execution should be created. Format: projects/{project}/locations/{location}/metadataStores/{metadatastore}

execution Google\Cloud\AIPlatform\V1\Execution

Required. The Execution to create.

optionalArgs array

Optional.

↳ executionId string

The {execution} portion of the resource name with the format: projects/{project}/locations/{location}/metadataStores/{metadatastore}/executions/{execution} If not provided, the Execution's ID will be a UUID generated by the service. Must be 4-128 characters in length. Valid characters are /[a-z][0-9]-/. Must be unique across all Executions in the parent MetadataStore. (Otherwise the request will fail with ALREADY_EXISTS, or PERMISSION_DENIED if the caller can't view the preexisting Execution.)

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\AIPlatform\V1\Execution
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient;
use Google\Cloud\AIPlatform\V1\CreateExecutionRequest;
use Google\Cloud\AIPlatform\V1\Execution;

/**
 * @param string $formattedParent The resource name of the MetadataStore where the Execution should
 *                                be created.
 *                                Format:
 *                                `projects/{project}/locations/{location}/metadataStores/{metadatastore}`
 *                                Please see {@see MetadataServiceClient::metadataStoreName()} for help formatting this field.
 */
function create_execution_sample(string $formattedParent): void
{
    // Create a client.
    $metadataServiceClient = new MetadataServiceClient();

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

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

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

    create_execution_sample($formattedParent);
}

createMetadataSchema

Creates a MetadataSchema.

Parameters
NameDescription
parent string

Required. The resource name of the MetadataStore where the MetadataSchema should be created. Format: projects/{project}/locations/{location}/metadataStores/{metadatastore}

metadataSchema Google\Cloud\AIPlatform\V1\MetadataSchema

Required. The MetadataSchema to create.

optionalArgs array

Optional.

↳ metadataSchemaId string

The {metadata_schema} portion of the resource name with the format: projects/{project}/locations/{location}/metadataStores/{metadatastore}/metadataSchemas/{metadataschema} If not provided, the MetadataStore's ID will be a UUID generated by the service. Must be 4-128 characters in length. Valid characters are /[a-z][0-9]-/. Must be unique across all MetadataSchemas in the parent Location. (Otherwise the request will fail with ALREADY_EXISTS, or PERMISSION_DENIED if the caller can't view the preexisting MetadataSchema.)

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\AIPlatform\V1\MetadataSchema
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient;
use Google\Cloud\AIPlatform\V1\CreateMetadataSchemaRequest;
use Google\Cloud\AIPlatform\V1\MetadataSchema;

/**
 * @param string $formattedParent      The resource name of the MetadataStore where the MetadataSchema
 *                                     should be created. Format:
 *                                     `projects/{project}/locations/{location}/metadataStores/{metadatastore}`
 *                                     Please see {@see MetadataServiceClient::metadataStoreName()} for help formatting this field.
 * @param string $metadataSchemaSchema The raw YAML string representation of the MetadataSchema. The
 *                                     combination of [MetadataSchema.version] and the schema name given by
 *                                     `title` in [MetadataSchema.schema] must be unique within a MetadataStore.
 *
 *                                     The schema is defined as an OpenAPI 3.0.2
 *                                     [MetadataSchema
 *                                     Object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#schemaObject)
 */
function create_metadata_schema_sample(
    string $formattedParent,
    string $metadataSchemaSchema
): void {
    // Create a client.
    $metadataServiceClient = new MetadataServiceClient();

    // Prepare the request message.
    $metadataSchema = (new MetadataSchema())
        ->setSchema($metadataSchemaSchema);
    $request = (new CreateMetadataSchemaRequest())
        ->setParent($formattedParent)
        ->setMetadataSchema($metadataSchema);

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

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

    create_metadata_schema_sample($formattedParent, $metadataSchemaSchema);
}

createMetadataStore

Initializes a MetadataStore, including allocation of resources.

Parameters
NameDescription
parent string

Required. The resource name of the Location where the MetadataStore should be created. Format: projects/{project}/locations/{location}/

metadataStore Google\Cloud\AIPlatform\V1\MetadataStore

Required. The MetadataStore to create.

optionalArgs array

Optional.

↳ metadataStoreId string

The {metadatastore} portion of the resource name with the format: projects/{project}/locations/{location}/metadataStores/{metadatastore} If not provided, the MetadataStore's ID will be a UUID generated by the service. Must be 4-128 characters in length. Valid characters are /[a-z][0-9]-/. Must be unique across all MetadataStores in the parent Location. (Otherwise the request will fail with ALREADY_EXISTS, or PERMISSION_DENIED if the caller can't view the preexisting MetadataStore.)

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient;
use Google\Cloud\AIPlatform\V1\CreateMetadataStoreRequest;
use Google\Cloud\AIPlatform\V1\MetadataStore;
use Google\Rpc\Status;

/**
 * @param string $formattedParent The resource name of the Location where the MetadataStore should
 *                                be created.
 *                                Format: `projects/{project}/locations/{location}/`
 *                                Please see {@see MetadataServiceClient::locationName()} for help formatting this field.
 */
function create_metadata_store_sample(string $formattedParent): void
{
    // Create a client.
    $metadataServiceClient = new MetadataServiceClient();

    // Prepare the request message.
    $metadataStore = new MetadataStore();
    $request = (new CreateMetadataStoreRequest())
        ->setParent($formattedParent)
        ->setMetadataStore($metadataStore);

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

        if ($response->operationSucceeded()) {
            /** @var MetadataStore $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 = MetadataServiceClient::locationName('[PROJECT]', '[LOCATION]');

    create_metadata_store_sample($formattedParent);
}

deleteArtifact

Deletes an Artifact.

Parameters
NameDescription
name string

Required. The resource name of the Artifact to delete. Format: projects/{project}/locations/{location}/metadataStores/{metadatastore}/artifacts/{artifact}

optionalArgs array

Optional.

↳ etag string

Optional. The etag of the Artifact to delete. If this is provided, it must match the server's etag. Otherwise, the request will fail with a FAILED_PRECONDITION.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient;
use Google\Cloud\AIPlatform\V1\DeleteArtifactRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The resource name of the Artifact to delete.
 *                              Format:
 *                              `projects/{project}/locations/{location}/metadataStores/{metadatastore}/artifacts/{artifact}`
 *                              Please see {@see MetadataServiceClient::artifactName()} for help formatting this field.
 */
function delete_artifact_sample(string $formattedName): void
{
    // Create a client.
    $metadataServiceClient = new MetadataServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $metadataServiceClient->deleteArtifact($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 = MetadataServiceClient::artifactName(
        '[PROJECT]',
        '[LOCATION]',
        '[METADATA_STORE]',
        '[ARTIFACT]'
    );

    delete_artifact_sample($formattedName);
}

deleteContext

Deletes a stored Context.

Parameters
NameDescription
name string

Required. The resource name of the Context to delete. Format: projects/{project}/locations/{location}/metadataStores/{metadatastore}/contexts/{context}

optionalArgs array

Optional.

↳ force bool

The force deletion semantics is still undefined. Users should not use this field.

↳ etag string

Optional. The etag of the Context to delete. If this is provided, it must match the server's etag. Otherwise, the request will fail with a FAILED_PRECONDITION.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient;
use Google\Cloud\AIPlatform\V1\DeleteContextRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The resource name of the Context to delete.
 *                              Format:
 *                              `projects/{project}/locations/{location}/metadataStores/{metadatastore}/contexts/{context}`
 *                              Please see {@see MetadataServiceClient::contextName()} for help formatting this field.
 */
function delete_context_sample(string $formattedName): void
{
    // Create a client.
    $metadataServiceClient = new MetadataServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $metadataServiceClient->deleteContext($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 = MetadataServiceClient::contextName(
        '[PROJECT]',
        '[LOCATION]',
        '[METADATA_STORE]',
        '[CONTEXT]'
    );

    delete_context_sample($formattedName);
}

deleteExecution

Deletes an Execution.

Parameters
NameDescription
name string

Required. The resource name of the Execution to delete. Format: projects/{project}/locations/{location}/metadataStores/{metadatastore}/executions/{execution}

optionalArgs array

Optional.

↳ etag string

Optional. The etag of the Execution to delete. If this is provided, it must match the server's etag. Otherwise, the request will fail with a FAILED_PRECONDITION.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient;
use Google\Cloud\AIPlatform\V1\DeleteExecutionRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The resource name of the Execution to delete.
 *                              Format:
 *                              `projects/{project}/locations/{location}/metadataStores/{metadatastore}/executions/{execution}`
 *                              Please see {@see MetadataServiceClient::executionName()} for help formatting this field.
 */
function delete_execution_sample(string $formattedName): void
{
    // Create a client.
    $metadataServiceClient = new MetadataServiceClient();

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

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

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

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

    delete_execution_sample($formattedName);
}

deleteMetadataStore

Deletes a single MetadataStore and all its child resources (Artifacts, Executions, and Contexts).

Parameters
NameDescription
name string

Required. The resource name of the MetadataStore to delete. Format: projects/{project}/locations/{location}/metadataStores/{metadatastore}

optionalArgs array

Optional.

↳ force bool

Deprecated: Field is no longer supported.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient;
use Google\Cloud\AIPlatform\V1\DeleteMetadataStoreRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The resource name of the MetadataStore to delete.
 *                              Format:
 *                              `projects/{project}/locations/{location}/metadataStores/{metadatastore}`
 *                              Please see {@see MetadataServiceClient::metadataStoreName()} for help formatting this field.
 */
function delete_metadata_store_sample(string $formattedName): void
{
    // Create a client.
    $metadataServiceClient = new MetadataServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $metadataServiceClient->deleteMetadataStore($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 = MetadataServiceClient::metadataStoreName(
        '[PROJECT]',
        '[LOCATION]',
        '[METADATA_STORE]'
    );

    delete_metadata_store_sample($formattedName);
}

getArtifact

Retrieves a specific Artifact.

Parameters
NameDescription
name string

Required. The resource name of the Artifact to retrieve. Format: projects/{project}/locations/{location}/metadataStores/{metadatastore}/artifacts/{artifact}

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\AIPlatform\V1\Artifact
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Artifact;
use Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient;
use Google\Cloud\AIPlatform\V1\GetArtifactRequest;

/**
 * @param string $formattedName The resource name of the Artifact to retrieve.
 *                              Format:
 *                              `projects/{project}/locations/{location}/metadataStores/{metadatastore}/artifacts/{artifact}`
 *                              Please see {@see MetadataServiceClient::artifactName()} for help formatting this field.
 */
function get_artifact_sample(string $formattedName): void
{
    // Create a client.
    $metadataServiceClient = new MetadataServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Artifact $response */
        $response = $metadataServiceClient->getArtifact($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 = MetadataServiceClient::artifactName(
        '[PROJECT]',
        '[LOCATION]',
        '[METADATA_STORE]',
        '[ARTIFACT]'
    );

    get_artifact_sample($formattedName);
}

getContext

Retrieves a specific Context.

Parameters
NameDescription
name string

Required. The resource name of the Context to retrieve. Format: projects/{project}/locations/{location}/metadataStores/{metadatastore}/contexts/{context}

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\AIPlatform\V1\Context
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient;
use Google\Cloud\AIPlatform\V1\Context;
use Google\Cloud\AIPlatform\V1\GetContextRequest;

/**
 * @param string $formattedName The resource name of the Context to retrieve.
 *                              Format:
 *                              `projects/{project}/locations/{location}/metadataStores/{metadatastore}/contexts/{context}`
 *                              Please see {@see MetadataServiceClient::contextName()} for help formatting this field.
 */
function get_context_sample(string $formattedName): void
{
    // Create a client.
    $metadataServiceClient = new MetadataServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Context $response */
        $response = $metadataServiceClient->getContext($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 = MetadataServiceClient::contextName(
        '[PROJECT]',
        '[LOCATION]',
        '[METADATA_STORE]',
        '[CONTEXT]'
    );

    get_context_sample($formattedName);
}

getExecution

Retrieves a specific Execution.

Parameters
NameDescription
name string

Required. The resource name of the Execution to retrieve. Format: projects/{project}/locations/{location}/metadataStores/{metadatastore}/executions/{execution}

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\AIPlatform\V1\Execution
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient;
use Google\Cloud\AIPlatform\V1\Execution;
use Google\Cloud\AIPlatform\V1\GetExecutionRequest;

/**
 * @param string $formattedName The resource name of the Execution to retrieve.
 *                              Format:
 *                              `projects/{project}/locations/{location}/metadataStores/{metadatastore}/executions/{execution}`
 *                              Please see {@see MetadataServiceClient::executionName()} for help formatting this field.
 */
function get_execution_sample(string $formattedName): void
{
    // Create a client.
    $metadataServiceClient = new MetadataServiceClient();

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

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

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

    get_execution_sample($formattedName);
}

getMetadataSchema

Retrieves a specific MetadataSchema.

Parameters
NameDescription
name string

Required. The resource name of the MetadataSchema to retrieve. Format: projects/{project}/locations/{location}/metadataStores/{metadatastore}/metadataSchemas/{metadataschema}

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\AIPlatform\V1\MetadataSchema
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient;
use Google\Cloud\AIPlatform\V1\GetMetadataSchemaRequest;
use Google\Cloud\AIPlatform\V1\MetadataSchema;

/**
 * @param string $formattedName The resource name of the MetadataSchema to retrieve.
 *                              Format:
 *                              `projects/{project}/locations/{location}/metadataStores/{metadatastore}/metadataSchemas/{metadataschema}`
 *                              Please see {@see MetadataServiceClient::metadataSchemaName()} for help formatting this field.
 */
function get_metadata_schema_sample(string $formattedName): void
{
    // Create a client.
    $metadataServiceClient = new MetadataServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var MetadataSchema $response */
        $response = $metadataServiceClient->getMetadataSchema($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 = MetadataServiceClient::metadataSchemaName(
        '[PROJECT]',
        '[LOCATION]',
        '[METADATA_STORE]',
        '[METADATA_SCHEMA]'
    );

    get_metadata_schema_sample($formattedName);
}

getMetadataStore

Retrieves a specific MetadataStore.

Parameters
NameDescription
name string

Required. The resource name of the MetadataStore to retrieve. Format: projects/{project}/locations/{location}/metadataStores/{metadatastore}

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\AIPlatform\V1\MetadataStore
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient;
use Google\Cloud\AIPlatform\V1\GetMetadataStoreRequest;
use Google\Cloud\AIPlatform\V1\MetadataStore;

/**
 * @param string $formattedName The resource name of the MetadataStore to retrieve.
 *                              Format:
 *                              `projects/{project}/locations/{location}/metadataStores/{metadatastore}`
 *                              Please see {@see MetadataServiceClient::metadataStoreName()} for help formatting this field.
 */
function get_metadata_store_sample(string $formattedName): void
{
    // Create a client.
    $metadataServiceClient = new MetadataServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var MetadataStore $response */
        $response = $metadataServiceClient->getMetadataStore($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 = MetadataServiceClient::metadataStoreName(
        '[PROJECT]',
        '[LOCATION]',
        '[METADATA_STORE]'
    );

    get_metadata_store_sample($formattedName);
}

listArtifacts

Lists Artifacts in the MetadataStore.

Parameters
NameDescription
parent string

Required. The MetadataStore whose Artifacts should be listed. Format: projects/{project}/locations/{location}/metadataStores/{metadatastore}

optionalArgs array

Optional.

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

↳ filter string

Filter specifying the boolean condition for the Artifacts to satisfy in order to be part of the result set. The syntax to define filter query is based on https://google.aip.dev/160. The supported set of filters include the following: * Attribute filtering: For example: display_name = "test". Supported fields include: name, display_name, uri, state, schema_title, create_time, and update_time. Time fields, such as create_time and update_time, require values specified in RFC-3339 format. For example: create_time = "2020-11-19T11:30:00-04:00" * Metadata field: To filter on metadata fields use traversal operation as follows: metadata.<field_name>.<type_value>. For example: metadata.field_1.number_value = 10.0 In case the field name contains special characters (such as colon), one can embed it inside double quote. For example: metadata."field:1".number_value = 10.0 * Context based filtering: To filter Artifacts based on the contexts to which they belong, use the function operator with the full resource name in_context(<context-name>). For example: in_context("projects/<project_number>/locations/<location>/metadataStores/<metadatastore_name>/contexts/<context-id>") Each of the above supported filter types can be combined together using logical operators (AND & OR). Maximum nested expression depth allowed is 5. For example: display_name = "test" AND metadata.field1.bool_value = true.

↳ orderBy string

How the list of messages is ordered. Specify the values to order by and an ordering operation. The default sorting order is ascending. To specify descending order for a field, users append a " desc" suffix; for example: "foo desc, bar". Subfields are specified with a . character, such as foo.bar. see https://google.aip.dev/132#ordering for more details.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\AIPlatform\V1\Artifact;
use Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient;
use Google\Cloud\AIPlatform\V1\ListArtifactsRequest;

/**
 * @param string $formattedParent The MetadataStore whose Artifacts should be listed.
 *                                Format:
 *                                `projects/{project}/locations/{location}/metadataStores/{metadatastore}`
 *                                Please see {@see MetadataServiceClient::metadataStoreName()} for help formatting this field.
 */
function list_artifacts_sample(string $formattedParent): void
{
    // Create a client.
    $metadataServiceClient = new MetadataServiceClient();

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

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

        /** @var Artifact $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 = MetadataServiceClient::metadataStoreName(
        '[PROJECT]',
        '[LOCATION]',
        '[METADATA_STORE]'
    );

    list_artifacts_sample($formattedParent);
}

listContexts

Lists Contexts on the MetadataStore.

Parameters
NameDescription
parent string

Required. The MetadataStore whose Contexts should be listed. Format: projects/{project}/locations/{location}/metadataStores/{metadatastore}

optionalArgs array

Optional.

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

↳ filter string

Filter specifying the boolean condition for the Contexts to satisfy in order to be part of the result set. The syntax to define filter query is based on https://google.aip.dev/160. Following are the supported set of filters: * Attribute filtering: For example: display_name = "test". Supported fields include: name, display_name, schema_title, create_time, and update_time. Time fields, such as create_time and update_time, require values specified in RFC-3339 format. For example: create_time = "2020-11-19T11:30:00-04:00". * Metadata field: To filter on metadata fields use traversal operation as follows: metadata.<field_name>.<type_value>. For example: metadata.field_1.number_value = 10.0. In case the field name contains special characters (such as colon), one can embed it inside double quote. For example: metadata."field:1".number_value = 10.0 * Parent Child filtering: To filter Contexts based on parent-child relationship use the HAS operator as follows: parent_contexts: "projects/<project_number>/locations/<location>/metadataStores/<metadatastore_name>/contexts/<context_id>" child_contexts: "projects/<project_number>/locations/<location>/metadataStores/<metadatastore_name>/contexts/<context_id>" Each of the above supported filters can be combined together using logical operators (AND & OR). Maximum nested expression depth allowed is 5. For example: display_name = "test" AND metadata.field1.bool_value = true.

↳ orderBy string

How the list of messages is ordered. Specify the values to order by and an ordering operation. The default sorting order is ascending. To specify descending order for a field, users append a " desc" suffix; for example: "foo desc, bar". Subfields are specified with a . character, such as foo.bar. see https://google.aip.dev/132#ordering for more details.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient;
use Google\Cloud\AIPlatform\V1\Context;
use Google\Cloud\AIPlatform\V1\ListContextsRequest;

/**
 * @param string $formattedParent The MetadataStore whose Contexts should be listed.
 *                                Format:
 *                                `projects/{project}/locations/{location}/metadataStores/{metadatastore}`
 *                                Please see {@see MetadataServiceClient::metadataStoreName()} for help formatting this field.
 */
function list_contexts_sample(string $formattedParent): void
{
    // Create a client.
    $metadataServiceClient = new MetadataServiceClient();

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

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

        /** @var Context $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 = MetadataServiceClient::metadataStoreName(
        '[PROJECT]',
        '[LOCATION]',
        '[METADATA_STORE]'
    );

    list_contexts_sample($formattedParent);
}

listExecutions

Lists Executions in the MetadataStore.

Parameters
NameDescription
parent string

Required. The MetadataStore whose Executions should be listed. Format: projects/{project}/locations/{location}/metadataStores/{metadatastore}

optionalArgs array

Optional.

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

↳ filter string

Filter specifying the boolean condition for the Executions to satisfy in order to be part of the result set. The syntax to define filter query is based on https://google.aip.dev/160. Following are the supported set of filters: * Attribute filtering: For example: display_name = "test". Supported fields include: name, display_name, state, schema_title, create_time, and update_time. Time fields, such as create_time and update_time, require values specified in RFC-3339 format. For example: create_time = "2020-11-19T11:30:00-04:00". * Metadata field: To filter on metadata fields use traversal operation as follows: metadata.<field_name>.<type_value> For example: metadata.field_1.number_value = 10.0 In case the field name contains special characters (such as colon), one can embed it inside double quote. For example: metadata."field:1".number_value = 10.0 * Context based filtering: To filter Executions based on the contexts to which they belong use the function operator with the full resource name: in_context(<context-name>). For example: in_context("projects/<project_number>/locations/<location>/metadataStores/<metadatastore_name>/contexts/<context-id>") Each of the above supported filters can be combined together using logical operators (AND & OR). Maximum nested expression depth allowed is 5. For example: display_name = "test" AND metadata.field1.bool_value = true.

↳ orderBy string

How the list of messages is ordered. Specify the values to order by and an ordering operation. The default sorting order is ascending. To specify descending order for a field, users append a " desc" suffix; for example: "foo desc, bar". Subfields are specified with a . character, such as foo.bar. see https://google.aip.dev/132#ordering for more details.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient;
use Google\Cloud\AIPlatform\V1\Execution;
use Google\Cloud\AIPlatform\V1\ListExecutionsRequest;

/**
 * @param string $formattedParent The MetadataStore whose Executions should be listed.
 *                                Format:
 *                                `projects/{project}/locations/{location}/metadataStores/{metadatastore}`
 *                                Please see {@see MetadataServiceClient::metadataStoreName()} for help formatting this field.
 */
function list_executions_sample(string $formattedParent): void
{
    // Create a client.
    $metadataServiceClient = new MetadataServiceClient();

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

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

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

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

    list_executions_sample($formattedParent);
}

listMetadataSchemas

Lists MetadataSchemas.

Parameters
NameDescription
parent string

Required. The MetadataStore whose MetadataSchemas should be listed. Format: projects/{project}/locations/{location}/metadataStores/{metadatastore}

optionalArgs array

Optional.

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

↳ filter string

A query to filter available MetadataSchemas for matching results.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient;
use Google\Cloud\AIPlatform\V1\ListMetadataSchemasRequest;
use Google\Cloud\AIPlatform\V1\MetadataSchema;

/**
 * @param string $formattedParent The MetadataStore whose MetadataSchemas should be listed.
 *                                Format:
 *                                `projects/{project}/locations/{location}/metadataStores/{metadatastore}`
 *                                Please see {@see MetadataServiceClient::metadataStoreName()} for help formatting this field.
 */
function list_metadata_schemas_sample(string $formattedParent): void
{
    // Create a client.
    $metadataServiceClient = new MetadataServiceClient();

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

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

        /** @var MetadataSchema $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 = MetadataServiceClient::metadataStoreName(
        '[PROJECT]',
        '[LOCATION]',
        '[METADATA_STORE]'
    );

    list_metadata_schemas_sample($formattedParent);
}

listMetadataStores

Lists MetadataStores for a Location.

Parameters
NameDescription
parent string

Required. The Location whose MetadataStores should be listed. Format: projects/{project}/locations/{location}

optionalArgs array

Optional.

↳ pageSize int

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

↳ pageToken string

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

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient;
use Google\Cloud\AIPlatform\V1\ListMetadataStoresRequest;
use Google\Cloud\AIPlatform\V1\MetadataStore;

/**
 * @param string $formattedParent The Location whose MetadataStores should be listed.
 *                                Format:
 *                                `projects/{project}/locations/{location}`
 *                                Please see {@see MetadataServiceClient::locationName()} for help formatting this field.
 */
function list_metadata_stores_sample(string $formattedParent): void
{
    // Create a client.
    $metadataServiceClient = new MetadataServiceClient();

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

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

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

    list_metadata_stores_sample($formattedParent);
}

purgeArtifacts

Purges Artifacts.

Parameters
NameDescription
parent string

Required. The metadata store to purge Artifacts from. Format: projects/{project}/locations/{location}/metadataStores/{metadatastore}

filter string

Required. A required filter matching the Artifacts to be purged. E.g., update_time <= 2020-11-19T11:30:00-04:00.

optionalArgs array

Optional.

↳ force bool

Optional. Flag to indicate to actually perform the purge. If force is set to false, the method will return a sample of Artifact names that would be deleted.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient;
use Google\Cloud\AIPlatform\V1\PurgeArtifactsRequest;
use Google\Cloud\AIPlatform\V1\PurgeArtifactsResponse;
use Google\Rpc\Status;

/**
 * @param string $formattedParent The metadata store to purge Artifacts from.
 *                                Format:
 *                                `projects/{project}/locations/{location}/metadataStores/{metadatastore}`
 *                                Please see {@see MetadataServiceClient::metadataStoreName()} for help formatting this field.
 * @param string $filter          A required filter matching the Artifacts to be purged.
 *                                E.g., `update_time <= 2020-11-19T11:30:00-04:00`.
 */
function purge_artifacts_sample(string $formattedParent, string $filter): void
{
    // Create a client.
    $metadataServiceClient = new MetadataServiceClient();

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

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

        if ($response->operationSucceeded()) {
            /** @var PurgeArtifactsResponse $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 = MetadataServiceClient::metadataStoreName(
        '[PROJECT]',
        '[LOCATION]',
        '[METADATA_STORE]'
    );
    $filter = '[FILTER]';

    purge_artifacts_sample($formattedParent, $filter);
}

purgeContexts

Purges Contexts.

Parameters
NameDescription
parent string

Required. The metadata store to purge Contexts from. Format: projects/{project}/locations/{location}/metadataStores/{metadatastore}

filter string

Required. A required filter matching the Contexts to be purged. E.g., update_time <= 2020-11-19T11:30:00-04:00.

optionalArgs array

Optional.

↳ force bool

Optional. Flag to indicate to actually perform the purge. If force is set to false, the method will return a sample of Context names that would be deleted.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient;
use Google\Cloud\AIPlatform\V1\PurgeContextsRequest;
use Google\Cloud\AIPlatform\V1\PurgeContextsResponse;
use Google\Rpc\Status;

/**
 * @param string $formattedParent The metadata store to purge Contexts from.
 *                                Format:
 *                                `projects/{project}/locations/{location}/metadataStores/{metadatastore}`
 *                                Please see {@see MetadataServiceClient::metadataStoreName()} for help formatting this field.
 * @param string $filter          A required filter matching the Contexts to be purged.
 *                                E.g., `update_time <= 2020-11-19T11:30:00-04:00`.
 */
function purge_contexts_sample(string $formattedParent, string $filter): void
{
    // Create a client.
    $metadataServiceClient = new MetadataServiceClient();

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

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

        if ($response->operationSucceeded()) {
            /** @var PurgeContextsResponse $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 = MetadataServiceClient::metadataStoreName(
        '[PROJECT]',
        '[LOCATION]',
        '[METADATA_STORE]'
    );
    $filter = '[FILTER]';

    purge_contexts_sample($formattedParent, $filter);
}

purgeExecutions

Purges Executions.

Parameters
NameDescription
parent string

Required. The metadata store to purge Executions from. Format: projects/{project}/locations/{location}/metadataStores/{metadatastore}

filter string

Required. A required filter matching the Executions to be purged. E.g., update_time <= 2020-11-19T11:30:00-04:00.

optionalArgs array

Optional.

↳ force bool

Optional. Flag to indicate to actually perform the purge. If force is set to false, the method will return a sample of Execution names that would be deleted.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient;
use Google\Cloud\AIPlatform\V1\PurgeExecutionsRequest;
use Google\Cloud\AIPlatform\V1\PurgeExecutionsResponse;
use Google\Rpc\Status;

/**
 * @param string $formattedParent The metadata store to purge Executions from.
 *                                Format:
 *                                `projects/{project}/locations/{location}/metadataStores/{metadatastore}`
 *                                Please see {@see MetadataServiceClient::metadataStoreName()} for help formatting this field.
 * @param string $filter          A required filter matching the Executions to be purged.
 *                                E.g., `update_time <= 2020-11-19T11:30:00-04:00`.
 */
function purge_executions_sample(string $formattedParent, string $filter): void
{
    // Create a client.
    $metadataServiceClient = new MetadataServiceClient();

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

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

        if ($response->operationSucceeded()) {
            /** @var PurgeExecutionsResponse $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 = MetadataServiceClient::metadataStoreName(
        '[PROJECT]',
        '[LOCATION]',
        '[METADATA_STORE]'
    );
    $filter = '[FILTER]';

    purge_executions_sample($formattedParent, $filter);
}

queryArtifactLineageSubgraph

Retrieves lineage of an Artifact represented through Artifacts and Executions connected by Event edges and returned as a LineageSubgraph.

Parameters
NameDescription
artifact string

Required. The resource name of the Artifact whose Lineage needs to be retrieved as a LineageSubgraph. Format: projects/{project}/locations/{location}/metadataStores/{metadatastore}/artifacts/{artifact}

The request may error with FAILED_PRECONDITION if the number of Artifacts, the number of Executions, or the number of Events that would be returned for the Context exceeds 1000.

optionalArgs array

Optional.

↳ maxHops int

Specifies the size of the lineage graph in terms of number of hops from the specified artifact. Negative Value: INVALID_ARGUMENT error is returned 0: Only input artifact is returned. No value: Transitive closure is performed to return the complete graph.

↳ filter string

Filter specifying the boolean condition for the Artifacts to satisfy in order to be part of the Lineage Subgraph. The syntax to define filter query is based on https://google.aip.dev/160. The supported set of filters include the following: * Attribute filtering: For example: display_name = "test" Supported fields include: name, display_name, uri, state, schema_title, create_time, and update_time. Time fields, such as create_time and update_time, require values specified in RFC-3339 format. For example: create_time = "2020-11-19T11:30:00-04:00" * Metadata field: To filter on metadata fields use traversal operation as follows: metadata.<field_name>.<type_value>. For example: metadata.field_1.number_value = 10.0 In case the field name contains special characters (such as colon), one can embed it inside double quote. For example: metadata."field:1".number_value = 10.0 Each of the above supported filter types can be combined together using logical operators (AND & OR). Maximum nested expression depth allowed is 5. For example: display_name = "test" AND metadata.field1.bool_value = true.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\AIPlatform\V1\LineageSubgraph
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient;
use Google\Cloud\AIPlatform\V1\LineageSubgraph;
use Google\Cloud\AIPlatform\V1\QueryArtifactLineageSubgraphRequest;

/**
 * @param string $formattedArtifact The resource name of the Artifact whose Lineage needs to be
 *                                  retrieved as a LineageSubgraph. Format:
 *                                  `projects/{project}/locations/{location}/metadataStores/{metadatastore}/artifacts/{artifact}`
 *
 *                                  The request may error with FAILED_PRECONDITION if the number of Artifacts,
 *                                  the number of Executions, or the number of Events that would be returned
 *                                  for the Context exceeds 1000. Please see
 *                                  {@see MetadataServiceClient::artifactName()} for help formatting this field.
 */
function query_artifact_lineage_subgraph_sample(string $formattedArtifact): void
{
    // Create a client.
    $metadataServiceClient = new MetadataServiceClient();

    // Prepare the request message.
    $request = (new QueryArtifactLineageSubgraphRequest())
        ->setArtifact($formattedArtifact);

    // Call the API and handle any network failures.
    try {
        /** @var LineageSubgraph $response */
        $response = $metadataServiceClient->queryArtifactLineageSubgraph($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
{
    $formattedArtifact = MetadataServiceClient::artifactName(
        '[PROJECT]',
        '[LOCATION]',
        '[METADATA_STORE]',
        '[ARTIFACT]'
    );

    query_artifact_lineage_subgraph_sample($formattedArtifact);
}

queryContextLineageSubgraph

Retrieves Artifacts and Executions within the specified Context, connected by Event edges and returned as a LineageSubgraph.

Parameters
NameDescription
context string

Required. The resource name of the Context whose Artifacts and Executions should be retrieved as a LineageSubgraph. Format: projects/{project}/locations/{location}/metadataStores/{metadatastore}/contexts/{context}

The request may error with FAILED_PRECONDITION if the number of Artifacts, the number of Executions, or the number of Events that would be returned for the Context exceeds 1000.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\AIPlatform\V1\LineageSubgraph
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient;
use Google\Cloud\AIPlatform\V1\LineageSubgraph;
use Google\Cloud\AIPlatform\V1\QueryContextLineageSubgraphRequest;

/**
 * @param string $formattedContext The resource name of the Context whose Artifacts and Executions
 *                                 should be retrieved as a LineageSubgraph.
 *                                 Format:
 *                                 `projects/{project}/locations/{location}/metadataStores/{metadatastore}/contexts/{context}`
 *
 *                                 The request may error with FAILED_PRECONDITION if the number of Artifacts,
 *                                 the number of Executions, or the number of Events that would be returned
 *                                 for the Context exceeds 1000. Please see
 *                                 {@see MetadataServiceClient::contextName()} for help formatting this field.
 */
function query_context_lineage_subgraph_sample(string $formattedContext): void
{
    // Create a client.
    $metadataServiceClient = new MetadataServiceClient();

    // Prepare the request message.
    $request = (new QueryContextLineageSubgraphRequest())
        ->setContext($formattedContext);

    // Call the API and handle any network failures.
    try {
        /** @var LineageSubgraph $response */
        $response = $metadataServiceClient->queryContextLineageSubgraph($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
{
    $formattedContext = MetadataServiceClient::contextName(
        '[PROJECT]',
        '[LOCATION]',
        '[METADATA_STORE]',
        '[CONTEXT]'
    );

    query_context_lineage_subgraph_sample($formattedContext);
}

queryExecutionInputsAndOutputs

Obtains the set of input and output Artifacts for this Execution, in the form of LineageSubgraph that also contains the Execution and connecting Events.

Parameters
NameDescription
execution string

Required. The resource name of the Execution whose input and output Artifacts should be retrieved as a LineageSubgraph. Format: projects/{project}/locations/{location}/metadataStores/{metadatastore}/executions/{execution}

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\AIPlatform\V1\LineageSubgraph
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient;
use Google\Cloud\AIPlatform\V1\LineageSubgraph;
use Google\Cloud\AIPlatform\V1\QueryExecutionInputsAndOutputsRequest;

/**
 * @param string $formattedExecution The resource name of the Execution whose input and output
 *                                   Artifacts should be retrieved as a LineageSubgraph. Format:
 *                                   `projects/{project}/locations/{location}/metadataStores/{metadatastore}/executions/{execution}`
 *                                   Please see {@see MetadataServiceClient::executionName()} for help formatting this field.
 */
function query_execution_inputs_and_outputs_sample(string $formattedExecution): void
{
    // Create a client.
    $metadataServiceClient = new MetadataServiceClient();

    // Prepare the request message.
    $request = (new QueryExecutionInputsAndOutputsRequest())
        ->setExecution($formattedExecution);

    // Call the API and handle any network failures.
    try {
        /** @var LineageSubgraph $response */
        $response = $metadataServiceClient->queryExecutionInputsAndOutputs($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
{
    $formattedExecution = MetadataServiceClient::executionName(
        '[PROJECT]',
        '[LOCATION]',
        '[METADATA_STORE]',
        '[EXECUTION]'
    );

    query_execution_inputs_and_outputs_sample($formattedExecution);
}

removeContextChildren

Remove a set of children contexts from a parent Context. If any of the child Contexts were NOT added to the parent Context, they are simply skipped.

Parameters
NameDescription
context string

Required. The resource name of the parent Context.

Format: projects/{project}/locations/{location}/metadataStores/{metadatastore}/contexts/{context}

optionalArgs array

Optional.

↳ childContexts string[]

The resource names of the child Contexts.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\AIPlatform\V1\RemoveContextChildrenResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient;
use Google\Cloud\AIPlatform\V1\RemoveContextChildrenRequest;
use Google\Cloud\AIPlatform\V1\RemoveContextChildrenResponse;

/**
 * @param string $formattedContext The resource name of the parent Context.
 *
 *                                 Format:
 *                                 `projects/{project}/locations/{location}/metadataStores/{metadatastore}/contexts/{context}`
 *                                 Please see {@see MetadataServiceClient::contextName()} for help formatting this field.
 */
function remove_context_children_sample(string $formattedContext): void
{
    // Create a client.
    $metadataServiceClient = new MetadataServiceClient();

    // Prepare the request message.
    $request = (new RemoveContextChildrenRequest())
        ->setContext($formattedContext);

    // Call the API and handle any network failures.
    try {
        /** @var RemoveContextChildrenResponse $response */
        $response = $metadataServiceClient->removeContextChildren($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
{
    $formattedContext = MetadataServiceClient::contextName(
        '[PROJECT]',
        '[LOCATION]',
        '[METADATA_STORE]',
        '[CONTEXT]'
    );

    remove_context_children_sample($formattedContext);
}

updateArtifact

Updates a stored Artifact.

Parameters
NameDescription
artifact Google\Cloud\AIPlatform\V1\Artifact

Required. The Artifact containing updates. The Artifact's Artifact.name field is used to identify the Artifact to be updated. Format: projects/{project}/locations/{location}/metadataStores/{metadatastore}/artifacts/{artifact}

optionalArgs array

Optional.

↳ updateMask FieldMask

Optional. A FieldMask indicating which fields should be updated.

↳ allowMissing bool

If set to true, and the Artifact is not found, a new Artifact is created.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\AIPlatform\V1\Artifact
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Artifact;
use Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient;
use Google\Cloud\AIPlatform\V1\UpdateArtifactRequest;

/**
 * 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_artifact_sample(): void
{
    // Create a client.
    $metadataServiceClient = new MetadataServiceClient();

    // Prepare the request message.
    $artifact = new Artifact();
    $request = (new UpdateArtifactRequest())
        ->setArtifact($artifact);

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

updateContext

Updates a stored Context.

Parameters
NameDescription
context Google\Cloud\AIPlatform\V1\Context

Required. The Context containing updates. The Context's Context.name field is used to identify the Context to be updated. Format: projects/{project}/locations/{location}/metadataStores/{metadatastore}/contexts/{context}

optionalArgs array

Optional.

↳ updateMask FieldMask

Optional. A FieldMask indicating which fields should be updated.

↳ allowMissing bool

If set to true, and the Context is not found, a new Context is created.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\AIPlatform\V1\Context
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient;
use Google\Cloud\AIPlatform\V1\Context;
use Google\Cloud\AIPlatform\V1\UpdateContextRequest;

/**
 * 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_context_sample(): void
{
    // Create a client.
    $metadataServiceClient = new MetadataServiceClient();

    // Prepare the request message.
    $context = new Context();
    $request = (new UpdateContextRequest())
        ->setContext($context);

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

updateExecution

Updates a stored Execution.

Parameters
NameDescription
execution Google\Cloud\AIPlatform\V1\Execution

Required. The Execution containing updates. The Execution's Execution.name field is used to identify the Execution to be updated. Format: projects/{project}/locations/{location}/metadataStores/{metadatastore}/executions/{execution}

optionalArgs array

Optional.

↳ updateMask FieldMask

Optional. A FieldMask indicating which fields should be updated.

↳ allowMissing bool

If set to true, and the Execution is not found, a new Execution is created.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\AIPlatform\V1\Execution
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient;
use Google\Cloud\AIPlatform\V1\Execution;
use Google\Cloud\AIPlatform\V1\UpdateExecutionRequest;

/**
 * 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_execution_sample(): void
{
    // Create a client.
    $metadataServiceClient = new MetadataServiceClient();

    // Prepare the request message.
    $execution = new Execution();
    $request = (new UpdateExecutionRequest())
        ->setExecution($execution);

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

getLocation

Gets information about a location.

Parameters
NameDescription
optionalArgs array

Optional.

↳ name string

Resource name for the location.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\Location\Location
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient;
use Google\Cloud\Location\GetLocationRequest;
use Google\Cloud\Location\Location;

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function get_location_sample(): void
{
    // Create a client.
    $metadataServiceClient = new MetadataServiceClient();

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

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

listLocations

Lists information about the supported locations for this service.

Parameters
NameDescription
optionalArgs array

Optional.

↳ name string

The resource that owns the locations collection, if applicable.

↳ filter string

The standard list filter.

↳ pageSize int

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

↳ pageToken string

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

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient;
use Google\Cloud\Location\ListLocationsRequest;
use Google\Cloud\Location\Location;

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function list_locations_sample(): void
{
    // Create a client.
    $metadataServiceClient = new MetadataServiceClient();

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

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

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

getIamPolicy

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

Parameters
NameDescription
resource string

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

optionalArgs array

Optional.

↳ options GetPolicyOptions

OPTIONAL: A GetPolicyOptions object for specifying options to GetIamPolicy.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\Iam\V1\Policy
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient;
use Google\Cloud\Iam\V1\GetIamPolicyRequest;
use Google\Cloud\Iam\V1\Policy;

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

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

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

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

    get_iam_policy_sample($resource);
}

setIamPolicy

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

Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors.

Parameters
NameDescription
resource string

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

policy Google\Cloud\Iam\V1\Policy

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

optionalArgs array

Optional.

↳ updateMask FieldMask

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

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\Iam\V1\Policy
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient;
use Google\Cloud\Iam\V1\Policy;
use Google\Cloud\Iam\V1\SetIamPolicyRequest;

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

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

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

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

    set_iam_policy_sample($resource);
}

testIamPermissions

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

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

Parameters
NameDescription
resource string

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

permissions string[]

The set of permissions to check for the resource. Permissions with wildcards (such as '' or 'storage.') are not allowed. For more information see IAM Overview.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\Iam\V1\TestIamPermissionsResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\MetadataServiceClient;
use Google\Cloud\Iam\V1\TestIamPermissionsRequest;
use Google\Cloud\Iam\V1\TestIamPermissionsResponse;

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

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

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

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

    test_iam_permissions_sample($resource, $permissionsElement);
}

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

static::artifactName

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

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

static::contextName

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

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

static::executionName

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

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

static::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.

static::metadataSchemaName

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

Parameters
NameDescription
project string
location string
metadataStore string
metadataSchema string
Returns
TypeDescription
stringThe formatted metadata_schema resource.

static::metadataStoreName

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

Parameters
NameDescription
project string
location string
metadataStore string
Returns
TypeDescription
stringThe formatted metadata_store 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

  • artifact: projects/{project}/locations/{location}/metadataStores/{metadata_store}/artifacts/{artifact}
  • context: projects/{project}/locations/{location}/metadataStores/{metadata_store}/contexts/{context}
  • execution: projects/{project}/locations/{location}/metadataStores/{metadata_store}/executions/{execution}
  • location: projects/{project}/locations/{location}
  • metadataSchema: projects/{project}/locations/{location}/metadataStores/{metadata_store}/metadataSchemas/{metadata_schema}
  • metadataStore: projects/{project}/locations/{location}/metadataStores/{metadata_store}

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.

Constants

SERVICE_NAME

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

The name of the service.

SERVICE_ADDRESS

Value: 'aiplatform.googleapis.com'

The default address of the service.

DEFAULT_SERVICE_PORT

Value: 443

The default port of the service.

CODEGEN_NAME

Value: 'gapic'

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