Google Cloud Vision Ai V1 Client - Class AppPlatformClient (0.3.0)

Reference documentation and code samples for the Google Cloud Vision Ai V1 Client class AppPlatformClient.

Service Description: Service describing handlers for resources

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

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

Namespace

Google \ Cloud \ VisionAI \ V1 \ Client

Methods

__construct

Constructor.

Parameters
Name
Description
options
array| Google\ApiCore\Options\ClientOptions

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
FetchAuthTokenInterface|CredentialsWrapper

This option should only be used with a pre-constructed Google\Auth\FetchAuthTokenInterface or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored. Important: If you are providing a path to a credentials file, or a decoded credentials file as a PHP array, this usage is now DEPRECATED. Providing an unvalidated credential configuration to Google APIs can compromise the security of your systems and data. It is recommended to create the credentials explicitly use Google\Auth\Credentials\ServiceAccountCredentials; use Google\Cloud\VisionAI\V1\AppPlatformClient; $creds = new ServiceAccountCredentials($scopes, $json); $options = new AppPlatformClient(['credentials' => $creds]); https://cloud.google.com/docs/authentication/external/externally-sourced-credentials

↳ credentialsConfig
array

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

↳ disableRetries
bool

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

↳ clientConfig
string|array

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

↳ transport
string|TransportInterface

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

↳ transportConfig
array

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

↳ clientCertSource
callable

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

↳ logger
false|LoggerInterface

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

↳ universeDomain
string

The service domain for the client. Defaults to 'googleapis.com'.

addApplicationStreamInput

Adds target stream input to the Application.

If the Application is deployed, the corresponding new Application instance will be created. If the stream has already been in the Application, the RPC will fail.

The async variant is AppPlatformClient::addApplicationStreamInputAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\AddApplicationStreamInputRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\AddApplicationStreamInputRequest;
use Google\Cloud\VisionAI\V1\AddApplicationStreamInputResponse;
use Google\Cloud\VisionAI\V1\Client\AppPlatformClient;
use Google\Rpc\Status;

/**
 * @param string $formattedName the name of the application to retrieve.
 *                              Format:
 *                              "projects/{project}/locations/{location}/applications/{application}"
 *                              Please see {@see AppPlatformClient::applicationName()} for help formatting this field.
 */
