diff --git a/packages/google-cloud-video-stitcher/google/cloud/video/stitcher_v1/services/video_stitcher_service/async_client.py b/packages/google-cloud-video-stitcher/google/cloud/video/stitcher_v1/services/video_stitcher_service/async_client.py index 78d5b23bc3d5..4147bfd2a3de 100644 --- a/packages/google-cloud-video-stitcher/google/cloud/video/stitcher_v1/services/video_stitcher_service/async_client.py +++ b/packages/google-cloud-video-stitcher/google/cloud/video/stitcher_v1/services/video_stitcher_service/async_client.py @@ -2148,15 +2148,6 @@ async def sample_create_live_session(): session should be created, in the form of ``projects/{project_number}/locations/{location}``. - Valid locations: - - - ``-`` (Video Stitcher API will pick a location that - is closest to the caller.) - - ``us-east1`` - - ``us-west1`` - - ``us-central1`` - - ``europe-west1`` - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. diff --git a/packages/google-cloud-video-stitcher/google/cloud/video/stitcher_v1/services/video_stitcher_service/client.py b/packages/google-cloud-video-stitcher/google/cloud/video/stitcher_v1/services/video_stitcher_service/client.py index 6549826214ca..c7e70721ab65 100644 --- a/packages/google-cloud-video-stitcher/google/cloud/video/stitcher_v1/services/video_stitcher_service/client.py +++ b/packages/google-cloud-video-stitcher/google/cloud/video/stitcher_v1/services/video_stitcher_service/client.py @@ -579,6 +579,7 @@ def __init__( quota_project_id=client_options.quota_project_id, client_info=client_info, always_use_jwt_access=True, + api_audience=client_options.api_audience, ) def create_cdn_key( @@ -2483,15 +2484,6 @@ def sample_create_live_session(): session should be created, in the form of ``projects/{project_number}/locations/{location}``. - Valid locations: - - - ``-`` (Video Stitcher API will pick a location that - is closest to the caller.) - - ``us-east1`` - - ``us-west1`` - - ``us-central1`` - - ``europe-west1`` - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. diff --git a/packages/google-cloud-video-stitcher/google/cloud/video/stitcher_v1/services/video_stitcher_service/transports/base.py b/packages/google-cloud-video-stitcher/google/cloud/video/stitcher_v1/services/video_stitcher_service/transports/base.py index 6f939c17dd83..0725f8febf0b 100644 --- a/packages/google-cloud-video-stitcher/google/cloud/video/stitcher_v1/services/video_stitcher_service/transports/base.py +++ b/packages/google-cloud-video-stitcher/google/cloud/video/stitcher_v1/services/video_stitcher_service/transports/base.py @@ -62,6 +62,7 @@ def __init__( quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, **kwargs, ) -> None: """Instantiate the transport. @@ -89,11 +90,6 @@ def __init__( be used for service account credentials. """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} # Save the scopes. @@ -114,6 +110,11 @@ def __init__( credentials, _ = google.auth.default( **scopes_kwargs, quota_project_id=quota_project_id ) + # Don't apply audience if the credentials file passed from user. + if hasattr(credentials, "with_gdch_audience"): + credentials = credentials.with_gdch_audience( + api_audience if api_audience else host + ) # If the credentials are service account credentials, then always try to use self signed JWT. if ( @@ -126,6 +127,11 @@ def __init__( # Save the credentials. self._credentials = credentials + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { diff --git a/packages/google-cloud-video-stitcher/google/cloud/video/stitcher_v1/services/video_stitcher_service/transports/grpc.py b/packages/google-cloud-video-stitcher/google/cloud/video/stitcher_v1/services/video_stitcher_service/transports/grpc.py index 28ff012488d2..cd1117c593ed 100644 --- a/packages/google-cloud-video-stitcher/google/cloud/video/stitcher_v1/services/video_stitcher_service/transports/grpc.py +++ b/packages/google-cloud-video-stitcher/google/cloud/video/stitcher_v1/services/video_stitcher_service/transports/grpc.py @@ -69,6 +69,7 @@ def __init__( quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, ) -> None: """Instantiate the transport. @@ -164,6 +165,7 @@ def __init__( quota_project_id=quota_project_id, client_info=client_info, always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, ) if not self._grpc_channel: diff --git a/packages/google-cloud-video-stitcher/google/cloud/video/stitcher_v1/services/video_stitcher_service/transports/grpc_asyncio.py b/packages/google-cloud-video-stitcher/google/cloud/video/stitcher_v1/services/video_stitcher_service/transports/grpc_asyncio.py index d6c20ae4d767..1700a486f28a 100644 --- a/packages/google-cloud-video-stitcher/google/cloud/video/stitcher_v1/services/video_stitcher_service/transports/grpc_asyncio.py +++ b/packages/google-cloud-video-stitcher/google/cloud/video/stitcher_v1/services/video_stitcher_service/transports/grpc_asyncio.py @@ -114,6 +114,7 @@ def __init__( quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, ) -> None: """Instantiate the transport. @@ -209,6 +210,7 @@ def __init__( quota_project_id=quota_project_id, client_info=client_info, always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, ) if not self._grpc_channel: diff --git a/packages/google-cloud-video-stitcher/google/cloud/video/stitcher_v1/types/sessions.py b/packages/google-cloud-video-stitcher/google/cloud/video/stitcher_v1/types/sessions.py index ad2b7a190286..2c0ad5940bce 100644 --- a/packages/google-cloud-video-stitcher/google/cloud/video/stitcher_v1/types/sessions.py +++ b/packages/google-cloud-video-stitcher/google/cloud/video/stitcher_v1/types/sessions.py @@ -77,6 +77,9 @@ class VodSession(proto.Message): manifest_options (google.cloud.video.stitcher_v1.types.ManifestOptions): Additional options that affect the output of the manifest. + asset_id (str): + Output only. The generated ID of the + VodSession's source media. """ name = proto.Field( @@ -114,6 +117,10 @@ class VodSession(proto.Message): number=9, message="ManifestOptions", ) + asset_id = proto.Field( + proto.STRING, + number=10, + ) class Interstitials(proto.Message): @@ -287,6 +294,9 @@ class LiveSession(proto.Message): manifest_options (google.cloud.video.stitcher_v1.types.ManifestOptions): Additional options that affect the output of the manifest. + stream_id (str): + Output only. The generated ID of the + LiveSession's source stream. """ class StitchingPolicy(proto.Enum): @@ -296,7 +306,6 @@ class StitchingPolicy(proto.Enum): """ STITCHING_POLICY_UNSPECIFIED = 0 COMPLETE_AD = 1 - COMPLETE_POD = 2 CUT_CURRENT = 3 name = proto.Field( @@ -344,6 +353,10 @@ class StitchingPolicy(proto.Enum): number=10, message="ManifestOptions", ) + stream_id = proto.Field( + proto.STRING, + number=11, + ) class AdTag(proto.Message): diff --git a/packages/google-cloud-video-stitcher/google/cloud/video/stitcher_v1/types/video_stitcher_service.py b/packages/google-cloud-video-stitcher/google/cloud/video/stitcher_v1/types/video_stitcher_service.py index e46abf67296a..80fcf51d4122 100644 --- a/packages/google-cloud-video-stitcher/google/cloud/video/stitcher_v1/types/video_stitcher_service.py +++ b/packages/google-cloud-video-stitcher/google/cloud/video/stitcher_v1/types/video_stitcher_service.py @@ -644,15 +644,6 @@ class CreateLiveSessionRequest(proto.Message): Required. The project and location in which the live session should be created, in the form of ``projects/{project_number}/locations/{location}``. - - Valid locations: - - - ``-`` (Video Stitcher API will pick a location that is - closest to the caller.) - - ``us-east1`` - - ``us-west1`` - - ``us-central1`` - - ``europe-west1`` live_session (google.cloud.video.stitcher_v1.types.LiveSession): Required. Parameters for creating a live session. diff --git a/packages/google-cloud-video-stitcher/setup.py b/packages/google-cloud-video-stitcher/setup.py index 5fb2894a3676..6898200676a3 100644 --- a/packages/google-cloud-video-stitcher/setup.py +++ b/packages/google-cloud-video-stitcher/setup.py @@ -39,7 +39,7 @@ platforms="Posix; MacOS X; Windows", include_package_data=True, install_requires=( - "google-api-core[grpc] >= 1.31.5, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0", + "google-api-core[grpc] >= 2.8.0, <3.0.0dev", "proto-plus >= 1.19.7, <2.0.0dev", "protobuf >= 3.19.0, <4.0.0dev", ), diff --git a/packages/google-cloud-video-stitcher/testing/constraints-3.6.txt b/packages/google-cloud-video-stitcher/testing/constraints-3.6.txt deleted file mode 100644 index 4c6a482bd147..000000000000 --- a/packages/google-cloud-video-stitcher/testing/constraints-3.6.txt +++ /dev/null @@ -1,10 +0,0 @@ -# This constraints file is used to check that lower bounds -# are correct in setup.py -# List *all* library dependencies and extras in this file. -# Pin the version to the lower bound. -# -# e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev", -# Then this file should have foo==1.14.0 -google-api-core==1.31.5 -proto-plus==1.19.7 -protobuf==3.19.0 diff --git a/packages/google-cloud-video-stitcher/testing/constraints-3.7.txt b/packages/google-cloud-video-stitcher/testing/constraints-3.7.txt index 4c6a482bd147..5f11e38986ff 100644 --- a/packages/google-cloud-video-stitcher/testing/constraints-3.7.txt +++ b/packages/google-cloud-video-stitcher/testing/constraints-3.7.txt @@ -5,6 +5,6 @@ # # e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev", # Then this file should have foo==1.14.0 -google-api-core==1.31.5 +google-api-core==2.8.0 proto-plus==1.19.7 protobuf==3.19.0 diff --git a/packages/google-cloud-video-stitcher/tests/unit/gapic/stitcher_v1/test_video_stitcher_service.py b/packages/google-cloud-video-stitcher/tests/unit/gapic/stitcher_v1/test_video_stitcher_service.py index 5730e9119b60..b8fa430d2682 100644 --- a/packages/google-cloud-video-stitcher/tests/unit/gapic/stitcher_v1/test_video_stitcher_service.py +++ b/packages/google-cloud-video-stitcher/tests/unit/gapic/stitcher_v1/test_video_stitcher_service.py @@ -243,6 +243,7 @@ def test_video_stitcher_service_client_client_options( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is @@ -260,6 +261,7 @@ def test_video_stitcher_service_client_client_options( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is @@ -277,6 +279,7 @@ def test_video_stitcher_service_client_client_options( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has @@ -306,6 +309,25 @@ def test_video_stitcher_service_client_client_options( quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, + ) + # Check the case api_endpoint is provided + options = client_options.ClientOptions( + api_audience="https://language.googleapis.com" + ) + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience="https://language.googleapis.com", ) @@ -383,6 +405,7 @@ def test_video_stitcher_service_client_mtls_env_auto( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case ADC client cert is provided. Whether client cert is used depends on @@ -417,6 +440,7 @@ def test_video_stitcher_service_client_mtls_env_auto( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case client_cert_source and ADC client cert are not provided. @@ -439,6 +463,7 @@ def test_video_stitcher_service_client_mtls_env_auto( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -557,6 +582,7 @@ def test_video_stitcher_service_client_client_options_scopes( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -595,6 +621,7 @@ def test_video_stitcher_service_client_client_options_credentials_file( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -615,6 +642,7 @@ def test_video_stitcher_service_client_client_options_from_dict(): quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -653,6 +681,7 @@ def test_video_stitcher_service_client_create_channel_credentials_file( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # test that the credentials from file are saved and used as the credentials. @@ -2114,6 +2143,7 @@ def test_create_vod_session(request_type, transport: str = "grpc"): source_uri="source_uri_value", ad_tag_uri="ad_tag_uri_value", client_ad_tracking=True, + asset_id="asset_id_value", ) response = client.create_vod_session(request) @@ -2129,6 +2159,7 @@ def test_create_vod_session(request_type, transport: str = "grpc"): assert response.source_uri == "source_uri_value" assert response.ad_tag_uri == "ad_tag_uri_value" assert response.client_ad_tracking is True + assert response.asset_id == "asset_id_value" def test_create_vod_session_empty_call(): @@ -2175,6 +2206,7 @@ async def test_create_vod_session_async( source_uri="source_uri_value", ad_tag_uri="ad_tag_uri_value", client_ad_tracking=True, + asset_id="asset_id_value", ) ) response = await client.create_vod_session(request) @@ -2191,6 +2223,7 @@ async def test_create_vod_session_async( assert response.source_uri == "source_uri_value" assert response.ad_tag_uri == "ad_tag_uri_value" assert response.client_ad_tracking is True + assert response.asset_id == "asset_id_value" @pytest.mark.asyncio @@ -2381,6 +2414,7 @@ def test_get_vod_session(request_type, transport: str = "grpc"): source_uri="source_uri_value", ad_tag_uri="ad_tag_uri_value", client_ad_tracking=True, + asset_id="asset_id_value", ) response = client.get_vod_session(request) @@ -2396,6 +2430,7 @@ def test_get_vod_session(request_type, transport: str = "grpc"): assert response.source_uri == "source_uri_value" assert response.ad_tag_uri == "ad_tag_uri_value" assert response.client_ad_tracking is True + assert response.asset_id == "asset_id_value" def test_get_vod_session_empty_call(): @@ -2438,6 +2473,7 @@ async def test_get_vod_session_async( source_uri="source_uri_value", ad_tag_uri="ad_tag_uri_value", client_ad_tracking=True, + asset_id="asset_id_value", ) ) response = await client.get_vod_session(request) @@ -2454,6 +2490,7 @@ async def test_get_vod_session_async( assert response.source_uri == "source_uri_value" assert response.ad_tag_uri == "ad_tag_uri_value" assert response.client_ad_tracking is True + assert response.asset_id == "asset_id_value" @pytest.mark.asyncio @@ -6074,6 +6111,7 @@ def test_create_live_session(request_type, transport: str = "grpc"): client_ad_tracking=True, default_slate_id="default_slate_id_value", stitching_policy=sessions.LiveSession.StitchingPolicy.COMPLETE_AD, + stream_id="stream_id_value", ) response = client.create_live_session(request) @@ -6091,6 +6129,7 @@ def test_create_live_session(request_type, transport: str = "grpc"): assert response.client_ad_tracking is True assert response.default_slate_id == "default_slate_id_value" assert response.stitching_policy == sessions.LiveSession.StitchingPolicy.COMPLETE_AD + assert response.stream_id == "stream_id_value" def test_create_live_session_empty_call(): @@ -6139,6 +6178,7 @@ async def test_create_live_session_async( client_ad_tracking=True, default_slate_id="default_slate_id_value", stitching_policy=sessions.LiveSession.StitchingPolicy.COMPLETE_AD, + stream_id="stream_id_value", ) ) response = await client.create_live_session(request) @@ -6157,6 +6197,7 @@ async def test_create_live_session_async( assert response.client_ad_tracking is True assert response.default_slate_id == "default_slate_id_value" assert response.stitching_policy == sessions.LiveSession.StitchingPolicy.COMPLETE_AD + assert response.stream_id == "stream_id_value" @pytest.mark.asyncio @@ -6353,6 +6394,7 @@ def test_get_live_session(request_type, transport: str = "grpc"): client_ad_tracking=True, default_slate_id="default_slate_id_value", stitching_policy=sessions.LiveSession.StitchingPolicy.COMPLETE_AD, + stream_id="stream_id_value", ) response = client.get_live_session(request) @@ -6370,6 +6412,7 @@ def test_get_live_session(request_type, transport: str = "grpc"): assert response.client_ad_tracking is True assert response.default_slate_id == "default_slate_id_value" assert response.stitching_policy == sessions.LiveSession.StitchingPolicy.COMPLETE_AD + assert response.stream_id == "stream_id_value" def test_get_live_session_empty_call(): @@ -6414,6 +6457,7 @@ async def test_get_live_session_async( client_ad_tracking=True, default_slate_id="default_slate_id_value", stitching_policy=sessions.LiveSession.StitchingPolicy.COMPLETE_AD, + stream_id="stream_id_value", ) ) response = await client.get_live_session(request) @@ -6432,6 +6476,7 @@ async def test_get_live_session_async( assert response.client_ad_tracking is True assert response.default_slate_id == "default_slate_id_value" assert response.stitching_policy == sessions.LiveSession.StitchingPolicy.COMPLETE_AD + assert response.stream_id == "stream_id_value" @pytest.mark.asyncio @@ -6820,6 +6865,28 @@ def test_video_stitcher_service_transport_auth_adc(transport_class): ) +@pytest.mark.parametrize( + "transport_class", + [ + transports.VideoStitcherServiceGrpcTransport, + transports.VideoStitcherServiceGrpcAsyncIOTransport, + ], +) +def test_video_stitcher_service_transport_auth_gdch_credentials(transport_class): + host = "https://language.com" + api_audience_tests = [None, "https://language2.com"] + api_audience_expect = [host, "https://language2.com"] + for t, e in zip(api_audience_tests, api_audience_expect): + with mock.patch.object(google.auth, "default", autospec=True) as adc: + gdch_mock = mock.MagicMock() + type(gdch_mock).with_gdch_audience = mock.PropertyMock( + return_value=gdch_mock + ) + adc.return_value = (gdch_mock, None) + transport_class(host=host, api_audience=t) + gdch_mock.with_gdch_audience.assert_called_once_with(e) + + @pytest.mark.parametrize( "transport_class,grpc_helpers", [ @@ -7470,4 +7537,5 @@ def test_api_key_credentials(client_class, transport_class): quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, )