diff --git a/VideoStitcher/metadata/V1/LiveConfigs.php b/VideoStitcher/metadata/V1/LiveConfigs.php new file mode 100644 index 00000000000..4604abff852 Binary files /dev/null and b/VideoStitcher/metadata/V1/LiveConfigs.php differ diff --git a/VideoStitcher/metadata/V1/Sessions.php b/VideoStitcher/metadata/V1/Sessions.php index 24c933e35c0..9bfdc50bbbe 100644 Binary files a/VideoStitcher/metadata/V1/Sessions.php and b/VideoStitcher/metadata/V1/Sessions.php differ diff --git a/VideoStitcher/metadata/V1/Slates.php b/VideoStitcher/metadata/V1/Slates.php index 5a4fe097e89..b64766ec351 100644 --- a/VideoStitcher/metadata/V1/Slates.php +++ b/VideoStitcher/metadata/V1/Slates.php @@ -18,11 +18,15 @@ public static function initOnce() { \GPBMetadata\Google\Api\Resource::initOnce(); $pool->internalAddGeneratedFile( ' -ð -+google/cloud/video/stitcher/v1/slates.protogoogle.cloud.video.stitcher.v1google/api/resource.proto"ˆ +õ ++google/cloud/video/stitcher/v1/slates.protogoogle.cloud.video.stitcher.v1google/api/resource.proto" Slate name ( BàA -uri ( :_êA\\ +uri ( A + gam_slate ( 2..google.cloud.video.stitcher.v1.Slate.GamSlate@ +GamSlate + network_code ( BàA + gam_slate_id (BàA:_êA\\ "videostitcher.googleapis.com/Slate6projects/{project}/locations/{location}/slates/{slate}Bs "com.google.cloud.video.stitcher.v1B SlatesProtoPZ>cloud.google.com/go/video/stitcher/apiv1/stitcherpb;stitcherpbbproto3' , true); diff --git a/VideoStitcher/metadata/V1/VideoStitcherService.php b/VideoStitcher/metadata/V1/VideoStitcherService.php index 0fb4433aea7..6bc198e11f6 100644 --- a/VideoStitcher/metadata/V1/VideoStitcherService.php +++ b/VideoStitcher/metadata/V1/VideoStitcherService.php @@ -20,15 +20,18 @@ public static function initOnce() { \GPBMetadata\Google\Api\Resource::initOnce(); \GPBMetadata\Google\Cloud\Video\Stitcher\V1\AdTagDetails::initOnce(); \GPBMetadata\Google\Cloud\Video\Stitcher\V1\CdnKeys::initOnce(); + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\LiveConfigs::initOnce(); \GPBMetadata\Google\Cloud\Video\Stitcher\V1\Sessions::initOnce(); \GPBMetadata\Google\Cloud\Video\Stitcher\V1\Slates::initOnce(); \GPBMetadata\Google\Cloud\Video\Stitcher\V1\StitchDetails::initOnce(); + \GPBMetadata\Google\Longrunning\Operations::initOnce(); \GPBMetadata\Google\Protobuf\GPBEmpty::initOnce(); \GPBMetadata\Google\Protobuf\FieldMask::initOnce(); + \GPBMetadata\Google\Protobuf\Timestamp::initOnce(); $pool->internalAddGeneratedFile( ' -È< -;google/cloud/video/stitcher/v1/video_stitcher_service.protogoogle.cloud.video.stitcher.v1google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.proto3google/cloud/video/stitcher/v1/ad_tag_details.proto-google/cloud/video/stitcher/v1/cdn_keys.proto-google/cloud/video/stitcher/v1/sessions.proto+google/cloud/video/stitcher/v1/slates.proto3google/cloud/video/stitcher/v1/stitch_details.protogoogle/protobuf/empty.proto google/protobuf/field_mask.proto"© +³L +;google/cloud/video/stitcher/v1/video_stitcher_service.protogoogle.cloud.video.stitcher.v1google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.proto3google/cloud/video/stitcher/v1/ad_tag_details.proto-google/cloud/video/stitcher/v1/cdn_keys.proto1google/cloud/video/stitcher/v1/live_configs.proto-google/cloud/video/stitcher/v1/sessions.proto+google/cloud/video/stitcher/v1/slates.proto3google/cloud/video/stitcher/v1/stitch_details.proto#google/longrunning/operations.protogoogle/protobuf/empty.proto google/protobuf/field_mask.protogoogle/protobuf/timestamp.proto"© CreateCdnKeyRequest; parent ( B+àAúA%#videostitcher.googleapis.com/CdnKey< cdn_key ( 2&.google.cloud.video.stitcher.v1.CdnKeyBàA @@ -92,11 +95,13 @@ public static function initOnce() { next_page_token ( "_ GetLiveAdTagDetailRequestB name ( B4àAúA. -,videostitcher.googleapis.com/LiveAdTagDetail"¢ +,videostitcher.googleapis.com/LiveAdTagDetail"¶ CreateSlateRequest: parent ( B*àAúA$"videostitcher.googleapis.com/Slate slate_id ( BàA9 -slate ( 2%.google.cloud.video.stitcher.v1.SlateBàA"K +slate ( 2%.google.cloud.video.stitcher.v1.SlateBàA + +request_id ( "K GetSlateRequest8 name ( B*àAúA$ "videostitcher.googleapis.com/Slate"˜ @@ -123,13 +128,44 @@ public static function initOnce() { live_session ( 2+.google.cloud.video.stitcher.v1.LiveSessionBàA"W GetLiveSessionRequest> name ( B0àAúA* -(videostitcher.googleapis.com/LiveSession2ª -VideoStitcherServiceÅ - CreateCdnKey3.google.cloud.video.stitcher.v1.CreateCdnKeyRequest&.google.cloud.video.stitcher.v1.CdnKey"X‚Óä“6"+/v1/{parent=projects/*/locations/*}/cdnKeys:cdn_keyÚAparent,cdn_key,cdn_key_id´ +(videostitcher.googleapis.com/LiveSession"Ñ +CreateLiveConfigRequest? +parent ( B/àAúA)\'videostitcher.googleapis.com/LiveConfig +live_config_id ( BàAD + live_config ( 2*.google.cloud.video.stitcher.v1.LiveConfigBàA + +request_id ( "¬ +ListLiveConfigsRequest? +parent ( B/àAúA)\'videostitcher.googleapis.com/LiveConfig + page_size ( + +page_token (  +filter ( BàA +order_by ( BàA"‰ +ListLiveConfigsResponse@ + live_configs ( 2*.google.cloud.video.stitcher.v1.LiveConfig +next_page_token (  + unreachable ( "U +GetLiveConfigRequest= +name ( B/àAúA) +\'videostitcher.googleapis.com/LiveConfig"X +DeleteLiveConfigRequest= +name ( B/àAúA) +\'videostitcher.googleapis.com/LiveConfig" +OperationMetadata/ + create_time ( 2.google.protobuf.Timestamp, +end_time ( 2.google.protobuf.Timestamp +target (  +verb ( 2µ\' +VideoStitcherServiceÚ + CreateCdnKey3.google.cloud.video.stitcher.v1.CreateCdnKeyRequest.google.longrunning.Operation"v‚Óä“6"+/v1/{parent=projects/*/locations/*}/cdnKeys:cdn_keyÚAparent,cdn_key,cdn_key_idÊA +CdnKeyOperationMetadata´ ListCdnKeys2.google.cloud.video.stitcher.v1.ListCdnKeysRequest3.google.cloud.video.stitcher.v1.ListCdnKeysResponse"<‚Óä“-+/v1/{parent=projects/*/locations/*}/cdnKeysÚAparent¡ - GetCdnKey0.google.cloud.video.stitcher.v1.GetCdnKeyRequest&.google.cloud.video.stitcher.v1.CdnKey":‚Óä“-+/v1/{name=projects/*/locations/*/cdnKeys/*}ÚAname— - DeleteCdnKey3.google.cloud.video.stitcher.v1.DeleteCdnKeyRequest.google.protobuf.Empty":‚Óä“-*+/v1/{name=projects/*/locations/*/cdnKeys/*}ÚAnameÇ - UpdateCdnKey3.google.cloud.video.stitcher.v1.UpdateCdnKeyRequest&.google.cloud.video.stitcher.v1.CdnKey"Z‚Óä“>23/v1/{cdn_key.name=projects/*/locations/*/cdnKeys/*}:cdn_keyÚAcdn_key,update_maskÒ + GetCdnKey0.google.cloud.video.stitcher.v1.GetCdnKeyRequest&.google.cloud.video.stitcher.v1.CdnKey":‚Óä“-+/v1/{name=projects/*/locations/*/cdnKeys/*}ÚAnameË + DeleteCdnKey3.google.cloud.video.stitcher.v1.DeleteCdnKeyRequest.google.longrunning.Operation"g‚Óä“-*+/v1/{name=projects/*/locations/*/cdnKeys/*}ÚAnameÊA* +google.protobuf.EmptyOperationMetadataÜ + UpdateCdnKey3.google.cloud.video.stitcher.v1.UpdateCdnKeyRequest.google.longrunning.Operation"x‚Óä“>23/v1/{cdn_key.name=projects/*/locations/*/cdnKeys/*}:cdn_keyÚAcdn_key,update_maskÊA +CdnKeyOperationMetadataÒ CreateVodSession7.google.cloud.video.stitcher.v1.CreateVodSessionRequest*.google.cloud.video.stitcher.v1.VodSession"Y‚Óä“>"//v1/{parent=projects/*/locations/*}/vodSessions: vod_sessionÚAparent,vod_session± GetVodSession4.google.cloud.video.stitcher.v1.GetVodSessionRequest*.google.cloud.video.stitcher.v1.VodSession">‚Óä“1//v1/{name=projects/*/locations/*/vodSessions/*}ÚAnameæ ListVodStitchDetails;.google.cloud.video.stitcher.v1.ListVodStitchDetailsRequest<.google.cloud.video.stitcher.v1.ListVodStitchDetailsResponse"S‚Óä“DB/v1/{parent=projects/*/locations/*/vodSessions/*}/vodStitchDetailsÚAparentÓ @@ -137,15 +173,25 @@ public static function initOnce() { ListVodAdTagDetails:.google.cloud.video.stitcher.v1.ListVodAdTagDetailsRequest;.google.cloud.video.stitcher.v1.ListVodAdTagDetailsResponse"R‚Óä“CA/v1/{parent=projects/*/locations/*/vodSessions/*}/vodAdTagDetailsÚAparentÏ GetVodAdTagDetail8.google.cloud.video.stitcher.v1.GetVodAdTagDetailRequest..google.cloud.video.stitcher.v1.VodAdTagDetail"P‚Óä“CA/v1/{name=projects/*/locations/*/vodSessions/*/vodAdTagDetails/*}ÚAnameç ListLiveAdTagDetails;.google.cloud.video.stitcher.v1.ListLiveAdTagDetailsRequest<.google.cloud.video.stitcher.v1.ListLiveAdTagDetailsResponse"T‚Óä“EC/v1/{parent=projects/*/locations/*/liveSessions/*}/liveAdTagDetailsÚAparentÔ -GetLiveAdTagDetail9.google.cloud.video.stitcher.v1.GetLiveAdTagDetailRequest/.google.cloud.video.stitcher.v1.LiveAdTagDetail"R‚Óä“EC/v1/{name=projects/*/locations/*/liveSessions/*/liveAdTagDetails/*}ÚAname» - CreateSlate2.google.cloud.video.stitcher.v1.CreateSlateRequest%.google.cloud.video.stitcher.v1.Slate"Q‚Óä“3"*/v1/{parent=projects/*/locations/*}/slates:slateÚAparent,slate,slate_id° +GetLiveAdTagDetail9.google.cloud.video.stitcher.v1.GetLiveAdTagDetailRequest/.google.cloud.video.stitcher.v1.LiveAdTagDetail"R‚Óä“EC/v1/{name=projects/*/locations/*/liveSessions/*/liveAdTagDetails/*}ÚAnameÐ + CreateSlate2.google.cloud.video.stitcher.v1.CreateSlateRequest.google.longrunning.Operation"n‚Óä“3"*/v1/{parent=projects/*/locations/*}/slates:slateÚAparent,slate,slate_idÊA +SlateOperationMetadata° ListSlates1.google.cloud.video.stitcher.v1.ListSlatesRequest2.google.cloud.video.stitcher.v1.ListSlatesResponse";‚Óä“,*/v1/{parent=projects/*/locations/*}/slatesÚAparent -GetSlate/.google.cloud.video.stitcher.v1.GetSlateRequest%.google.cloud.video.stitcher.v1.Slate"9‚Óä“,*/v1/{name=projects/*/locations/*/slates/*}ÚAname½ - UpdateSlate2.google.cloud.video.stitcher.v1.UpdateSlateRequest%.google.cloud.video.stitcher.v1.Slate"S‚Óä“920/v1/{slate.name=projects/*/locations/*/slates/*}:slateÚAslate,update_mask” - DeleteSlate2.google.cloud.video.stitcher.v1.DeleteSlateRequest.google.protobuf.Empty"9‚Óä“,**/v1/{name=projects/*/locations/*/slates/*}ÚAnameØ +GetSlate/.google.cloud.video.stitcher.v1.GetSlateRequest%.google.cloud.video.stitcher.v1.Slate"9‚Óä“,*/v1/{name=projects/*/locations/*/slates/*}ÚAnameÒ + UpdateSlate2.google.cloud.video.stitcher.v1.UpdateSlateRequest.google.longrunning.Operation"p‚Óä“920/v1/{slate.name=projects/*/locations/*/slates/*}:slateÚAslate,update_maskÊA +SlateOperationMetadataÈ + DeleteSlate2.google.cloud.video.stitcher.v1.DeleteSlateRequest.google.longrunning.Operation"f‚Óä“,**/v1/{name=projects/*/locations/*/slates/*}ÚAnameÊA* +google.protobuf.EmptyOperationMetadataØ CreateLiveSession8.google.cloud.video.stitcher.v1.CreateLiveSessionRequest+.google.cloud.video.stitcher.v1.LiveSession"\\‚Óä“@"0/v1/{parent=projects/*/locations/*}/liveSessions: live_sessionÚAparent,live_sessionµ -GetLiveSession5.google.cloud.video.stitcher.v1.GetLiveSessionRequest+.google.cloud.video.stitcher.v1.LiveSession"?‚Óä“20/v1/{name=projects/*/locations/*/liveSessions/*}ÚAnamePÊAvideostitcher.googleapis.comÒA.https://www.googleapis.com/auth/cloud-platformB +GetLiveSession5.google.cloud.video.stitcher.v1.GetLiveSessionRequest+.google.cloud.video.stitcher.v1.LiveSession"?‚Óä“20/v1/{name=projects/*/locations/*/liveSessions/*}ÚAname÷ +CreateLiveConfig7.google.cloud.video.stitcher.v1.CreateLiveConfigRequest.google.longrunning.Operation"Š‚Óä“>"//v1/{parent=projects/*/locations/*}/liveConfigs: live_configÚA!parent,live_config,live_config_idÊA + +LiveConfigOperationMetadataÄ +ListLiveConfigs6.google.cloud.video.stitcher.v1.ListLiveConfigsRequest7.google.cloud.video.stitcher.v1.ListLiveConfigsResponse"@‚Óä“1//v1/{parent=projects/*/locations/*}/liveConfigsÚAparent± + GetLiveConfig4.google.cloud.video.stitcher.v1.GetLiveConfigRequest*.google.cloud.video.stitcher.v1.LiveConfig">‚Óä“1//v1/{name=projects/*/locations/*/liveConfigs/*}ÚAname× +DeleteLiveConfig7.google.cloud.video.stitcher.v1.DeleteLiveConfigRequest.google.longrunning.Operation"k‚Óä“1*//v1/{name=projects/*/locations/*/liveConfigs/*}ÚAnameÊA* +google.protobuf.EmptyOperationMetadataPÊAvideostitcher.googleapis.comÒA.https://www.googleapis.com/auth/cloud-platformB "com.google.cloud.video.stitcher.v1BVideoStitcherServiceProtoPZ>cloud.google.com/go/video/stitcher/apiv1/stitcherpb;stitcherpbbproto3' , true); diff --git a/VideoStitcher/samples/V1/VideoStitcherServiceClient/create_cdn_key.php b/VideoStitcher/samples/V1/VideoStitcherServiceClient/create_cdn_key.php index 6bb32d3476a..be91ccc209e 100644 --- a/VideoStitcher/samples/V1/VideoStitcherServiceClient/create_cdn_key.php +++ b/VideoStitcher/samples/V1/VideoStitcherServiceClient/create_cdn_key.php @@ -24,17 +24,19 @@ // [START videostitcher_v1_generated_VideoStitcherService_CreateCdnKey_sync] use Google\ApiCore\ApiException; +use Google\ApiCore\OperationResponse; use Google\Cloud\Video\Stitcher\V1\CdnKey; use Google\Cloud\Video\Stitcher\V1\VideoStitcherServiceClient; +use Google\Rpc\Status; /** * Creates a new CDN key. * - * @param string $formattedParent The project in which the CDN key should be created, in the form of - * `projects/{project_number}/locations/{location}`. Please see + * @param string $formattedParent The project in which the CDN key should be created, in the form + * of `projects/{project_number}/locations/{location}`. Please see * {@see VideoStitcherServiceClient::locationName()} for help formatting this field. - * @param string $cdnKeyId The ID to use for the CDN key, which will become the final component of - * the CDN key's resource name. + * @param string $cdnKeyId The ID to use for the CDN key, which will become the final + * component of the CDN key's resource name. * * This value should conform to RFC-1034, which restricts to * lower-case letters, numbers, and hyphen, with the first character a @@ -50,9 +52,19 @@ function create_cdn_key_sample(string $formattedParent, string $cdnKeyId): void // Call the API and handle any network failures. try { - /** @var CdnKey $response */ + /** @var OperationResponse $response */ $response = $videoStitcherServiceClient->createCdnKey($formattedParent, $cdnKey, $cdnKeyId); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var CdnKey $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()); } diff --git a/VideoStitcher/samples/V1/VideoStitcherServiceClient/create_live_config.php b/VideoStitcher/samples/V1/VideoStitcherServiceClient/create_live_config.php new file mode 100644 index 00000000000..01620900292 --- /dev/null +++ b/VideoStitcher/samples/V1/VideoStitcherServiceClient/create_live_config.php @@ -0,0 +1,107 @@ +setSourceUri($liveConfigSourceUri) + ->setAdTracking($liveConfigAdTracking); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $videoStitcherServiceClient->createLiveConfig( + $formattedParent, + $liveConfigId, + $liveConfig + ); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var LiveConfig $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 = VideoStitcherServiceClient::locationName('[PROJECT]', '[LOCATION]'); + $liveConfigId = '[LIVE_CONFIG_ID]'; + $liveConfigSourceUri = '[SOURCE_URI]'; + $liveConfigAdTracking = AdTracking::AD_TRACKING_UNSPECIFIED; + + create_live_config_sample( + $formattedParent, + $liveConfigId, + $liveConfigSourceUri, + $liveConfigAdTracking + ); +} +// [END videostitcher_v1_generated_VideoStitcherService_CreateLiveConfig_sync] diff --git a/VideoStitcher/samples/V1/VideoStitcherServiceClient/create_live_session.php b/VideoStitcher/samples/V1/VideoStitcherServiceClient/create_live_session.php index 485ad57c830..739fb50cfe4 100644 --- a/VideoStitcher/samples/V1/VideoStitcherServiceClient/create_live_session.php +++ b/VideoStitcher/samples/V1/VideoStitcherServiceClient/create_live_session.php @@ -30,17 +30,23 @@ /** * Creates a new live session. * - * @param string $formattedParent The project and location in which the live session should be created, - * in the form of `projects/{project_number}/locations/{location}`. Please see - * {@see VideoStitcherServiceClient::liveSessionName()} for help formatting this field. + * @param string $formattedParent The project and location in which the live session should be + * created, in the form of `projects/{project_number}/locations/{location}`. Please see + * {@see VideoStitcherServiceClient::liveSessionName()} for help formatting this field. + * @param string $formattedLiveSessionLiveConfig The resource name of the live config for this session, in the + * form of `projects/{project}/locations/{location}/liveConfigs/{id}`. Please see + * {@see VideoStitcherServiceClient::liveConfigName()} for help formatting this field. */ -function create_live_session_sample(string $formattedParent): void -{ +function create_live_session_sample( + string $formattedParent, + string $formattedLiveSessionLiveConfig +): void { // Create a client. $videoStitcherServiceClient = new VideoStitcherServiceClient(); // Prepare any non-scalar elements to be passed along with the request. - $liveSession = new LiveSession(); + $liveSession = (new LiveSession()) + ->setLiveConfig($formattedLiveSessionLiveConfig); // Call the API and handle any network failures. try { @@ -68,7 +74,12 @@ function callSample(): void '[LOCATION]', '[LIVE_SESSION]' ); + $formattedLiveSessionLiveConfig = VideoStitcherServiceClient::liveConfigName( + '[PROJECT]', + '[LOCATION]', + '[LIVE_CONFIG]' + ); - create_live_session_sample($formattedParent); + create_live_session_sample($formattedParent, $formattedLiveSessionLiveConfig); } // [END videostitcher_v1_generated_VideoStitcherService_CreateLiveSession_sync] diff --git a/VideoStitcher/samples/V1/VideoStitcherServiceClient/create_slate.php b/VideoStitcher/samples/V1/VideoStitcherServiceClient/create_slate.php index 544425a97db..4d8af138aa4 100644 --- a/VideoStitcher/samples/V1/VideoStitcherServiceClient/create_slate.php +++ b/VideoStitcher/samples/V1/VideoStitcherServiceClient/create_slate.php @@ -24,14 +24,16 @@ // [START videostitcher_v1_generated_VideoStitcherService_CreateSlate_sync] use Google\ApiCore\ApiException; +use Google\ApiCore\OperationResponse; use Google\Cloud\Video\Stitcher\V1\Slate; use Google\Cloud\Video\Stitcher\V1\VideoStitcherServiceClient; +use Google\Rpc\Status; /** * Creates a slate. * * @param string $formattedParent The project in which the slate should be created, in the form of - * `projects/{project_number}`. Please see + * `projects/{project_number}/locations/{location}`. Please see * {@see VideoStitcherServiceClient::locationName()} for help formatting this field. * @param string $slateId The unique identifier for the slate. * This value should conform to RFC-1034, which restricts to @@ -48,9 +50,19 @@ function create_slate_sample(string $formattedParent, string $slateId): void // Call the API and handle any network failures. try { - /** @var Slate $response */ + /** @var OperationResponse $response */ $response = $videoStitcherServiceClient->createSlate($formattedParent, $slateId, $slate); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Slate $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()); } diff --git a/VideoStitcher/samples/V1/VideoStitcherServiceClient/create_vod_session.php b/VideoStitcher/samples/V1/VideoStitcherServiceClient/create_vod_session.php index fc1b0e5c34c..bfc8b0e8cae 100644 --- a/VideoStitcher/samples/V1/VideoStitcherServiceClient/create_vod_session.php +++ b/VideoStitcher/samples/V1/VideoStitcherServiceClient/create_vod_session.php @@ -24,6 +24,7 @@ // [START videostitcher_v1_generated_VideoStitcherService_CreateVodSession_sync] use Google\ApiCore\ApiException; +use Google\Cloud\Video\Stitcher\V1\AdTracking; use Google\Cloud\Video\Stitcher\V1\VideoStitcherServiceClient; use Google\Cloud\Video\Stitcher\V1\VodSession; @@ -31,16 +32,20 @@ * Creates a client side playback VOD session and returns the full * tracking and playback metadata of the session. * - * @param string $formattedParent The project and location in which the VOD session should be created, in the - * form of `projects/{project_number}/locations/{location}`. Please see - * {@see VideoStitcherServiceClient::locationName()} for help formatting this field. - * @param string $vodSessionSourceUri URI of the media to stitch. - * @param string $vodSessionAdTagUri Ad tag URI. + * @param string $formattedParent The project and location in which the VOD session should be + * created, in the form of `projects/{project_number}/locations/{location}`. Please see + * {@see VideoStitcherServiceClient::locationName()} for help formatting this field. + * @param string $vodSessionSourceUri URI of the media to stitch. + * @param string $vodSessionAdTagUri Ad tag URI. + * @param int $vodSessionAdTracking Determines how the ad should be tracked. If + * [gam_vod_config][google.cloud.video.stitcher.v1.VodSession.gam_vod_config] + * is set, the value must be `CLIENT` because the IMA SDK handles ad tracking. */ function create_vod_session_sample( string $formattedParent, string $vodSessionSourceUri, - string $vodSessionAdTagUri + string $vodSessionAdTagUri, + int $vodSessionAdTracking ): void { // Create a client. $videoStitcherServiceClient = new VideoStitcherServiceClient(); @@ -48,7 +53,8 @@ function create_vod_session_sample( // Prepare any non-scalar elements to be passed along with the request. $vodSession = (new VodSession()) ->setSourceUri($vodSessionSourceUri) - ->setAdTagUri($vodSessionAdTagUri); + ->setAdTagUri($vodSessionAdTagUri) + ->setAdTracking($vodSessionAdTracking); // Call the API and handle any network failures. try { @@ -74,7 +80,13 @@ function callSample(): void $formattedParent = VideoStitcherServiceClient::locationName('[PROJECT]', '[LOCATION]'); $vodSessionSourceUri = '[SOURCE_URI]'; $vodSessionAdTagUri = '[AD_TAG_URI]'; + $vodSessionAdTracking = AdTracking::AD_TRACKING_UNSPECIFIED; - create_vod_session_sample($formattedParent, $vodSessionSourceUri, $vodSessionAdTagUri); + create_vod_session_sample( + $formattedParent, + $vodSessionSourceUri, + $vodSessionAdTagUri, + $vodSessionAdTracking + ); } // [END videostitcher_v1_generated_VideoStitcherService_CreateVodSession_sync] diff --git a/VideoStitcher/samples/V1/VideoStitcherServiceClient/delete_cdn_key.php b/VideoStitcher/samples/V1/VideoStitcherServiceClient/delete_cdn_key.php index 328a2c251bc..601a8a30f1e 100644 --- a/VideoStitcher/samples/V1/VideoStitcherServiceClient/delete_cdn_key.php +++ b/VideoStitcher/samples/V1/VideoStitcherServiceClient/delete_cdn_key.php @@ -24,7 +24,9 @@ // [START videostitcher_v1_generated_VideoStitcherService_DeleteCdnKey_sync] use Google\ApiCore\ApiException; +use Google\ApiCore\OperationResponse; use Google\Cloud\Video\Stitcher\V1\VideoStitcherServiceClient; +use Google\Rpc\Status; /** * Deletes the specified CDN key. @@ -40,8 +42,17 @@ function delete_cdn_key_sample(string $formattedName): void // Call the API and handle any network failures. try { - $videoStitcherServiceClient->deleteCdnKey($formattedName); - printf('Call completed successfully.' . PHP_EOL); + /** @var OperationResponse $response */ + $response = $videoStitcherServiceClient->deleteCdnKey($formattedName); + $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()); } diff --git a/VideoStitcher/samples/V1/VideoStitcherServiceClient/delete_live_config.php b/VideoStitcher/samples/V1/VideoStitcherServiceClient/delete_live_config.php new file mode 100644 index 00000000000..2eaecda7395 --- /dev/null +++ b/VideoStitcher/samples/V1/VideoStitcherServiceClient/delete_live_config.php @@ -0,0 +1,80 @@ +deleteLiveConfig($formattedName); + $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 = VideoStitcherServiceClient::liveConfigName( + '[PROJECT]', + '[LOCATION]', + '[LIVE_CONFIG]' + ); + + delete_live_config_sample($formattedName); +} +// [END videostitcher_v1_generated_VideoStitcherService_DeleteLiveConfig_sync] diff --git a/VideoStitcher/samples/V1/VideoStitcherServiceClient/delete_slate.php b/VideoStitcher/samples/V1/VideoStitcherServiceClient/delete_slate.php index 1974846e7ba..ffe2d475f54 100644 --- a/VideoStitcher/samples/V1/VideoStitcherServiceClient/delete_slate.php +++ b/VideoStitcher/samples/V1/VideoStitcherServiceClient/delete_slate.php @@ -24,7 +24,9 @@ // [START videostitcher_v1_generated_VideoStitcherService_DeleteSlate_sync] use Google\ApiCore\ApiException; +use Google\ApiCore\OperationResponse; use Google\Cloud\Video\Stitcher\V1\VideoStitcherServiceClient; +use Google\Rpc\Status; /** * Deletes the specified slate. @@ -40,8 +42,17 @@ function delete_slate_sample(string $formattedName): void // Call the API and handle any network failures. try { - $videoStitcherServiceClient->deleteSlate($formattedName); - printf('Call completed successfully.' . PHP_EOL); + /** @var OperationResponse $response */ + $response = $videoStitcherServiceClient->deleteSlate($formattedName); + $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()); } diff --git a/VideoStitcher/samples/V1/VideoStitcherServiceClient/get_live_config.php b/VideoStitcher/samples/V1/VideoStitcherServiceClient/get_live_config.php new file mode 100644 index 00000000000..20bda5f67f4 --- /dev/null +++ b/VideoStitcher/samples/V1/VideoStitcherServiceClient/get_live_config.php @@ -0,0 +1,73 @@ +getLiveConfig($formattedName); + 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 = VideoStitcherServiceClient::liveConfigName( + '[PROJECT]', + '[LOCATION]', + '[LIVE_CONFIG]' + ); + + get_live_config_sample($formattedName); +} +// [END videostitcher_v1_generated_VideoStitcherService_GetLiveConfig_sync] diff --git a/VideoStitcher/samples/V1/VideoStitcherServiceClient/get_slate.php b/VideoStitcher/samples/V1/VideoStitcherServiceClient/get_slate.php index 67b85f68b3b..3a64f751c44 100644 --- a/VideoStitcher/samples/V1/VideoStitcherServiceClient/get_slate.php +++ b/VideoStitcher/samples/V1/VideoStitcherServiceClient/get_slate.php @@ -30,8 +30,8 @@ /** * Returns the specified slate. * - * @param string $formattedName The name of the slate to be retrieved, of the slate, in the form of - * `projects/{project_number}/locations/{location}/slates/{id}`. Please see + * @param string $formattedName The name of the slate to be retrieved, of the slate, in the form + * of `projects/{project_number}/locations/{location}/slates/{id}`. Please see * {@see VideoStitcherServiceClient::slateName()} for help formatting this field. */ function get_slate_sample(string $formattedName): void diff --git a/VideoStitcher/samples/V1/VideoStitcherServiceClient/get_vod_ad_tag_detail.php b/VideoStitcher/samples/V1/VideoStitcherServiceClient/get_vod_ad_tag_detail.php index 4b0297d67b8..d28ac6c5dfa 100644 --- a/VideoStitcher/samples/V1/VideoStitcherServiceClient/get_vod_ad_tag_detail.php +++ b/VideoStitcher/samples/V1/VideoStitcherServiceClient/get_vod_ad_tag_detail.php @@ -30,7 +30,8 @@ /** * Returns the specified ad tag detail for the specified VOD session. * - * @param string $formattedName The name of the ad tag detail for the specified VOD session, in the form of + * @param string $formattedName The name of the ad tag detail for the specified VOD session, in + * the form of * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}/vodAdTagDetails/{vod_ad_tag_detail}`. Please see * {@see VideoStitcherServiceClient::vodAdTagDetailName()} for help formatting this field. */ diff --git a/VideoStitcher/samples/V1/VideoStitcherServiceClient/get_vod_stitch_detail.php b/VideoStitcher/samples/V1/VideoStitcherServiceClient/get_vod_stitch_detail.php index 1d99b30a21f..d850e7f7034 100644 --- a/VideoStitcher/samples/V1/VideoStitcherServiceClient/get_vod_stitch_detail.php +++ b/VideoStitcher/samples/V1/VideoStitcherServiceClient/get_vod_stitch_detail.php @@ -30,7 +30,8 @@ /** * Returns the specified stitching information for the specified VOD session. * - * @param string $formattedName The name of the stitch detail in the specified VOD session, in the form of + * @param string $formattedName The name of the stitch detail in the specified VOD session, in + * the form of * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}/vodStitchDetails/{id}`. Please see * {@see VideoStitcherServiceClient::vodStitchDetailName()} for help formatting this field. */ diff --git a/VideoStitcher/samples/V1/VideoStitcherServiceClient/list_live_configs.php b/VideoStitcher/samples/V1/VideoStitcherServiceClient/list_live_configs.php new file mode 100644 index 00000000000..d0d67bc3f40 --- /dev/null +++ b/VideoStitcher/samples/V1/VideoStitcherServiceClient/list_live_configs.php @@ -0,0 +1,73 @@ +listLiveConfigs($formattedParent); + + /** @var LiveConfig $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 = VideoStitcherServiceClient::locationName('[PROJECT]', '[LOCATION]'); + + list_live_configs_sample($formattedParent); +} +// [END videostitcher_v1_generated_VideoStitcherService_ListLiveConfigs_sync] diff --git a/VideoStitcher/samples/V1/VideoStitcherServiceClient/list_slates.php b/VideoStitcher/samples/V1/VideoStitcherServiceClient/list_slates.php index 71963650fe8..fcd9bfaf9e5 100644 --- a/VideoStitcher/samples/V1/VideoStitcherServiceClient/list_slates.php +++ b/VideoStitcher/samples/V1/VideoStitcherServiceClient/list_slates.php @@ -31,7 +31,8 @@ /** * Lists all slates in the specified project and location. * - * @param string $formattedParent The project to list slates, in the form of `projects/{project_number}`. Please see + * @param string $formattedParent The project to list slates, in the form of + * `projects/{project_number}/locations/{location}`. Please see * {@see VideoStitcherServiceClient::locationName()} for help formatting this field. */ function list_slates_sample(string $formattedParent): void diff --git a/VideoStitcher/samples/V1/VideoStitcherServiceClient/list_vod_ad_tag_details.php b/VideoStitcher/samples/V1/VideoStitcherServiceClient/list_vod_ad_tag_details.php index 34520c49b2f..cf01422ed62 100644 --- a/VideoStitcher/samples/V1/VideoStitcherServiceClient/list_vod_ad_tag_details.php +++ b/VideoStitcher/samples/V1/VideoStitcherServiceClient/list_vod_ad_tag_details.php @@ -31,8 +31,8 @@ /** * Return the list of ad tag details for the specified VOD session. * - * @param string $formattedParent The VOD session which the ad tag details belong to, in the form of - * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}`. Please see + * @param string $formattedParent The VOD session which the ad tag details belong to, in the form + * of `projects/{project}/locations/{location}/vodSessions/{vod_session_id}`. Please see * {@see VideoStitcherServiceClient::vodSessionName()} for help formatting this field. */ function list_vod_ad_tag_details_sample(string $formattedParent): void diff --git a/VideoStitcher/samples/V1/VideoStitcherServiceClient/list_vod_stitch_details.php b/VideoStitcher/samples/V1/VideoStitcherServiceClient/list_vod_stitch_details.php index b71c7db5e67..6e09b474af5 100644 --- a/VideoStitcher/samples/V1/VideoStitcherServiceClient/list_vod_stitch_details.php +++ b/VideoStitcher/samples/V1/VideoStitcherServiceClient/list_vod_stitch_details.php @@ -32,8 +32,8 @@ * Returns a list of detailed stitching information of the specified VOD * session. * - * @param string $formattedParent The VOD session where the stitch details belong to, in the form of - * `projects/{project}/locations/{location}/vodSessions/{id}`. Please see + * @param string $formattedParent The VOD session where the stitch details belong to, in the form + * of `projects/{project}/locations/{location}/vodSessions/{id}`. Please see * {@see VideoStitcherServiceClient::vodSessionName()} for help formatting this field. */ function list_vod_stitch_details_sample(string $formattedParent): void diff --git a/VideoStitcher/samples/V1/VideoStitcherServiceClient/update_cdn_key.php b/VideoStitcher/samples/V1/VideoStitcherServiceClient/update_cdn_key.php index 167294d77ff..0bcdadd3bd7 100644 --- a/VideoStitcher/samples/V1/VideoStitcherServiceClient/update_cdn_key.php +++ b/VideoStitcher/samples/V1/VideoStitcherServiceClient/update_cdn_key.php @@ -24,9 +24,11 @@ // [START videostitcher_v1_generated_VideoStitcherService_UpdateCdnKey_sync] use Google\ApiCore\ApiException; +use Google\ApiCore\OperationResponse; use Google\Cloud\Video\Stitcher\V1\CdnKey; use Google\Cloud\Video\Stitcher\V1\VideoStitcherServiceClient; use Google\Protobuf\FieldMask; +use Google\Rpc\Status; /** * Updates the specified CDN key. Only update fields specified @@ -49,9 +51,19 @@ function update_cdn_key_sample(): void // Call the API and handle any network failures. try { - /** @var CdnKey $response */ + /** @var OperationResponse $response */ $response = $videoStitcherServiceClient->updateCdnKey($cdnKey, $updateMask); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var CdnKey $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()); } diff --git a/VideoStitcher/samples/V1/VideoStitcherServiceClient/update_slate.php b/VideoStitcher/samples/V1/VideoStitcherServiceClient/update_slate.php index 840205c005f..f087df9914a 100644 --- a/VideoStitcher/samples/V1/VideoStitcherServiceClient/update_slate.php +++ b/VideoStitcher/samples/V1/VideoStitcherServiceClient/update_slate.php @@ -24,9 +24,11 @@ // [START videostitcher_v1_generated_VideoStitcherService_UpdateSlate_sync] use Google\ApiCore\ApiException; +use Google\ApiCore\OperationResponse; use Google\Cloud\Video\Stitcher\V1\Slate; use Google\Cloud\Video\Stitcher\V1\VideoStitcherServiceClient; use Google\Protobuf\FieldMask; +use Google\Rpc\Status; /** * Updates the specified slate. @@ -48,9 +50,19 @@ function update_slate_sample(): void // Call the API and handle any network failures. try { - /** @var Slate $response */ + /** @var OperationResponse $response */ $response = $videoStitcherServiceClient->updateSlate($slate, $updateMask); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Slate $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()); } diff --git a/VideoStitcher/src/V1/AdTracking.php b/VideoStitcher/src/V1/AdTracking.php new file mode 100644 index 00000000000..890ba78d7b4 --- /dev/null +++ b/VideoStitcher/src/V1/AdTracking.php @@ -0,0 +1,63 @@ +google.cloud.video.stitcher.v1.AdTracking + */ +class AdTracking +{ + /** + * The ad tracking policy is not specified. + * + * Generated from protobuf enum AD_TRACKING_UNSPECIFIED = 0; + */ + const AD_TRACKING_UNSPECIFIED = 0; + /** + * Client side ad tracking is specified. The client player is expected to + * trigger playback and activity events itself. + * + * Generated from protobuf enum CLIENT = 1; + */ + const CLIENT = 1; + /** + * The Video Stitcher API will trigger playback events on behalf of + * the client player. + * + * Generated from protobuf enum SERVER = 2; + */ + const SERVER = 2; + + private static $valueToName = [ + self::AD_TRACKING_UNSPECIFIED => 'AD_TRACKING_UNSPECIFIED', + self::CLIENT => 'CLIENT', + self::SERVER => 'SERVER', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/VideoStitcher/src/V1/CreateCdnKeyRequest.php b/VideoStitcher/src/V1/CreateCdnKeyRequest.php index 31df34e5a78..4db0f15a765 100644 --- a/VideoStitcher/src/V1/CreateCdnKeyRequest.php +++ b/VideoStitcher/src/V1/CreateCdnKeyRequest.php @@ -16,8 +16,8 @@ class CreateCdnKeyRequest extends \Google\Protobuf\Internal\Message { /** - * Required. The project in which the CDN key should be created, in the form of - * `projects/{project_number}/locations/{location}`. + * Required. The project in which the CDN key should be created, in the form + * of `projects/{project_number}/locations/{location}`. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ @@ -29,8 +29,8 @@ class CreateCdnKeyRequest extends \Google\Protobuf\Internal\Message */ private $cdn_key = null; /** - * Required. The ID to use for the CDN key, which will become the final component of - * the CDN key's resource name. + * Required. The ID to use for the CDN key, which will become the final + * component of the CDN key's resource name. * This value should conform to RFC-1034, which restricts to * lower-case letters, numbers, and hyphen, with the first character a * letter, the last a letter or a number, and a 63 character maximum. @@ -46,13 +46,13 @@ class CreateCdnKeyRequest extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type string $parent - * Required. The project in which the CDN key should be created, in the form of - * `projects/{project_number}/locations/{location}`. + * Required. The project in which the CDN key should be created, in the form + * of `projects/{project_number}/locations/{location}`. * @type \Google\Cloud\Video\Stitcher\V1\CdnKey $cdn_key * Required. The CDN key resource to create. * @type string $cdn_key_id - * Required. The ID to use for the CDN key, which will become the final component of - * the CDN key's resource name. + * Required. The ID to use for the CDN key, which will become the final + * component of the CDN key's resource name. * This value should conform to RFC-1034, which restricts to * lower-case letters, numbers, and hyphen, with the first character a * letter, the last a letter or a number, and a 63 character maximum. @@ -64,8 +64,8 @@ public function __construct($data = NULL) { } /** - * Required. The project in which the CDN key should be created, in the form of - * `projects/{project_number}/locations/{location}`. + * Required. The project in which the CDN key should be created, in the form + * of `projects/{project_number}/locations/{location}`. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @return string @@ -76,8 +76,8 @@ public function getParent() } /** - * Required. The project in which the CDN key should be created, in the form of - * `projects/{project_number}/locations/{location}`. + * Required. The project in which the CDN key should be created, in the form + * of `projects/{project_number}/locations/{location}`. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @param string $var @@ -128,8 +128,8 @@ public function setCdnKey($var) } /** - * Required. The ID to use for the CDN key, which will become the final component of - * the CDN key's resource name. + * Required. The ID to use for the CDN key, which will become the final + * component of the CDN key's resource name. * This value should conform to RFC-1034, which restricts to * lower-case letters, numbers, and hyphen, with the first character a * letter, the last a letter or a number, and a 63 character maximum. @@ -143,8 +143,8 @@ public function getCdnKeyId() } /** - * Required. The ID to use for the CDN key, which will become the final component of - * the CDN key's resource name. + * Required. The ID to use for the CDN key, which will become the final + * component of the CDN key's resource name. * This value should conform to RFC-1034, which restricts to * lower-case letters, numbers, and hyphen, with the first character a * letter, the last a letter or a number, and a 63 character maximum. diff --git a/VideoStitcher/src/V1/CreateLiveConfigRequest.php b/VideoStitcher/src/V1/CreateLiveConfigRequest.php new file mode 100644 index 00000000000..388981f3c10 --- /dev/null +++ b/VideoStitcher/src/V1/CreateLiveConfigRequest.php @@ -0,0 +1,223 @@ +google.cloud.video.stitcher.v1.CreateLiveConfigRequest + */ +class CreateLiveConfigRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project in which the live config should be created, in + * the form of `projects/{project_number}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $parent = ''; + /** + * Required. The unique identifier ID to use for the live config. + * + * Generated from protobuf field string live_config_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $live_config_id = ''; + /** + * Required. The live config resource to create. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveConfig live_config = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + private $live_config = null; + /** + * 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)`. + * + * Generated from protobuf field string request_id = 4; + */ + private $request_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project in which the live config should be created, in + * the form of `projects/{project_number}/locations/{location}`. + * @type string $live_config_id + * Required. The unique identifier ID to use for the live config. + * @type \Google\Cloud\Video\Stitcher\V1\LiveConfig $live_config + * Required. The live config resource to create. + * @type string $request_id + * 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)`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\VideoStitcherService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project in which the live config should be created, in + * the form of `projects/{project_number}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The project in which the live config should be created, in + * the form of `projects/{project_number}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The unique identifier ID to use for the live config. + * + * Generated from protobuf field string live_config_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getLiveConfigId() + { + return $this->live_config_id; + } + + /** + * Required. The unique identifier ID to use for the live config. + * + * Generated from protobuf field string live_config_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setLiveConfigId($var) + { + GPBUtil::checkString($var, True); + $this->live_config_id = $var; + + return $this; + } + + /** + * Required. The live config resource to create. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveConfig live_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Video\Stitcher\V1\LiveConfig|null + */ + public function getLiveConfig() + { + return $this->live_config; + } + + public function hasLiveConfig() + { + return isset($this->live_config); + } + + public function clearLiveConfig() + { + unset($this->live_config); + } + + /** + * Required. The live config resource to create. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveConfig live_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Video\Stitcher\V1\LiveConfig $var + * @return $this + */ + public function setLiveConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Stitcher\V1\LiveConfig::class); + $this->live_config = $var; + + return $this; + } + + /** + * 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)`. + * + * Generated from protobuf field string request_id = 4; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * 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)`. + * + * Generated from protobuf field string request_id = 4; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/VideoStitcher/src/V1/CreateLiveSessionRequest.php b/VideoStitcher/src/V1/CreateLiveSessionRequest.php index eb0714ce5eb..02288496263 100644 --- a/VideoStitcher/src/V1/CreateLiveSessionRequest.php +++ b/VideoStitcher/src/V1/CreateLiveSessionRequest.php @@ -16,8 +16,8 @@ class CreateLiveSessionRequest extends \Google\Protobuf\Internal\Message { /** - * Required. The project and location in which the live session should be created, - * in the form of `projects/{project_number}/locations/{location}`. + * Required. The project and location in which the live session should be + * created, in the form of `projects/{project_number}/locations/{location}`. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ @@ -36,8 +36,8 @@ class CreateLiveSessionRequest extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type string $parent - * Required. The project and location in which the live session should be created, - * in the form of `projects/{project_number}/locations/{location}`. + * Required. The project and location in which the live session should be + * created, in the form of `projects/{project_number}/locations/{location}`. * @type \Google\Cloud\Video\Stitcher\V1\LiveSession $live_session * Required. Parameters for creating a live session. * } @@ -48,8 +48,8 @@ public function __construct($data = NULL) { } /** - * Required. The project and location in which the live session should be created, - * in the form of `projects/{project_number}/locations/{location}`. + * Required. The project and location in which the live session should be + * created, in the form of `projects/{project_number}/locations/{location}`. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @return string @@ -60,8 +60,8 @@ public function getParent() } /** - * Required. The project and location in which the live session should be created, - * in the form of `projects/{project_number}/locations/{location}`. + * Required. The project and location in which the live session should be + * created, in the form of `projects/{project_number}/locations/{location}`. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @param string $var diff --git a/VideoStitcher/src/V1/CreateSlateRequest.php b/VideoStitcher/src/V1/CreateSlateRequest.php index d89a4e1d42b..7390a6cb510 100644 --- a/VideoStitcher/src/V1/CreateSlateRequest.php +++ b/VideoStitcher/src/V1/CreateSlateRequest.php @@ -17,7 +17,7 @@ class CreateSlateRequest extends \Google\Protobuf\Internal\Message { /** * Required. The project in which the slate should be created, in the form of - * `projects/{project_number}`. + * `projects/{project_number}/locations/{location}`. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ @@ -37,6 +37,22 @@ class CreateSlateRequest extends \Google\Protobuf\Internal\Message * Generated from protobuf field .google.cloud.video.stitcher.v1.Slate slate = 3 [(.google.api.field_behavior) = REQUIRED]; */ private $slate = null; + /** + * 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)`. + * + * Generated from protobuf field string request_id = 4; + */ + private $request_id = ''; /** * Constructor. @@ -46,7 +62,7 @@ class CreateSlateRequest extends \Google\Protobuf\Internal\Message * * @type string $parent * Required. The project in which the slate should be created, in the form of - * `projects/{project_number}`. + * `projects/{project_number}/locations/{location}`. * @type string $slate_id * Required. The unique identifier for the slate. * This value should conform to RFC-1034, which restricts to @@ -54,6 +70,18 @@ class CreateSlateRequest extends \Google\Protobuf\Internal\Message * letter, the last a letter or a number, and a 63 character maximum. * @type \Google\Cloud\Video\Stitcher\V1\Slate $slate * Required. The slate to create. + * @type string $request_id + * 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)`. * } */ public function __construct($data = NULL) { @@ -63,7 +91,7 @@ public function __construct($data = NULL) { /** * Required. The project in which the slate should be created, in the form of - * `projects/{project_number}`. + * `projects/{project_number}/locations/{location}`. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @return string @@ -75,7 +103,7 @@ public function getParent() /** * Required. The project in which the slate should be created, in the form of - * `projects/{project_number}`. + * `projects/{project_number}/locations/{location}`. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @param string $var @@ -157,5 +185,51 @@ public function setSlate($var) return $this; } + /** + * 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)`. + * + * Generated from protobuf field string request_id = 4; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * 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)`. + * + * Generated from protobuf field string request_id = 4; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + } diff --git a/VideoStitcher/src/V1/CreateVodSessionRequest.php b/VideoStitcher/src/V1/CreateVodSessionRequest.php index a3ab0dad7a8..da245761764 100644 --- a/VideoStitcher/src/V1/CreateVodSessionRequest.php +++ b/VideoStitcher/src/V1/CreateVodSessionRequest.php @@ -16,8 +16,8 @@ class CreateVodSessionRequest extends \Google\Protobuf\Internal\Message { /** - * Required. The project and location in which the VOD session should be created, in the - * form of `projects/{project_number}/locations/{location}`. + * Required. The project and location in which the VOD session should be + * created, in the form of `projects/{project_number}/locations/{location}`. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ @@ -36,8 +36,8 @@ class CreateVodSessionRequest extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type string $parent - * Required. The project and location in which the VOD session should be created, in the - * form of `projects/{project_number}/locations/{location}`. + * Required. The project and location in which the VOD session should be + * created, in the form of `projects/{project_number}/locations/{location}`. * @type \Google\Cloud\Video\Stitcher\V1\VodSession $vod_session * Required. Parameters for creating a session. * } @@ -48,8 +48,8 @@ public function __construct($data = NULL) { } /** - * Required. The project and location in which the VOD session should be created, in the - * form of `projects/{project_number}/locations/{location}`. + * Required. The project and location in which the VOD session should be + * created, in the form of `projects/{project_number}/locations/{location}`. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @return string @@ -60,8 +60,8 @@ public function getParent() } /** - * Required. The project and location in which the VOD session should be created, in the - * form of `projects/{project_number}/locations/{location}`. + * Required. The project and location in which the VOD session should be + * created, in the form of `projects/{project_number}/locations/{location}`. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @param string $var diff --git a/VideoStitcher/src/V1/DeleteLiveConfigRequest.php b/VideoStitcher/src/V1/DeleteLiveConfigRequest.php new file mode 100644 index 00000000000..c8ee068204b --- /dev/null +++ b/VideoStitcher/src/V1/DeleteLiveConfigRequest.php @@ -0,0 +1,71 @@ +google.cloud.video.stitcher.v1.DeleteLiveConfigRequest + */ +class DeleteLiveConfigRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the live config to be deleted, in the form of + * `projects/{project_number}/locations/{location}/liveConfigs/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the live config to be deleted, in the form of + * `projects/{project_number}/locations/{location}/liveConfigs/{id}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\VideoStitcherService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the live config to be deleted, in the form of + * `projects/{project_number}/locations/{location}/liveConfigs/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the live config to be deleted, in the form of + * `projects/{project_number}/locations/{location}/liveConfigs/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/VideoStitcher/src/V1/GamLiveConfig.php b/VideoStitcher/src/V1/GamLiveConfig.php new file mode 100644 index 00000000000..12471c8f5d5 --- /dev/null +++ b/VideoStitcher/src/V1/GamLiveConfig.php @@ -0,0 +1,135 @@ +google.cloud.video.stitcher.v1.GamLiveConfig + */ +class GamLiveConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Ad Manager network code to associate with the live config. + * + * Generated from protobuf field string network_code = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $network_code = ''; + /** + * Output only. The asset key identifier generated for the live config. + * + * Generated from protobuf field string asset_key = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $asset_key = ''; + /** + * Output only. The custom asset key identifier generated for the live config. + * + * Generated from protobuf field string custom_asset_key = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $custom_asset_key = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $network_code + * Required. Ad Manager network code to associate with the live config. + * @type string $asset_key + * Output only. The asset key identifier generated for the live config. + * @type string $custom_asset_key + * Output only. The custom asset key identifier generated for the live config. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\LiveConfigs::initOnce(); + parent::__construct($data); + } + + /** + * Required. Ad Manager network code to associate with the live config. + * + * Generated from protobuf field string network_code = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getNetworkCode() + { + return $this->network_code; + } + + /** + * Required. Ad Manager network code to associate with the live config. + * + * Generated from protobuf field string network_code = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setNetworkCode($var) + { + GPBUtil::checkString($var, True); + $this->network_code = $var; + + return $this; + } + + /** + * Output only. The asset key identifier generated for the live config. + * + * Generated from protobuf field string asset_key = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getAssetKey() + { + return $this->asset_key; + } + + /** + * Output only. The asset key identifier generated for the live config. + * + * Generated from protobuf field string asset_key = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setAssetKey($var) + { + GPBUtil::checkString($var, True); + $this->asset_key = $var; + + return $this; + } + + /** + * Output only. The custom asset key identifier generated for the live config. + * + * Generated from protobuf field string custom_asset_key = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getCustomAssetKey() + { + return $this->custom_asset_key; + } + + /** + * Output only. The custom asset key identifier generated for the live config. + * + * Generated from protobuf field string custom_asset_key = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setCustomAssetKey($var) + { + GPBUtil::checkString($var, True); + $this->custom_asset_key = $var; + + return $this; + } + +} + diff --git a/VideoStitcher/src/V1/GamVodConfig.php b/VideoStitcher/src/V1/GamVodConfig.php new file mode 100644 index 00000000000..c08a53f96ae --- /dev/null +++ b/VideoStitcher/src/V1/GamVodConfig.php @@ -0,0 +1,101 @@ +google.cloud.video.stitcher.v1.GamVodConfig + */ +class GamVodConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Ad Manager network code. + * + * Generated from protobuf field string network_code = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $network_code = ''; + /** + * Required. The stream ID generated by Ad Manager. + * + * Generated from protobuf field string stream_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $stream_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $network_code + * Required. Ad Manager network code. + * @type string $stream_id + * Required. The stream ID generated by Ad Manager. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\Sessions::initOnce(); + parent::__construct($data); + } + + /** + * Required. Ad Manager network code. + * + * Generated from protobuf field string network_code = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getNetworkCode() + { + return $this->network_code; + } + + /** + * Required. Ad Manager network code. + * + * Generated from protobuf field string network_code = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setNetworkCode($var) + { + GPBUtil::checkString($var, True); + $this->network_code = $var; + + return $this; + } + + /** + * Required. The stream ID generated by Ad Manager. + * + * Generated from protobuf field string stream_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getStreamId() + { + return $this->stream_id; + } + + /** + * Required. The stream ID generated by Ad Manager. + * + * Generated from protobuf field string stream_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setStreamId($var) + { + GPBUtil::checkString($var, True); + $this->stream_id = $var; + + return $this; + } + +} + diff --git a/VideoStitcher/src/V1/Gapic/VideoStitcherServiceGapicClient.php b/VideoStitcher/src/V1/Gapic/VideoStitcherServiceGapicClient.php index c321ac52e8a..3e0f7cee21d 100644 --- a/VideoStitcher/src/V1/Gapic/VideoStitcherServiceGapicClient.php +++ b/VideoStitcher/src/V1/Gapic/VideoStitcherServiceGapicClient.php @@ -27,6 +27,8 @@ use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; use Google\ApiCore\GapicClientTrait; +use Google\ApiCore\LongRunning\OperationsClient; +use Google\ApiCore\OperationResponse; use Google\ApiCore\PathTemplate; use Google\ApiCore\RequestParamsHeaderDescriptor; use Google\ApiCore\RetrySettings; @@ -35,13 +37,16 @@ use Google\Auth\FetchAuthTokenInterface; use Google\Cloud\Video\Stitcher\V1\CdnKey; use Google\Cloud\Video\Stitcher\V1\CreateCdnKeyRequest; +use Google\Cloud\Video\Stitcher\V1\CreateLiveConfigRequest; use Google\Cloud\Video\Stitcher\V1\CreateLiveSessionRequest; use Google\Cloud\Video\Stitcher\V1\CreateSlateRequest; use Google\Cloud\Video\Stitcher\V1\CreateVodSessionRequest; use Google\Cloud\Video\Stitcher\V1\DeleteCdnKeyRequest; +use Google\Cloud\Video\Stitcher\V1\DeleteLiveConfigRequest; use Google\Cloud\Video\Stitcher\V1\DeleteSlateRequest; use Google\Cloud\Video\Stitcher\V1\GetCdnKeyRequest; use Google\Cloud\Video\Stitcher\V1\GetLiveAdTagDetailRequest; +use Google\Cloud\Video\Stitcher\V1\GetLiveConfigRequest; use Google\Cloud\Video\Stitcher\V1\GetLiveSessionRequest; use Google\Cloud\Video\Stitcher\V1\GetSlateRequest; use Google\Cloud\Video\Stitcher\V1\GetVodAdTagDetailRequest; @@ -51,6 +56,8 @@ use Google\Cloud\Video\Stitcher\V1\ListCdnKeysResponse; use Google\Cloud\Video\Stitcher\V1\ListLiveAdTagDetailsRequest; use Google\Cloud\Video\Stitcher\V1\ListLiveAdTagDetailsResponse; +use Google\Cloud\Video\Stitcher\V1\ListLiveConfigsRequest; +use Google\Cloud\Video\Stitcher\V1\ListLiveConfigsResponse; use Google\Cloud\Video\Stitcher\V1\ListSlatesRequest; use Google\Cloud\Video\Stitcher\V1\ListSlatesResponse; use Google\Cloud\Video\Stitcher\V1\ListVodAdTagDetailsRequest; @@ -58,6 +65,7 @@ use Google\Cloud\Video\Stitcher\V1\ListVodStitchDetailsRequest; use Google\Cloud\Video\Stitcher\V1\ListVodStitchDetailsResponse; use Google\Cloud\Video\Stitcher\V1\LiveAdTagDetail; +use Google\Cloud\Video\Stitcher\V1\LiveConfig; use Google\Cloud\Video\Stitcher\V1\LiveSession; use Google\Cloud\Video\Stitcher\V1\Slate; use Google\Cloud\Video\Stitcher\V1\UpdateCdnKeyRequest; @@ -65,8 +73,8 @@ use Google\Cloud\Video\Stitcher\V1\VodAdTagDetail; use Google\Cloud\Video\Stitcher\V1\VodSession; use Google\Cloud\Video\Stitcher\V1\VodStitchDetail; +use Google\LongRunning\Operation; use Google\Protobuf\FieldMask; -use Google\Protobuf\GPBEmpty; /** * Service Description: Video-On-Demand content stitching API allows you to insert ads @@ -84,7 +92,32 @@ * $formattedParent = $videoStitcherServiceClient->locationName('[PROJECT]', '[LOCATION]'); * $cdnKey = new CdnKey(); * $cdnKeyId = 'cdn_key_id'; - * $response = $videoStitcherServiceClient->createCdnKey($formattedParent, $cdnKey, $cdnKeyId); + * $operationResponse = $videoStitcherServiceClient->createCdnKey($formattedParent, $cdnKey, $cdnKeyId); + * $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 = $videoStitcherServiceClient->createCdnKey($formattedParent, $cdnKey, $cdnKeyId); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $videoStitcherServiceClient->resumeOperation($operationName, 'createCdnKey'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } * } finally { * $videoStitcherServiceClient->close(); * } @@ -120,6 +153,8 @@ class VideoStitcherServiceGapicClient private static $liveAdTagDetailNameTemplate; + private static $liveConfigNameTemplate; + private static $liveSessionNameTemplate; private static $locationNameTemplate; @@ -134,6 +169,8 @@ class VideoStitcherServiceGapicClient private static $pathTemplateMap; + private $operationsClient; + private static function getClientDefaults() { return [ @@ -184,6 +221,17 @@ private static function getLiveAdTagDetailNameTemplate() return self::$liveAdTagDetailNameTemplate; } + private static function getLiveConfigNameTemplate() + { + if (self::$liveConfigNameTemplate == null) { + self::$liveConfigNameTemplate = new PathTemplate( + 'projects/{project}/locations/{location}/liveConfigs/{live_config}' + ); + } + + return self::$liveConfigNameTemplate; + } + private static function getLiveSessionNameTemplate() { if (self::$liveSessionNameTemplate == null) { @@ -256,6 +304,7 @@ private static function getPathTemplateMap() self::$pathTemplateMap = [ 'cdnKey' => self::getCdnKeyNameTemplate(), 'liveAdTagDetail' => self::getLiveAdTagDetailNameTemplate(), + 'liveConfig' => self::getLiveConfigNameTemplate(), 'liveSession' => self::getLiveSessionNameTemplate(), 'location' => self::getLocationNameTemplate(), 'slate' => self::getSlateNameTemplate(), @@ -312,6 +361,25 @@ public static function liveAdTagDetailName( ]); } + /** + * Formats a string containing the fully-qualified path to represent a live_config + * resource. + * + * @param string $project + * @param string $location + * @param string $liveConfig + * + * @return string The formatted live_config resource. + */ + public static function liveConfigName($project, $location, $liveConfig) + { + return self::getLiveConfigNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'live_config' => $liveConfig, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a live_session * resource. @@ -442,6 +510,7 @@ public static function vodStitchDetailName( * Template: Pattern * - cdnKey: projects/{project}/locations/{location}/cdnKeys/{cdn_key} * - liveAdTagDetail: projects/{project}/locations/{location}/liveSessions/{live_session}/liveAdTagDetails/{live_ad_tag_detail} + * - liveConfig: projects/{project}/locations/{location}/liveConfigs/{live_config} * - liveSession: projects/{project}/locations/{location}/liveSessions/{live_session} * - location: projects/{project}/locations/{location} * - slate: projects/{project}/locations/{location}/slates/{slate} @@ -488,6 +557,41 @@ public static function parseName($formattedName, $template = null) ); } + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + */ + public function getOperationsClient() + { + return $this->operationsClient; + } + + /** + * 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. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + */ + public function resumeOperation($operationName, $methodName = null) + { + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : []; + $operation = new OperationResponse( + $operationName, + $this->getOperationsClient(), + $options + ); + $operation->reload(); + return $operation; + } + /** * Constructor. * @@ -546,6 +650,7 @@ public function __construct(array $options = []) { $clientOptions = $this->buildClientOptions($options); $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); } /** @@ -558,17 +663,42 @@ public function __construct(array $options = []) * $formattedParent = $videoStitcherServiceClient->locationName('[PROJECT]', '[LOCATION]'); * $cdnKey = new CdnKey(); * $cdnKeyId = 'cdn_key_id'; - * $response = $videoStitcherServiceClient->createCdnKey($formattedParent, $cdnKey, $cdnKeyId); + * $operationResponse = $videoStitcherServiceClient->createCdnKey($formattedParent, $cdnKey, $cdnKeyId); + * $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 = $videoStitcherServiceClient->createCdnKey($formattedParent, $cdnKey, $cdnKeyId); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $videoStitcherServiceClient->resumeOperation($operationName, 'createCdnKey'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } * } finally { * $videoStitcherServiceClient->close(); * } * ``` * - * @param string $parent Required. The project in which the CDN key should be created, in the form of - * `projects/{project_number}/locations/{location}`. + * @param string $parent Required. The project in which the CDN key should be created, in the form + * of `projects/{project_number}/locations/{location}`. * @param CdnKey $cdnKey Required. The CDN key resource to create. - * @param string $cdnKeyId Required. The ID to use for the CDN key, which will become the final component of - * the CDN key's resource name. + * @param string $cdnKeyId Required. The ID to use for the CDN key, which will become the final + * component of the CDN key's resource name. * * This value should conform to RFC-1034, which restricts to * lower-case letters, numbers, and hyphen, with the first character a @@ -582,7 +712,7 @@ public function __construct(array $options = []) * {@see RetrySettings} for example usage. * } * - * @return \Google\Cloud\Video\Stitcher\V1\CdnKey + * @return \Google\ApiCore\OperationResponse * * @throws ApiException if the remote call fails */ @@ -604,11 +734,114 @@ public function createCdnKey( $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall( + return $this->startOperationsCall( 'CreateCdnKey', - CdnKey::class, $optionalArgs, - $request + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Registers the live config with the provided unique ID in + * the specified region. + * + * Sample code: + * ``` + * $videoStitcherServiceClient = new VideoStitcherServiceClient(); + * try { + * $formattedParent = $videoStitcherServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $liveConfigId = 'live_config_id'; + * $liveConfig = new LiveConfig(); + * $operationResponse = $videoStitcherServiceClient->createLiveConfig($formattedParent, $liveConfigId, $liveConfig); + * $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 = $videoStitcherServiceClient->createLiveConfig($formattedParent, $liveConfigId, $liveConfig); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $videoStitcherServiceClient->resumeOperation($operationName, 'createLiveConfig'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $videoStitcherServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The project in which the live config should be created, in + * the form of `projects/{project_number}/locations/{location}`. + * @param string $liveConfigId Required. The unique identifier ID to use for the live config. + * @param LiveConfig $liveConfig Required. The live config resource to create. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * 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)`. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createLiveConfig( + $parent, + $liveConfigId, + $liveConfig, + array $optionalArgs = [] + ) { + $request = new CreateLiveConfigRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setLiveConfigId($liveConfigId); + $request->setLiveConfig($liveConfig); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startOperationsCall( + 'CreateLiveConfig', + $optionalArgs, + $request, + $this->getOperationsClient() )->wait(); } @@ -627,8 +860,8 @@ public function createCdnKey( * } * ``` * - * @param string $parent Required. The project and location in which the live session should be created, - * in the form of `projects/{project_number}/locations/{location}`. + * @param string $parent Required. The project and location in which the live session should be + * created, in the form of `projects/{project_number}/locations/{location}`. * @param LiveSession $liveSession Required. Parameters for creating a live session. * @param array $optionalArgs { * Optional. @@ -677,14 +910,39 @@ public function createLiveSession( * $formattedParent = $videoStitcherServiceClient->locationName('[PROJECT]', '[LOCATION]'); * $slateId = 'slate_id'; * $slate = new Slate(); - * $response = $videoStitcherServiceClient->createSlate($formattedParent, $slateId, $slate); + * $operationResponse = $videoStitcherServiceClient->createSlate($formattedParent, $slateId, $slate); + * $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 = $videoStitcherServiceClient->createSlate($formattedParent, $slateId, $slate); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $videoStitcherServiceClient->resumeOperation($operationName, 'createSlate'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } * } finally { * $videoStitcherServiceClient->close(); * } * ``` * * @param string $parent Required. The project in which the slate should be created, in the form of - * `projects/{project_number}`. + * `projects/{project_number}/locations/{location}`. * @param string $slateId Required. The unique identifier for the slate. * This value should conform to RFC-1034, which restricts to * lower-case letters, numbers, and hyphen, with the first character a @@ -693,13 +951,27 @@ public function createLiveSession( * @param array $optionalArgs { * Optional. * + * @type string $requestId + * 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)`. * @type RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an * associative array of retry settings parameters. See the documentation on * {@see RetrySettings} for example usage. * } * - * @return \Google\Cloud\Video\Stitcher\V1\Slate + * @return \Google\ApiCore\OperationResponse * * @throws ApiException if the remote call fails */ @@ -715,17 +987,21 @@ public function createSlate( $request->setSlateId($slateId); $request->setSlate($slate); $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + $requestParams = new RequestParamsHeaderDescriptor( $requestParamHeaders ); $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall( + return $this->startOperationsCall( 'CreateSlate', - Slate::class, $optionalArgs, - $request + $request, + $this->getOperationsClient() )->wait(); } @@ -745,8 +1021,8 @@ public function createSlate( * } * ``` * - * @param string $parent Required. The project and location in which the VOD session should be created, in the - * form of `projects/{project_number}/locations/{location}`. + * @param string $parent Required. The project and location in which the VOD session should be + * created, in the form of `projects/{project_number}/locations/{location}`. * @param VodSession $vodSession Required. Parameters for creating a session. * @param array $optionalArgs { * Optional. @@ -793,7 +1069,30 @@ public function createVodSession( * $videoStitcherServiceClient = new VideoStitcherServiceClient(); * try { * $formattedName = $videoStitcherServiceClient->cdnKeyName('[PROJECT]', '[LOCATION]', '[CDN_KEY]'); - * $videoStitcherServiceClient->deleteCdnKey($formattedName); + * $operationResponse = $videoStitcherServiceClient->deleteCdnKey($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $videoStitcherServiceClient->deleteCdnKey($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $videoStitcherServiceClient->resumeOperation($operationName, 'deleteCdnKey'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } * } finally { * $videoStitcherServiceClient->close(); * } @@ -810,6 +1109,8 @@ public function createVodSession( * {@see RetrySettings} for example usage. * } * + * @return \Google\ApiCore\OperationResponse + * * @throws ApiException if the remote call fails */ public function deleteCdnKey($name, array $optionalArgs = []) @@ -824,11 +1125,83 @@ public function deleteCdnKey($name, array $optionalArgs = []) $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall( + return $this->startOperationsCall( 'DeleteCdnKey', - GPBEmpty::class, $optionalArgs, - $request + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Deletes the specified live config. + * + * Sample code: + * ``` + * $videoStitcherServiceClient = new VideoStitcherServiceClient(); + * try { + * $formattedName = $videoStitcherServiceClient->liveConfigName('[PROJECT]', '[LOCATION]', '[LIVE_CONFIG]'); + * $operationResponse = $videoStitcherServiceClient->deleteLiveConfig($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $videoStitcherServiceClient->deleteLiveConfig($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $videoStitcherServiceClient->resumeOperation($operationName, 'deleteLiveConfig'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $videoStitcherServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the live config to be deleted, in the form of + * `projects/{project_number}/locations/{location}/liveConfigs/{id}`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deleteLiveConfig($name, array $optionalArgs = []) + { + $request = new DeleteLiveConfigRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startOperationsCall( + 'DeleteLiveConfig', + $optionalArgs, + $request, + $this->getOperationsClient() )->wait(); } @@ -840,7 +1213,30 @@ public function deleteCdnKey($name, array $optionalArgs = []) * $videoStitcherServiceClient = new VideoStitcherServiceClient(); * try { * $formattedName = $videoStitcherServiceClient->slateName('[PROJECT]', '[LOCATION]', '[SLATE]'); - * $videoStitcherServiceClient->deleteSlate($formattedName); + * $operationResponse = $videoStitcherServiceClient->deleteSlate($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $videoStitcherServiceClient->deleteSlate($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $videoStitcherServiceClient->resumeOperation($operationName, 'deleteSlate'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } * } finally { * $videoStitcherServiceClient->close(); * } @@ -857,6 +1253,8 @@ public function deleteCdnKey($name, array $optionalArgs = []) * {@see RetrySettings} for example usage. * } * + * @return \Google\ApiCore\OperationResponse + * * @throws ApiException if the remote call fails */ public function deleteSlate($name, array $optionalArgs = []) @@ -871,11 +1269,11 @@ public function deleteSlate($name, array $optionalArgs = []) $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall( + return $this->startOperationsCall( 'DeleteSlate', - GPBEmpty::class, $optionalArgs, - $request + $request, + $this->getOperationsClient() )->wait(); } @@ -977,6 +1375,57 @@ public function getLiveAdTagDetail($name, array $optionalArgs = []) )->wait(); } + /** + * Returns the specified live config managed by the Video + * Stitcher service. + * + * Sample code: + * ``` + * $videoStitcherServiceClient = new VideoStitcherServiceClient(); + * try { + * $formattedName = $videoStitcherServiceClient->liveConfigName('[PROJECT]', '[LOCATION]', '[LIVE_CONFIG]'); + * $response = $videoStitcherServiceClient->getLiveConfig($formattedName); + * } finally { + * $videoStitcherServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the live config to be retrieved, in the form + * of + * `projects/{project_number}/locations/{location}/liveConfigs/{id}`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Video\Stitcher\V1\LiveConfig + * + * @throws ApiException if the remote call fails + */ + public function getLiveConfig($name, array $optionalArgs = []) + { + $request = new GetLiveConfigRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( + 'GetLiveConfig', + LiveConfig::class, + $optionalArgs, + $request + )->wait(); + } + /** * Returns the details for the specified live session. * @@ -1040,8 +1489,8 @@ public function getLiveSession($name, array $optionalArgs = []) * } * ``` * - * @param string $name Required. The name of the slate to be retrieved, of the slate, in the form of - * `projects/{project_number}/locations/{location}/slates/{id}`. + * @param string $name Required. The name of the slate to be retrieved, of the slate, in the form + * of `projects/{project_number}/locations/{location}/slates/{id}`. * @param array $optionalArgs { * Optional. * @@ -1089,7 +1538,8 @@ public function getSlate($name, array $optionalArgs = []) * } * ``` * - * @param string $name Required. The name of the ad tag detail for the specified VOD session, in the form of + * @param string $name Required. The name of the ad tag detail for the specified VOD session, in + * the form of * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}/vodAdTagDetails/{vod_ad_tag_detail}`. * @param array $optionalArgs { * Optional. @@ -1188,7 +1638,8 @@ public function getVodSession($name, array $optionalArgs = []) * } * ``` * - * @param string $name Required. The name of the stitch detail in the specified VOD session, in the form of + * @param string $name Required. The name of the stitch detail in the specified VOD session, in + * the form of * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}/vodStitchDetails/{id}`. * @param array $optionalArgs { * Optional. @@ -1391,6 +1842,100 @@ public function listLiveAdTagDetails($parent, array $optionalArgs = []) ); } + /** + * Lists all live configs managed by the Video Stitcher that + * belong to the specified project and region. + * + * Sample code: + * ``` + * $videoStitcherServiceClient = new VideoStitcherServiceClient(); + * try { + * $formattedParent = $videoStitcherServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $videoStitcherServiceClient->listLiveConfigs($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $videoStitcherServiceClient->listLiveConfigs($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $videoStitcherServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The project that contains the list of live configs, in the + * form of `projects/{project_number}/locations/{location}`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * 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. + * @type string $pageToken + * 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. + * @type string $filter + * Optional. The filter to apply to list results (see + * [Filtering](https://google.aip.dev/160)). + * @type string $orderBy + * Optional. Specifies the ordering of results following + * [Cloud API + * syntax](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listLiveConfigs($parent, array $optionalArgs = []) + { + $request = new ListLiveConfigsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->getPagedListResponse( + 'ListLiveConfigs', + $optionalArgs, + ListLiveConfigsResponse::class, + $request + ); + } + /** * Lists all slates in the specified project and location. * @@ -1417,7 +1962,8 @@ public function listLiveAdTagDetails($parent, array $optionalArgs = []) * } * ``` * - * @param string $parent Required. The project to list slates, in the form of `projects/{project_number}`. + * @param string $parent Required. The project to list slates, in the form of + * `projects/{project_number}/locations/{location}`. * @param array $optionalArgs { * Optional. * @@ -1506,8 +2052,8 @@ public function listSlates($parent, array $optionalArgs = []) * } * ``` * - * @param string $parent Required. The VOD session which the ad tag details belong to, in the form of - * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}`. + * @param string $parent Required. The VOD session which the ad tag details belong to, in the form + * of `projects/{project}/locations/{location}/vodSessions/{vod_session_id}`. * @param array $optionalArgs { * Optional. * @@ -1585,8 +2131,8 @@ public function listVodAdTagDetails($parent, array $optionalArgs = []) * } * ``` * - * @param string $parent Required. The VOD session where the stitch details belong to, in the form of - * `projects/{project}/locations/{location}/vodSessions/{id}`. + * @param string $parent Required. The VOD session where the stitch details belong to, in the form + * of `projects/{project}/locations/{location}/vodSessions/{id}`. * @param array $optionalArgs { * Optional. * @@ -1647,7 +2193,32 @@ public function listVodStitchDetails($parent, array $optionalArgs = []) * try { * $cdnKey = new CdnKey(); * $updateMask = new FieldMask(); - * $response = $videoStitcherServiceClient->updateCdnKey($cdnKey, $updateMask); + * $operationResponse = $videoStitcherServiceClient->updateCdnKey($cdnKey, $updateMask); + * $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 = $videoStitcherServiceClient->updateCdnKey($cdnKey, $updateMask); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $videoStitcherServiceClient->resumeOperation($operationName, 'updateCdnKey'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } * } finally { * $videoStitcherServiceClient->close(); * } @@ -1666,7 +2237,7 @@ public function listVodStitchDetails($parent, array $optionalArgs = []) * {@see RetrySettings} for example usage. * } * - * @return \Google\Cloud\Video\Stitcher\V1\CdnKey + * @return \Google\ApiCore\OperationResponse * * @throws ApiException if the remote call fails */ @@ -1683,11 +2254,11 @@ public function updateCdnKey($cdnKey, $updateMask, array $optionalArgs = []) $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall( + return $this->startOperationsCall( 'UpdateCdnKey', - CdnKey::class, $optionalArgs, - $request + $request, + $this->getOperationsClient() )->wait(); } @@ -1700,7 +2271,32 @@ public function updateCdnKey($cdnKey, $updateMask, array $optionalArgs = []) * try { * $slate = new Slate(); * $updateMask = new FieldMask(); - * $response = $videoStitcherServiceClient->updateSlate($slate, $updateMask); + * $operationResponse = $videoStitcherServiceClient->updateSlate($slate, $updateMask); + * $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 = $videoStitcherServiceClient->updateSlate($slate, $updateMask); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $videoStitcherServiceClient->resumeOperation($operationName, 'updateSlate'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } * } finally { * $videoStitcherServiceClient->close(); * } @@ -1717,7 +2313,7 @@ public function updateCdnKey($cdnKey, $updateMask, array $optionalArgs = []) * {@see RetrySettings} for example usage. * } * - * @return \Google\Cloud\Video\Stitcher\V1\Slate + * @return \Google\ApiCore\OperationResponse * * @throws ApiException if the remote call fails */ @@ -1734,11 +2330,11 @@ public function updateSlate($slate, $updateMask, array $optionalArgs = []) $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall( + return $this->startOperationsCall( 'UpdateSlate', - Slate::class, $optionalArgs, - $request + $request, + $this->getOperationsClient() )->wait(); } } diff --git a/VideoStitcher/src/V1/GetLiveConfigRequest.php b/VideoStitcher/src/V1/GetLiveConfigRequest.php new file mode 100644 index 00000000000..6f627987d68 --- /dev/null +++ b/VideoStitcher/src/V1/GetLiveConfigRequest.php @@ -0,0 +1,75 @@ +google.cloud.video.stitcher.v1.GetLiveConfigRequest + */ +class GetLiveConfigRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the live config to be retrieved, in the form + * of + * `projects/{project_number}/locations/{location}/liveConfigs/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the live config to be retrieved, in the form + * of + * `projects/{project_number}/locations/{location}/liveConfigs/{id}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\VideoStitcherService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the live config to be retrieved, in the form + * of + * `projects/{project_number}/locations/{location}/liveConfigs/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the live config to be retrieved, in the form + * of + * `projects/{project_number}/locations/{location}/liveConfigs/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/VideoStitcher/src/V1/GetSlateRequest.php b/VideoStitcher/src/V1/GetSlateRequest.php index e7bfc89fa1d..06d635327f9 100644 --- a/VideoStitcher/src/V1/GetSlateRequest.php +++ b/VideoStitcher/src/V1/GetSlateRequest.php @@ -16,8 +16,8 @@ class GetSlateRequest extends \Google\Protobuf\Internal\Message { /** - * Required. The name of the slate to be retrieved, of the slate, in the form of - * `projects/{project_number}/locations/{location}/slates/{id}`. + * Required. The name of the slate to be retrieved, of the slate, in the form + * of `projects/{project_number}/locations/{location}/slates/{id}`. * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ @@ -30,8 +30,8 @@ class GetSlateRequest extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type string $name - * Required. The name of the slate to be retrieved, of the slate, in the form of - * `projects/{project_number}/locations/{location}/slates/{id}`. + * Required. The name of the slate to be retrieved, of the slate, in the form + * of `projects/{project_number}/locations/{location}/slates/{id}`. * } */ public function __construct($data = NULL) { @@ -40,8 +40,8 @@ public function __construct($data = NULL) { } /** - * Required. The name of the slate to be retrieved, of the slate, in the form of - * `projects/{project_number}/locations/{location}/slates/{id}`. + * Required. The name of the slate to be retrieved, of the slate, in the form + * of `projects/{project_number}/locations/{location}/slates/{id}`. * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @return string @@ -52,8 +52,8 @@ public function getName() } /** - * Required. The name of the slate to be retrieved, of the slate, in the form of - * `projects/{project_number}/locations/{location}/slates/{id}`. + * Required. The name of the slate to be retrieved, of the slate, in the form + * of `projects/{project_number}/locations/{location}/slates/{id}`. * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @param string $var diff --git a/VideoStitcher/src/V1/GetVodAdTagDetailRequest.php b/VideoStitcher/src/V1/GetVodAdTagDetailRequest.php index c8c8ee590b3..ccba25b0e9c 100644 --- a/VideoStitcher/src/V1/GetVodAdTagDetailRequest.php +++ b/VideoStitcher/src/V1/GetVodAdTagDetailRequest.php @@ -16,7 +16,8 @@ class GetVodAdTagDetailRequest extends \Google\Protobuf\Internal\Message { /** - * Required. The name of the ad tag detail for the specified VOD session, in the form of + * Required. The name of the ad tag detail for the specified VOD session, in + * the form of * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}/vodAdTagDetails/{vod_ad_tag_detail}`. * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { @@ -30,7 +31,8 @@ class GetVodAdTagDetailRequest extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type string $name - * Required. The name of the ad tag detail for the specified VOD session, in the form of + * Required. The name of the ad tag detail for the specified VOD session, in + * the form of * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}/vodAdTagDetails/{vod_ad_tag_detail}`. * } */ @@ -40,7 +42,8 @@ public function __construct($data = NULL) { } /** - * Required. The name of the ad tag detail for the specified VOD session, in the form of + * Required. The name of the ad tag detail for the specified VOD session, in + * the form of * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}/vodAdTagDetails/{vod_ad_tag_detail}`. * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { @@ -52,7 +55,8 @@ public function getName() } /** - * Required. The name of the ad tag detail for the specified VOD session, in the form of + * Required. The name of the ad tag detail for the specified VOD session, in + * the form of * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}/vodAdTagDetails/{vod_ad_tag_detail}`. * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { diff --git a/VideoStitcher/src/V1/GetVodStitchDetailRequest.php b/VideoStitcher/src/V1/GetVodStitchDetailRequest.php index 8b992668014..df418877aa5 100644 --- a/VideoStitcher/src/V1/GetVodStitchDetailRequest.php +++ b/VideoStitcher/src/V1/GetVodStitchDetailRequest.php @@ -16,7 +16,8 @@ class GetVodStitchDetailRequest extends \Google\Protobuf\Internal\Message { /** - * Required. The name of the stitch detail in the specified VOD session, in the form of + * Required. The name of the stitch detail in the specified VOD session, in + * the form of * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}/vodStitchDetails/{id}`. * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { @@ -30,7 +31,8 @@ class GetVodStitchDetailRequest extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type string $name - * Required. The name of the stitch detail in the specified VOD session, in the form of + * Required. The name of the stitch detail in the specified VOD session, in + * the form of * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}/vodStitchDetails/{id}`. * } */ @@ -40,7 +42,8 @@ public function __construct($data = NULL) { } /** - * Required. The name of the stitch detail in the specified VOD session, in the form of + * Required. The name of the stitch detail in the specified VOD session, in + * the form of * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}/vodStitchDetails/{id}`. * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { @@ -52,7 +55,8 @@ public function getName() } /** - * Required. The name of the stitch detail in the specified VOD session, in the form of + * Required. The name of the stitch detail in the specified VOD session, in + * the form of * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}/vodStitchDetails/{id}`. * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { diff --git a/VideoStitcher/src/V1/ListLiveConfigsRequest.php b/VideoStitcher/src/V1/ListLiveConfigsRequest.php new file mode 100644 index 00000000000..899ad31adfb --- /dev/null +++ b/VideoStitcher/src/V1/ListLiveConfigsRequest.php @@ -0,0 +1,219 @@ +google.cloud.video.stitcher.v1.ListLiveConfigsRequest + */ +class ListLiveConfigsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project that contains the list of live configs, in the + * form of `projects/{project_number}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $parent = ''; + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + */ + private $page_size = 0; + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + */ + private $page_token = ''; + /** + * Optional. The filter to apply to list results (see + * [Filtering](https://google.aip.dev/160)). + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $filter = ''; + /** + * Optional. Specifies the ordering of results following + * [Cloud API + * syntax](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $order_by = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project that contains the list of live configs, in the + * form of `projects/{project_number}/locations/{location}`. + * @type int $page_size + * The maximum number of items to return. + * @type string $page_token + * The next_page_token value returned from a previous List request, if any. + * @type string $filter + * Optional. The filter to apply to list results (see + * [Filtering](https://google.aip.dev/160)). + * @type string $order_by + * Optional. Specifies the ordering of results following + * [Cloud API + * syntax](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\VideoStitcherService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project that contains the list of live configs, in the + * form of `projects/{project_number}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The project that contains the list of live configs, in the + * form of `projects/{project_number}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token value returned from a previous List request, if any. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Optional. The filter to apply to list results (see + * [Filtering](https://google.aip.dev/160)). + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. The filter to apply to list results (see + * [Filtering](https://google.aip.dev/160)). + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. Specifies the ordering of results following + * [Cloud API + * syntax](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. Specifies the ordering of results following + * [Cloud API + * syntax](https://cloud.google.com/apis/design/design_patterns#sorting_order). + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/VideoStitcher/src/V1/ListLiveConfigsResponse.php b/VideoStitcher/src/V1/ListLiveConfigsResponse.php new file mode 100644 index 00000000000..8c94daf2ba9 --- /dev/null +++ b/VideoStitcher/src/V1/ListLiveConfigsResponse.php @@ -0,0 +1,135 @@ +google.cloud.video.stitcher.v1.ListLiveConfigsResponse + */ +class ListLiveConfigsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * List of live configs. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.LiveConfig live_configs = 1; + */ + private $live_configs; + /** + * The pagination token. + * + * Generated from protobuf field string next_page_token = 2; + */ + private $next_page_token = ''; + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Video\Stitcher\V1\LiveConfig>|\Google\Protobuf\Internal\RepeatedField $live_configs + * List of live configs. + * @type string $next_page_token + * The pagination token. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\VideoStitcherService::initOnce(); + parent::__construct($data); + } + + /** + * List of live configs. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.LiveConfig live_configs = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLiveConfigs() + { + return $this->live_configs; + } + + /** + * List of live configs. + * + * Generated from protobuf field repeated .google.cloud.video.stitcher.v1.LiveConfig live_configs = 1; + * @param array<\Google\Cloud\Video\Stitcher\V1\LiveConfig>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLiveConfigs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\Stitcher\V1\LiveConfig::class); + $this->live_configs = $arr; + + return $this; + } + + /** + * The pagination token. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * The pagination token. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/VideoStitcher/src/V1/ListSlatesRequest.php b/VideoStitcher/src/V1/ListSlatesRequest.php index e9cea253abb..0d43d4935e6 100644 --- a/VideoStitcher/src/V1/ListSlatesRequest.php +++ b/VideoStitcher/src/V1/ListSlatesRequest.php @@ -16,7 +16,8 @@ class ListSlatesRequest extends \Google\Protobuf\Internal\Message { /** - * Required. The project to list slates, in the form of `projects/{project_number}`. + * Required. The project to list slates, in the form of + * `projects/{project_number}/locations/{location}`. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ @@ -54,7 +55,8 @@ class ListSlatesRequest extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type string $parent - * Required. The project to list slates, in the form of `projects/{project_number}`. + * Required. The project to list slates, in the form of + * `projects/{project_number}/locations/{location}`. * @type int $page_size * Requested page size. Server may return fewer items than requested. * If unspecified, server will pick an appropriate default. @@ -72,7 +74,8 @@ public function __construct($data = NULL) { } /** - * Required. The project to list slates, in the form of `projects/{project_number}`. + * Required. The project to list slates, in the form of + * `projects/{project_number}/locations/{location}`. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @return string @@ -83,7 +86,8 @@ public function getParent() } /** - * Required. The project to list slates, in the form of `projects/{project_number}`. + * Required. The project to list slates, in the form of + * `projects/{project_number}/locations/{location}`. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @param string $var diff --git a/VideoStitcher/src/V1/ListVodAdTagDetailsRequest.php b/VideoStitcher/src/V1/ListVodAdTagDetailsRequest.php index 7a7fa32be44..c5b89683c78 100644 --- a/VideoStitcher/src/V1/ListVodAdTagDetailsRequest.php +++ b/VideoStitcher/src/V1/ListVodAdTagDetailsRequest.php @@ -16,8 +16,8 @@ class ListVodAdTagDetailsRequest extends \Google\Protobuf\Internal\Message { /** - * Required. The VOD session which the ad tag details belong to, in the form of - * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}`. + * Required. The VOD session which the ad tag details belong to, in the form + * of `projects/{project}/locations/{location}/vodSessions/{vod_session_id}`. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ @@ -42,8 +42,8 @@ class ListVodAdTagDetailsRequest extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type string $parent - * Required. The VOD session which the ad tag details belong to, in the form of - * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}`. + * Required. The VOD session which the ad tag details belong to, in the form + * of `projects/{project}/locations/{location}/vodSessions/{vod_session_id}`. * @type int $page_size * The maximum number of items to return. * @type string $page_token @@ -56,8 +56,8 @@ public function __construct($data = NULL) { } /** - * Required. The VOD session which the ad tag details belong to, in the form of - * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}`. + * Required. The VOD session which the ad tag details belong to, in the form + * of `projects/{project}/locations/{location}/vodSessions/{vod_session_id}`. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @return string @@ -68,8 +68,8 @@ public function getParent() } /** - * Required. The VOD session which the ad tag details belong to, in the form of - * `projects/{project}/locations/{location}/vodSessions/{vod_session_id}`. + * Required. The VOD session which the ad tag details belong to, in the form + * of `projects/{project}/locations/{location}/vodSessions/{vod_session_id}`. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @param string $var diff --git a/VideoStitcher/src/V1/ListVodStitchDetailsRequest.php b/VideoStitcher/src/V1/ListVodStitchDetailsRequest.php index 253611d417b..dff54ff368a 100644 --- a/VideoStitcher/src/V1/ListVodStitchDetailsRequest.php +++ b/VideoStitcher/src/V1/ListVodStitchDetailsRequest.php @@ -16,8 +16,8 @@ class ListVodStitchDetailsRequest extends \Google\Protobuf\Internal\Message { /** - * Required. The VOD session where the stitch details belong to, in the form of - * `projects/{project}/locations/{location}/vodSessions/{id}`. + * Required. The VOD session where the stitch details belong to, in the form + * of `projects/{project}/locations/{location}/vodSessions/{id}`. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ @@ -42,8 +42,8 @@ class ListVodStitchDetailsRequest extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type string $parent - * Required. The VOD session where the stitch details belong to, in the form of - * `projects/{project}/locations/{location}/vodSessions/{id}`. + * Required. The VOD session where the stitch details belong to, in the form + * of `projects/{project}/locations/{location}/vodSessions/{id}`. * @type int $page_size * The maximum number of items to return. * @type string $page_token @@ -56,8 +56,8 @@ public function __construct($data = NULL) { } /** - * Required. The VOD session where the stitch details belong to, in the form of - * `projects/{project}/locations/{location}/vodSessions/{id}`. + * Required. The VOD session where the stitch details belong to, in the form + * of `projects/{project}/locations/{location}/vodSessions/{id}`. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @return string @@ -68,8 +68,8 @@ public function getParent() } /** - * Required. The VOD session where the stitch details belong to, in the form of - * `projects/{project}/locations/{location}/vodSessions/{id}`. + * Required. The VOD session where the stitch details belong to, in the form + * of `projects/{project}/locations/{location}/vodSessions/{id}`. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @param string $var diff --git a/VideoStitcher/src/V1/LiveConfig.php b/VideoStitcher/src/V1/LiveConfig.php new file mode 100644 index 00000000000..30ad3be810a --- /dev/null +++ b/VideoStitcher/src/V1/LiveConfig.php @@ -0,0 +1,443 @@ +google.cloud.video.stitcher.v1.LiveConfig + */ +class LiveConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The resource name of the live config, in the form of + * `projects/{project}/locations/{location}/liveConfigs/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $name = ''; + /** + * Required. Source URI for the live stream manifest. + * + * Generated from protobuf field string source_uri = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $source_uri = ''; + /** + * The default ad tag associated with this live stream config. + * + * Generated from protobuf field string ad_tag_uri = 3; + */ + private $ad_tag_uri = ''; + /** + * Additional metadata used to register a live stream with Google Ad Manager + * (GAM) + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.GamLiveConfig gam_live_config = 4; + */ + private $gam_live_config = null; + /** + * Output only. State of the live config. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveConfig.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $state = 0; + /** + * Required. Determines how the ads should be tracked. If + * [gam_live_config][google.cloud.video.stitcher.v1.LiveConfig.gam_live_config] + * is set, the value must be `CLIENT` because the IMA SDK handles ad tracking. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.AdTracking ad_tracking = 6 [(.google.api.field_behavior) = REQUIRED]; + */ + private $ad_tracking = 0; + /** + * This must refer to a slate in the same + * project. In case Google Ad Manager (GAM) is being used for ads this will be + * used to set the appropriate value of slateCreativeId in + * https://developers.google.com/ad-manager/api/reference/v202211/LiveStreamEventService.LiveStreamEvent#slateCreativeId + * + * Generated from protobuf field string default_slate = 7 [(.google.api.resource_reference) = { + */ + private $default_slate = ''; + /** + * Defines the stitcher behavior in case an ad does not align exactly with + * the ad break boundaries. If not specified, the default is `CUT_CURRENT`. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveConfig.StitchingPolicy stitching_policy = 8; + */ + private $stitching_policy = 0; + /** + * The configuration for prefetching ads. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.PrefetchConfig prefetch_config = 10; + */ + private $prefetch_config = null; + /** + * The default ad pod duration in seconds that will be requested when a + * cue-out does not specify a duration. + * The default value of this field is 30s. + * + * Generated from protobuf field .google.protobuf.Duration default_ad_break_duration = 11; + */ + private $default_ad_break_duration = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The resource name of the live config, in the form of + * `projects/{project}/locations/{location}/liveConfigs/{id}`. + * @type string $source_uri + * Required. Source URI for the live stream manifest. + * @type string $ad_tag_uri + * The default ad tag associated with this live stream config. + * @type \Google\Cloud\Video\Stitcher\V1\GamLiveConfig $gam_live_config + * Additional metadata used to register a live stream with Google Ad Manager + * (GAM) + * @type int $state + * Output only. State of the live config. + * @type int $ad_tracking + * Required. Determines how the ads should be tracked. If + * [gam_live_config][google.cloud.video.stitcher.v1.LiveConfig.gam_live_config] + * is set, the value must be `CLIENT` because the IMA SDK handles ad tracking. + * @type string $default_slate + * This must refer to a slate in the same + * project. In case Google Ad Manager (GAM) is being used for ads this will be + * used to set the appropriate value of slateCreativeId in + * https://developers.google.com/ad-manager/api/reference/v202211/LiveStreamEventService.LiveStreamEvent#slateCreativeId + * @type int $stitching_policy + * Defines the stitcher behavior in case an ad does not align exactly with + * the ad break boundaries. If not specified, the default is `CUT_CURRENT`. + * @type \Google\Cloud\Video\Stitcher\V1\PrefetchConfig $prefetch_config + * The configuration for prefetching ads. + * @type \Google\Protobuf\Duration $default_ad_break_duration + * The default ad pod duration in seconds that will be requested when a + * cue-out does not specify a duration. + * The default value of this field is 30s. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\LiveConfigs::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The resource name of the live config, in the form of + * `projects/{project}/locations/{location}/liveConfigs/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The resource name of the live config, in the form of + * `projects/{project}/locations/{location}/liveConfigs/{id}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. Source URI for the live stream manifest. + * + * Generated from protobuf field string source_uri = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getSourceUri() + { + return $this->source_uri; + } + + /** + * Required. Source URI for the live stream manifest. + * + * Generated from protobuf field string source_uri = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setSourceUri($var) + { + GPBUtil::checkString($var, True); + $this->source_uri = $var; + + return $this; + } + + /** + * The default ad tag associated with this live stream config. + * + * Generated from protobuf field string ad_tag_uri = 3; + * @return string + */ + public function getAdTagUri() + { + return $this->ad_tag_uri; + } + + /** + * The default ad tag associated with this live stream config. + * + * Generated from protobuf field string ad_tag_uri = 3; + * @param string $var + * @return $this + */ + public function setAdTagUri($var) + { + GPBUtil::checkString($var, True); + $this->ad_tag_uri = $var; + + return $this; + } + + /** + * Additional metadata used to register a live stream with Google Ad Manager + * (GAM) + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.GamLiveConfig gam_live_config = 4; + * @return \Google\Cloud\Video\Stitcher\V1\GamLiveConfig|null + */ + public function getGamLiveConfig() + { + return $this->gam_live_config; + } + + public function hasGamLiveConfig() + { + return isset($this->gam_live_config); + } + + public function clearGamLiveConfig() + { + unset($this->gam_live_config); + } + + /** + * Additional metadata used to register a live stream with Google Ad Manager + * (GAM) + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.GamLiveConfig gam_live_config = 4; + * @param \Google\Cloud\Video\Stitcher\V1\GamLiveConfig $var + * @return $this + */ + public function setGamLiveConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Stitcher\V1\GamLiveConfig::class); + $this->gam_live_config = $var; + + return $this; + } + + /** + * Output only. State of the live config. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveConfig.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. State of the live config. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveConfig.State state = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Video\Stitcher\V1\LiveConfig\State::class); + $this->state = $var; + + return $this; + } + + /** + * Required. Determines how the ads should be tracked. If + * [gam_live_config][google.cloud.video.stitcher.v1.LiveConfig.gam_live_config] + * is set, the value must be `CLIENT` because the IMA SDK handles ad tracking. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.AdTracking ad_tracking = 6 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getAdTracking() + { + return $this->ad_tracking; + } + + /** + * Required. Determines how the ads should be tracked. If + * [gam_live_config][google.cloud.video.stitcher.v1.LiveConfig.gam_live_config] + * is set, the value must be `CLIENT` because the IMA SDK handles ad tracking. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.AdTracking ad_tracking = 6 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setAdTracking($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Video\Stitcher\V1\AdTracking::class); + $this->ad_tracking = $var; + + return $this; + } + + /** + * This must refer to a slate in the same + * project. In case Google Ad Manager (GAM) is being used for ads this will be + * used to set the appropriate value of slateCreativeId in + * https://developers.google.com/ad-manager/api/reference/v202211/LiveStreamEventService.LiveStreamEvent#slateCreativeId + * + * Generated from protobuf field string default_slate = 7 [(.google.api.resource_reference) = { + * @return string + */ + public function getDefaultSlate() + { + return $this->default_slate; + } + + /** + * This must refer to a slate in the same + * project. In case Google Ad Manager (GAM) is being used for ads this will be + * used to set the appropriate value of slateCreativeId in + * https://developers.google.com/ad-manager/api/reference/v202211/LiveStreamEventService.LiveStreamEvent#slateCreativeId + * + * Generated from protobuf field string default_slate = 7 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setDefaultSlate($var) + { + GPBUtil::checkString($var, True); + $this->default_slate = $var; + + return $this; + } + + /** + * Defines the stitcher behavior in case an ad does not align exactly with + * the ad break boundaries. If not specified, the default is `CUT_CURRENT`. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveConfig.StitchingPolicy stitching_policy = 8; + * @return int + */ + public function getStitchingPolicy() + { + return $this->stitching_policy; + } + + /** + * Defines the stitcher behavior in case an ad does not align exactly with + * the ad break boundaries. If not specified, the default is `CUT_CURRENT`. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveConfig.StitchingPolicy stitching_policy = 8; + * @param int $var + * @return $this + */ + public function setStitchingPolicy($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Video\Stitcher\V1\LiveConfig\StitchingPolicy::class); + $this->stitching_policy = $var; + + return $this; + } + + /** + * The configuration for prefetching ads. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.PrefetchConfig prefetch_config = 10; + * @return \Google\Cloud\Video\Stitcher\V1\PrefetchConfig|null + */ + public function getPrefetchConfig() + { + return $this->prefetch_config; + } + + public function hasPrefetchConfig() + { + return isset($this->prefetch_config); + } + + public function clearPrefetchConfig() + { + unset($this->prefetch_config); + } + + /** + * The configuration for prefetching ads. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.PrefetchConfig prefetch_config = 10; + * @param \Google\Cloud\Video\Stitcher\V1\PrefetchConfig $var + * @return $this + */ + public function setPrefetchConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Stitcher\V1\PrefetchConfig::class); + $this->prefetch_config = $var; + + return $this; + } + + /** + * The default ad pod duration in seconds that will be requested when a + * cue-out does not specify a duration. + * The default value of this field is 30s. + * + * Generated from protobuf field .google.protobuf.Duration default_ad_break_duration = 11; + * @return \Google\Protobuf\Duration|null + */ + public function getDefaultAdBreakDuration() + { + return $this->default_ad_break_duration; + } + + public function hasDefaultAdBreakDuration() + { + return isset($this->default_ad_break_duration); + } + + public function clearDefaultAdBreakDuration() + { + unset($this->default_ad_break_duration); + } + + /** + * The default ad pod duration in seconds that will be requested when a + * cue-out does not specify a duration. + * The default value of this field is 30s. + * + * Generated from protobuf field .google.protobuf.Duration default_ad_break_duration = 11; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setDefaultAdBreakDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->default_ad_break_duration = $var; + + return $this; + } + +} + diff --git a/VideoStitcher/src/V1/LiveConfig/State.php b/VideoStitcher/src/V1/LiveConfig/State.php new file mode 100644 index 00000000000..f6f318c0e6a --- /dev/null +++ b/VideoStitcher/src/V1/LiveConfig/State.php @@ -0,0 +1,69 @@ +google.cloud.video.stitcher.v1.LiveConfig.State + */ +class State +{ + /** + * State is not specified. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Live config is being created. + * + * Generated from protobuf enum CREATING = 1; + */ + const CREATING = 1; + /** + * Live config is ready for use. + * + * Generated from protobuf enum READY = 2; + */ + const READY = 2; + /** + * Live config is queued up for deletion. + * + * Generated from protobuf enum DELETING = 3; + */ + const DELETING = 3; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::CREATING => 'CREATING', + self::READY => 'READY', + self::DELETING => 'DELETING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/VideoStitcher/src/V1/LiveConfig/StitchingPolicy.php b/VideoStitcher/src/V1/LiveConfig/StitchingPolicy.php new file mode 100644 index 00000000000..91f30300e29 --- /dev/null +++ b/VideoStitcher/src/V1/LiveConfig/StitchingPolicy.php @@ -0,0 +1,64 @@ +google.cloud.video.stitcher.v1.LiveConfig.StitchingPolicy + */ +class StitchingPolicy +{ + /** + * Stitching policy is not specified. + * + * Generated from protobuf enum STITCHING_POLICY_UNSPECIFIED = 0; + */ + const STITCHING_POLICY_UNSPECIFIED = 0; + /** + * Cuts an ad short and returns to content in the middle of the ad. + * + * Generated from protobuf enum CUT_CURRENT = 1; + */ + const CUT_CURRENT = 1; + /** + * Finishes stitching the current ad before returning to content. + * + * Generated from protobuf enum COMPLETE_AD = 2; + */ + const COMPLETE_AD = 2; + + private static $valueToName = [ + self::STITCHING_POLICY_UNSPECIFIED => 'STITCHING_POLICY_UNSPECIFIED', + self::CUT_CURRENT => 'CUT_CURRENT', + self::COMPLETE_AD => 'COMPLETE_AD', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/VideoStitcher/src/V1/LiveSession.php b/VideoStitcher/src/V1/LiveSession.php index 1685e1841b3..a3a07878351 100644 --- a/VideoStitcher/src/V1/LiveSession.php +++ b/VideoStitcher/src/V1/LiveSession.php @@ -9,7 +9,8 @@ use Google\Protobuf\Internal\GPBUtil; /** - * Metadata for a live session. + * Metadata for a live session. The session expires 5 minutes after the client + * stops fetching the session's playlists. * * Generated from protobuf message google.cloud.video.stitcher.v1.LiveSession */ @@ -28,28 +29,6 @@ class LiveSession extends \Google\Protobuf\Internal\Message * Generated from protobuf field string play_uri = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ private $play_uri = ''; - /** - * The URI of the live session's source stream. - * - * Generated from protobuf field string source_uri = 3; - */ - private $source_uri = ''; - /** - * The default ad tag to use when no ad tag ids are specified in an ad break's - * SCTE-35 message. - * default_ad_tag_id is necessary when `adTagMap` has more than one key. Its - * value must be present in the `adTagMap`. - * - * Generated from protobuf field string default_ad_tag_id = 4; - */ - private $default_ad_tag_id = ''; - /** - * Key value pairs for ad tags. Ads parsed from ad tags must be MP4 videos - * each with at least one audio track. - * - * Generated from protobuf field map ad_tag_map = 5; - */ - private $ad_tag_map; /** * Key value pairs for ad tag macro replacement. If the * specified ad tag URI has macros, this field provides the mapping @@ -64,31 +43,6 @@ class LiveSession extends \Google\Protobuf\Internal\Message * Generated from protobuf field map ad_tag_macros = 6; */ private $ad_tag_macros; - /** - * Whether client side ad tracking is enabled. If enabled, the client player - * is expected to trigger playback and activity events itself. Otherwise, - * server side ad tracking is enabled and the Video Stitcher API will trigger - * playback events on behalf of the client player. - * - * Generated from protobuf field bool client_ad_tracking = 7; - */ - private $client_ad_tracking = false; - /** - * The default slate to use when no slates are specified in an ad break's - * SCTE-35 message. When specified, this value must match the ID for a slate - * that has already been created via the - * [CreateSlate](projects.locations.slates/create) method. - * - * Generated from protobuf field string default_slate_id = 8; - */ - private $default_slate_id = ''; - /** - * Defines the stitcher behavior in case an ad does not align exactly with - * the ad break boundaries. If not specified, the default is `COMPLETE_AD`. - * - * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveSession.StitchingPolicy stitching_policy = 9; - */ - private $stitching_policy = 0; /** * Additional options that affect the output of the manifest. * @@ -96,11 +50,19 @@ class LiveSession extends \Google\Protobuf\Internal\Message */ private $manifest_options = null; /** - * Output only. The generated ID of the LiveSession's source stream. + * This field should be set with appropriate values if GAM is being used for + * ads. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveSession.GamSettings gam_settings = 15; + */ + private $gam_settings = null; + /** + * Required. The resource name of the live config for this session, in the + * form of `projects/{project}/locations/{location}/liveConfigs/{id}`. * - * Generated from protobuf field string stream_id = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * Generated from protobuf field string live_config = 16 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ - private $stream_id = ''; + private $live_config = ''; /** * Constructor. @@ -113,16 +75,6 @@ class LiveSession extends \Google\Protobuf\Internal\Message * `projects/{project}/locations/{location}/liveSessions/{id}`. * @type string $play_uri * Output only. The URI to play the live session's ad-stitched stream. - * @type string $source_uri - * The URI of the live session's source stream. - * @type string $default_ad_tag_id - * The default ad tag to use when no ad tag ids are specified in an ad break's - * SCTE-35 message. - * default_ad_tag_id is necessary when `adTagMap` has more than one key. Its - * value must be present in the `adTagMap`. - * @type array|\Google\Protobuf\Internal\MapField $ad_tag_map - * Key value pairs for ad tags. Ads parsed from ad tags must be MP4 videos - * each with at least one audio track. * @type array|\Google\Protobuf\Internal\MapField $ad_tag_macros * Key value pairs for ad tag macro replacement. If the * specified ad tag URI has macros, this field provides the mapping @@ -133,23 +85,14 @@ class LiveSession extends \Google\Protobuf\Internal\Message * Ad tag macros: `{"geoId": "123"}` * Fully qualified ad tag: * `"https://doubleclick.google.com/ad/1?geo_id=123"` - * @type bool $client_ad_tracking - * Whether client side ad tracking is enabled. If enabled, the client player - * is expected to trigger playback and activity events itself. Otherwise, - * server side ad tracking is enabled and the Video Stitcher API will trigger - * playback events on behalf of the client player. - * @type string $default_slate_id - * The default slate to use when no slates are specified in an ad break's - * SCTE-35 message. When specified, this value must match the ID for a slate - * that has already been created via the - * [CreateSlate](projects.locations.slates/create) method. - * @type int $stitching_policy - * Defines the stitcher behavior in case an ad does not align exactly with - * the ad break boundaries. If not specified, the default is `COMPLETE_AD`. * @type \Google\Cloud\Video\Stitcher\V1\ManifestOptions $manifest_options * Additional options that affect the output of the manifest. - * @type string $stream_id - * Output only. The generated ID of the LiveSession's source stream. + * @type \Google\Cloud\Video\Stitcher\V1\LiveSession\GamSettings $gam_settings + * This field should be set with appropriate values if GAM is being used for + * ads. + * @type string $live_config + * Required. The resource name of the live config for this session, in the + * form of `projects/{project}/locations/{location}/liveConfigs/{id}`. * } */ public function __construct($data = NULL) { @@ -211,92 +154,6 @@ public function setPlayUri($var) return $this; } - /** - * The URI of the live session's source stream. - * - * Generated from protobuf field string source_uri = 3; - * @return string - */ - public function getSourceUri() - { - return $this->source_uri; - } - - /** - * The URI of the live session's source stream. - * - * Generated from protobuf field string source_uri = 3; - * @param string $var - * @return $this - */ - public function setSourceUri($var) - { - GPBUtil::checkString($var, True); - $this->source_uri = $var; - - return $this; - } - - /** - * The default ad tag to use when no ad tag ids are specified in an ad break's - * SCTE-35 message. - * default_ad_tag_id is necessary when `adTagMap` has more than one key. Its - * value must be present in the `adTagMap`. - * - * Generated from protobuf field string default_ad_tag_id = 4; - * @return string - */ - public function getDefaultAdTagId() - { - return $this->default_ad_tag_id; - } - - /** - * The default ad tag to use when no ad tag ids are specified in an ad break's - * SCTE-35 message. - * default_ad_tag_id is necessary when `adTagMap` has more than one key. Its - * value must be present in the `adTagMap`. - * - * Generated from protobuf field string default_ad_tag_id = 4; - * @param string $var - * @return $this - */ - public function setDefaultAdTagId($var) - { - GPBUtil::checkString($var, True); - $this->default_ad_tag_id = $var; - - return $this; - } - - /** - * Key value pairs for ad tags. Ads parsed from ad tags must be MP4 videos - * each with at least one audio track. - * - * Generated from protobuf field map ad_tag_map = 5; - * @return \Google\Protobuf\Internal\MapField - */ - public function getAdTagMap() - { - return $this->ad_tag_map; - } - - /** - * Key value pairs for ad tags. Ads parsed from ad tags must be MP4 videos - * each with at least one audio track. - * - * Generated from protobuf field map ad_tag_map = 5; - * @param array|\Google\Protobuf\Internal\MapField $var - * @return $this - */ - public function setAdTagMap($var) - { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Video\Stitcher\V1\AdTag::class); - $this->ad_tag_map = $arr; - - return $this; - } - /** * Key value pairs for ad tag macro replacement. If the * specified ad tag URI has macros, this field provides the mapping @@ -340,155 +197,103 @@ public function setAdTagMacros($var) } /** - * Whether client side ad tracking is enabled. If enabled, the client player - * is expected to trigger playback and activity events itself. Otherwise, - * server side ad tracking is enabled and the Video Stitcher API will trigger - * playback events on behalf of the client player. - * - * Generated from protobuf field bool client_ad_tracking = 7; - * @return bool - */ - public function getClientAdTracking() - { - return $this->client_ad_tracking; - } - - /** - * Whether client side ad tracking is enabled. If enabled, the client player - * is expected to trigger playback and activity events itself. Otherwise, - * server side ad tracking is enabled and the Video Stitcher API will trigger - * playback events on behalf of the client player. - * - * Generated from protobuf field bool client_ad_tracking = 7; - * @param bool $var - * @return $this - */ - public function setClientAdTracking($var) - { - GPBUtil::checkBool($var); - $this->client_ad_tracking = $var; - - return $this; - } - - /** - * The default slate to use when no slates are specified in an ad break's - * SCTE-35 message. When specified, this value must match the ID for a slate - * that has already been created via the - * [CreateSlate](projects.locations.slates/create) method. + * Additional options that affect the output of the manifest. * - * Generated from protobuf field string default_slate_id = 8; - * @return string + * Generated from protobuf field .google.cloud.video.stitcher.v1.ManifestOptions manifest_options = 10; + * @return \Google\Cloud\Video\Stitcher\V1\ManifestOptions|null */ - public function getDefaultSlateId() + public function getManifestOptions() { - return $this->default_slate_id; + return $this->manifest_options; } - /** - * The default slate to use when no slates are specified in an ad break's - * SCTE-35 message. When specified, this value must match the ID for a slate - * that has already been created via the - * [CreateSlate](projects.locations.slates/create) method. - * - * Generated from protobuf field string default_slate_id = 8; - * @param string $var - * @return $this - */ - public function setDefaultSlateId($var) + public function hasManifestOptions() { - GPBUtil::checkString($var, True); - $this->default_slate_id = $var; - - return $this; + return isset($this->manifest_options); } - /** - * Defines the stitcher behavior in case an ad does not align exactly with - * the ad break boundaries. If not specified, the default is `COMPLETE_AD`. - * - * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveSession.StitchingPolicy stitching_policy = 9; - * @return int - */ - public function getStitchingPolicy() + public function clearManifestOptions() { - return $this->stitching_policy; + unset($this->manifest_options); } /** - * Defines the stitcher behavior in case an ad does not align exactly with - * the ad break boundaries. If not specified, the default is `COMPLETE_AD`. + * Additional options that affect the output of the manifest. * - * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveSession.StitchingPolicy stitching_policy = 9; - * @param int $var + * Generated from protobuf field .google.cloud.video.stitcher.v1.ManifestOptions manifest_options = 10; + * @param \Google\Cloud\Video\Stitcher\V1\ManifestOptions $var * @return $this */ - public function setStitchingPolicy($var) + public function setManifestOptions($var) { - GPBUtil::checkEnum($var, \Google\Cloud\Video\Stitcher\V1\LiveSession\StitchingPolicy::class); - $this->stitching_policy = $var; + GPBUtil::checkMessage($var, \Google\Cloud\Video\Stitcher\V1\ManifestOptions::class); + $this->manifest_options = $var; return $this; } /** - * Additional options that affect the output of the manifest. + * This field should be set with appropriate values if GAM is being used for + * ads. * - * Generated from protobuf field .google.cloud.video.stitcher.v1.ManifestOptions manifest_options = 10; - * @return \Google\Cloud\Video\Stitcher\V1\ManifestOptions|null + * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveSession.GamSettings gam_settings = 15; + * @return \Google\Cloud\Video\Stitcher\V1\LiveSession\GamSettings|null */ - public function getManifestOptions() + public function getGamSettings() { - return $this->manifest_options; + return $this->gam_settings; } - public function hasManifestOptions() + public function hasGamSettings() { - return isset($this->manifest_options); + return isset($this->gam_settings); } - public function clearManifestOptions() + public function clearGamSettings() { - unset($this->manifest_options); + unset($this->gam_settings); } /** - * Additional options that affect the output of the manifest. + * This field should be set with appropriate values if GAM is being used for + * ads. * - * Generated from protobuf field .google.cloud.video.stitcher.v1.ManifestOptions manifest_options = 10; - * @param \Google\Cloud\Video\Stitcher\V1\ManifestOptions $var + * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveSession.GamSettings gam_settings = 15; + * @param \Google\Cloud\Video\Stitcher\V1\LiveSession\GamSettings $var * @return $this */ - public function setManifestOptions($var) + public function setGamSettings($var) { - GPBUtil::checkMessage($var, \Google\Cloud\Video\Stitcher\V1\ManifestOptions::class); - $this->manifest_options = $var; + GPBUtil::checkMessage($var, \Google\Cloud\Video\Stitcher\V1\LiveSession\GamSettings::class); + $this->gam_settings = $var; return $this; } /** - * Output only. The generated ID of the LiveSession's source stream. + * Required. The resource name of the live config for this session, in the + * form of `projects/{project}/locations/{location}/liveConfigs/{id}`. * - * Generated from protobuf field string stream_id = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * Generated from protobuf field string live_config = 16 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @return string */ - public function getStreamId() + public function getLiveConfig() { - return $this->stream_id; + return $this->live_config; } /** - * Output only. The generated ID of the LiveSession's source stream. + * Required. The resource name of the live config for this session, in the + * form of `projects/{project}/locations/{location}/liveConfigs/{id}`. * - * Generated from protobuf field string stream_id = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * Generated from protobuf field string live_config = 16 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @param string $var * @return $this */ - public function setStreamId($var) + public function setLiveConfig($var) { GPBUtil::checkString($var, True); - $this->stream_id = $var; + $this->live_config = $var; return $this; } diff --git a/VideoStitcher/src/V1/LiveSession/GamSettings.php b/VideoStitcher/src/V1/LiveSession/GamSettings.php new file mode 100644 index 00000000000..84584c00999 --- /dev/null +++ b/VideoStitcher/src/V1/LiveSession/GamSettings.php @@ -0,0 +1,145 @@ +google.cloud.video.stitcher.v1.LiveSession.GamSettings + */ +class GamSettings extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The stream ID generated by Ad Manager. + * + * Generated from protobuf field string stream_id = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $stream_id = ''; + protected $manifest_fields; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Video\Stitcher\V1\LiveSession\GamSettings\GamHls $gam_hls + * Fields that are specific to HLS manifests. + * @type \Google\Cloud\Video\Stitcher\V1\LiveSession\GamSettings\GamDash $gam_dash + * Fields that are specific to DASH manifests. + * @type string $stream_id + * Required. The stream ID generated by Ad Manager. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\Sessions::initOnce(); + parent::__construct($data); + } + + /** + * Fields that are specific to HLS manifests. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveSession.GamSettings.GamHls gam_hls = 2; + * @return \Google\Cloud\Video\Stitcher\V1\LiveSession\GamSettings\GamHls|null + */ + public function getGamHls() + { + return $this->readOneof(2); + } + + public function hasGamHls() + { + return $this->hasOneof(2); + } + + /** + * Fields that are specific to HLS manifests. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveSession.GamSettings.GamHls gam_hls = 2; + * @param \Google\Cloud\Video\Stitcher\V1\LiveSession\GamSettings\GamHls $var + * @return $this + */ + public function setGamHls($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Stitcher\V1\LiveSession\GamSettings\GamHls::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Fields that are specific to DASH manifests. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveSession.GamSettings.GamDash gam_dash = 3; + * @return \Google\Cloud\Video\Stitcher\V1\LiveSession\GamSettings\GamDash|null + */ + public function getGamDash() + { + return $this->readOneof(3); + } + + public function hasGamDash() + { + return $this->hasOneof(3); + } + + /** + * Fields that are specific to DASH manifests. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.LiveSession.GamSettings.GamDash gam_dash = 3; + * @param \Google\Cloud\Video\Stitcher\V1\LiveSession\GamSettings\GamDash $var + * @return $this + */ + public function setGamDash($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Stitcher\V1\LiveSession\GamSettings\GamDash::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Required. The stream ID generated by Ad Manager. + * + * Generated from protobuf field string stream_id = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getStreamId() + { + return $this->stream_id; + } + + /** + * Required. The stream ID generated by Ad Manager. + * + * Generated from protobuf field string stream_id = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setStreamId($var) + { + GPBUtil::checkString($var, True); + $this->stream_id = $var; + + return $this; + } + + /** + * @return string + */ + public function getManifestFields() + { + return $this->whichOneof("manifest_fields"); + } + +} + + diff --git a/VideoStitcher/src/V1/LiveSession/GamSettings/GamDash.php b/VideoStitcher/src/V1/LiveSession/GamSettings/GamDash.php new file mode 100644 index 00000000000..62f210feac4 --- /dev/null +++ b/VideoStitcher/src/V1/LiveSession/GamSettings/GamDash.php @@ -0,0 +1,69 @@ +google.cloud.video.stitcher.v1.LiveSession.GamSettings.GamDash + */ +class GamDash extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The session template url by Ad Manager for DASH periods. + * + * Generated from protobuf field string period_template_uri = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $period_template_uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $period_template_uri + * Required. The session template url by Ad Manager for DASH periods. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\Sessions::initOnce(); + parent::__construct($data); + } + + /** + * Required. The session template url by Ad Manager for DASH periods. + * + * Generated from protobuf field string period_template_uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getPeriodTemplateUri() + { + return $this->period_template_uri; + } + + /** + * Required. The session template url by Ad Manager for DASH periods. + * + * Generated from protobuf field string period_template_uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setPeriodTemplateUri($var) + { + GPBUtil::checkString($var, True); + $this->period_template_uri = $var; + + return $this; + } + +} + + diff --git a/VideoStitcher/src/V1/LiveSession/GamSettings/GamHls.php b/VideoStitcher/src/V1/LiveSession/GamSettings/GamHls.php new file mode 100644 index 00000000000..fb36797a123 --- /dev/null +++ b/VideoStitcher/src/V1/LiveSession/GamSettings/GamHls.php @@ -0,0 +1,35 @@ +google.cloud.video.stitcher.v1.LiveSession.GamSettings.GamHls + */ +class GamHls extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\Sessions::initOnce(); + parent::__construct($data); + } + +} + + diff --git a/VideoStitcher/src/V1/OperationMetadata.php b/VideoStitcher/src/V1/OperationMetadata.php new file mode 100644 index 00000000000..0f87006b86e --- /dev/null +++ b/VideoStitcher/src/V1/OperationMetadata.php @@ -0,0 +1,189 @@ +google.cloud.video.stitcher.v1.OperationMetadata + */ +class OperationMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; + */ + private $create_time = null; + /** + * The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + */ + private $end_time = null; + /** + * Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3; + */ + private $target = ''; + /** + * Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4; + */ + private $verb = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $create_time + * The time the operation was created. + * @type \Google\Protobuf\Timestamp $end_time + * The time the operation finished running. + * @type string $target + * Server-defined resource path for the target of the operation. + * @type string $verb + * Name of the verb executed by the operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\VideoStitcherService::initOnce(); + parent::__construct($data); + } + + /** + * The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3; + * @return string + */ + public function getTarget() + { + return $this->target; + } + + /** + * Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3; + * @param string $var + * @return $this + */ + public function setTarget($var) + { + GPBUtil::checkString($var, True); + $this->target = $var; + + return $this; + } + + /** + * Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4; + * @return string + */ + public function getVerb() + { + return $this->verb; + } + + /** + * Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4; + * @param string $var + * @return $this + */ + public function setVerb($var) + { + GPBUtil::checkString($var, True); + $this->verb = $var; + + return $this; + } + +} + diff --git a/VideoStitcher/src/V1/PrefetchConfig.php b/VideoStitcher/src/V1/PrefetchConfig.php new file mode 100644 index 00000000000..16ca493de4e --- /dev/null +++ b/VideoStitcher/src/V1/PrefetchConfig.php @@ -0,0 +1,131 @@ +google.cloud.video.stitcher.v1.PrefetchConfig + */ +class PrefetchConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Indicates whether the option to prefetch ad requests is enabled. + * + * Generated from protobuf field bool enabled = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $enabled = false; + /** + * The duration in seconds of the part of the break to be prefetched. + * This field is only relevant if prefetch is enabled. + * You should set this duration to as long as possible to increase the + * benefits of prefetching, but not longer than the shortest ad break + * expected. For example, for a live event with 30s and 60s ad breaks, the + * initial duration should be set to 30s. + * + * Generated from protobuf field .google.protobuf.Duration initial_ad_request_duration = 2; + */ + private $initial_ad_request_duration = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $enabled + * Required. Indicates whether the option to prefetch ad requests is enabled. + * @type \Google\Protobuf\Duration $initial_ad_request_duration + * The duration in seconds of the part of the break to be prefetched. + * This field is only relevant if prefetch is enabled. + * You should set this duration to as long as possible to increase the + * benefits of prefetching, but not longer than the shortest ad break + * expected. For example, for a live event with 30s and 60s ad breaks, the + * initial duration should be set to 30s. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\LiveConfigs::initOnce(); + parent::__construct($data); + } + + /** + * Required. Indicates whether the option to prefetch ad requests is enabled. + * + * Generated from protobuf field bool enabled = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return bool + */ + public function getEnabled() + { + return $this->enabled; + } + + /** + * Required. Indicates whether the option to prefetch ad requests is enabled. + * + * Generated from protobuf field bool enabled = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param bool $var + * @return $this + */ + public function setEnabled($var) + { + GPBUtil::checkBool($var); + $this->enabled = $var; + + return $this; + } + + /** + * The duration in seconds of the part of the break to be prefetched. + * This field is only relevant if prefetch is enabled. + * You should set this duration to as long as possible to increase the + * benefits of prefetching, but not longer than the shortest ad break + * expected. For example, for a live event with 30s and 60s ad breaks, the + * initial duration should be set to 30s. + * + * Generated from protobuf field .google.protobuf.Duration initial_ad_request_duration = 2; + * @return \Google\Protobuf\Duration|null + */ + public function getInitialAdRequestDuration() + { + return $this->initial_ad_request_duration; + } + + public function hasInitialAdRequestDuration() + { + return isset($this->initial_ad_request_duration); + } + + public function clearInitialAdRequestDuration() + { + unset($this->initial_ad_request_duration); + } + + /** + * The duration in seconds of the part of the break to be prefetched. + * This field is only relevant if prefetch is enabled. + * You should set this duration to as long as possible to increase the + * benefits of prefetching, but not longer than the shortest ad break + * expected. For example, for a live event with 30s and 60s ad breaks, the + * initial duration should be set to 30s. + * + * Generated from protobuf field .google.protobuf.Duration initial_ad_request_duration = 2; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setInitialAdRequestDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->initial_ad_request_duration = $var; + + return $this; + } + +} + diff --git a/VideoStitcher/src/V1/Slate.php b/VideoStitcher/src/V1/Slate.php index 26d132423c3..e7066f7bd22 100644 --- a/VideoStitcher/src/V1/Slate.php +++ b/VideoStitcher/src/V1/Slate.php @@ -29,6 +29,12 @@ class Slate extends \Google\Protobuf\Internal\Message * Generated from protobuf field string uri = 2; */ private $uri = ''; + /** + * gam_slate has all the GAM related attributes of slates. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.Slate.GamSlate gam_slate = 3; + */ + private $gam_slate = null; /** * Constructor. @@ -42,6 +48,8 @@ class Slate extends \Google\Protobuf\Internal\Message * @type string $uri * The URI to fetch the source content for the slate. This URI must return an * MP4 video with at least one audio track. + * @type \Google\Cloud\Video\Stitcher\V1\Slate\GamSlate $gam_slate + * gam_slate has all the GAM related attributes of slates. * } */ public function __construct($data = NULL) { @@ -105,5 +113,41 @@ public function setUri($var) return $this; } + /** + * gam_slate has all the GAM related attributes of slates. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.Slate.GamSlate gam_slate = 3; + * @return \Google\Cloud\Video\Stitcher\V1\Slate\GamSlate|null + */ + public function getGamSlate() + { + return $this->gam_slate; + } + + public function hasGamSlate() + { + return isset($this->gam_slate); + } + + public function clearGamSlate() + { + unset($this->gam_slate); + } + + /** + * gam_slate has all the GAM related attributes of slates. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.Slate.GamSlate gam_slate = 3; + * @param \Google\Cloud\Video\Stitcher\V1\Slate\GamSlate $var + * @return $this + */ + public function setGamSlate($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Stitcher\V1\Slate\GamSlate::class); + $this->gam_slate = $var; + + return $this; + } + } diff --git a/VideoStitcher/src/V1/Slate/GamSlate.php b/VideoStitcher/src/V1/Slate/GamSlate.php new file mode 100644 index 00000000000..25221535b43 --- /dev/null +++ b/VideoStitcher/src/V1/Slate/GamSlate.php @@ -0,0 +1,103 @@ +google.cloud.video.stitcher.v1.Slate.GamSlate + */ +class GamSlate extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Ad Manager network code to associate with the live config. + * + * Generated from protobuf field string network_code = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $network_code = ''; + /** + * Output only. The identifier generated for the slate by GAM. + * + * Generated from protobuf field int64 gam_slate_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $gam_slate_id = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $network_code + * Required. Ad Manager network code to associate with the live config. + * @type int|string $gam_slate_id + * Output only. The identifier generated for the slate by GAM. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Video\Stitcher\V1\Slates::initOnce(); + parent::__construct($data); + } + + /** + * Required. Ad Manager network code to associate with the live config. + * + * Generated from protobuf field string network_code = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getNetworkCode() + { + return $this->network_code; + } + + /** + * Required. Ad Manager network code to associate with the live config. + * + * Generated from protobuf field string network_code = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setNetworkCode($var) + { + GPBUtil::checkString($var, True); + $this->network_code = $var; + + return $this; + } + + /** + * Output only. The identifier generated for the slate by GAM. + * + * Generated from protobuf field int64 gam_slate_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int|string + */ + public function getGamSlateId() + { + return $this->gam_slate_id; + } + + /** + * Output only. The identifier generated for the slate by GAM. + * + * Generated from protobuf field int64 gam_slate_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int|string $var + * @return $this + */ + public function setGamSlateId($var) + { + GPBUtil::checkInt64($var); + $this->gam_slate_id = $var; + + return $this; + } + +} + + diff --git a/VideoStitcher/src/V1/VideoStitcherServiceGrpcClient.php b/VideoStitcher/src/V1/VideoStitcherServiceGrpcClient.php index 01f027f65a7..b366912d366 100644 --- a/VideoStitcher/src/V1/VideoStitcherServiceGrpcClient.php +++ b/VideoStitcher/src/V1/VideoStitcherServiceGrpcClient.php @@ -47,7 +47,7 @@ public function CreateCdnKey(\Google\Cloud\Video\Stitcher\V1\CreateCdnKeyRequest $metadata = [], $options = []) { return $this->_simpleRequest('/google.cloud.video.stitcher.v1.VideoStitcherService/CreateCdnKey', $argument, - ['\Google\Cloud\Video\Stitcher\V1\CdnKey', 'decode'], + ['\Google\LongRunning\Operation', 'decode'], $metadata, $options); } @@ -92,7 +92,7 @@ public function DeleteCdnKey(\Google\Cloud\Video\Stitcher\V1\DeleteCdnKeyRequest $metadata = [], $options = []) { return $this->_simpleRequest('/google.cloud.video.stitcher.v1.VideoStitcherService/DeleteCdnKey', $argument, - ['\Google\Protobuf\GPBEmpty', 'decode'], + ['\Google\LongRunning\Operation', 'decode'], $metadata, $options); } @@ -108,7 +108,7 @@ public function UpdateCdnKey(\Google\Cloud\Video\Stitcher\V1\UpdateCdnKeyRequest $metadata = [], $options = []) { return $this->_simpleRequest('/google.cloud.video.stitcher.v1.VideoStitcherService/UpdateCdnKey', $argument, - ['\Google\Cloud\Video\Stitcher\V1\CdnKey', 'decode'], + ['\Google\LongRunning\Operation', 'decode'], $metadata, $options); } @@ -246,7 +246,7 @@ public function CreateSlate(\Google\Cloud\Video\Stitcher\V1\CreateSlateRequest $ $metadata = [], $options = []) { return $this->_simpleRequest('/google.cloud.video.stitcher.v1.VideoStitcherService/CreateSlate', $argument, - ['\Google\Cloud\Video\Stitcher\V1\Slate', 'decode'], + ['\Google\LongRunning\Operation', 'decode'], $metadata, $options); } @@ -291,7 +291,7 @@ public function UpdateSlate(\Google\Cloud\Video\Stitcher\V1\UpdateSlateRequest $ $metadata = [], $options = []) { return $this->_simpleRequest('/google.cloud.video.stitcher.v1.VideoStitcherService/UpdateSlate', $argument, - ['\Google\Cloud\Video\Stitcher\V1\Slate', 'decode'], + ['\Google\LongRunning\Operation', 'decode'], $metadata, $options); } @@ -306,7 +306,7 @@ public function DeleteSlate(\Google\Cloud\Video\Stitcher\V1\DeleteSlateRequest $ $metadata = [], $options = []) { return $this->_simpleRequest('/google.cloud.video.stitcher.v1.VideoStitcherService/DeleteSlate', $argument, - ['\Google\Protobuf\GPBEmpty', 'decode'], + ['\Google\LongRunning\Operation', 'decode'], $metadata, $options); } @@ -340,4 +340,67 @@ public function GetLiveSession(\Google\Cloud\Video\Stitcher\V1\GetLiveSessionReq $metadata, $options); } + /** + * Registers the live config with the provided unique ID in + * the specified region. + * @param \Google\Cloud\Video\Stitcher\V1\CreateLiveConfigRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function CreateLiveConfig(\Google\Cloud\Video\Stitcher\V1\CreateLiveConfigRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.video.stitcher.v1.VideoStitcherService/CreateLiveConfig', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + + /** + * Lists all live configs managed by the Video Stitcher that + * belong to the specified project and region. + * @param \Google\Cloud\Video\Stitcher\V1\ListLiveConfigsRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ListLiveConfigs(\Google\Cloud\Video\Stitcher\V1\ListLiveConfigsRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.video.stitcher.v1.VideoStitcherService/ListLiveConfigs', + $argument, + ['\Google\Cloud\Video\Stitcher\V1\ListLiveConfigsResponse', 'decode'], + $metadata, $options); + } + + /** + * Returns the specified live config managed by the Video + * Stitcher service. + * @param \Google\Cloud\Video\Stitcher\V1\GetLiveConfigRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function GetLiveConfig(\Google\Cloud\Video\Stitcher\V1\GetLiveConfigRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.video.stitcher.v1.VideoStitcherService/GetLiveConfig', + $argument, + ['\Google\Cloud\Video\Stitcher\V1\LiveConfig', 'decode'], + $metadata, $options); + } + + /** + * Deletes the specified live config. + * @param \Google\Cloud\Video\Stitcher\V1\DeleteLiveConfigRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function DeleteLiveConfig(\Google\Cloud\Video\Stitcher\V1\DeleteLiveConfigRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.video.stitcher.v1.VideoStitcherService/DeleteLiveConfig', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + } diff --git a/VideoStitcher/src/V1/VodSession.php b/VideoStitcher/src/V1/VodSession.php index e78cdb61e77..3487dcee454 100644 --- a/VideoStitcher/src/V1/VodSession.php +++ b/VideoStitcher/src/V1/VodSession.php @@ -9,7 +9,7 @@ use Google\Protobuf\Internal\GPBUtil; /** - * Metadata for a VOD session. + * Metadata for a VOD session. The session expires 4 hours after its creation. * * Generated from protobuf message google.cloud.video.stitcher.v1.VodSession */ @@ -60,17 +60,6 @@ class VodSession extends \Google\Protobuf\Internal\Message * Generated from protobuf field map ad_tag_macro_map = 7; */ private $ad_tag_macro_map; - /** - * Indicates whether client side ad tracking is enabled. If client - * side ad tracking is enabled, then the client player is expected - * to trigger playback and activity events itself. - * If this is set to false, server side ad tracking is enabled, - * causing the Video Stitcher service will trigger playback events - * on behalf of the client player. - * - * Generated from protobuf field bool client_ad_tracking = 8; - */ - private $client_ad_tracking = false; /** * Additional options that affect the output of the manifest. * @@ -83,6 +72,21 @@ class VodSession extends \Google\Protobuf\Internal\Message * Generated from protobuf field string asset_id = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ private $asset_id = ''; + /** + * Required. Determines how the ad should be tracked. If + * [gam_vod_config][google.cloud.video.stitcher.v1.VodSession.gam_vod_config] + * is set, the value must be `CLIENT` because the IMA SDK handles ad tracking. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.AdTracking ad_tracking = 11 [(.google.api.field_behavior) = REQUIRED]; + */ + private $ad_tracking = 0; + /** + * This has the Google Ad Manager (GAM) related metadata in the case where GAM + * is used for the ads. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.GamVodConfig gam_vod_config = 12; + */ + private $gam_vod_config = null; /** * Constructor. @@ -111,17 +115,17 @@ class VodSession extends \Google\Protobuf\Internal\Message * Ad tag macro map: `{"geoId": "123"}` * Fully qualified ad tag: * `"`https://doubleclick.google.com/ad/1?geo_id=123"` - * @type bool $client_ad_tracking - * Indicates whether client side ad tracking is enabled. If client - * side ad tracking is enabled, then the client player is expected - * to trigger playback and activity events itself. - * If this is set to false, server side ad tracking is enabled, - * causing the Video Stitcher service will trigger playback events - * on behalf of the client player. * @type \Google\Cloud\Video\Stitcher\V1\ManifestOptions $manifest_options * Additional options that affect the output of the manifest. * @type string $asset_id * Output only. The generated ID of the VodSession's source media. + * @type int $ad_tracking + * Required. Determines how the ad should be tracked. If + * [gam_vod_config][google.cloud.video.stitcher.v1.VodSession.gam_vod_config] + * is set, the value must be `CLIENT` because the IMA SDK handles ad tracking. + * @type \Google\Cloud\Video\Stitcher\V1\GamVodConfig $gam_vod_config + * This has the Google Ad Manager (GAM) related metadata in the case where GAM + * is used for the ads. * } */ public function __construct($data = NULL) { @@ -313,42 +317,6 @@ public function setAdTagMacroMap($var) return $this; } - /** - * Indicates whether client side ad tracking is enabled. If client - * side ad tracking is enabled, then the client player is expected - * to trigger playback and activity events itself. - * If this is set to false, server side ad tracking is enabled, - * causing the Video Stitcher service will trigger playback events - * on behalf of the client player. - * - * Generated from protobuf field bool client_ad_tracking = 8; - * @return bool - */ - public function getClientAdTracking() - { - return $this->client_ad_tracking; - } - - /** - * Indicates whether client side ad tracking is enabled. If client - * side ad tracking is enabled, then the client player is expected - * to trigger playback and activity events itself. - * If this is set to false, server side ad tracking is enabled, - * causing the Video Stitcher service will trigger playback events - * on behalf of the client player. - * - * Generated from protobuf field bool client_ad_tracking = 8; - * @param bool $var - * @return $this - */ - public function setClientAdTracking($var) - { - GPBUtil::checkBool($var); - $this->client_ad_tracking = $var; - - return $this; - } - /** * Additional options that affect the output of the manifest. * @@ -411,5 +379,73 @@ public function setAssetId($var) return $this; } + /** + * Required. Determines how the ad should be tracked. If + * [gam_vod_config][google.cloud.video.stitcher.v1.VodSession.gam_vod_config] + * is set, the value must be `CLIENT` because the IMA SDK handles ad tracking. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.AdTracking ad_tracking = 11 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getAdTracking() + { + return $this->ad_tracking; + } + + /** + * Required. Determines how the ad should be tracked. If + * [gam_vod_config][google.cloud.video.stitcher.v1.VodSession.gam_vod_config] + * is set, the value must be `CLIENT` because the IMA SDK handles ad tracking. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.AdTracking ad_tracking = 11 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setAdTracking($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Video\Stitcher\V1\AdTracking::class); + $this->ad_tracking = $var; + + return $this; + } + + /** + * This has the Google Ad Manager (GAM) related metadata in the case where GAM + * is used for the ads. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.GamVodConfig gam_vod_config = 12; + * @return \Google\Cloud\Video\Stitcher\V1\GamVodConfig|null + */ + public function getGamVodConfig() + { + return $this->gam_vod_config; + } + + public function hasGamVodConfig() + { + return isset($this->gam_vod_config); + } + + public function clearGamVodConfig() + { + unset($this->gam_vod_config); + } + + /** + * This has the Google Ad Manager (GAM) related metadata in the case where GAM + * is used for the ads. + * + * Generated from protobuf field .google.cloud.video.stitcher.v1.GamVodConfig gam_vod_config = 12; + * @param \Google\Cloud\Video\Stitcher\V1\GamVodConfig $var + * @return $this + */ + public function setGamVodConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Video\Stitcher\V1\GamVodConfig::class); + $this->gam_vod_config = $var; + + return $this; + } + } diff --git a/VideoStitcher/src/V1/gapic_metadata.json b/VideoStitcher/src/V1/gapic_metadata.json index 4e4b277777e..7765f6f837a 100644 --- a/VideoStitcher/src/V1/gapic_metadata.json +++ b/VideoStitcher/src/V1/gapic_metadata.json @@ -15,6 +15,11 @@ "createCdnKey" ] }, + "CreateLiveConfig": { + "methods": [ + "createLiveConfig" + ] + }, "CreateLiveSession": { "methods": [ "createLiveSession" @@ -35,6 +40,11 @@ "deleteCdnKey" ] }, + "DeleteLiveConfig": { + "methods": [ + "deleteLiveConfig" + ] + }, "DeleteSlate": { "methods": [ "deleteSlate" @@ -50,6 +60,11 @@ "getLiveAdTagDetail" ] }, + "GetLiveConfig": { + "methods": [ + "getLiveConfig" + ] + }, "GetLiveSession": { "methods": [ "getLiveSession" @@ -85,6 +100,11 @@ "listLiveAdTagDetails" ] }, + "ListLiveConfigs": { + "methods": [ + "listLiveConfigs" + ] + }, "ListSlates": { "methods": [ "listSlates" diff --git a/VideoStitcher/src/V1/resources/video_stitcher_service_client_config.json b/VideoStitcher/src/V1/resources/video_stitcher_service_client_config.json index ed339d7f014..46f02d7398b 100644 --- a/VideoStitcher/src/V1/resources/video_stitcher_service_client_config.json +++ b/VideoStitcher/src/V1/resources/video_stitcher_service_client_config.json @@ -43,6 +43,11 @@ "retry_codes_name": "no_retry_1_codes", "retry_params_name": "no_retry_1_params" }, + "CreateLiveConfig": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, "CreateLiveSession": { "timeout_millis": 60000, "retry_codes_name": "no_retry_1_codes", @@ -63,6 +68,11 @@ "retry_codes_name": "no_retry_1_codes", "retry_params_name": "no_retry_1_params" }, + "DeleteLiveConfig": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, "DeleteSlate": { "timeout_millis": 60000, "retry_codes_name": "no_retry_1_codes", @@ -78,6 +88,11 @@ "retry_codes_name": "no_retry_1_codes", "retry_params_name": "no_retry_1_params" }, + "GetLiveConfig": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, "GetLiveSession": { "timeout_millis": 60000, "retry_codes_name": "no_retry_1_codes", @@ -113,6 +128,11 @@ "retry_codes_name": "no_retry_1_codes", "retry_params_name": "no_retry_1_params" }, + "ListLiveConfigs": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, "ListSlates": { "timeout_millis": 60000, "retry_codes_name": "no_retry_1_codes", diff --git a/VideoStitcher/src/V1/resources/video_stitcher_service_descriptor_config.php b/VideoStitcher/src/V1/resources/video_stitcher_service_descriptor_config.php index db022b7df05..dfd44255454 100644 --- a/VideoStitcher/src/V1/resources/video_stitcher_service_descriptor_config.php +++ b/VideoStitcher/src/V1/resources/video_stitcher_service_descriptor_config.php @@ -3,6 +3,86 @@ return [ 'interfaces' => [ 'google.cloud.video.stitcher.v1.VideoStitcherService' => [ + 'CreateCdnKey' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Video\Stitcher\V1\CdnKey', + 'metadataReturnType' => '\Google\Cloud\Video\Stitcher\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'CreateLiveConfig' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Video\Stitcher\V1\LiveConfig', + 'metadataReturnType' => '\Google\Cloud\Video\Stitcher\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'CreateSlate' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Video\Stitcher\V1\Slate', + 'metadataReturnType' => '\Google\Cloud\Video\Stitcher\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'DeleteCdnKey' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\Video\Stitcher\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'DeleteLiveConfig' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\Video\Stitcher\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'DeleteSlate' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\Video\Stitcher\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'UpdateCdnKey' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Video\Stitcher\V1\CdnKey', + 'metadataReturnType' => '\Google\Cloud\Video\Stitcher\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'UpdateSlate' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Video\Stitcher\V1\Slate', + 'metadataReturnType' => '\Google\Cloud\Video\Stitcher\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], 'ListCdnKeys' => [ 'pageStreaming' => [ 'requestPageTokenGetMethod' => 'getPageToken', @@ -23,6 +103,16 @@ 'resourcesGetMethod' => 'getLiveAdTagDetails', ], ], + 'ListLiveConfigs' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLiveConfigs', + ], + ], 'ListSlates' => [ 'pageStreaming' => [ 'requestPageTokenGetMethod' => 'getPageToken', diff --git a/VideoStitcher/src/V1/resources/video_stitcher_service_rest_client_config.php b/VideoStitcher/src/V1/resources/video_stitcher_service_rest_client_config.php index 062e13ea928..d6dd5bc244c 100644 --- a/VideoStitcher/src/V1/resources/video_stitcher_service_rest_client_config.php +++ b/VideoStitcher/src/V1/resources/video_stitcher_service_rest_client_config.php @@ -18,6 +18,21 @@ 'cdn_key_id', ], ], + 'CreateLiveConfig' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/liveConfigs', + 'body' => 'live_config', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'live_config_id', + ], + ], 'CreateLiveSession' => [ 'method' => 'post', 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/liveSessions', @@ -68,6 +83,17 @@ ], ], ], + 'DeleteLiveConfig' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/liveConfigs/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], 'DeleteSlate' => [ 'method' => 'delete', 'uriTemplate' => '/v1/{name=projects/*/locations/*/slates/*}', @@ -101,6 +127,17 @@ ], ], ], + 'GetLiveConfig' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/liveConfigs/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], 'GetLiveSession' => [ 'method' => 'get', 'uriTemplate' => '/v1/{name=projects/*/locations/*/liveSessions/*}', @@ -178,6 +215,17 @@ ], ], ], + 'ListLiveConfigs' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/liveConfigs', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], 'ListSlates' => [ 'method' => 'get', 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/slates', @@ -244,6 +292,53 @@ ], ], ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}:cancel', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], ], 'numericEnums' => true, ]; diff --git a/VideoStitcher/tests/Unit/V1/VideoStitcherServiceClientTest.php b/VideoStitcher/tests/Unit/V1/VideoStitcherServiceClientTest.php index a59a2dd868a..3c8b0a25e5d 100644 --- a/VideoStitcher/tests/Unit/V1/VideoStitcherServiceClientTest.php +++ b/VideoStitcher/tests/Unit/V1/VideoStitcherServiceClientTest.php @@ -24,21 +24,28 @@ use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; +use Google\ApiCore\LongRunning\OperationsClient; use Google\ApiCore\Testing\GeneratedTest; use Google\ApiCore\Testing\MockTransport; +use Google\Cloud\Video\Stitcher\V1\AdTracking; use Google\Cloud\Video\Stitcher\V1\CdnKey; use Google\Cloud\Video\Stitcher\V1\ListCdnKeysResponse; use Google\Cloud\Video\Stitcher\V1\ListLiveAdTagDetailsResponse; +use Google\Cloud\Video\Stitcher\V1\ListLiveConfigsResponse; use Google\Cloud\Video\Stitcher\V1\ListSlatesResponse; use Google\Cloud\Video\Stitcher\V1\ListVodAdTagDetailsResponse; use Google\Cloud\Video\Stitcher\V1\ListVodStitchDetailsResponse; use Google\Cloud\Video\Stitcher\V1\LiveAdTagDetail; +use Google\Cloud\Video\Stitcher\V1\LiveConfig; use Google\Cloud\Video\Stitcher\V1\LiveSession; use Google\Cloud\Video\Stitcher\V1\Slate; use Google\Cloud\Video\Stitcher\V1\VideoStitcherServiceClient; use Google\Cloud\Video\Stitcher\V1\VodAdTagDetail; use Google\Cloud\Video\Stitcher\V1\VodSession; use Google\Cloud\Video\Stitcher\V1\VodStitchDetail; +use Google\LongRunning\GetOperationRequest; +use Google\LongRunning\Operation; +use Google\Protobuf\Any; use Google\Protobuf\FieldMask; use Google\Protobuf\GPBEmpty; use Google\Rpc\Code; @@ -75,71 +82,271 @@ private function createClient(array $options = []) /** @test */ public function createCdnKeyTest() { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); $transport = $this->createTransport(); $gapicClient = $this->createClient([ 'transport' => $transport, + 'operationsClient' => $operationsClient, ]); $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createCdnKeyTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); $name = 'name3373707'; $hostname = 'hostname-299803597'; $expectedResponse = new CdnKey(); $expectedResponse->setName($name); $expectedResponse->setHostname($hostname); - $transport->addResponse($expectedResponse); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createCdnKeyTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); $cdnKey = new CdnKey(); $cdnKeyId = 'cdnKeyId1672586061'; $response = $gapicClient->createCdnKey($formattedParent, $cdnKey, $cdnKeyId); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/CreateCdnKey', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/CreateCdnKey', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getCdnKey(); + $actualValue = $actualApiRequestObject->getCdnKey(); $this->assertProtobufEquals($cdnKey, $actualValue); - $actualValue = $actualRequestObject->getCdnKeyId(); + $actualValue = $actualApiRequestObject->getCdnKeyId(); $this->assertProtobufEquals($cdnKeyId, $actualValue); - $this->assertTrue($transport->isExhausted()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createCdnKeyTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); } /** @test */ public function createCdnKeyExceptionTest() { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); $transport = $this->createTransport(); $gapicClient = $this->createClient([ 'transport' => $transport, + 'operationsClient' => $operationsClient, ]); $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createCdnKeyTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ + $expectedExceptionMessage = json_encode([ 'message' => 'internal error', 'code' => Code::DATA_LOSS, 'status' => 'DATA_LOSS', 'details' => [], ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); + $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); $cdnKey = new CdnKey(); $cdnKeyId = 'cdnKeyId1672586061'; + $response = $gapicClient->createCdnKey($formattedParent, $cdnKey, $cdnKeyId); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createCdnKeyTest'); try { - $gapicClient->createCdnKey($formattedParent, $cdnKey, $cdnKeyId); - // If the $gapicClient method call did not throw, fail the test + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test $this->fail('Expected an ApiException, but no exception was thrown.'); } catch (ApiException $ex) { $this->assertEquals($status->code, $ex->getCode()); $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); } - // Call popReceivedCalls to ensure the stub is exhausted + // Call popReceivedCalls to ensure the stubs are exhausted $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createLiveConfigTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createLiveConfigTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $sourceUri = 'sourceUri-1111107768'; + $adTagUri = 'adTagUri-1429194965'; + $defaultSlate = 'defaultSlate1316218395'; + $expectedResponse = new LiveConfig(); + $expectedResponse->setName($name); + $expectedResponse->setSourceUri($sourceUri); + $expectedResponse->setAdTagUri($adTagUri); + $expectedResponse->setDefaultSlate($defaultSlate); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createLiveConfigTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $liveConfigId = 'liveConfigId-558267483'; + $liveConfig = new LiveConfig(); + $liveConfigSourceUri = 'liveConfigSourceUri-20192349'; + $liveConfig->setSourceUri($liveConfigSourceUri); + $liveConfigAdTracking = AdTracking::AD_TRACKING_UNSPECIFIED; + $liveConfig->setAdTracking($liveConfigAdTracking); + $response = $gapicClient->createLiveConfig($formattedParent, $liveConfigId, $liveConfig); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/CreateLiveConfig', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getLiveConfigId(); + $this->assertProtobufEquals($liveConfigId, $actualValue); + $actualValue = $actualApiRequestObject->getLiveConfig(); + $this->assertProtobufEquals($liveConfig, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createLiveConfigTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createLiveConfigExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createLiveConfigTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $liveConfigId = 'liveConfigId-558267483'; + $liveConfig = new LiveConfig(); + $liveConfigSourceUri = 'liveConfigSourceUri-20192349'; + $liveConfig->setSourceUri($liveConfigSourceUri); + $liveConfigAdTracking = AdTracking::AD_TRACKING_UNSPECIFIED; + $liveConfig->setAdTracking($liveConfigAdTracking); + $response = $gapicClient->createLiveConfig($formattedParent, $liveConfigId, $liveConfig); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createLiveConfigTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); } /** @test */ @@ -153,23 +360,17 @@ public function createLiveSessionTest() // Mock response $name = 'name3373707'; $playUri = 'playUri1879098849'; - $sourceUri = 'sourceUri-1111107768'; - $defaultAdTagId = 'defaultAdTagId1910479614'; - $clientAdTracking = false; - $defaultSlateId = 'defaultSlateId-1589112385'; - $streamId = 'streamId-315624902'; + $liveConfig = 'liveConfig-1498665483'; $expectedResponse = new LiveSession(); $expectedResponse->setName($name); $expectedResponse->setPlayUri($playUri); - $expectedResponse->setSourceUri($sourceUri); - $expectedResponse->setDefaultAdTagId($defaultAdTagId); - $expectedResponse->setClientAdTracking($clientAdTracking); - $expectedResponse->setDefaultSlateId($defaultSlateId); - $expectedResponse->setStreamId($streamId); + $expectedResponse->setLiveConfig($liveConfig); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $gapicClient->liveSessionName('[PROJECT]', '[LOCATION]', '[LIVE_SESSION]'); $liveSession = new LiveSession(); + $liveSessionLiveConfig = $gapicClient->liveConfigName('[PROJECT]', '[LOCATION]', '[LIVE_CONFIG]'); + $liveSession->setLiveConfig($liveSessionLiveConfig); $response = $gapicClient->createLiveSession($formattedParent, $liveSession); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -205,6 +406,8 @@ public function createLiveSessionExceptionTest() // Mock request $formattedParent = $gapicClient->liveSessionName('[PROJECT]', '[LOCATION]', '[LIVE_SESSION]'); $liveSession = new LiveSession(); + $liveSessionLiveConfig = $gapicClient->liveConfigName('[PROJECT]', '[LOCATION]', '[LIVE_CONFIG]'); + $liveSession->setLiveConfig($liveSessionLiveConfig); try { $gapicClient->createLiveSession($formattedParent, $liveSession); // If the $gapicClient method call did not throw, fail the test @@ -221,71 +424,130 @@ public function createLiveSessionExceptionTest() /** @test */ public function createSlateTest() { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); $transport = $this->createTransport(); $gapicClient = $this->createClient([ 'transport' => $transport, + 'operationsClient' => $operationsClient, ]); $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createSlateTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); $name = 'name3373707'; $uri = 'uri116076'; $expectedResponse = new Slate(); $expectedResponse->setName($name); $expectedResponse->setUri($uri); - $transport->addResponse($expectedResponse); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createSlateTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); $slateId = 'slateId-1486865023'; $slate = new Slate(); $response = $gapicClient->createSlate($formattedParent, $slateId, $slate); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/CreateSlate', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/CreateSlate', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getSlateId(); + $actualValue = $actualApiRequestObject->getSlateId(); $this->assertProtobufEquals($slateId, $actualValue); - $actualValue = $actualRequestObject->getSlate(); + $actualValue = $actualApiRequestObject->getSlate(); $this->assertProtobufEquals($slate, $actualValue); - $this->assertTrue($transport->isExhausted()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createSlateTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); } /** @test */ public function createSlateExceptionTest() { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); $transport = $this->createTransport(); $gapicClient = $this->createClient([ 'transport' => $transport, + 'operationsClient' => $operationsClient, ]); $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createSlateTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ + $expectedExceptionMessage = json_encode([ 'message' => 'internal error', 'code' => Code::DATA_LOSS, 'status' => 'DATA_LOSS', 'details' => [], ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); + $operationsTransport->addResponse(null, $status); // Mock request $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); $slateId = 'slateId-1486865023'; $slate = new Slate(); + $response = $gapicClient->createSlate($formattedParent, $slateId, $slate); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createSlateTest'); try { - $gapicClient->createSlate($formattedParent, $slateId, $slate); - // If the $gapicClient method call did not throw, fail the test + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test $this->fail('Expected an ApiException, but no exception was thrown.'); } catch (ApiException $ex) { $this->assertEquals($status->code, $ex->getCode()); $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); } - // Call popReceivedCalls to ensure the stub is exhausted + // Call popReceivedCalls to ensure the stubs are exhausted $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); } /** @test */ @@ -301,14 +563,12 @@ public function createVodSessionTest() $playUri = 'playUri1879098849'; $sourceUri = 'sourceUri-1111107768'; $adTagUri = 'adTagUri-1429194965'; - $clientAdTracking = false; $assetId = 'assetId-373202742'; $expectedResponse = new VodSession(); $expectedResponse->setName($name); $expectedResponse->setPlayUri($playUri); $expectedResponse->setSourceUri($sourceUri); $expectedResponse->setAdTagUri($adTagUri); - $expectedResponse->setClientAdTracking($clientAdTracking); $expectedResponse->setAssetId($assetId); $transport->addResponse($expectedResponse); // Mock request @@ -318,6 +578,8 @@ public function createVodSessionTest() $vodSession->setSourceUri($vodSessionSourceUri); $vodSessionAdTagUri = 'vodSessionAdTagUri-600567328'; $vodSession->setAdTagUri($vodSessionAdTagUri); + $vodSessionAdTracking = AdTracking::AD_TRACKING_UNSPECIFIED; + $vodSession->setAdTracking($vodSessionAdTracking); $response = $gapicClient->createVodSession($formattedParent, $vodSession); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -357,6 +619,8 @@ public function createVodSessionExceptionTest() $vodSession->setSourceUri($vodSessionSourceUri); $vodSessionAdTagUri = 'vodSessionAdTagUri-600567328'; $vodSession->setAdTagUri($vodSessionAdTagUri); + $vodSessionAdTracking = AdTracking::AD_TRACKING_UNSPECIFIED; + $vodSession->setAdTracking($vodSessionAdTracking); try { $gapicClient->createVodSession($formattedParent, $vodSession); // If the $gapicClient method call did not throw, fail the test @@ -373,115 +637,352 @@ public function createVodSessionExceptionTest() /** @test */ public function deleteCdnKeyTest() { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); $transport = $this->createTransport(); $gapicClient = $this->createClient([ 'transport' => $transport, + 'operationsClient' => $operationsClient, ]); $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteCdnKeyTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteCdnKeyTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->cdnKeyName('[PROJECT]', '[LOCATION]', '[CDN_KEY]'); - $gapicClient->deleteCdnKey($formattedName); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/DeleteCdnKey', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); + $response = $gapicClient->deleteCdnKey($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/DeleteCdnKey', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteCdnKeyTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); } /** @test */ public function deleteCdnKeyExceptionTest() { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); $transport = $this->createTransport(); $gapicClient = $this->createClient([ 'transport' => $transport, + 'operationsClient' => $operationsClient, ]); $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteCdnKeyTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ + $expectedExceptionMessage = json_encode([ 'message' => 'internal error', 'code' => Code::DATA_LOSS, 'status' => 'DATA_LOSS', 'details' => [], ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); + $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->cdnKeyName('[PROJECT]', '[LOCATION]', '[CDN_KEY]'); + $response = $gapicClient->deleteCdnKey($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteCdnKeyTest'); try { - $gapicClient->deleteCdnKey($formattedName); - // If the $gapicClient method call did not throw, fail the test + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test $this->fail('Expected an ApiException, but no exception was thrown.'); } catch (ApiException $ex) { $this->assertEquals($status->code, $ex->getCode()); $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); } - // Call popReceivedCalls to ensure the stub is exhausted + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteLiveConfigTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteLiveConfigTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteLiveConfigTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->liveConfigName('[PROJECT]', '[LOCATION]', '[LIVE_CONFIG]'); + $response = $gapicClient->deleteLiveConfig($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/DeleteLiveConfig', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteLiveConfigTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteLiveConfigExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteLiveConfigTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->liveConfigName('[PROJECT]', '[LOCATION]', '[LIVE_CONFIG]'); + $response = $gapicClient->deleteLiveConfig($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteLiveConfigTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); } /** @test */ public function deleteSlateTest() { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); $transport = $this->createTransport(); $gapicClient = $this->createClient([ 'transport' => $transport, + 'operationsClient' => $operationsClient, ]); $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteSlateTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteSlateTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->slateName('[PROJECT]', '[LOCATION]', '[SLATE]'); - $gapicClient->deleteSlate($formattedName); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/DeleteSlate', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); + $response = $gapicClient->deleteSlate($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/DeleteSlate', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteSlateTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); } /** @test */ public function deleteSlateExceptionTest() { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); $transport = $this->createTransport(); $gapicClient = $this->createClient([ 'transport' => $transport, + 'operationsClient' => $operationsClient, ]); $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteSlateTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ + $expectedExceptionMessage = json_encode([ 'message' => 'internal error', 'code' => Code::DATA_LOSS, 'status' => 'DATA_LOSS', 'details' => [], ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); + $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->slateName('[PROJECT]', '[LOCATION]', '[SLATE]'); + $response = $gapicClient->deleteSlate($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteSlateTest'); try { - $gapicClient->deleteSlate($formattedName); - // If the $gapicClient method call did not throw, fail the test + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test $this->fail('Expected an ApiException, but no exception was thrown.'); } catch (ApiException $ex) { $this->assertEquals($status->code, $ex->getCode()); $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); } - // Call popReceivedCalls to ensure the stub is exhausted + // Call popReceivedCalls to ensure the stubs are exhausted $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); } /** @test */ @@ -606,6 +1107,72 @@ public function getLiveAdTagDetailExceptionTest() $this->assertTrue($transport->isExhausted()); } + /** @test */ + public function getLiveConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $sourceUri = 'sourceUri-1111107768'; + $adTagUri = 'adTagUri-1429194965'; + $defaultSlate = 'defaultSlate1316218395'; + $expectedResponse = new LiveConfig(); + $expectedResponse->setName($name2); + $expectedResponse->setSourceUri($sourceUri); + $expectedResponse->setAdTagUri($adTagUri); + $expectedResponse->setDefaultSlate($defaultSlate); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->liveConfigName('[PROJECT]', '[LOCATION]', '[LIVE_CONFIG]'); + $response = $gapicClient->getLiveConfig($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/GetLiveConfig', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLiveConfigExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->liveConfigName('[PROJECT]', '[LOCATION]', '[LIVE_CONFIG]'); + try { + $gapicClient->getLiveConfig($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + /** @test */ public function getLiveSessionTest() { @@ -617,19 +1184,11 @@ public function getLiveSessionTest() // Mock response $name2 = 'name2-1052831874'; $playUri = 'playUri1879098849'; - $sourceUri = 'sourceUri-1111107768'; - $defaultAdTagId = 'defaultAdTagId1910479614'; - $clientAdTracking = false; - $defaultSlateId = 'defaultSlateId-1589112385'; - $streamId = 'streamId-315624902'; + $liveConfig = 'liveConfig-1498665483'; $expectedResponse = new LiveSession(); $expectedResponse->setName($name2); $expectedResponse->setPlayUri($playUri); - $expectedResponse->setSourceUri($sourceUri); - $expectedResponse->setDefaultAdTagId($defaultAdTagId); - $expectedResponse->setClientAdTracking($clientAdTracking); - $expectedResponse->setDefaultSlateId($defaultSlateId); - $expectedResponse->setStreamId($streamId); + $expectedResponse->setLiveConfig($liveConfig); $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->liveSessionName('[PROJECT]', '[LOCATION]', '[LIVE_SESSION]'); @@ -813,14 +1372,12 @@ public function getVodSessionTest() $playUri = 'playUri1879098849'; $sourceUri = 'sourceUri-1111107768'; $adTagUri = 'adTagUri-1429194965'; - $clientAdTracking = false; $assetId = 'assetId-373202742'; $expectedResponse = new VodSession(); $expectedResponse->setName($name2); $expectedResponse->setPlayUri($playUri); $expectedResponse->setSourceUri($sourceUri); $expectedResponse->setAdTagUri($adTagUri); - $expectedResponse->setClientAdTracking($clientAdTracking); $expectedResponse->setAssetId($assetId); $transport->addResponse($expectedResponse); // Mock request @@ -1066,6 +1623,74 @@ public function listLiveAdTagDetailsExceptionTest() $this->assertTrue($transport->isExhausted()); } + /** @test */ + public function listLiveConfigsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $liveConfigsElement = new LiveConfig(); + $liveConfigs = [ + $liveConfigsElement, + ]; + $expectedResponse = new ListLiveConfigsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLiveConfigs($liveConfigs); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listLiveConfigs($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLiveConfigs()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/ListLiveConfigs', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLiveConfigsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listLiveConfigs($formattedParent); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + /** @test */ public function listSlatesTest() { @@ -1273,132 +1898,250 @@ public function listVodStitchDetailsExceptionTest() /** @test */ public function updateCdnKeyTest() { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); $transport = $this->createTransport(); $gapicClient = $this->createClient([ 'transport' => $transport, + 'operationsClient' => $operationsClient, ]); $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateCdnKeyTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); $name = 'name3373707'; $hostname = 'hostname-299803597'; $expectedResponse = new CdnKey(); $expectedResponse->setName($name); $expectedResponse->setHostname($hostname); - $transport->addResponse($expectedResponse); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateCdnKeyTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); // Mock request $cdnKey = new CdnKey(); $updateMask = new FieldMask(); $response = $gapicClient->updateCdnKey($cdnKey, $updateMask); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/UpdateCdnKey', $actualFuncCall); - $actualValue = $actualRequestObject->getCdnKey(); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/UpdateCdnKey', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getCdnKey(); $this->assertProtobufEquals($cdnKey, $actualValue); - $actualValue = $actualRequestObject->getUpdateMask(); + $actualValue = $actualApiRequestObject->getUpdateMask(); $this->assertProtobufEquals($updateMask, $actualValue); - $this->assertTrue($transport->isExhausted()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateCdnKeyTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); } /** @test */ public function updateCdnKeyExceptionTest() { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); $transport = $this->createTransport(); $gapicClient = $this->createClient([ 'transport' => $transport, + 'operationsClient' => $operationsClient, ]); $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateCdnKeyTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ + $expectedExceptionMessage = json_encode([ 'message' => 'internal error', 'code' => Code::DATA_LOSS, 'status' => 'DATA_LOSS', 'details' => [], ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); + $operationsTransport->addResponse(null, $status); // Mock request $cdnKey = new CdnKey(); $updateMask = new FieldMask(); + $response = $gapicClient->updateCdnKey($cdnKey, $updateMask); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateCdnKeyTest'); try { - $gapicClient->updateCdnKey($cdnKey, $updateMask); - // If the $gapicClient method call did not throw, fail the test + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test $this->fail('Expected an ApiException, but no exception was thrown.'); } catch (ApiException $ex) { $this->assertEquals($status->code, $ex->getCode()); $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); } - // Call popReceivedCalls to ensure the stub is exhausted + // Call popReceivedCalls to ensure the stubs are exhausted $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); } /** @test */ public function updateSlateTest() { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); $transport = $this->createTransport(); $gapicClient = $this->createClient([ 'transport' => $transport, + 'operationsClient' => $operationsClient, ]); $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateSlateTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); $name = 'name3373707'; $uri = 'uri116076'; $expectedResponse = new Slate(); $expectedResponse->setName($name); $expectedResponse->setUri($uri); - $transport->addResponse($expectedResponse); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateSlateTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); // Mock request $slate = new Slate(); $updateMask = new FieldMask(); $response = $gapicClient->updateSlate($slate, $updateMask); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/UpdateSlate', $actualFuncCall); - $actualValue = $actualRequestObject->getSlate(); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.video.stitcher.v1.VideoStitcherService/UpdateSlate', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getSlate(); $this->assertProtobufEquals($slate, $actualValue); - $actualValue = $actualRequestObject->getUpdateMask(); + $actualValue = $actualApiRequestObject->getUpdateMask(); $this->assertProtobufEquals($updateMask, $actualValue); - $this->assertTrue($transport->isExhausted()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateSlateTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); } /** @test */ public function updateSlateExceptionTest() { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); $transport = $this->createTransport(); $gapicClient = $this->createClient([ 'transport' => $transport, + 'operationsClient' => $operationsClient, ]); $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateSlateTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ + $expectedExceptionMessage = json_encode([ 'message' => 'internal error', 'code' => Code::DATA_LOSS, 'status' => 'DATA_LOSS', 'details' => [], ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); + $operationsTransport->addResponse(null, $status); // Mock request $slate = new Slate(); $updateMask = new FieldMask(); + $response = $gapicClient->updateSlate($slate, $updateMask); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateSlateTest'); try { - $gapicClient->updateSlate($slate, $updateMask); - // If the $gapicClient method call did not throw, fail the test + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test $this->fail('Expected an ApiException, but no exception was thrown.'); } catch (ApiException $ex) { $this->assertEquals($status->code, $ex->getCode()); $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); } - // Call popReceivedCalls to ensure the stub is exhausted + // Call popReceivedCalls to ensure the stubs are exhausted $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); } }