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

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

Service Description: Service describing handlers for resources.

Vision API and Vision AI API are two independent APIs developed by the same team. Vision API is for people to annotate their image while Vision AI is an e2e solution for customer to build their own computer vision application.

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\StreamsServiceClient; $creds = new ServiceAccountCredentials($scopes, $json); $options = new StreamsServiceClient(['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'.

createCluster

Creates a new Cluster in a given project and location.

The async variant is StreamsServiceClient::createClusterAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse<Google\Cloud\VisionAI\V1\Cluster>
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\StreamsServiceClient;
use Google\Cloud\VisionAI\V1\Cluster;
use Google\Cloud\VisionAI\V1\CreateClusterRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedParent Value for parent. Please see
 *                                {@see StreamsServiceClient::locationName()} for help formatting this field.
 * @param string $clusterId       Id of the requesting object.
 */
function create_cluster_sample(string $formattedParent, string $clusterId): void
{
    // Create a client.
    $streamsServiceClient = new StreamsServiceClient();

    // Prepare the request message.
    $cluster = new Cluster();
    $request = (new CreateClusterRequest())
        ->setParent($formattedParent)
        ->setClusterId($clusterId)
        ->setCluster($cluster);

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

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

    create_cluster_sample($formattedParent, $clusterId);
}

createEvent

Creates a new Event in a given project and location.

The async variant is StreamsServiceClient::createEventAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse<Google\Cloud\VisionAI\V1\Event>
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\StreamsServiceClient;
use Google\Cloud\VisionAI\V1\CreateEventRequest;
use Google\Cloud\VisionAI\V1\Event;
use Google\Rpc\Status;

/**
 * @param string $formattedParent Value for parent. Please see
 *                                {@see StreamsServiceClient::clusterName()} for help formatting this field.
 * @param string $eventId         Id of the requesting object.
 */
function create_event_sample(string $formattedParent, string $eventId): void
{
    // Create a client.
    $streamsServiceClient = new StreamsServiceClient();

    // Prepare the request message.
    $event = new Event();
    $request = (new CreateEventRequest())
        ->setParent($formattedParent)
        ->setEventId($eventId)
        ->setEvent($event);

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

        if ($response->operationSucceeded()) {
            /** @var Event $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 = StreamsServiceClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]');
    $eventId = '[EVENT_ID]';

    create_event_sample($formattedParent, $eventId);
}

createSeries

Creates a new Series in a given project and location.

The async variant is StreamsServiceClient::createSeriesAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse<Google\Cloud\VisionAI\V1\Series>
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\StreamsServiceClient;
use Google\Cloud\VisionAI\V1\CreateSeriesRequest;
use Google\Cloud\VisionAI\V1\Series;
use Google\Rpc\Status;

/**
 * @param string $formattedParent       Value for parent. Please see
 *                                      {@see StreamsServiceClient::clusterName()} for help formatting this field.
 * @param string $seriesId              Id of the requesting object.
 * @param string $formattedSeriesStream Stream that is associated with this series. Please see
 *                                      {@see StreamsServiceClient::streamName()} for help formatting this field.
 * @param string $formattedSeriesEvent  Event that is associated with this series. Please see
 *                                      {@see StreamsServiceClient::eventName()} for help formatting this field.
 */
function create_series_sample(
    string $formattedParent,
    string $seriesId,
    string $formattedSeriesStream,
    string $formattedSeriesEvent
): void {
    // Create a client.
    $streamsServiceClient = new StreamsServiceClient();

    // Prepare the request message.
    $series = (new Series())
        ->setStream($formattedSeriesStream)
        ->setEvent($formattedSeriesEvent);
    $request = (new CreateSeriesRequest())
        ->setParent($formattedParent)
        ->setSeriesId($seriesId)
        ->setSeries($series);

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

        if ($response->operationSucceeded()) {
            /** @var Series $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 = StreamsServiceClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]');
    $seriesId = '[SERIES_ID]';
    $formattedSeriesStream = StreamsServiceClient::streamName(
        '[PROJECT]',
        '[LOCATION]',
        '[CLUSTER]',
        '[STREAM]'
    );
    $formattedSeriesEvent = StreamsServiceClient::eventName(
        '[PROJECT]',
        '[LOCATION]',
        '[CLUSTER]',
        '[EVENT]'
    );

    create_series_sample($formattedParent, $seriesId, $formattedSeriesStream, $formattedSeriesEvent);
}

createStream

Creates a new Stream in a given project and location.

The async variant is StreamsServiceClient::createStreamAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse<Google\Cloud\VisionAI\V1\Stream>
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\StreamsServiceClient;
use Google\Cloud\VisionAI\V1\CreateStreamRequest;
use Google\Cloud\VisionAI\V1\Stream;
use Google\Rpc\Status;

/**
 * @param string $formattedParent Value for parent. Please see
 *                                {@see StreamsServiceClient::clusterName()} for help formatting this field.
 * @param string $streamId        Id of the requesting object.
 */
function create_stream_sample(string $formattedParent, string $streamId): void
{
    // Create a client.
    $streamsServiceClient = new StreamsServiceClient();

    // Prepare the request message.
    $stream = new Stream();
    $request = (new CreateStreamRequest())
        ->setParent($formattedParent)
        ->setStreamId($streamId)
        ->setStream($stream);

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

        if ($response->operationSucceeded()) {
            /** @var Stream $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 = StreamsServiceClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]');
    $streamId = '[STREAM_ID]';

    create_stream_sample($formattedParent, $streamId);
}

deleteCluster

Deletes a single Cluster.

The async variant is StreamsServiceClient::deleteClusterAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse<null>
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\StreamsServiceClient;
use Google\Cloud\VisionAI\V1\DeleteClusterRequest;
use Google\Rpc\Status;

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

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $streamsServiceClient->deleteCluster($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 = StreamsServiceClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]');

    delete_cluster_sample($formattedName);
}

deleteEvent

Deletes a single Event.

The async variant is StreamsServiceClient::deleteEventAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse<null>
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\StreamsServiceClient;
use Google\Cloud\VisionAI\V1\DeleteEventRequest;
use Google\Rpc\Status;

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

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $streamsServiceClient->deleteEvent($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 = StreamsServiceClient::eventName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[EVENT]');

    delete_event_sample($formattedName);
}

deleteSeries

Deletes a single Series.

The async variant is StreamsServiceClient::deleteSeriesAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse<null>
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\StreamsServiceClient;
use Google\Cloud\VisionAI\V1\DeleteSeriesRequest;
use Google\Rpc\Status;

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

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $streamsServiceClient->deleteSeries($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 = StreamsServiceClient::seriesName(
        '[PROJECT]',
        '[LOCATION]',
        '[CLUSTER]',
        '[SERIES]'
    );

    delete_series_sample($formattedName);
}

deleteStream

Deletes a single Stream.

The async variant is StreamsServiceClient::deleteStreamAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse<null>
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\StreamsServiceClient;
use Google\Cloud\VisionAI\V1\DeleteStreamRequest;
use Google\Rpc\Status;

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

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $streamsServiceClient->deleteStream($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 = StreamsServiceClient::streamName(
        '[PROJECT]',
        '[LOCATION]',
        '[CLUSTER]',
        '[STREAM]'
    );

    delete_stream_sample($formattedName);
}

generateStreamHlsToken

Generate the JWT auth token required to get the stream HLS contents.

The async variant is StreamsServiceClient::generateStreamHlsTokenAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\Cloud\VisionAI\V1\GenerateStreamHlsTokenResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\VisionAI\V1\Client\StreamsServiceClient;
use Google\Cloud\VisionAI\V1\GenerateStreamHlsTokenRequest;
use Google\Cloud\VisionAI\V1\GenerateStreamHlsTokenResponse;

/**
 * @param string $stream The name of the stream.
 */
function generate_stream_hls_token_sample(string $stream): void
{
    // Create a client.
    $streamsServiceClient = new StreamsServiceClient();

    // Prepare the request message.
    $request = (new GenerateStreamHlsTokenRequest())
        ->setStream($stream);

    // Call the API and handle any network failures.
    try {
        /** @var GenerateStreamHlsTokenResponse $response */
        $response = $streamsServiceClient->generateStreamHlsToken($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
{
    $stream = '[STREAM]';

    generate_stream_hls_token_sample($stream);
}

getCluster

Gets details of a single Cluster.

The async variant is StreamsServiceClient::getClusterAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\Cloud\VisionAI\V1\Cluster
Example
use Google\ApiCore\ApiException;
use Google\Cloud\VisionAI\V1\Client\StreamsServiceClient;
use Google\Cloud\VisionAI\V1\Cluster;
use Google\Cloud\VisionAI\V1\GetClusterRequest;

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

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

    // Call the API and handle any network failures.
    try {
        /** @var Cluster $response */
        $response = $streamsServiceClient->getCluster($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 = StreamsServiceClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]');

    get_cluster_sample($formattedName);
}

getEvent

Gets details of a single Event.

The async variant is StreamsServiceClient::getEventAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\Cloud\VisionAI\V1\Event
Example
use Google\ApiCore\ApiException;
use Google\Cloud\VisionAI\V1\Client\StreamsServiceClient;
use Google\Cloud\VisionAI\V1\Event;
use Google\Cloud\VisionAI\V1\GetEventRequest;

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

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

    // Call the API and handle any network failures.
    try {
        /** @var Event $response */
        $response = $streamsServiceClient->getEvent($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 = StreamsServiceClient::eventName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[EVENT]');

    get_event_sample($formattedName);
}

getSeries

Gets details of a single Series.

The async variant is StreamsServiceClient::getSeriesAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\Cloud\VisionAI\V1\Series
Example
use Google\ApiCore\ApiException;
use Google\Cloud\VisionAI\V1\Client\StreamsServiceClient;
use Google\Cloud\VisionAI\V1\GetSeriesRequest;
use Google\Cloud\VisionAI\V1\Series;

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

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

    // Call the API and handle any network failures.
    try {
        /** @var Series $response */
        $response = $streamsServiceClient->getSeries($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 = StreamsServiceClient::seriesName(
        '[PROJECT]',
        '[LOCATION]',
        '[CLUSTER]',
        '[SERIES]'
    );

    get_series_sample($formattedName);
}

getStream

Gets details of a single Stream.

The async variant is StreamsServiceClient::getStreamAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\Cloud\VisionAI\V1\Stream
Example
use Google\ApiCore\ApiException;
use Google\Cloud\VisionAI\V1\Client\StreamsServiceClient;
use Google\Cloud\VisionAI\V1\GetStreamRequest;
use Google\Cloud\VisionAI\V1\Stream;

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

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

    // Call the API and handle any network failures.
    try {
        /** @var Stream $response */
        $response = $streamsServiceClient->getStream($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 = StreamsServiceClient::streamName(
        '[PROJECT]',
        '[LOCATION]',
        '[CLUSTER]',
        '[STREAM]'
    );

    get_stream_sample($formattedName);
}

getStreamThumbnail

Gets the thumbnail (image snapshot) of a single Stream.

The async variant is StreamsServiceClient::getStreamThumbnailAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse<Google\Cloud\VisionAI\V1\GetStreamThumbnailResponse>
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\StreamsServiceClient;
use Google\Cloud\VisionAI\V1\GetStreamThumbnailRequest;
use Google\Cloud\VisionAI\V1\GetStreamThumbnailResponse;
use Google\Rpc\Status;

/**
 * @param string $stream        The name of the stream for to get the thumbnail from.
 * @param string $gcsObjectName The name of the GCS object to store the thumbnail image.
 */
function get_stream_thumbnail_sample(string $stream, string $gcsObjectName): void
{
    // Create a client.
    $streamsServiceClient = new StreamsServiceClient();

    // Prepare the request message.
    $request = (new GetStreamThumbnailRequest())
        ->setStream($stream)
        ->setGcsObjectName($gcsObjectName);

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

        if ($response->operationSucceeded()) {
            /** @var GetStreamThumbnailResponse $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
{
    $stream = '[STREAM]';
    $gcsObjectName = '[GCS_OBJECT_NAME]';

    get_stream_thumbnail_sample($stream, $gcsObjectName);
}

listClusters

Lists Clusters in a given project and location.

The async variant is StreamsServiceClient::listClustersAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\VisionAI\V1\Client\StreamsServiceClient;
use Google\Cloud\VisionAI\V1\Cluster;
use Google\Cloud\VisionAI\V1\ListClustersRequest;

/**
 * @param string $formattedParent Parent value for ListClustersRequest. Please see
 *                                {@see StreamsServiceClient::locationName()} for help formatting this field.
 */
function list_clusters_sample(string $formattedParent): void
{
    // Create a client.
    $streamsServiceClient = new StreamsServiceClient();

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

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

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

    list_clusters_sample($formattedParent);
}

listEvents

Lists Events in a given project and location.

The async variant is StreamsServiceClient::listEventsAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\VisionAI\V1\Client\StreamsServiceClient;
use Google\Cloud\VisionAI\V1\Event;
use Google\Cloud\VisionAI\V1\ListEventsRequest;

/**
 * @param string $formattedParent Parent value for ListEventsRequest. Please see
 *                                {@see StreamsServiceClient::clusterName()} for help formatting this field.
 */
function list_events_sample(string $formattedParent): void
{
    // Create a client.
    $streamsServiceClient = new StreamsServiceClient();

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

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

        /** @var Event $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 = StreamsServiceClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]');

    list_events_sample($formattedParent);
}

listSeries

Lists Series in a given project and location.

The async variant is StreamsServiceClient::listSeriesAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\VisionAI\V1\Client\StreamsServiceClient;
use Google\Cloud\VisionAI\V1\ListSeriesRequest;
use Google\Cloud\VisionAI\V1\Series;

/**
 * @param string $formattedParent Parent value for ListSeriesRequest. Please see
 *                                {@see StreamsServiceClient::clusterName()} for help formatting this field.
 */
function list_series_sample(string $formattedParent): void
{
    // Create a client.
    $streamsServiceClient = new StreamsServiceClient();

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

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

        /** @var Series $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 = StreamsServiceClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]');

    list_series_sample($formattedParent);
}

listStreams

Lists Streams in a given project and location.

The async variant is StreamsServiceClient::listStreamsAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\VisionAI\V1\Client\StreamsServiceClient;
use Google\Cloud\VisionAI\V1\ListStreamsRequest;
use Google\Cloud\VisionAI\V1\Stream;

/**
 * @param string $formattedParent Parent value for ListStreamsRequest. Please see
 *                                {@see StreamsServiceClient::clusterName()} for help formatting this field.
 */
function list_streams_sample(string $formattedParent): void
{
    // Create a client.
    $streamsServiceClient = new StreamsServiceClient();

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

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

        /** @var Stream $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 = StreamsServiceClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]');

    list_streams_sample($formattedParent);
}

materializeChannel

Materialize a channel.

The async variant is StreamsServiceClient::materializeChannelAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse<Google\Cloud\VisionAI\V1\Channel>
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Channel;
use Google\Cloud\VisionAI\V1\Client\StreamsServiceClient;
use Google\Cloud\VisionAI\V1\MaterializeChannelRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedParent        Value for parent. Please see
 *                                       {@see StreamsServiceClient::clusterName()} for help formatting this field.
 * @param string $channelId              Id of the channel.
 * @param string $formattedChannelStream Stream that is associated with this series. Please see
 *                                       {@see StreamsServiceClient::streamName()} for help formatting this field.
 * @param string $formattedChannelEvent  Event that is associated with this series. Please see
 *                                       {@see StreamsServiceClient::eventName()} for help formatting this field.
 */
function materialize_channel_sample(
    string $formattedParent,
    string $channelId,
    string $formattedChannelStream,
    string $formattedChannelEvent
): void {
    // Create a client.
    $streamsServiceClient = new StreamsServiceClient();

    // Prepare the request message.
    $channel = (new Channel())
        ->setStream($formattedChannelStream)
        ->setEvent($formattedChannelEvent);
    $request = (new MaterializeChannelRequest())
        ->setParent($formattedParent)
        ->setChannelId($channelId)
        ->setChannel($channel);

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

        if ($response->operationSucceeded()) {
            /** @var Channel $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 = StreamsServiceClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]');
    $channelId = '[CHANNEL_ID]';
    $formattedChannelStream = StreamsServiceClient::streamName(
        '[PROJECT]',
        '[LOCATION]',
        '[CLUSTER]',
        '[STREAM]'
    );
    $formattedChannelEvent = StreamsServiceClient::eventName(
        '[PROJECT]',
        '[LOCATION]',
        '[CLUSTER]',
        '[EVENT]'
    );

    materialize_channel_sample(
        $formattedParent,
        $channelId,
        $formattedChannelStream,
        $formattedChannelEvent
    );
}

updateCluster

Updates the parameters of a single Cluster.

The async variant is StreamsServiceClient::updateClusterAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse<Google\Cloud\VisionAI\V1\Cluster>
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\StreamsServiceClient;
use Google\Cloud\VisionAI\V1\Cluster;
use Google\Cloud\VisionAI\V1\UpdateClusterRequest;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;

/**
 * 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_cluster_sample(): void
{
    // Create a client.
    $streamsServiceClient = new StreamsServiceClient();

    // Prepare the request message.
    $updateMask = new FieldMask();
    $cluster = new Cluster();
    $request = (new UpdateClusterRequest())
        ->setUpdateMask($updateMask)
        ->setCluster($cluster);

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

        if ($response->operationSucceeded()) {
            /** @var Cluster $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());
    }
}

updateEvent

Updates the parameters of a single Event.

The async variant is StreamsServiceClient::updateEventAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse<Google\Cloud\VisionAI\V1\Event>
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\StreamsServiceClient;
use Google\Cloud\VisionAI\V1\Event;
use Google\Cloud\VisionAI\V1\UpdateEventRequest;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;

/**
 * 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_event_sample(): void
{
    // Create a client.
    $streamsServiceClient = new StreamsServiceClient();

    // Prepare the request message.
    $updateMask = new FieldMask();
    $event = new Event();
    $request = (new UpdateEventRequest())
        ->setUpdateMask($updateMask)
        ->setEvent($event);

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

        if ($response->operationSucceeded()) {
            /** @var Event $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());
    }
}

updateSeries

Updates the parameters of a single Event.

The async variant is StreamsServiceClient::updateSeriesAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse<Google\Cloud\VisionAI\V1\Series>
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\StreamsServiceClient;
use Google\Cloud\VisionAI\V1\Series;
use Google\Cloud\VisionAI\V1\UpdateSeriesRequest;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;

/**
 * @param string $formattedSeriesStream Stream that is associated with this series. Please see
 *                                      {@see StreamsServiceClient::streamName()} for help formatting this field.
 * @param string $formattedSeriesEvent  Event that is associated with this series. Please see
 *                                      {@see StreamsServiceClient::eventName()} for help formatting this field.
 */
function update_series_sample(string $formattedSeriesStream, string $formattedSeriesEvent): void
{
    // Create a client.
    $streamsServiceClient = new StreamsServiceClient();

    // Prepare the request message.
    $updateMask = new FieldMask();
    $series = (new Series())
        ->setStream($formattedSeriesStream)
        ->setEvent($formattedSeriesEvent);
    $request = (new UpdateSeriesRequest())
        ->setUpdateMask($updateMask)
        ->setSeries($series);

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

        if ($response->operationSucceeded()) {
            /** @var Series $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
{
    $formattedSeriesStream = StreamsServiceClient::streamName(
        '[PROJECT]',
        '[LOCATION]',
        '[CLUSTER]',
        '[STREAM]'
    );
    $formattedSeriesEvent = StreamsServiceClient::eventName(
        '[PROJECT]',
        '[LOCATION]',
        '[CLUSTER]',
        '[EVENT]'
    );

    update_series_sample($formattedSeriesStream, $formattedSeriesEvent);
}

updateStream

Updates the parameters of a single Stream.

The async variant is StreamsServiceClient::updateStreamAsync() .

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

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
Type Description
Google\ApiCore\OperationResponse<Google\Cloud\VisionAI\V1\Stream>
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\VisionAI\V1\Client\StreamsServiceClient;
use Google\Cloud\VisionAI\V1\Stream;
use Google\Cloud\VisionAI\V1\UpdateStreamRequest;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;

/**
 * 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_stream_sample(): void
{
    // Create a client.
    $streamsServiceClient = new StreamsServiceClient();

    // Prepare the request message.
    $updateMask = new FieldMask();
    $stream = new Stream();
    $request = (new UpdateStreamRequest())
        ->setUpdateMask($updateMask)
        ->setStream($stream);

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

        if ($response->operationSucceeded()) {
            /** @var Stream $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());
    }
}

getLocation

Gets information about a location.

The async variant is StreamsServiceClient::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
Google\Cloud\Location\Location
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Location\GetLocationRequest;
use Google\Cloud\Location\Location;
use Google\Cloud\VisionAI\V1\Client\StreamsServiceClient;

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

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

    // Call the API and handle any network failures.
    try {
        /** @var Location $response */
        $response = $streamsServiceClient->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 StreamsServiceClient::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
Google\ApiCore\PagedListResponse
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\StreamsServiceClient;

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

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

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

createClusterAsync

Parameters
Name Description
request Google\Cloud\VisionAI\V1\CreateClusterRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

createEventAsync

Parameters
Name Description
request Google\Cloud\VisionAI\V1\CreateEventRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

createSeriesAsync

Parameters
Name Description
request Google\Cloud\VisionAI\V1\CreateSeriesRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

createStreamAsync

Parameters
Name Description
request Google\Cloud\VisionAI\V1\CreateStreamRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

deleteClusterAsync

Parameters
Name Description
request Google\Cloud\VisionAI\V1\DeleteClusterRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

deleteEventAsync

Parameters
Name Description
request Google\Cloud\VisionAI\V1\DeleteEventRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

deleteSeriesAsync

Parameters
Name Description
request Google\Cloud\VisionAI\V1\DeleteSeriesRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

deleteStreamAsync

Parameters
Name Description
request Google\Cloud\VisionAI\V1\DeleteStreamRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

generateStreamHlsTokenAsync

Parameters
Name Description
request Google\Cloud\VisionAI\V1\GenerateStreamHlsTokenRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\VisionAI\V1\GenerateStreamHlsTokenResponse>

getClusterAsync

Parameters
Name Description
request Google\Cloud\VisionAI\V1\GetClusterRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\VisionAI\V1\Cluster>

getEventAsync

Parameters
Name Description
request Google\Cloud\VisionAI\V1\GetEventRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\VisionAI\V1\Event>

getSeriesAsync

Parameters
Name Description
request Google\Cloud\VisionAI\V1\GetSeriesRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\VisionAI\V1\Series>

getStreamAsync

Parameters
Name Description
request Google\Cloud\VisionAI\V1\GetStreamRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\VisionAI\V1\Stream>

getStreamThumbnailAsync

Parameters
Name Description
request Google\Cloud\VisionAI\V1\GetStreamThumbnailRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

listClustersAsync

Parameters
Name Description
request Google\Cloud\VisionAI\V1\ListClustersRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

listEventsAsync

Parameters
Name Description
request Google\Cloud\VisionAI\V1\ListEventsRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

listSeriesAsync

Parameters
Name Description
request Google\Cloud\VisionAI\V1\ListSeriesRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

listStreamsAsync

Parameters
Name Description
request Google\Cloud\VisionAI\V1\ListStreamsRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

materializeChannelAsync

Parameters
Name Description
request Google\Cloud\VisionAI\V1\MaterializeChannelRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

updateClusterAsync

Parameters
Name Description
request Google\Cloud\VisionAI\V1\UpdateClusterRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

updateEventAsync

Parameters
Name Description
request Google\Cloud\VisionAI\V1\UpdateEventRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

updateSeriesAsync

Parameters
Name Description
request Google\Cloud\VisionAI\V1\UpdateSeriesRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

updateStreamAsync

Parameters
Name Description
request Google\Cloud\VisionAI\V1\UpdateStreamRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

getLocationAsync

Parameters
Name Description
request Google\Cloud\Location\GetLocationRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Location\Location>

listLocationsAsync

Parameters
Name Description
request Google\Cloud\Location\ListLocationsRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

getOperationsClient

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

Returns
Type Description
Google\LongRunning\Client\OperationsClient

resumeOperation

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

Parameters
Name Description
operationName string

The name of the long running operation

methodName string

The name of the method used to start the operation

Returns
Type Description
Google\ApiCore\OperationResponse

static::channelName

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

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

static::clusterName

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

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

static::eventName

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

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

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

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

  • channel: projects/{project}/locations/{location}/clusters/{cluster}/channels/{channel}
  • cluster: projects/{project}/locations/{location}/clusters/{cluster}
  • event: projects/{project}/locations/{location}/clusters/{cluster}/events/{event}
  • location: projects/{project}/locations/{location}
  • series: projects/{project}/locations/{location}/clusters/{cluster}/series/{series}
  • 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.