function add_application_stream_input_sample(string $formattedName): void
{
    // Create a client.
    $appPlatformClient = new AppPlatformClient();

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

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

        if ($response->operationSucceeded()) {
            /** @var AddApplicationStreamInputResponse $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
{
    $formattedName = AppPlatformClient::applicationName('[PROJECT]', '[LOCATION]', '[APPLICATION]');

    add_application_stream_input_sample($formattedName);
} 

createApplication

Creates a new Application in a given project and location.

The async variant is AppPlatformClient::createApplicationAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\CreateApplicationRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Application;
use Google\Cloud\VisionAI\V1\Client\AppPlatformClient;
use Google\Cloud\VisionAI\V1\CreateApplicationRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedParent        Value for parent. Please see
 *                                       {@see AppPlatformClient::locationName()} for help formatting this field.
 * @param string $applicationId          Id of the requesting object.
 * @param string $applicationDisplayName A user friendly display name for the solution.
 */
function create_application_sample(
    string $formattedParent,
    string $applicationId,
    string $applicationDisplayName
): void {
    // Create a client.
    $appPlatformClient = new AppPlatformClient();

    // Prepare the request message.
    $application = (new Application())
        ->setDisplayName($applicationDisplayName);
    $request = (new CreateApplicationRequest())
        ->setParent($formattedParent)
        ->setApplicationId($applicationId)
        ->setApplication($application);

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

        if ($response->operationSucceeded()) {
            /** @var Application $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 = AppPlatformClient::locationName('[PROJECT]', '[LOCATION]');
    $applicationId = '[APPLICATION_ID]';
    $applicationDisplayName = '[DISPLAY_NAME]';

    create_application_sample($formattedParent, $applicationId, $applicationDisplayName);
} 

createApplicationInstances

Adds target stream input to the Application.

If the Application is deployed, the corresponding new Application instance will be created. If the stream has already been in the Application, the RPC will fail.

The async variant is AppPlatformClient::createApplicationInstancesAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\CreateApplicationInstancesRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\ApplicationInstance;
use Google\Cloud\VisionAI\V1\Client\AppPlatformClient;
use Google\Cloud\VisionAI\V1\CreateApplicationInstancesRequest;
use Google\Cloud\VisionAI\V1\CreateApplicationInstancesResponse;
use Google\Cloud\VisionAI\V1\Instance;
use Google\Rpc\Status;

/**
 * @param string $formattedName                           the name of the application to retrieve.
 *                                                        Format:
 *                                                        "projects/{project}/locations/{location}/applications/{application}"
 *                                                        Please see {@see AppPlatformClient::applicationName()} for help formatting this field.
 * @param string $applicationInstancesInstanceId          Id of the requesting object.
 * @param string $applicationInstancesInstanceDisplayName A user friendly display name for the solution.
 */
function create_application_instances_sample(
    string $formattedName,
    string $applicationInstancesInstanceId,
    string $applicationInstancesInstanceDisplayName
): void {
    // Create a client.
    $appPlatformClient = new AppPlatformClient();

    // Prepare the request message.
    $applicationInstancesInstance = (new Instance())
        ->setDisplayName($applicationInstancesInstanceDisplayName);
    $applicationInstance = (new ApplicationInstance())
        ->setInstanceId($applicationInstancesInstanceId)
        ->setInstance($applicationInstancesInstance);
    $applicationInstances = [$applicationInstance,];
    $request = (new CreateApplicationInstancesRequest())
        ->setName($formattedName)
        ->setApplicationInstances($applicationInstances);

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

        if ($response->operationSucceeded()) {
            /** @var CreateApplicationInstancesResponse $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
{
    $formattedName = AppPlatformClient::applicationName('[PROJECT]', '[LOCATION]', '[APPLICATION]');
    $applicationInstancesInstanceId = '[INSTANCE_ID]';
    $applicationInstancesInstanceDisplayName = '[DISPLAY_NAME]';

    create_application_instances_sample(
        $formattedName,
        $applicationInstancesInstanceId,
        $applicationInstancesInstanceDisplayName
    );
} 

createDraft

Creates a new Draft in a given project and location.

The async variant is AppPlatformClient::createDraftAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\CreateDraftRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\AppPlatformClient;
use Google\Cloud\VisionAI\V1\CreateDraftRequest;
use Google\Cloud\VisionAI\V1\Draft;
use Google\Rpc\Status;

/**
 * @param string $formattedParent  Value for parent. Please see
 *                                 {@see AppPlatformClient::applicationName()} for help formatting this field.
 * @param string $draftId          Id of the requesting object.
 * @param string $draftDisplayName A user friendly display name for the solution.
 */
function create_draft_sample(
    string $formattedParent,
    string $draftId,
    string $draftDisplayName
): void {
    // Create a client.
    $appPlatformClient = new AppPlatformClient();

    // Prepare the request message.
    $draft = (new Draft())
        ->setDisplayName($draftDisplayName);
    $request = (new CreateDraftRequest())
        ->setParent($formattedParent)
        ->setDraftId($draftId)
        ->setDraft($draft);

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

        if ($response->operationSucceeded()) {
            /** @var Draft $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 = AppPlatformClient::applicationName('[PROJECT]', '[LOCATION]', '[APPLICATION]');
    $draftId = '[DRAFT_ID]';
    $draftDisplayName = '[DISPLAY_NAME]';

    create_draft_sample($formattedParent, $draftId, $draftDisplayName);
} 

createProcessor

Creates a new Processor in a given project and location.

The async variant is AppPlatformClient::createProcessorAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\CreateProcessorRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\AppPlatformClient;
use Google\Cloud\VisionAI\V1\CreateProcessorRequest;
use Google\Cloud\VisionAI\V1\Processor;
use Google\Rpc\Status;

/**
 * @param string $formattedParent      Value for parent. Please see
 *                                     {@see AppPlatformClient::locationName()} for help formatting this field.
 * @param string $processorId          Id of the requesting object.
 * @param string $processorDisplayName A user friendly display name for the processor.
 */
function create_processor_sample(
    string $formattedParent,
    string $processorId,
    string $processorDisplayName
): void {
    // Create a client.
    $appPlatformClient = new AppPlatformClient();

    // Prepare the request message.
    $processor = (new Processor())
        ->setDisplayName($processorDisplayName);
    $request = (new CreateProcessorRequest())
        ->setParent($formattedParent)
        ->setProcessorId($processorId)
        ->setProcessor($processor);

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

        if ($response->operationSucceeded()) {
            /** @var Processor $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 = AppPlatformClient::locationName('[PROJECT]', '[LOCATION]');
    $processorId = '[PROCESSOR_ID]';
    $processorDisplayName = '[DISPLAY_NAME]';

    create_processor_sample($formattedParent, $processorId, $processorDisplayName);
} 

deleteApplication

Deletes a single Application.

The async variant is AppPlatformClient::deleteApplicationAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\DeleteApplicationRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\AppPlatformClient;
use Google\Cloud\VisionAI\V1\DeleteApplicationRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName Name of the resource. Please see
 *                              {@see AppPlatformClient::applicationName()} for help formatting this field.
 */
function delete_application_sample(string $formattedName): void
{
    // Create a client.
    $appPlatformClient = new AppPlatformClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $appPlatformClient->deleteApplication($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 = AppPlatformClient::applicationName('[PROJECT]', '[LOCATION]', '[APPLICATION]');

    delete_application_sample($formattedName);
} 

deleteApplicationInstances

Remove target stream input to the Application, if the Application is deployed, the corresponding instance based will be deleted. If the stream is not in the Application, the RPC will fail.

The async variant is AppPlatformClient::deleteApplicationInstancesAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\DeleteApplicationInstancesRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\AppPlatformClient;
use Google\Cloud\VisionAI\V1\DeleteApplicationInstancesRequest;
use Google\Cloud\VisionAI\V1\Instance;
use Google\Rpc\Status;

/**
 * @param string $formattedName               the name of the application to retrieve.
 *                                            Format:
 *                                            "projects/{project}/locations/{location}/applications/{application}"
 *                                            Please see {@see AppPlatformClient::applicationName()} for help formatting this field.
 * @param string $formattedInstanceIdsElement Id of the requesting object. Please see
 *                                            {@see AppPlatformClient::instanceName()} for help formatting this field.
 */
function delete_application_instances_sample(
    string $formattedName,
    string $formattedInstanceIdsElement
): void {
    // Create a client.
    $appPlatformClient = new AppPlatformClient();

    // Prepare the request message.
    $formattedInstanceIds = [$formattedInstanceIdsElement,];
    $request = (new DeleteApplicationInstancesRequest())
        ->setName($formattedName)
        ->setInstanceIds($formattedInstanceIds);

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

        if ($response->operationSucceeded()) {
            /** @var Instance $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
{
    $formattedName = AppPlatformClient::applicationName('[PROJECT]', '[LOCATION]', '[APPLICATION]');
    $formattedInstanceIdsElement = AppPlatformClient::instanceName(
        '[PROJECT]',
        '[LOCATION]',
        '[APPLICATION]',
        '[INSTANCE]'
    );

    delete_application_instances_sample($formattedName, $formattedInstanceIdsElement);
} 

deleteDraft

Deletes a single Draft.

The async variant is AppPlatformClient::deleteDraftAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\DeleteDraftRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\AppPlatformClient;
use Google\Cloud\VisionAI\V1\DeleteDraftRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName Name of the resource. Please see
 *                              {@see AppPlatformClient::draftName()} for help formatting this field.
 */
function delete_draft_sample(string $formattedName): void
{
    // Create a client.
    $appPlatformClient = new AppPlatformClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $appPlatformClient->deleteDraft($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 = AppPlatformClient::draftName(
        '[PROJECT]',
        '[LOCATION]',
        '[APPLICATION]',
        '[DRAFT]'
    );

    delete_draft_sample($formattedName);
} 

deleteProcessor

Deletes a single Processor.

The async variant is AppPlatformClient::deleteProcessorAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\DeleteProcessorRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\AppPlatformClient;
use Google\Cloud\VisionAI\V1\DeleteProcessorRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName Name of the resource
 *                              Please see {@see AppPlatformClient::processorName()} for help formatting this field.
 */
function delete_processor_sample(string $formattedName): void
{
    // Create a client.
    $appPlatformClient = new AppPlatformClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $appPlatformClient->deleteProcessor($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 = AppPlatformClient::processorName('[PROJECT]', '[LOCATION]', '[PROCESSOR]');

    delete_processor_sample($formattedName);
} 

deployApplication

Deploys a single Application.

The async variant is AppPlatformClient::deployApplicationAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\DeployApplicationRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\AppPlatformClient;
use Google\Cloud\VisionAI\V1\DeployApplicationRequest;
use Google\Cloud\VisionAI\V1\DeployApplicationResponse;
use Google\Rpc\Status;

/**
 * @param string $formattedName the name of the application to retrieve.
 *                              Format:
 *                              "projects/{project}/locations/{location}/applications/{application}"
 *                              Please see {@see AppPlatformClient::applicationName()} for help formatting this field.
 */
function deploy_application_sample(string $formattedName): void
{
    // Create a client.
    $appPlatformClient = new AppPlatformClient();

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

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

        if ($response->operationSucceeded()) {
            /** @var DeployApplicationResponse $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
{
    $formattedName = AppPlatformClient::applicationName('[PROJECT]', '[LOCATION]', '[APPLICATION]');

    deploy_application_sample($formattedName);
} 

getApplication

Gets details of a single Application.

The async variant is AppPlatformClient::getApplicationAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\GetApplicationRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\VisionAI\V1\Application;
use Google\Cloud\VisionAI\V1\Client\AppPlatformClient;
use Google\Cloud\VisionAI\V1\GetApplicationRequest;

/**
 * @param string $formattedName Name of the resource. Please see
 *                              {@see AppPlatformClient::applicationName()} for help formatting this field.
 */
function get_application_sample(string $formattedName): void
{
    // Create a client.
    $appPlatformClient = new AppPlatformClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Application $response */
        $response = $appPlatformClient->getApplication($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 = AppPlatformClient::applicationName('[PROJECT]', '[LOCATION]', '[APPLICATION]');

    get_application_sample($formattedName);
} 

getDraft

Gets details of a single Draft.

The async variant is AppPlatformClient::getDraftAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\GetDraftRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\VisionAI\V1\Client\AppPlatformClient;
use Google\Cloud\VisionAI\V1\Draft;
use Google\Cloud\VisionAI\V1\GetDraftRequest;

/**
 * @param string $formattedName Name of the resource. Please see
 *                              {@see AppPlatformClient::draftName()} for help formatting this field.
 */
function get_draft_sample(string $formattedName): void
{
    // Create a client.
    $appPlatformClient = new AppPlatformClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Draft $response */
        $response = $appPlatformClient->getDraft($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 = AppPlatformClient::draftName(
        '[PROJECT]',
        '[LOCATION]',
        '[APPLICATION]',
        '[DRAFT]'
    );

    get_draft_sample($formattedName);
} 

getInstance

Gets details of a single Instance.

The async variant is AppPlatformClient::getInstanceAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\GetInstanceRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\VisionAI\V1\Client\AppPlatformClient;
use Google\Cloud\VisionAI\V1\GetInstanceRequest;
use Google\Cloud\VisionAI\V1\Instance;

/**
 * @param string $formattedName Name of the resource. Please see
 *                              {@see AppPlatformClient::instanceName()} for help formatting this field.
 */
function get_instance_sample(string $formattedName): void
{
    // Create a client.
    $appPlatformClient = new AppPlatformClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Instance $response */
        $response = $appPlatformClient->getInstance($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 = AppPlatformClient::instanceName(
        '[PROJECT]',
        '[LOCATION]',
        '[APPLICATION]',
        '[INSTANCE]'
    );

    get_instance_sample($formattedName);
} 

getProcessor

Gets details of a single Processor.

The async variant is AppPlatformClient::getProcessorAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\GetProcessorRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\VisionAI\V1\Client\AppPlatformClient;
use Google\Cloud\VisionAI\V1\GetProcessorRequest;
use Google\Cloud\VisionAI\V1\Processor;

/**
 * @param string $formattedName Name of the resource. Please see
 *                              {@see AppPlatformClient::processorName()} for help formatting this field.
 */
function get_processor_sample(string $formattedName): void
{
    // Create a client.
    $appPlatformClient = new AppPlatformClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Processor $response */
        $response = $appPlatformClient->getProcessor($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 = AppPlatformClient::processorName('[PROJECT]', '[LOCATION]', '[PROCESSOR]');

    get_processor_sample($formattedName);
} 

listApplications

Lists Applications in a given project and location.

The async variant is AppPlatformClient::listApplicationsAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\ListApplicationsRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\VisionAI\V1\Application;
use Google\Cloud\VisionAI\V1\Client\AppPlatformClient;
use Google\Cloud\VisionAI\V1\ListApplicationsRequest;

/**
 * @param string $formattedParent Parent value for ListApplicationsRequest. Please see
 *                                {@see AppPlatformClient::locationName()} for help formatting this field.
 */
function list_applications_sample(string $formattedParent): void
{
    // Create a client.
    $appPlatformClient = new AppPlatformClient();

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

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

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

    list_applications_sample($formattedParent);
} 

listDrafts

Lists Drafts in a given project and location.

The async variant is AppPlatformClient::listDraftsAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\ListDraftsRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\VisionAI\V1\Client\AppPlatformClient;
use Google\Cloud\VisionAI\V1\Draft;
use Google\Cloud\VisionAI\V1\ListDraftsRequest;

/**
 * @param string $formattedParent Parent value for ListDraftsRequest. Please see
 *                                {@see AppPlatformClient::applicationName()} for help formatting this field.
 */
function list_drafts_sample(string $formattedParent): void
{
    // Create a client.
    $appPlatformClient = new AppPlatformClient();

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

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

        /** @var Draft $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 = AppPlatformClient::applicationName('[PROJECT]', '[LOCATION]', '[APPLICATION]');

    list_drafts_sample($formattedParent);
} 

listInstances

Lists Instances in a given project and location.

The async variant is AppPlatformClient::listInstancesAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\ListInstancesRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\VisionAI\V1\Client\AppPlatformClient;
use Google\Cloud\VisionAI\V1\Instance;
use Google\Cloud\VisionAI\V1\ListInstancesRequest;

/**
 * @param string $formattedParent Parent value for ListInstancesRequest. Please see
 *                                {@see AppPlatformClient::applicationName()} for help formatting this field.
 */
function list_instances_sample(string $formattedParent): void
{
    // Create a client.
    $appPlatformClient = new AppPlatformClient();

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

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

        /** @var Instance $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 = AppPlatformClient::applicationName('[PROJECT]', '[LOCATION]', '[APPLICATION]');

    list_instances_sample($formattedParent);
} 

listPrebuiltProcessors

ListPrebuiltProcessors is a custom pass-through verb that Lists Prebuilt Processors.

The async variant is AppPlatformClient::listPrebuiltProcessorsAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\ListPrebuiltProcessorsRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Example
 use Google\ApiCore\ApiException;
use Google\Cloud\VisionAI\V1\Client\AppPlatformClient;
use Google\Cloud\VisionAI\V1\ListPrebuiltProcessorsRequest;
use Google\Cloud\VisionAI\V1\ListPrebuiltProcessorsResponse;

/**
 * @param string $formattedParent Parent path. Please see
 *                                {@see AppPlatformClient::locationName()} for help formatting this field.
 */
function list_prebuilt_processors_sample(string $formattedParent): void
{
    // Create a client.
    $appPlatformClient = new AppPlatformClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var ListPrebuiltProcessorsResponse $response */
        $response = $appPlatformClient->listPrebuiltProcessors($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 = AppPlatformClient::locationName('[PROJECT]', '[LOCATION]');

    list_prebuilt_processors_sample($formattedParent);
} 

listProcessors

Lists Processors in a given project and location.

The async variant is AppPlatformClient::listProcessorsAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\ListProcessorsRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\VisionAI\V1\Client\AppPlatformClient;
use Google\Cloud\VisionAI\V1\ListProcessorsRequest;
use Google\Cloud\VisionAI\V1\Processor;

/**
 * @param string $formattedParent Parent value for ListProcessorsRequest. Please see
 *                                {@see AppPlatformClient::locationName()} for help formatting this field.
 */
function list_processors_sample(string $formattedParent): void
{
    // Create a client.
    $appPlatformClient = new AppPlatformClient();

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

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

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

    list_processors_sample($formattedParent);
} 

removeApplicationStreamInput

Remove target stream input to the Application, if the Application is deployed, the corresponding instance based will be deleted. If the stream is not in the Application, the RPC will fail.

The async variant is AppPlatformClient::removeApplicationStreamInputAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\RemoveApplicationStreamInputRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\AppPlatformClient;
use Google\Cloud\VisionAI\V1\RemoveApplicationStreamInputRequest;
use Google\Cloud\VisionAI\V1\RemoveApplicationStreamInputResponse;
use Google\Rpc\Status;

/**
 * @param string $formattedName the name of the application to retrieve.
 *                              Format:
 *                              "projects/{project}/locations/{location}/applications/{application}"
 *                              Please see {@see AppPlatformClient::applicationName()} for help formatting this field.
 */
function remove_application_stream_input_sample(string $formattedName): void
{
    // Create a client.
    $appPlatformClient = new AppPlatformClient();

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

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

        if ($response->operationSucceeded()) {
            /** @var RemoveApplicationStreamInputResponse $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
{
    $formattedName = AppPlatformClient::applicationName('[PROJECT]', '[LOCATION]', '[APPLICATION]');

    remove_application_stream_input_sample($formattedName);
} 

undeployApplication

Undeploys a single Application.

The async variant is AppPlatformClient::undeployApplicationAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\UndeployApplicationRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\AppPlatformClient;
use Google\Cloud\VisionAI\V1\UndeployApplicationRequest;
use Google\Cloud\VisionAI\V1\UndeployApplicationResponse;
use Google\Rpc\Status;

/**
 * @param string $formattedName the name of the application to retrieve.
 *                              Format:
 *                              "projects/{project}/locations/{location}/applications/{application}"
 *                              Please see {@see AppPlatformClient::applicationName()} for help formatting this field.
 */
function undeploy_application_sample(string $formattedName): void
{
    // Create a client.
    $appPlatformClient = new AppPlatformClient();

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

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

        if ($response->operationSucceeded()) {
            /** @var UndeployApplicationResponse $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
{
    $formattedName = AppPlatformClient::applicationName('[PROJECT]', '[LOCATION]', '[APPLICATION]');

    undeploy_application_sample($formattedName);
} 

updateApplication

Updates the parameters of a single Application.

The async variant is AppPlatformClient::updateApplicationAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\UpdateApplicationRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Application;
use Google\Cloud\VisionAI\V1\Client\AppPlatformClient;
use Google\Cloud\VisionAI\V1\UpdateApplicationRequest;
use Google\Rpc\Status;

/**
 * @param string $applicationDisplayName A user friendly display name for the solution.
 */
function update_application_sample(string $applicationDisplayName): void
{
    // Create a client.
    $appPlatformClient = new AppPlatformClient();

    // Prepare the request message.
    $application = (new Application())
        ->setDisplayName($applicationDisplayName);
    $request = (new UpdateApplicationRequest())
        ->setApplication($application);

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

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

    update_application_sample($applicationDisplayName);
} 

updateApplicationInstances

Adds target stream input to the Application.

If the Application is deployed, the corresponding new Application instance will be created. If the stream has already been in the Application, the RPC will fail.

The async variant is AppPlatformClient::updateApplicationInstancesAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\UpdateApplicationInstancesRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\AppPlatformClient;
use Google\Cloud\VisionAI\V1\UpdateApplicationInstancesRequest;
use Google\Cloud\VisionAI\V1\UpdateApplicationInstancesResponse;
use Google\Rpc\Status;

/**
 * @param string $formattedName the name of the application to retrieve.
 *                              Format:
 *                              "projects/{project}/locations/{location}/applications/{application}"
 *                              Please see {@see AppPlatformClient::applicationName()} for help formatting this field.
 */
function update_application_instances_sample(string $formattedName): void
{
    // Create a client.
    $appPlatformClient = new AppPlatformClient();

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

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

        if ($response->operationSucceeded()) {
            /** @var UpdateApplicationInstancesResponse $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
{
    $formattedName = AppPlatformClient::applicationName('[PROJECT]', '[LOCATION]', '[APPLICATION]');

    update_application_instances_sample($formattedName);
} 

updateApplicationStreamInput

Update target stream input to the Application, if the Application is deployed, the corresponding instance based will be deployed. For CreateOrUpdate behavior, set allow_missing to true.

The async variant is AppPlatformClient::updateApplicationStreamInputAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\UpdateApplicationStreamInputRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\AppPlatformClient;
use Google\Cloud\VisionAI\V1\UpdateApplicationStreamInputRequest;
use Google\Cloud\VisionAI\V1\UpdateApplicationStreamInputResponse;
use Google\Rpc\Status;

/**
 * @param string $formattedName the name of the application to retrieve.
 *                              Format:
 *                              "projects/{project}/locations/{location}/applications/{application}"
 *                              Please see {@see AppPlatformClient::applicationName()} for help formatting this field.
 */
function update_application_stream_input_sample(string $formattedName): void
{
    // Create a client.
    $appPlatformClient = new AppPlatformClient();

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

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

        if ($response->operationSucceeded()) {
            /** @var UpdateApplicationStreamInputResponse $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
{
    $formattedName = AppPlatformClient::applicationName('[PROJECT]', '[LOCATION]', '[APPLICATION]');

    update_application_stream_input_sample($formattedName);
} 

updateDraft

Updates the parameters of a single Draft.

The async variant is AppPlatformClient::updateDraftAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\UpdateDraftRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\AppPlatformClient;
use Google\Cloud\VisionAI\V1\Draft;
use Google\Cloud\VisionAI\V1\UpdateDraftRequest;
use Google\Rpc\Status;

/**
 * @param string $draftDisplayName A user friendly display name for the solution.
 */
function update_draft_sample(string $draftDisplayName): void
{
    // Create a client.
    $appPlatformClient = new AppPlatformClient();

    // Prepare the request message.
    $draft = (new Draft())
        ->setDisplayName($draftDisplayName);
    $request = (new UpdateDraftRequest())
        ->setDraft($draft);

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

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

    update_draft_sample($draftDisplayName);
} 

updateProcessor

Updates the parameters of a single Processor.

The async variant is AppPlatformClient::updateProcessorAsync() .

Parameters
Name
Description
request
Google\Cloud\VisionAI\V1\UpdateProcessorRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\AppPlatformClient;
use Google\Cloud\VisionAI\V1\Processor;
use Google\Cloud\VisionAI\V1\UpdateProcessorRequest;
use Google\Rpc\Status;

/**
 * @param string $processorDisplayName A user friendly display name for the processor.
 */
function update_processor_sample(string $processorDisplayName): void
{
    // Create a client.
    $appPlatformClient = new AppPlatformClient();

    // Prepare the request message.
    $processor = (new Processor())
        ->setDisplayName($processorDisplayName);
    $request = (new UpdateProcessorRequest())
        ->setProcessor($processor);

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

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

    update_processor_sample($processorDisplayName);
} 

getLocation

Gets information about a location.

The async variant is AppPlatformClient::getLocationAsync() .

Parameters
Name
Description
request
Google\Cloud\Location\GetLocationRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\Location\GetLocationRequest;
use Google\Cloud\Location\Location;
use Google\Cloud\VisionAI\V1\Client\AppPlatformClient;

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

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

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

listLocations

Lists information about the supported locations for this service.

The async variant is AppPlatformClient::listLocationsAsync() .

Parameters
Name
Description
request
Google\Cloud\Location\ListLocationsRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Location\ListLocationsRequest;
use Google\Cloud\Location\Location;
use Google\Cloud\VisionAI\V1\Client\AppPlatformClient;

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

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

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

addApplicationStreamInputAsync

Parameters
Name
Description
optionalArgs
array

createApplicationAsync

Parameters
Name
Description
optionalArgs
array

createApplicationInstancesAsync

Parameters
Name
Description
optionalArgs
array

createDraftAsync

Parameters
Name
Description
optionalArgs
array

createProcessorAsync

Parameters
Name
Description
optionalArgs
array

deleteApplicationAsync

Parameters
Name
Description
optionalArgs
array

deleteApplicationInstancesAsync

Parameters
Name
Description
optionalArgs
array

deleteDraftAsync

Parameters
Name
Description
optionalArgs
array

deleteProcessorAsync

Parameters
Name
Description
optionalArgs
array

deployApplicationAsync

Parameters
Name
Description
optionalArgs
array

getApplicationAsync

Parameters
Name
Description
optionalArgs
array

getDraftAsync

Parameters
Name
Description
optionalArgs
array

getInstanceAsync

Parameters
Name
Description
optionalArgs
array

getProcessorAsync

Parameters
Name
Description
optionalArgs
array

listApplicationsAsync

Parameters
Name
Description
optionalArgs
array

listDraftsAsync

Parameters
Name
Description
optionalArgs
array

listInstancesAsync

Parameters
Name
Description
optionalArgs
array

listPrebuiltProcessorsAsync

Parameters
Name
Description
optionalArgs
array

listProcessorsAsync

Parameters
Name
Description
optionalArgs
array

removeApplicationStreamInputAsync

Parameters
Name
Description
optionalArgs
array

undeployApplicationAsync

Parameters
Name
Description
optionalArgs
array

updateApplicationAsync

Parameters
Name
Description
optionalArgs
array

updateApplicationInstancesAsync

Parameters
Name
Description
optionalArgs
array

updateApplicationStreamInputAsync

Parameters
Name
Description
optionalArgs
array

updateDraftAsync

Parameters
Name
Description
optionalArgs
array

updateProcessorAsync

Parameters
Name
Description
optionalArgs
array

getLocationAsync

Parameters
Name
Description
optionalArgs
array

listLocationsAsync

Parameters
Name
Description
optionalArgs
array

getOperationsClient

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

Returns
Type
Description
Google\LongRunning\Client\OperationsClient

resumeOperation

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

Parameters
Name
Description
operationName
string

The name of the long running operation

methodName
string

The name of the method used to start the operation

Returns
Type
Description

static::applicationName

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

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

static::draftName

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

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

static::instanceName

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

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

static::locationName

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

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

static::processorName

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

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

static::streamName

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

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

  • application: projects/{project}/locations/{location}/applications/{application}
  • draft: projects/{project}/locations/{location}/applications/{application}/drafts/{draft}
  • instance: projects/{project}/locations/{location}/applications/{application}/instances/{instance}
  • location: projects/{project}/locations/{location}
  • processor: projects/{project}/locations/{location}/processors/{processor}
  • stream: projects/{project}/locations/{location}/clusters/{cluster}/streams/{stream}

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

Parameters
Name
Description
formattedName
string

The formatted name string

template
?string

Optional name of template to match

Returns
Type
Description
array
An associative array from name component IDs to component values.
Create a Mobile Website
View Site in Mobile | Classic
Share by: