Skip to content

Commit

Permalink
feat: added support for slate events which allow users to create and …
Browse files Browse the repository at this point in the history
…insert a slate into a live stream to replace the main live stream content (#6471)

feat: added a new asset resource which can be used as the content of slate events
feat: added a new pool resource for protecting input endpoints within a VPC Service Controls perimeter
PiperOrigin-RevId: 549682971
Source-Link: googleapis/googleapis@e43e3d6
Source-Link: googleapis/googleapis-gen@47b8267
Copy-Tag: eyJwIjoiVmlkZW9MaXZlU3RyZWFtLy5Pd2xCb3QueWFtbCIsImgiOiI0N2I4MjY3MWJhMTA4NjJhNjhkZjRjMTFhOTc4MTMxYzJjOTIxMjRjIn0=
  • Loading branch information
gcf-owl-bot[bot] committed Jul 21, 2023
1 parent 1c15021 commit b8164c7
Show file tree
Hide file tree
Showing 32 changed files with 5,075 additions and 69 deletions.
Binary file modified metadata/V1/Resources.php
Binary file not shown.
55 changes: 50 additions & 5 deletions metadata/V1/Service.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

92 changes: 92 additions & 0 deletions samples/V1/LivestreamServiceClient/create_asset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?php
/*
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* GENERATED CODE WARNING
* This file was automatically generated - do not edit!
*/

require_once __DIR__ . '/../../../vendor/autoload.php';

// [START livestream_v1_generated_LivestreamService_CreateAsset_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Video\LiveStream\V1\Asset;
use Google\Cloud\Video\LiveStream\V1\Client\LivestreamServiceClient;
use Google\Cloud\Video\LiveStream\V1\CreateAssetRequest;
use Google\Rpc\Status;

/**
* Creates a Asset with the provided unique ID in the specified
* region.
*
* @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 $assetId The ID of the asset 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_asset_sample(string $formattedParent, string $assetId): void
{
// Create a client.
$livestreamServiceClient = new LivestreamServiceClient();

// Prepare the request message.
$asset = new Asset();
$request = (new CreateAssetRequest())
->setParent($formattedParent)
->setAsset($asset)
->setAssetId($assetId);

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

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

create_asset_sample($formattedParent, $assetId);
}
// [END livestream_v1_generated_LivestreamService_CreateAsset_sync]
5 changes: 1 addition & 4 deletions samples/V1/LivestreamServiceClient/create_event.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
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;

/**
* Creates an event with the provided unique ID in the specified channel.
Expand All @@ -45,9 +44,7 @@ function create_event_sample(string $formattedParent, string $eventId): void
$livestreamServiceClient = new LivestreamServiceClient();

// Prepare the request message.
$eventInputSwitch = new InputSwitchTask();
$event = (new Event())
->setInputSwitch($eventInputSwitch);
$event = new Event();
$request = (new CreateEventRequest())
->setParent($formattedParent)
->setEvent($event)
Expand Down
81 changes: 81 additions & 0 deletions samples/V1/LivestreamServiceClient/delete_asset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?php
/*
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* GENERATED CODE WARNING
* This file was automatically generated - do not edit!
*/

require_once __DIR__ . '/../../../vendor/autoload.php';

// [START livestream_v1_generated_LivestreamService_DeleteAsset_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Video\LiveStream\V1\Client\LivestreamServiceClient;
use Google\Cloud\Video\LiveStream\V1\DeleteAssetRequest;
use Google\Rpc\Status;

/**
* Deletes the specified asset if it is not used.
*
* @param string $formattedName The name of the asset resource, in the form of:
* `projects/{project}/locations/{location}/assets/{assetId}`. Please see
* {@see LivestreamServiceClient::assetName()} for help formatting this field.
*/
function delete_asset_sample(string $formattedName): void
{
// Create a client.
$livestreamServiceClient = new LivestreamServiceClient();

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

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

delete_asset_sample($formattedName);
}
// [END livestream_v1_generated_LivestreamService_DeleteAsset_sync]
72 changes: 72 additions & 0 deletions samples/V1/LivestreamServiceClient/get_asset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php
/*
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* GENERATED CODE WARNING
* This file was automatically generated - do not edit!
*/

require_once __DIR__ . '/../../../vendor/autoload.php';

// [START livestream_v1_generated_LivestreamService_GetAsset_sync]
use Google\ApiCore\ApiException;
use Google\Cloud\Video\LiveStream\V1\Asset;
use Google\Cloud\Video\LiveStream\V1\Client\LivestreamServiceClient;
use Google\Cloud\Video\LiveStream\V1\GetAssetRequest;

/**
* Returns the specified asset.
*
* @param string $formattedName Name of the resource, in the following form:
* `projects/{project}/locations/{location}/assets/{asset}`. Please see
* {@see LivestreamServiceClient::assetName()} for help formatting this field.
*/
function get_asset_sample(string $formattedName): void
{
// Create a client.
$livestreamServiceClient = new LivestreamServiceClient();

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

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

get_asset_sample($formattedName);
}
// [END livestream_v1_generated_LivestreamService_GetAsset_sync]

0 comments on commit b8164c7

Please sign in to comment.