Google Cloud Video Live Stream V1 Client - Class LivestreamServiceClient (0.4.2)

Reference documentation and code samples for the Google Cloud Video Live Stream V1 Client class LivestreamServiceClient.

Service Description: Using Live Stream API, you can generate live streams in the various renditions and streaming formats. The streaming format include HTTP Live Streaming (HLS) and Dynamic Adaptive Streaming over HTTP (DASH). You can send a source stream in the various ways, including Real-Time Messaging Protocol (RTMP) and Secure Reliable Transport (SRT).

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:

$livestreamServiceClient = new LivestreamServiceClient();
try {
    $formattedParent = $livestreamServiceClient->locationName('[PROJECT]', '[LOCATION]');
    $channel = new Channel();
    $channelId = 'channel_id';
    $operationResponse = $livestreamServiceClient->createChannel($formattedParent, $channel, $channelId);
    $operationResponse->pollUntilComplete();
    if ($operationResponse->operationSucceeded()) {
        $result = $operationResponse->getResult();
        // doSomethingWith($result)
    } else {
        $error = $operationResponse->getError();
        // handleError($error)
    }
    // Alternatively:
    // start the operation, keep the operation name, and resume later
    $operationResponse = $livestreamServiceClient->createChannel($formattedParent, $channel, $channelId);
    $operationName = $operationResponse->getName();
    // ... do other work
    $newOperationResponse = $livestreamServiceClient->resumeOperation($operationName, 'createChannel');
    while (!$newOperationResponse->isDone()) {
        // ... do other work
        $newOperationResponse->reload();
    }
    if ($newOperationResponse->operationSucceeded()) {
        $result = $newOperationResponse->getResult();
        // doSomethingWith($result)
    } else {
        $error = $newOperationResponse->getError();
        // handleError($error)
    }
} finally {
    $livestreamServiceClient->close();
}

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

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

Namespace

Google \ Cloud \ Video \ LiveStream \ V1

Methods

__construct

Constructor.

Parameters
NameDescription
options array

Optional. Options for configuring the service API wrapper.

↳ apiEndpoint string

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

↳ credentials string|array|FetchAuthTokenInterface|CredentialsWrapper

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

↳ credentialsConfig array

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

↳ disableRetries bool

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

↳ clientConfig string|array

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

↳ transport string|TransportInterface

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

↳ transportConfig array

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

↳ clientCertSource callable

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

createChannel

Creates a channel with the provided unique ID in the specified region.

Parameters
NameDescription
parent string

Required. The parent location for the resource, in the form of: projects/{project}/locations/{location}.

channel Google\Cloud\Video\LiveStream\V1\Channel

Required. The channel resource to be created.

channelId string

Required. The ID of the channel resource to be created. This value must be 1-63 characters, begin and end with [a-z0-9], could contain dashes (-) in between.

optionalArgs array

Optional.

↳ requestId string

A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Video\LiveStream\V1\Channel;
use Google\Cloud\Video\LiveStream\V1\Channel\Output;
use Google\Cloud\Video\LiveStream\V1\Client\LivestreamServiceClient;
use Google\Cloud\Video\LiveStream\V1\CreateChannelRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedParent The parent location for the resource, in the form of:
 *                                `projects/{project}/locations/{location}`. Please see
 *                                {@see LivestreamServiceClient::locationName()} for help formatting this field.
 * @param string $channelId       The ID of the channel resource to be created.
 *                                This value must be 1-63 characters, begin and end with `[a-z0-9]`,
 *                                could contain dashes (-) in between.
 */
function create_channel_sample(string $formattedParent, string $channelId): void
{
    // Create a client.
    $livestreamServiceClient = new LivestreamServiceClient();

    // Prepare the request message.
    $channelOutput = new Output();
    $channel = (new Channel())
        ->setOutput($channelOutput);
    $request = (new CreateChannelRequest())
        ->setParent($formattedParent)
        ->setChannel($channel)
        ->setChannelId($channelId);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $livestreamServiceClient->createChannel($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 = LivestreamServiceClient::locationName('[PROJECT]', '[LOCATION]');
    $channelId = '[CHANNEL_ID]';

    create_channel_sample($formattedParent, $channelId);
}

createEvent

Creates an event with the provided unique ID in the specified channel.

Parameters
NameDescription
parent string

Required. The parent channel for the resource, in the form of: projects/{project}/locations/{location}/channels/{channelId}.

event Google\Cloud\Video\LiveStream\V1\Event

Required. The event resource to be created.

eventId string

Required. The ID of the event resource to be created. This value must be 1-63 characters, begin and end with [a-z0-9], could contain dashes (-) in between.

optionalArgs array

Optional.

↳ requestId string

A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\Video\LiveStream\V1\Event
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Video\LiveStream\V1\Client\LivestreamServiceClient;
use Google\Cloud\Video\LiveStream\V1\CreateEventRequest;
use Google\Cloud\Video\LiveStream\V1\Event;
use Google\Cloud\Video\LiveStream\V1\Event\InputSwitchTask;

/**
 * @param string $formattedParent The parent channel for the resource, in the form of:
 *                                `projects/{project}/locations/{location}/channels/{channelId}`. Please see
 *                                {@see LivestreamServiceClient::channelName()} for help formatting this field.
 * @param string $eventId         The ID of the event resource to be created.
 *                                This value must be 1-63 characters, begin and end with `[a-z0-9]`,
 *                                could contain dashes (-) in between.
 */
function create_event_sample(string $formattedParent, string $eventId): void
{
    // Create a client.
    $livestreamServiceClient = new LivestreamServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Event $response */
        $response = $livestreamServiceClient->createEvent($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 = LivestreamServiceClient::channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]');
    $eventId = '[EVENT_ID]';

    create_event_sample($formattedParent, $eventId);
}

createInput

Creates an input with the provided unique ID in the specified region.

Parameters
NameDescription
parent string

Required. The parent location for the resource, in the form of: projects/{project}/locations/{location}.

input Google\Cloud\Video\LiveStream\V1\Input

Required. The input resource to be created.

inputId string

Required. The ID of the input resource to be created. This value must be 1-63 characters, begin and end with [a-z0-9], could contain dashes (-) in between.

optionalArgs array

Optional.

↳ requestId string

A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Video\LiveStream\V1\Client\LivestreamServiceClient;
use Google\Cloud\Video\LiveStream\V1\CreateInputRequest;
use Google\Cloud\Video\LiveStream\V1\Input;
use Google\Rpc\Status;

/**
 * @param string $formattedParent The parent location for the resource, in the form of:
 *                                `projects/{project}/locations/{location}`. Please see
 *                                {@see LivestreamServiceClient::locationName()} for help formatting this field.
 * @param string $inputId         The ID of the input resource to be created.
 *                                This value must be 1-63 characters, begin and end with `[a-z0-9]`,
 *                                could contain dashes (-) in between.
 */
function create_input_sample(string $formattedParent, string $inputId): void
{
    // Create a client.
    $livestreamServiceClient = new LivestreamServiceClient();

    // Prepare the request message.
    $input = new Input();
    $request = (new CreateInputRequest())
        ->setParent($formattedParent)
        ->setInput($input)
        ->setInputId($inputId);

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

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

    create_input_sample($formattedParent, $inputId);
}

deleteChannel

Deletes the specified channel.

Parameters
NameDescription
name string

Required. The name of the channel resource, in the form of: projects/{project}/locations/{location}/channels/{channelId}.

optionalArgs array

Optional.

↳ requestId string

A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ force bool

If the force field is set to the default value of false, you must delete all of a channel's events before you can delete the channel itself. If the field is set to true, requests to delete a channel also delete associated channel events.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Video\LiveStream\V1\Client\LivestreamServiceClient;
use Google\Cloud\Video\LiveStream\V1\DeleteChannelRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the channel resource, in the form of:
 *                              `projects/{project}/locations/{location}/channels/{channelId}`. Please see
 *                              {@see LivestreamServiceClient::channelName()} for help formatting this field.
 */
function delete_channel_sample(string $formattedName): void
{
    // Create a client.
    $livestreamServiceClient = new LivestreamServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $livestreamServiceClient->deleteChannel($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 = LivestreamServiceClient::channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]');

    delete_channel_sample($formattedName);
}

deleteEvent

Deletes the specified event.

Parameters
NameDescription
name string

Required. The name of the event resource, in the form of: projects/{project}/locations/{location}/channels/{channelId}/events/{eventId}.

optionalArgs array

Optional.

↳ requestId string

A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ 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\Video\LiveStream\V1\Client\LivestreamServiceClient;
use Google\Cloud\Video\LiveStream\V1\DeleteEventRequest;

/**
 * @param string $formattedName The name of the event resource, in the form of:
 *                              `projects/{project}/locations/{location}/channels/{channelId}/events/{eventId}`. Please see
 *                              {@see LivestreamServiceClient::eventName()} for help formatting this field.
 */
function delete_event_sample(string $formattedName): void
{
    // Create a client.
    $livestreamServiceClient = new LivestreamServiceClient();

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

    // Call the API and handle any network failures.
    try {
        $livestreamServiceClient->deleteEvent($request);
        printf('Call completed successfully.' . PHP_EOL);
    } 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 = LivestreamServiceClient::eventName(
        '[PROJECT]',
        '[LOCATION]',
        '[CHANNEL]',
        '[EVENT]'
    );

    delete_event_sample($formattedName);
}

deleteInput

Deletes the specified input.

Parameters
NameDescription
name string

Required. The name of the input resource, in the form of: projects/{project}/locations/{location}/inputs/{inputId}.

optionalArgs array

Optional.

↳ requestId string

A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Video\LiveStream\V1\Client\LivestreamServiceClient;
use Google\Cloud\Video\LiveStream\V1\DeleteInputRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the input resource, in the form of:
 *                              `projects/{project}/locations/{location}/inputs/{inputId}`. Please see
 *                              {@see LivestreamServiceClient::inputName()} for help formatting this field.
 */
function delete_input_sample(string $formattedName): void
{
    // Create a client.
    $livestreamServiceClient = new LivestreamServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $livestreamServiceClient->deleteInput($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 = LivestreamServiceClient::inputName('[PROJECT]', '[LOCATION]', '[INPUT]');

    delete_input_sample($formattedName);
}

getChannel

Returns the specified channel.

Parameters
NameDescription
name string

Required. The name of the channel resource, in the form of: projects/{project}/locations/{location}/channels/{channelId}.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\Video\LiveStream\V1\Channel
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Video\LiveStream\V1\Channel;
use Google\Cloud\Video\LiveStream\V1\Client\LivestreamServiceClient;
use Google\Cloud\Video\LiveStream\V1\GetChannelRequest;

/**
 * @param string $formattedName The name of the channel resource, in the form of:
 *                              `projects/{project}/locations/{location}/channels/{channelId}`. Please see
 *                              {@see LivestreamServiceClient::channelName()} for help formatting this field.
 */
function get_channel_sample(string $formattedName): void
{
    // Create a client.
    $livestreamServiceClient = new LivestreamServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Channel $response */
        $response = $livestreamServiceClient->getChannel($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 = LivestreamServiceClient::channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]');

    get_channel_sample($formattedName);
}

getEvent

Returns the specified event.

Parameters
NameDescription
name string

Required. The name of the event resource, in the form of: projects/{project}/locations/{location}/channels/{channelId}/events/{eventId}.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\Video\LiveStream\V1\Event
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Video\LiveStream\V1\Client\LivestreamServiceClient;
use Google\Cloud\Video\LiveStream\V1\Event;
use Google\Cloud\Video\LiveStream\V1\GetEventRequest;

/**
 * @param string $formattedName The name of the event resource, in the form of:
 *                              `projects/{project}/locations/{location}/channels/{channelId}/events/{eventId}`. Please see
 *                              {@see LivestreamServiceClient::eventName()} for help formatting this field.
 */
function get_event_sample(string $formattedName): void
{
    // Create a client.
    $livestreamServiceClient = new LivestreamServiceClient();

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

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

    get_event_sample($formattedName);
}

getInput

Returns the specified input.

Parameters
NameDescription
name string

Required. The name of the input resource, in the form of: projects/{project}/locations/{location}/inputs/{inputId}.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\Video\LiveStream\V1\Input
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Video\LiveStream\V1\Client\LivestreamServiceClient;
use Google\Cloud\Video\LiveStream\V1\GetInputRequest;
use Google\Cloud\Video\LiveStream\V1\Input;

/**
 * @param string $formattedName The name of the input resource, in the form of:
 *                              `projects/{project}/locations/{location}/inputs/{inputId}`. Please see
 *                              {@see LivestreamServiceClient::inputName()} for help formatting this field.
 */
function get_input_sample(string $formattedName): void
{
    // Create a client.
    $livestreamServiceClient = new LivestreamServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Input $response */
        $response = $livestreamServiceClient->getInput($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 = LivestreamServiceClient::inputName('[PROJECT]', '[LOCATION]', '[INPUT]');

    get_input_sample($formattedName);
}

listChannels

Returns a list of all channels in the specified region.

Parameters
NameDescription
parent string

Required. The parent location for the resource, in the form of: projects/{project}/locations/{location}.

optionalArgs array

Optional.

↳ pageSize int

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

↳ pageToken string

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

↳ filter string

The filter to apply to list results.

↳ orderBy string

Specifies the ordering of results following syntax at https://cloud.google.com/apis/design/design_patterns#sorting_order.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Video\LiveStream\V1\Channel;
use Google\Cloud\Video\LiveStream\V1\Client\LivestreamServiceClient;
use Google\Cloud\Video\LiveStream\V1\ListChannelsRequest;

/**
 * @param string $formattedParent The parent location for the resource, in the form of:
 *                                `projects/{project}/locations/{location}`. Please see
 *                                {@see LivestreamServiceClient::locationName()} for help formatting this field.
 */
function list_channels_sample(string $formattedParent): void
{
    // Create a client.
    $livestreamServiceClient = new LivestreamServiceClient();

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

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

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

    list_channels_sample($formattedParent);
}

listEvents

Returns a list of all events in the specified channel.

Parameters
NameDescription
parent string

Required. The parent channel for the resource, in the form of: projects/{project}/locations/{location}/channels/{channelId}.

optionalArgs array

Optional.

↳ pageSize int

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

↳ pageToken string

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

↳ filter string

The filter to apply to list results.

↳ orderBy string

Specifies the ordering of results following syntax at https://cloud.google.com/apis/design/design_patterns#sorting_order.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Video\LiveStream\V1\Client\LivestreamServiceClient;
use Google\Cloud\Video\LiveStream\V1\Event;
use Google\Cloud\Video\LiveStream\V1\ListEventsRequest;

/**
 * @param string $formattedParent The parent channel for the resource, in the form of:
 *                                `projects/{project}/locations/{location}/channels/{channelId}`. Please see
 *                                {@see LivestreamServiceClient::channelName()} for help formatting this field.
 */
function list_events_sample(string $formattedParent): void
{
    // Create a client.
    $livestreamServiceClient = new LivestreamServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $livestreamServiceClient->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 = LivestreamServiceClient::channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]');

    list_events_sample($formattedParent);
}

listInputs

Returns a list of all inputs in the specified region.

Parameters
NameDescription
parent string

Required. The parent location for the resource, in the form of: projects/{project}/locations/{location}.

optionalArgs array

Optional.

↳ pageSize int

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

↳ pageToken string

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

↳ filter string

The filter to apply to list results.

↳ orderBy string

Specifies the ordering of results following syntax at Sorting Order.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Video\LiveStream\V1\Client\LivestreamServiceClient;
use Google\Cloud\Video\LiveStream\V1\Input;
use Google\Cloud\Video\LiveStream\V1\ListInputsRequest;

/**
 * @param string $formattedParent The parent location for the resource, in the form of:
 *                                `projects/{project}/locations/{location}`. Please see
 *                                {@see LivestreamServiceClient::locationName()} for help formatting this field.
 */
function list_inputs_sample(string $formattedParent): void
{
    // Create a client.
    $livestreamServiceClient = new LivestreamServiceClient();

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

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

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

    list_inputs_sample($formattedParent);
}

startChannel

Starts the specified channel. Part of the video pipeline will be created only when the StartChannel request is received by the server.

Parameters
NameDescription
name string

Required. The name of the channel resource, in the form of: projects/{project}/locations/{location}/channels/{channelId}.

optionalArgs array

Optional.

↳ requestId string

A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Video\LiveStream\V1\ChannelOperationResponse;
use Google\Cloud\Video\LiveStream\V1\Client\LivestreamServiceClient;
use Google\Cloud\Video\LiveStream\V1\StartChannelRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the channel resource, in the form of:
 *                              `projects/{project}/locations/{location}/channels/{channelId}`. Please see
 *                              {@see LivestreamServiceClient::channelName()} for help formatting this field.
 */
function start_channel_sample(string $formattedName): void
{
    // Create a client.
    $livestreamServiceClient = new LivestreamServiceClient();

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

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

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

    start_channel_sample($formattedName);
}

stopChannel

Stops the specified channel. Part of the video pipeline will be released when the StopChannel request is received by the server.

Parameters
NameDescription
name string

Required. The name of the channel resource, in the form of: projects/{project}/locations/{location}/channels/{channelId}.

optionalArgs array

Optional.

↳ requestId string

A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Video\LiveStream\V1\ChannelOperationResponse;
use Google\Cloud\Video\LiveStream\V1\Client\LivestreamServiceClient;
use Google\Cloud\Video\LiveStream\V1\StopChannelRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the channel resource, in the form of:
 *                              `projects/{project}/locations/{location}/channels/{channelId}`. Please see
 *                              {@see LivestreamServiceClient::channelName()} for help formatting this field.
 */
function stop_channel_sample(string $formattedName): void
{
    // Create a client.
    $livestreamServiceClient = new LivestreamServiceClient();

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

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

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

    stop_channel_sample($formattedName);
}

updateChannel

Updates the specified channel.

Parameters
NameDescription
channel Google\Cloud\Video\LiveStream\V1\Channel

Required. The channel resource to be updated.

optionalArgs array

Optional.

↳ updateMask FieldMask

Field mask is used to specify the fields to be overwritten in the Channel resource by the update. You can only update the following fields: * inputAttachments * inputConfig * output * elementaryStreams * muxStreams * manifests * spriteSheets * logConfig * timecodeConfig * encryptions The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the mask is not present, then each field from the list above is updated if the field appears in the request payload. To unset a field, add the field to the update mask and remove it from the request payload.

↳ requestId string

A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Video\LiveStream\V1\Channel;
use Google\Cloud\Video\LiveStream\V1\Channel\Output;
use Google\Cloud\Video\LiveStream\V1\Client\LivestreamServiceClient;
use Google\Cloud\Video\LiveStream\V1\UpdateChannelRequest;
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_channel_sample(): void
{
    // Create a client.
    $livestreamServiceClient = new LivestreamServiceClient();

    // Prepare the request message.
    $channelOutput = new Output();
    $channel = (new Channel())
        ->setOutput($channelOutput);
    $request = (new UpdateChannelRequest())
        ->setChannel($channel);

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

updateInput

Updates the specified input.

Parameters
NameDescription
input Google\Cloud\Video\LiveStream\V1\Input

Required. The input resource to be updated.

optionalArgs array

Optional.

↳ updateMask FieldMask

Field mask is used to specify the fields to be overwritten in the Input resource by the update. You can only update the following fields: * preprocessingConfig * securityRules The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the mask is not present, then each field from the list above is updated if the field appears in the request payload. To unset a field, add the field to the update mask and remove it from the request payload.

↳ requestId string

A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Video\LiveStream\V1\Client\LivestreamServiceClient;
use Google\Cloud\Video\LiveStream\V1\Input;
use Google\Cloud\Video\LiveStream\V1\UpdateInputRequest;
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_input_sample(): void
{
    // Create a client.
    $livestreamServiceClient = new LivestreamServiceClient();

    // Prepare the request message.
    $input = new Input();
    $request = (new UpdateInputRequest())
        ->setInput($input);

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

        if ($response->operationSucceeded()) {
            /** @var Input $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.

Parameters
NameDescription
optionalArgs array

Optional.

↳ name string

Resource name for the location.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\Location\Location
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Location\GetLocationRequest;
use Google\Cloud\Location\Location;
use Google\Cloud\Video\LiveStream\V1\Client\LivestreamServiceClient;

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

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

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

listLocations

Lists information about the supported locations for this service.

Parameters
NameDescription
optionalArgs array

Optional.

↳ name string

The resource that owns the locations collection, if applicable.

↳ filter string

The standard list filter.

↳ pageSize int

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

↳ pageToken string

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

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Location\ListLocationsRequest;
use Google\Cloud\Location\Location;
use Google\Cloud\Video\LiveStream\V1\Client\LivestreamServiceClient;

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

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

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

getOperationsClient

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

Returns
TypeDescription
Google\ApiCore\LongRunning\OperationsClient

resumeOperation

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

Parameters
NameDescription
operationName string

The name of the long running operation

methodName string

The name of the method used to start the operation

Returns
TypeDescription
Google\ApiCore\OperationResponse

static::channelName

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

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

static::eventName

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

Parameters
NameDescription
project string
location string
channel string
event string
Returns
TypeDescription
stringThe formatted event resource.

static::inputName

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

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

static::locationName

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

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

static::secretVersionName

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

Parameters
NameDescription
project string
secret string
version string
Returns
TypeDescription
stringThe formatted secret_version 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}/channels/{channel}
  • event: projects/{project}/locations/{location}/channels/{channel}/events/{event}
  • input: projects/{project}/locations/{location}/inputs/{input}
  • location: projects/{project}/locations/{location}
  • secretVersion: projects/{project}/secrets/{secret}/versions/{version}

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

Parameters
NameDescription
formattedName string

The formatted name string

template string

Optional name of template to match

Returns
TypeDescription
arrayAn associative array from name component IDs to component values.

Constants

SERVICE_NAME

Value: 'google.cloud.video.livestream.v1.LivestreamService'

The name of the service.

SERVICE_ADDRESS

Value: 'livestream.googleapis.com'

The default address of the service.

DEFAULT_SERVICE_PORT

Value: 443

The default port of the service.

CODEGEN_NAME

Value: 'gapic'

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