-
Notifications
You must be signed in to change notification settings - Fork 436
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added support for slate events which allow users to create and …
…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
1 parent
0925fe4
commit fefa9af
Showing
32 changed files
with
5,075 additions
and
69 deletions.
There are no files selected for viewing
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
92 changes: 92 additions & 0 deletions
92
VideoLiveStream/samples/V1/LivestreamServiceClient/create_asset.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
VideoLiveStream/samples/V1/LivestreamServiceClient/delete_asset.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
72
VideoLiveStream/samples/V1/LivestreamServiceClient/get_asset.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
Oops, something went wrong.