diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 2567653..7d98291 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:87eee22d276554e4e52863ec9b1cb6a7245815dfae20439712bf644348215a5a + digest: sha256:58f73ba196b5414782605236dd0712a73541b44ff2ff4d3a36ec41092dd6fa5b diff --git a/.kokoro/samples/lint/common.cfg b/.kokoro/samples/lint/common.cfg index 65b1bb1..22c5f14 100644 --- a/.kokoro/samples/lint/common.cfg +++ b/.kokoro/samples/lint/common.cfg @@ -31,4 +31,4 @@ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" # Use the trampoline script to run in docker. -build_file: "python-video-transcoder/.kokoro/trampoline.sh" \ No newline at end of file +build_file: "python-video-transcoder/.kokoro/trampoline_v2.sh" \ No newline at end of file diff --git a/.kokoro/samples/python3.10/common.cfg b/.kokoro/samples/python3.10/common.cfg new file mode 100644 index 0000000..4f0946f --- /dev/null +++ b/.kokoro/samples/python3.10/common.cfg @@ -0,0 +1,40 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} + +# Specify which tests to run +env_vars: { + key: "RUN_TESTS_SESSION" + value: "py-3.10" +} + +# Declare build specific Cloud project. +env_vars: { + key: "BUILD_SPECIFIC_GCLOUD_PROJECT" + value: "python-docs-samples-tests-310" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/python-video-transcoder/.kokoro/test-samples.sh" +} + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker" +} + +# Download secrets for samples +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "python-video-transcoder/.kokoro/trampoline_v2.sh" \ No newline at end of file diff --git a/.kokoro/samples/python3.10/continuous.cfg b/.kokoro/samples/python3.10/continuous.cfg new file mode 100644 index 0000000..a1c8d97 --- /dev/null +++ b/.kokoro/samples/python3.10/continuous.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} \ No newline at end of file diff --git a/.kokoro/samples/python3.10/periodic-head.cfg b/.kokoro/samples/python3.10/periodic-head.cfg new file mode 100644 index 0000000..882c418 --- /dev/null +++ b/.kokoro/samples/python3.10/periodic-head.cfg @@ -0,0 +1,11 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/python-video-transcoder/.kokoro/test-samples-against-head.sh" +} diff --git a/.kokoro/samples/python3.10/periodic.cfg b/.kokoro/samples/python3.10/periodic.cfg new file mode 100644 index 0000000..71cd1e5 --- /dev/null +++ b/.kokoro/samples/python3.10/periodic.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "False" +} diff --git a/.kokoro/samples/python3.10/presubmit.cfg b/.kokoro/samples/python3.10/presubmit.cfg new file mode 100644 index 0000000..a1c8d97 --- /dev/null +++ b/.kokoro/samples/python3.10/presubmit.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} \ No newline at end of file diff --git a/.kokoro/samples/python3.6/common.cfg b/.kokoro/samples/python3.6/common.cfg index 53c2039..949d88e 100644 --- a/.kokoro/samples/python3.6/common.cfg +++ b/.kokoro/samples/python3.6/common.cfg @@ -37,4 +37,4 @@ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" # Use the trampoline script to run in docker. -build_file: "python-video-transcoder/.kokoro/trampoline.sh" \ No newline at end of file +build_file: "python-video-transcoder/.kokoro/trampoline_v2.sh" \ No newline at end of file diff --git a/.kokoro/samples/python3.6/periodic.cfg b/.kokoro/samples/python3.6/periodic.cfg index 50fec96..71cd1e5 100644 --- a/.kokoro/samples/python3.6/periodic.cfg +++ b/.kokoro/samples/python3.6/periodic.cfg @@ -3,4 +3,4 @@ env_vars: { key: "INSTALL_LIBRARY_FROM_SOURCE" value: "False" -} \ No newline at end of file +} diff --git a/.kokoro/samples/python3.7/common.cfg b/.kokoro/samples/python3.7/common.cfg index 33e7d9c..6ea1957 100644 --- a/.kokoro/samples/python3.7/common.cfg +++ b/.kokoro/samples/python3.7/common.cfg @@ -37,4 +37,4 @@ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" # Use the trampoline script to run in docker. -build_file: "python-video-transcoder/.kokoro/trampoline.sh" \ No newline at end of file +build_file: "python-video-transcoder/.kokoro/trampoline_v2.sh" \ No newline at end of file diff --git a/.kokoro/samples/python3.7/periodic.cfg b/.kokoro/samples/python3.7/periodic.cfg index 50fec96..71cd1e5 100644 --- a/.kokoro/samples/python3.7/periodic.cfg +++ b/.kokoro/samples/python3.7/periodic.cfg @@ -3,4 +3,4 @@ env_vars: { key: "INSTALL_LIBRARY_FROM_SOURCE" value: "False" -} \ No newline at end of file +} diff --git a/.kokoro/samples/python3.8/common.cfg b/.kokoro/samples/python3.8/common.cfg index c94d8bf..d25c9e7 100644 --- a/.kokoro/samples/python3.8/common.cfg +++ b/.kokoro/samples/python3.8/common.cfg @@ -37,4 +37,4 @@ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" # Use the trampoline script to run in docker. -build_file: "python-video-transcoder/.kokoro/trampoline.sh" \ No newline at end of file +build_file: "python-video-transcoder/.kokoro/trampoline_v2.sh" \ No newline at end of file diff --git a/.kokoro/samples/python3.8/periodic.cfg b/.kokoro/samples/python3.8/periodic.cfg index 50fec96..71cd1e5 100644 --- a/.kokoro/samples/python3.8/periodic.cfg +++ b/.kokoro/samples/python3.8/periodic.cfg @@ -3,4 +3,4 @@ env_vars: { key: "INSTALL_LIBRARY_FROM_SOURCE" value: "False" -} \ No newline at end of file +} diff --git a/.kokoro/samples/python3.9/common.cfg b/.kokoro/samples/python3.9/common.cfg index caac37c..a72ee88 100644 --- a/.kokoro/samples/python3.9/common.cfg +++ b/.kokoro/samples/python3.9/common.cfg @@ -37,4 +37,4 @@ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" # Use the trampoline script to run in docker. -build_file: "python-video-transcoder/.kokoro/trampoline.sh" \ No newline at end of file +build_file: "python-video-transcoder/.kokoro/trampoline_v2.sh" \ No newline at end of file diff --git a/.kokoro/samples/python3.9/periodic.cfg b/.kokoro/samples/python3.9/periodic.cfg index 50fec96..71cd1e5 100644 --- a/.kokoro/samples/python3.9/periodic.cfg +++ b/.kokoro/samples/python3.9/periodic.cfg @@ -3,4 +3,4 @@ env_vars: { key: "INSTALL_LIBRARY_FROM_SOURCE" value: "False" -} \ No newline at end of file +} diff --git a/.kokoro/test-samples-against-head.sh b/.kokoro/test-samples-against-head.sh index fd9ccdb..ba3a707 100755 --- a/.kokoro/test-samples-against-head.sh +++ b/.kokoro/test-samples-against-head.sh @@ -23,6 +23,4 @@ set -eo pipefail # Enables `**` to include files nested inside sub-folders shopt -s globstar -cd github/python-video-transcoder - exec .kokoro/test-samples-impl.sh diff --git a/.kokoro/test-samples.sh b/.kokoro/test-samples.sh index ef463cc..11c042d 100755 --- a/.kokoro/test-samples.sh +++ b/.kokoro/test-samples.sh @@ -24,8 +24,6 @@ set -eo pipefail # Enables `**` to include files nested inside sub-folders shopt -s globstar -cd github/python-video-transcoder - # Run periodic samples tests at latest release if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then # preserving the test runner implementation. diff --git a/.repo-metadata.json b/.repo-metadata.json index 1056851..ee08121 100644 --- a/.repo-metadata.json +++ b/.repo-metadata.json @@ -9,6 +9,7 @@ "library_type": "GAPIC_AUTO", "repo": "googleapis/python-video-transcoder", "distribution_name": "google-cloud-video-transcoder", - "api_id": "transcoder.googleapis.com" - } - \ No newline at end of file + "api_id": "transcoder.googleapis.com", + "default_version": "v1", + "codeowner_team": "" +} diff --git a/.trampolinerc b/.trampolinerc index 383b6ec..0eee72a 100644 --- a/.trampolinerc +++ b/.trampolinerc @@ -16,15 +16,26 @@ # Add required env vars here. required_envvars+=( - "STAGING_BUCKET" - "V2_STAGING_BUCKET" ) # Add env vars which are passed down into the container here. pass_down_envvars+=( + "NOX_SESSION" + ############### + # Docs builds + ############### "STAGING_BUCKET" "V2_STAGING_BUCKET" - "NOX_SESSION" + ################## + # Samples builds + ################## + "INSTALL_LIBRARY_FROM_SOURCE" + "RUN_TESTS_SESSION" + "BUILD_SPECIFIC_GCLOUD_PROJECT" + # Target directories. + "RUN_TESTS_DIRS" + # The nox session to run. + "RUN_TESTS_SESSION" ) # Prevent unintentional override on the default image. diff --git a/CHANGELOG.md b/CHANGELOG.md index 49e6987..364a544 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [1.1.0](https://www.github.com/googleapis/python-video-transcoder/compare/v1.0.1...v1.1.0) (2021-10-08) + + +### Features + +* add context manager support in client ([#104](https://www.github.com/googleapis/python-video-transcoder/issues/104)) ([2c5f07d](https://www.github.com/googleapis/python-video-transcoder/commit/2c5f07d5d12d05c65854409f45374b846363328c)) + + +### Bug Fixes + +* remove Encryption settings that were published erroneously ([#102](https://www.github.com/googleapis/python-video-transcoder/issues/102)) ([824009a](https://www.github.com/googleapis/python-video-transcoder/commit/824009ac01700341071b50af2741ef6493dcbcf5)) + ### [1.0.1](https://www.github.com/googleapis/python-video-transcoder/compare/v1.0.0...v1.0.1) (2021-09-30) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 659b644..18b5877 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -22,7 +22,7 @@ In order to add a feature: documentation. - The feature must work fully on the following CPython versions: - 3.6, 3.7, 3.8 and 3.9 on both UNIX and Windows. + 3.6, 3.7, 3.8, 3.9 and 3.10 on both UNIX and Windows. - The feature must not add unnecessary dependencies (where "unnecessary" is of course subjective, but new dependencies should @@ -72,7 +72,7 @@ We use `nox `__ to instrument our tests. - To run a single unit test:: - $ nox -s unit-3.9 -- -k + $ nox -s unit-3.10 -- -k .. note:: @@ -225,11 +225,13 @@ We support: - `Python 3.7`_ - `Python 3.8`_ - `Python 3.9`_ +- `Python 3.10`_ .. _Python 3.6: https://docs.python.org/3.6/ .. _Python 3.7: https://docs.python.org/3.7/ .. _Python 3.8: https://docs.python.org/3.8/ .. _Python 3.9: https://docs.python.org/3.9/ +.. _Python 3.10: https://docs.python.org/3.10/ Supported versions can be found in our ``noxfile.py`` `config`_. diff --git a/google/cloud/video/transcoder/__init__.py b/google/cloud/video/transcoder/__init__.py index a5fa944..67b4b12 100644 --- a/google/cloud/video/transcoder/__init__.py +++ b/google/cloud/video/transcoder/__init__.py @@ -25,7 +25,6 @@ from google.cloud.video.transcoder_v1.types.resources import AudioStream from google.cloud.video.transcoder_v1.types.resources import EditAtom from google.cloud.video.transcoder_v1.types.resources import ElementaryStream -from google.cloud.video.transcoder_v1.types.resources import Encryption from google.cloud.video.transcoder_v1.types.resources import Input from google.cloud.video.transcoder_v1.types.resources import Job from google.cloud.video.transcoder_v1.types.resources import JobConfig @@ -58,7 +57,6 @@ "AudioStream", "EditAtom", "ElementaryStream", - "Encryption", "Input", "Job", "JobConfig", diff --git a/google/cloud/video/transcoder_v1/__init__.py b/google/cloud/video/transcoder_v1/__init__.py index cd70bef..b76bfde 100644 --- a/google/cloud/video/transcoder_v1/__init__.py +++ b/google/cloud/video/transcoder_v1/__init__.py @@ -21,7 +21,6 @@ from .types.resources import AudioStream from .types.resources import EditAtom from .types.resources import ElementaryStream -from .types.resources import Encryption from .types.resources import Input from .types.resources import Job from .types.resources import JobConfig @@ -57,7 +56,6 @@ "DeleteJobTemplateRequest", "EditAtom", "ElementaryStream", - "Encryption", "GetJobRequest", "GetJobTemplateRequest", "Input", diff --git a/google/cloud/video/transcoder_v1/services/transcoder_service/async_client.py b/google/cloud/video/transcoder_v1/services/transcoder_service/async_client.py index 5d129e7..d7cce70 100644 --- a/google/cloud/video/transcoder_v1/services/transcoder_service/async_client.py +++ b/google/cloud/video/transcoder_v1/services/transcoder_service/async_client.py @@ -776,6 +776,12 @@ async def delete_job_template( request, retry=retry, timeout=timeout, metadata=metadata, ) + async def __aenter__(self): + return self + + async def __aexit__(self, exc_type, exc, tb): + await self.transport.close() + try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( diff --git a/google/cloud/video/transcoder_v1/services/transcoder_service/client.py b/google/cloud/video/transcoder_v1/services/transcoder_service/client.py index f2c66a9..00a2235 100644 --- a/google/cloud/video/transcoder_v1/services/transcoder_service/client.py +++ b/google/cloud/video/transcoder_v1/services/transcoder_service/client.py @@ -372,10 +372,7 @@ def __init__( client_cert_source_for_mtls=client_cert_source_func, quota_project_id=client_options.quota_project_id, client_info=client_info, - always_use_jwt_access=( - Transport == type(self).get_transport_class("grpc") - or Transport == type(self).get_transport_class("grpc_asyncio") - ), + always_use_jwt_access=True, ) def create_job( @@ -979,6 +976,19 @@ def delete_job_template( request, retry=retry, timeout=timeout, metadata=metadata, ) + def __enter__(self): + return self + + def __exit__(self, type, value, traceback): + """Releases underlying transport's resources. + + .. warning:: + ONLY use as a context manager if the transport is NOT shared + with other clients! Exiting the with block will CLOSE the transport + and may cause errors in other clients! + """ + self.transport.close() + try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( diff --git a/google/cloud/video/transcoder_v1/services/transcoder_service/transports/base.py b/google/cloud/video/transcoder_v1/services/transcoder_service/transports/base.py index c7755d7..cf9d646 100644 --- a/google/cloud/video/transcoder_v1/services/transcoder_service/transports/base.py +++ b/google/cloud/video/transcoder_v1/services/transcoder_service/transports/base.py @@ -182,6 +182,15 @@ def _prep_wrapped_messages(self, client_info): ), } + def close(self): + """Closes resources associated with the transport. + + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! + """ + raise NotImplementedError() + @property def create_job( self, diff --git a/google/cloud/video/transcoder_v1/services/transcoder_service/transports/grpc.py b/google/cloud/video/transcoder_v1/services/transcoder_service/transports/grpc.py index 4853aac..457c5af 100644 --- a/google/cloud/video/transcoder_v1/services/transcoder_service/transports/grpc.py +++ b/google/cloud/video/transcoder_v1/services/transcoder_service/transports/grpc.py @@ -437,5 +437,8 @@ def delete_job_template( ) return self._stubs["delete_job_template"] + def close(self): + self.grpc_channel.close() + __all__ = ("TranscoderServiceGrpcTransport",) diff --git a/google/cloud/video/transcoder_v1/services/transcoder_service/transports/grpc_asyncio.py b/google/cloud/video/transcoder_v1/services/transcoder_service/transports/grpc_asyncio.py index ae4830b..512ba37 100644 --- a/google/cloud/video/transcoder_v1/services/transcoder_service/transports/grpc_asyncio.py +++ b/google/cloud/video/transcoder_v1/services/transcoder_service/transports/grpc_asyncio.py @@ -446,5 +446,8 @@ def delete_job_template( ) return self._stubs["delete_job_template"] + def close(self): + return self.grpc_channel.close() + __all__ = ("TranscoderServiceGrpcAsyncIOTransport",) diff --git a/google/cloud/video/transcoder_v1/types/__init__.py b/google/cloud/video/transcoder_v1/types/__init__.py index 4aa88f8..9544b42 100644 --- a/google/cloud/video/transcoder_v1/types/__init__.py +++ b/google/cloud/video/transcoder_v1/types/__init__.py @@ -18,7 +18,6 @@ AudioStream, EditAtom, ElementaryStream, - Encryption, Input, Job, JobConfig, @@ -52,7 +51,6 @@ "AudioStream", "EditAtom", "ElementaryStream", - "Encryption", "Input", "Job", "JobConfig", diff --git a/google/cloud/video/transcoder_v1/types/resources.py b/google/cloud/video/transcoder_v1/types/resources.py index 5b655c2..2bd7328 100644 --- a/google/cloud/video/transcoder_v1/types/resources.py +++ b/google/cloud/video/transcoder_v1/types/resources.py @@ -41,17 +41,17 @@ "AudioStream", "TextStream", "SegmentSettings", - "Encryption", }, ) class Job(proto.Message): r"""Transcoding job resource. + Attributes: name (str): The resource name of the job. Format: - ``projects/{project}/locations/{location}/jobs/{job}`` + ``projects/{project_number}/locations/{location}/jobs/{job}`` input_uri (str): Input only. Specify the ``input_uri`` to populate empty ``uri`` fields in each element of ``Job.config.inputs`` or @@ -124,10 +124,11 @@ class ProcessingState(proto.Enum): class JobTemplate(proto.Message): r"""Transcoding job template resource. + Attributes: name (str): The resource name of the job template. Format: - ``projects/{project}/locations/{location}/jobTemplates/{job_template}`` + ``projects/{project_number}/locations/{location}/jobTemplates/{job_template}`` config (google.cloud.video.transcoder_v1.types.JobConfig): The configuration for this template. """ @@ -138,6 +139,7 @@ class JobTemplate(proto.Message): class JobConfig(proto.Message): r"""Job configuration + Attributes: inputs (Sequence[google.cloud.video.transcoder_v1.types.Input]): List of input assets stored in Cloud Storage. @@ -183,6 +185,7 @@ class JobConfig(proto.Message): class Input(proto.Message): r"""Input asset. + Attributes: key (str): A unique key for this input. Must be @@ -206,6 +209,7 @@ class Input(proto.Message): class Output(proto.Message): r"""Location of output file(s) in a Cloud Storage bucket. + Attributes: uri (str): URI for the output file(s). For example, @@ -218,6 +222,7 @@ class Output(proto.Message): class EditAtom(proto.Message): r"""Edit atom. + Attributes: key (str): A unique key for this atom. Must be specified @@ -247,6 +252,7 @@ class EditAtom(proto.Message): class AdBreak(proto.Message): r"""Ad break. + Attributes: start_time_offset (google.protobuf.duration_pb2.Duration): Start time in seconds for the ad break, relative to the @@ -289,11 +295,12 @@ class ElementaryStream(proto.Message): class MuxStream(proto.Message): r"""Multiplexing settings for output stream. + Attributes: key (str): A unique key for this multiplexed stream. HLS media - manifests will be named ``MuxStream.key`` with the - ``".m3u8"`` extension suffix. + manifests will be named ``MuxStream.key`` with the ``.m3u8`` + extension suffix. file_name (str): The name of the generated file. The default is ``MuxStream.key`` with the extension suffix corresponding to @@ -301,23 +308,21 @@ class MuxStream(proto.Message): Individual segments also have an incremental 10-digit zero-padded suffix starting from 0 before the extension, - such as ``"mux_stream0000000123.ts"``. + such as ``mux_stream0000000123.ts``. container (str): - The container format. The default is ``"mp4"`` + The container format. The default is ``mp4`` Supported container formats: - - 'ts' - - 'fmp4'- the corresponding file extension is ``".m4s"`` - - 'mp4' - - 'vtt' + - ``ts`` + - ``fmp4``- the corresponding file extension is ``.m4s`` + - ``mp4`` + - ``vtt`` elementary_streams (Sequence[str]): List of ``ElementaryStream.key``\ s multiplexed in this stream. segment_settings (google.cloud.video.transcoder_v1.types.SegmentSettings): - Segment settings for ``"ts"``, ``"fmp4"`` and ``"vtt"``. - encryption (google.cloud.video.transcoder_v1.types.Encryption): - Encryption settings. + Segment settings for ``ts``, ``fmp4`` and ``vtt``. """ key = proto.Field(proto.STRING, number=1,) @@ -325,19 +330,18 @@ class MuxStream(proto.Message): container = proto.Field(proto.STRING, number=3,) elementary_streams = proto.RepeatedField(proto.STRING, number=4,) segment_settings = proto.Field(proto.MESSAGE, number=5, message="SegmentSettings",) - encryption = proto.Field(proto.MESSAGE, number=6, message="Encryption",) class Manifest(proto.Message): r"""Manifest configuration. + Attributes: file_name (str): - The name of the generated file. The default is - ``"manifest"`` with the extension suffix corresponding to - the ``Manifest.type``. + The name of the generated file. The default is ``manifest`` + with the extension suffix corresponding to the + ``Manifest.type``. type_ (google.cloud.video.transcoder_v1.types.Manifest.ManifestType): - Required. Type of the manifest, can be "HLS" - or "DASH". + Required. Type of the manifest, can be ``HLS`` or ``DASH``. mux_streams (Sequence[str]): Required. List of user given ``MuxStream.key``\ s that should appear in this manifest. @@ -348,7 +352,7 @@ class Manifest(proto.Message): """ class ManifestType(proto.Enum): - r"""The manifest type can be either ``"HLS"`` or ``"DASH"``.""" + r"""The manifest type can be either ``HLS`` or ``DASH``.""" MANIFEST_TYPE_UNSPECIFIED = 0 HLS = 1 DASH = 2 @@ -360,6 +364,7 @@ class ManifestType(proto.Enum): class PubsubDestination(proto.Message): r"""A Pub/Sub destination. + Attributes: topic (str): The name of the Pub/Sub topic to publish job completion @@ -375,17 +380,17 @@ class SpriteSheet(proto.Message): Attributes: format_ (str): - Format type. The default is ``"jpeg"``. + Format type. The default is ``jpeg``. Supported formats: - - 'jpeg' + - ``jpeg`` file_prefix (str): Required. File name prefix for the generated sprite sheets. Each sprite sheet has an incremental 10-digit zero-padded suffix starting from 0 before the extension, such as - ``"sprite_sheet0000000123.jpeg"``. + ``sprite_sheet0000000123.jpeg``. sprite_width_pixels (int): Required. The width of sprite in pixels. Must be an even integer. To preserve the source aspect ratio, set the @@ -459,6 +464,7 @@ class SpriteSheet(proto.Message): class Overlay(proto.Message): r"""Overlay configuration. + Attributes: image (google.cloud.video.transcoder_v1.types.Overlay.Image): Image overlay. @@ -475,6 +481,7 @@ class FadeType(proto.Enum): class NormalizedCoordinate(proto.Message): r"""2D normalized coordinates. Default: ``{0.0, 0.0}`` + Attributes: x (float): Normalized x coordinate. @@ -487,6 +494,7 @@ class NormalizedCoordinate(proto.Message): class Image(proto.Message): r"""Overlaid jpeg image. + Attributes: uri (str): Required. URI of the JPEG image in Cloud Storage. For @@ -512,6 +520,7 @@ class Image(proto.Message): class AnimationStatic(proto.Message): r"""Display static overlay object. + Attributes: xy (google.cloud.video.transcoder_v1.types.Overlay.NormalizedCoordinate): Normalized coordinates based on output video resolution. @@ -534,6 +543,7 @@ class AnimationStatic(proto.Message): class AnimationFade(proto.Message): r"""Display overlay object with fade animation. + Attributes: fade_type (google.cloud.video.transcoder_v1.types.Overlay.FadeType): Required. Type of fade animation: ``FADE_IN`` or @@ -581,6 +591,7 @@ class AnimationEnd(proto.Message): class Animation(proto.Message): r"""Animation types. + Attributes: animation_static (google.cloud.video.transcoder_v1.types.Overlay.AnimationStatic): Display static overlay object. @@ -615,6 +626,7 @@ class Animation(proto.Message): class PreprocessingConfig(proto.Message): r"""Preprocessing configurations. + Attributes: color (google.cloud.video.transcoder_v1.types.PreprocessingConfig.Color): Color preprocessing configuration. @@ -632,6 +644,7 @@ class PreprocessingConfig(proto.Message): class Color(proto.Message): r"""Color preprocessing configuration. + Attributes: saturation (float): Control color saturation of the video. Enter @@ -656,6 +669,7 @@ class Color(proto.Message): class Denoise(proto.Message): r"""Denoise preprocessing configuration. + Attributes: strength (float): Set strength of the denoise. Enter a value @@ -663,12 +677,12 @@ class Denoise(proto.Message): smoother the image. 0 is no denoising. The default is 0. tune (str): - Set the denoiser mode. The default is ``"standard"``. + Set the denoiser mode. The default is ``standard``. Supported denoiser modes: - - 'standard' - - 'grain' + - ``standard`` + - ``grain`` """ strength = proto.Field(proto.DOUBLE, number=1,) @@ -676,6 +690,7 @@ class Denoise(proto.Message): class Deblock(proto.Message): r"""Deblock preprocessing configuration. + Attributes: strength (float): Set strength of the deblocker. Enter a value @@ -691,6 +706,7 @@ class Deblock(proto.Message): class Audio(proto.Message): r"""Audio preprocessing configuration. + Attributes: lufs (float): Specify audio loudness normalization in loudness units @@ -777,6 +793,7 @@ class Pad(proto.Message): class VideoStream(proto.Message): r"""Video stream resource. + Attributes: h264 (google.cloud.video.transcoder_v1.types.VideoStream.H264CodecSettings): H264 codec settings. @@ -788,6 +805,7 @@ class VideoStream(proto.Message): class H264CodecSettings(proto.Message): r"""H264 codec settings. + Attributes: width_pixels (int): The width of the video in pixels. Must be an @@ -812,28 +830,29 @@ class H264CodecSettings(proto.Message): for more information. bitrate_bps (int): Required. The video bitrate in bits per - second. Must be between 1 and 1,000,000,000. + second. The minimum value is 1,000. The maximum + value is 800,000,000. pixel_format (str): - Pixel format to use. The default is ``"yuv420p"``. + Pixel format to use. The default is ``yuv420p``. Supported pixel formats: - - 'yuv420p' pixel format. - - 'yuv422p' pixel format. - - 'yuv444p' pixel format. - - 'yuv420p10' 10-bit HDR pixel format. - - 'yuv422p10' 10-bit HDR pixel format. - - 'yuv444p10' 10-bit HDR pixel format. - - 'yuv420p12' 12-bit HDR pixel format. - - 'yuv422p12' 12-bit HDR pixel format. - - 'yuv444p12' 12-bit HDR pixel format. + - ``yuv420p`` pixel format + - ``yuv422p`` pixel format + - ``yuv444p`` pixel format + - ``yuv420p10`` 10-bit HDR pixel format + - ``yuv422p10`` 10-bit HDR pixel format + - ``yuv444p10`` 10-bit HDR pixel format + - ``yuv420p12`` 12-bit HDR pixel format + - ``yuv422p12`` 12-bit HDR pixel format + - ``yuv444p12`` 12-bit HDR pixel format rate_control_mode (str): - Specify the ``rate_control_mode``. The default is ``"vbr"``. + Specify the ``rate_control_mode``. The default is ``vbr``. Supported rate control modes: - - 'vbr' - variable bitrate - - 'crf' - constant rate factor + - ``vbr`` - variable bitrate + - ``crf`` - constant rate factor crf_level (int): Target CRF level. Must be between 10 and 36, where 10 is the highest quality and 36 is the @@ -846,14 +865,14 @@ class H264CodecSettings(proto.Message): frame count. Must be greater than zero. gop_duration (google.protobuf.duration_pb2.Duration): Select the GOP size based on the specified duration. The - default is ``"3s"``. Note that ``gopDuration`` must be less + default is ``3s``. Note that ``gopDuration`` must be less than or equal to ```segmentDuration`` <#SegmentSettings>`__, and ```segmentDuration`` <#SegmentSettings>`__ must be divisible by ``gopDuration``. enable_two_pass (bool): Use two-pass encoding strategy to achieve better video - quality. ``VideoStream.rate_control_mode`` must be - ``"vbr"``. The default is ``false``. + quality. ``VideoStream.rate_control_mode`` must be ``vbr``. + The default is ``false``. vbv_size_bits (int): Size of the Video Buffering Verifier (VBV) buffer in bits. Must be greater than zero. The default is equal to @@ -863,12 +882,12 @@ class H264CodecSettings(proto.Message): buffer in bits. Must be greater than zero. The default is equal to 90% of ``VideoStream.vbv_size_bits``. entropy_coder (str): - The entropy coder to use. The default is ``"cabac"``. + The entropy coder to use. The default is ``cabac``. Supported entropy coders: - - 'cavlc' - - 'cabac' + - ``cavlc`` + - ``cabac`` b_pyramid (bool): Allow B-pyramid for reference frame selection. This may not be supported on all decoders. The default is ``false``. @@ -891,23 +910,23 @@ class H264CodecSettings(proto.Message): - ``high`` (default) The available options are - `FFmpeg-compatible `__\ {: - class="external" }. Note that certain values for this field - may cause the transcoder to override other fields you set in - the ``H264CodecSettings`` message. + `FFmpeg-compatible `__. + Note that certain values for this field may cause the + transcoder to override other fields you set in the + ``H264CodecSettings`` message. tune (str): Enforces the specified codec tune. The available options are - `FFmpeg-compatible `__\ {: - class="external" }. Note that certain values for this field - may cause the transcoder to override other fields you set in - the ``H264CodecSettings`` message. + `FFmpeg-compatible `__. + Note that certain values for this field may cause the + transcoder to override other fields you set in the + ``H264CodecSettings`` message. preset (str): Enforces the specified codec preset. The default is ``veryfast``. The available options are - `FFmpeg-compatible `__\ {: - class="external" }. Note that certain values for this field - may cause the transcoder to override other fields you set in - the ``H264CodecSettings`` message. + `FFmpeg-compatible `__. + Note that certain values for this field may cause the + transcoder to override other fields you set in the + ``H264CodecSettings`` message. """ width_pixels = proto.Field(proto.INT32, number=1,) @@ -935,6 +954,7 @@ class H264CodecSettings(proto.Message): class H265CodecSettings(proto.Message): r"""H265 codec settings. + Attributes: width_pixels (int): The width of the video in pixels. Must be an @@ -959,28 +979,29 @@ class H265CodecSettings(proto.Message): for more information. bitrate_bps (int): Required. The video bitrate in bits per - second. Must be between 1 and 1,000,000,000. + second. The minimum value is 1,000. The maximum + value is 800,000,000. pixel_format (str): - Pixel format to use. The default is ``"yuv420p"``. + Pixel format to use. The default is ``yuv420p``. Supported pixel formats: - - 'yuv420p' pixel format. - - 'yuv422p' pixel format. - - 'yuv444p' pixel format. - - 'yuv420p10' 10-bit HDR pixel format. - - 'yuv422p10' 10-bit HDR pixel format. - - 'yuv444p10' 10-bit HDR pixel format. - - 'yuv420p12' 12-bit HDR pixel format. - - 'yuv422p12' 12-bit HDR pixel format. - - 'yuv444p12' 12-bit HDR pixel format. + - ``yuv420p`` pixel format + - ``yuv422p`` pixel format + - ``yuv444p`` pixel format + - ``yuv420p10`` 10-bit HDR pixel format + - ``yuv422p10`` 10-bit HDR pixel format + - ``yuv444p10`` 10-bit HDR pixel format + - ``yuv420p12`` 12-bit HDR pixel format + - ``yuv422p12`` 12-bit HDR pixel format + - ``yuv444p12`` 12-bit HDR pixel format rate_control_mode (str): - Specify the ``rate_control_mode``. The default is ``"vbr"``. + Specify the ``rate_control_mode``. The default is ``vbr``. Supported rate control modes: - - 'vbr' - variable bitrate - - 'crf' - constant rate factor + - ``vbr`` - variable bitrate + - ``crf`` - constant rate factor crf_level (int): Target CRF level. Must be between 10 and 36, where 10 is the highest quality and 36 is the @@ -993,14 +1014,14 @@ class H265CodecSettings(proto.Message): frame count. Must be greater than zero. gop_duration (google.protobuf.duration_pb2.Duration): Select the GOP size based on the specified duration. The - default is ``"3s"``. Note that ``gopDuration`` must be less + default is ``3s``. Note that ``gopDuration`` must be less than or equal to ```segmentDuration`` <#SegmentSettings>`__, and ```segmentDuration`` <#SegmentSettings>`__ must be divisible by ``gopDuration``. enable_two_pass (bool): Use two-pass encoding strategy to achieve better video - quality. ``VideoStream.rate_control_mode`` must be - ``"vbr"``. The default is ``false``. + quality. ``VideoStream.rate_control_mode`` must be ``vbr``. + The default is ``false``. vbv_size_bits (int): Size of the Video Buffering Verifier (VBV) buffer in bits. Must be greater than zero. The default is equal to @@ -1026,48 +1047,48 @@ class H265CodecSettings(proto.Message): Enforces the specified codec profile. The following profiles are supported: - 8bit profiles + - 8-bit profiles - - ``main`` (default) - - ``main-intra`` - - ``mainstillpicture`` + - ``main`` (default) + - ``main-intra`` + - ``mainstillpicture`` - 10bit profiles + - 10-bit profiles - - ``main10`` (default) - - ``main10-intra`` - - ``main422-10`` - - ``main422-10-intra`` - - ``main444-10`` - - ``main444-10-intra`` + - ``main10`` (default) + - ``main10-intra`` + - ``main422-10`` + - ``main422-10-intra`` + - ``main444-10`` + - ``main444-10-intra`` - 12bit profiles + - 12-bit profiles - - ``main12`` (default) - - ``main12-intra`` - - ``main422-12`` - - ``main422-12-intra`` - - ``main444-12`` - - ``main444-12-intra`` + - ``main12`` (default) + - ``main12-intra`` + - ``main422-12`` + - ``main422-12-intra`` + - ``main444-12`` + - ``main444-12-intra`` The available options are - `FFmpeg-compatible `__\ {: - class="external" }. Note that certain values for this field - may cause the transcoder to override other fields you set in - the ``H265CodecSettings`` message. + `FFmpeg-compatible `__. Note + that certain values for this field may cause the transcoder + to override other fields you set in the + ``H265CodecSettings`` message. tune (str): Enforces the specified codec tune. The available options are - `FFmpeg-compatible `__\ {: - class="external" }. Note that certain values for this field - may cause the transcoder to override other fields you set in - the ``H265CodecSettings`` message. + `FFmpeg-compatible `__. + Note that certain values for this field may cause the + transcoder to override other fields you set in the + ``H265CodecSettings`` message. preset (str): Enforces the specified codec preset. The default is ``veryfast``. The available options are - `FFmpeg-compatible `__\ {: - class="external" }. Note that certain values for this field - may cause the transcoder to override other fields you set in - the ``H265CodecSettings`` message. + `FFmpeg-compatible `__. + Note that certain values for this field may cause the + transcoder to override other fields you set in the + ``H265CodecSettings`` message. """ width_pixels = proto.Field(proto.INT32, number=1,) @@ -1094,6 +1115,7 @@ class H265CodecSettings(proto.Message): class Vp9CodecSettings(proto.Message): r"""VP9 codec settings. + Attributes: width_pixels (int): The width of the video in pixels. Must be an @@ -1118,28 +1140,29 @@ class Vp9CodecSettings(proto.Message): for more information. bitrate_bps (int): Required. The video bitrate in bits per - second. Must be between 1 and 1,000,000,000. + second. The minimum value is 1,000. The maximum + value is 480,000,000. pixel_format (str): - Pixel format to use. The default is ``"yuv420p"``. + Pixel format to use. The default is ``yuv420p``. Supported pixel formats: - - 'yuv420p' pixel format. - - 'yuv422p' pixel format. - - 'yuv444p' pixel format. - - 'yuv420p10' 10-bit HDR pixel format. - - 'yuv422p10' 10-bit HDR pixel format. - - 'yuv444p10' 10-bit HDR pixel format. - - 'yuv420p12' 12-bit HDR pixel format. - - 'yuv422p12' 12-bit HDR pixel format. - - 'yuv444p12' 12-bit HDR pixel format. + - ``yuv420p`` pixel format + - ``yuv422p`` pixel format + - ``yuv444p`` pixel format + - ``yuv420p10`` 10-bit HDR pixel format + - ``yuv422p10`` 10-bit HDR pixel format + - ``yuv444p10`` 10-bit HDR pixel format + - ``yuv420p12`` 12-bit HDR pixel format + - ``yuv422p12`` 12-bit HDR pixel format + - ``yuv444p12`` 12-bit HDR pixel format rate_control_mode (str): - Specify the ``rate_control_mode``. The default is ``"vbr"``. + Specify the ``rate_control_mode``. The default is ``vbr``. Supported rate control modes: - - 'vbr' - variable bitrate - - 'crf' - constant rate factor + - ``vbr`` - variable bitrate + - ``crf`` - constant rate factor crf_level (int): Target CRF level. Must be between 10 and 36, where 10 is the highest quality and 36 is the @@ -1149,7 +1172,7 @@ class Vp9CodecSettings(proto.Message): frame count. Must be greater than zero. gop_duration (google.protobuf.duration_pb2.Duration): Select the GOP size based on the specified duration. The - default is ``"3s"``. Note that ``gopDuration`` must be less + default is ``3s``. Note that ``gopDuration`` must be less than or equal to ```segmentDuration`` <#SegmentSettings>`__, and ```segmentDuration`` <#SegmentSettings>`__ must be divisible by ``gopDuration``. @@ -1163,10 +1186,10 @@ class Vp9CodecSettings(proto.Message): - ``profile3`` The available options are - `WebM-compatible `__\ {: - class="external" }. Note that certain values for this field - may cause the transcoder to override other fields you set in - the ``Vp9CodecSettings`` message. + `WebM-compatible `__. + Note that certain values for this field may cause the + transcoder to override other fields you set in the + ``Vp9CodecSettings`` message. """ width_pixels = proto.Field(proto.INT32, number=1,) @@ -1195,18 +1218,19 @@ class Vp9CodecSettings(proto.Message): class AudioStream(proto.Message): r"""Audio stream resource. + Attributes: codec (str): - The codec for this audio stream. The default is ``"aac"``. + The codec for this audio stream. The default is ``aac``. Supported audio codecs: - - 'aac' - - 'aac-he' - - 'aac-he-v2' - - 'mp3' - - 'ac3' - - 'eac3' + - ``aac`` + - ``aac-he`` + - ``aac-he-v2`` + - ``mp3`` + - ``ac3`` + - ``eac3`` bitrate_bps (int): Required. Audio bitrate in bits per second. Must be between 1 and 10,000,000. @@ -1221,12 +1245,12 @@ class AudioStream(proto.Message): Supported channel names: - - 'fl' - Front left channel - - 'fr' - Front right channel - - 'sl' - Side left channel - - 'sr' - Side right channel - - 'fc' - Front center channel - - 'lfe' - Low frequency + - ``fl`` - Front left channel + - ``fr`` - Front right channel + - ``sl`` - Side left channel + - ``sr`` - Side right channel + - ``fc`` - Front center channel + - ``lfe`` - Low frequency mapping (Sequence[google.cloud.video.transcoder_v1.types.AudioStream.AudioMapping]): The mapping for the ``Job.edit_list`` atoms with audio ``EditAtom.inputs``. @@ -1281,15 +1305,15 @@ class TextStream(proto.Message): Attributes: codec (str): - The codec for this text stream. The default is ``"webvtt"``. + The codec for this text stream. The default is ``webvtt``. Supported text codecs: - - 'srt' - - 'ttml' - - 'cea608' - - 'cea708' - - 'webvtt' + - ``srt`` + - ``ttml`` + - ``cea608`` + - ``cea708`` + - ``webvtt`` mapping (Sequence[google.cloud.video.transcoder_v1.types.TextStream.TextMapping]): The mapping for the ``Job.edit_list`` atoms with text ``EditAtom.inputs``. @@ -1319,12 +1343,13 @@ class TextMapping(proto.Message): class SegmentSettings(proto.Message): - r"""Segment settings for ``"ts"``, ``"fmp4"`` and ``"vtt"``. + r"""Segment settings for ``ts``, ``fmp4`` and ``vtt``. + Attributes: segment_duration (google.protobuf.duration_pb2.Duration): Duration of the segments in seconds. The default is - ``"6.0s"``. Note that ``segmentDuration`` must be greater - than or equal to ```gopDuration`` <#videostream>`__, and + ``6.0s``. Note that ``segmentDuration`` must be greater than + or equal to ```gopDuration`` <#videostream>`__, and ``segmentDuration`` must be divisible by ```gopDuration`` <#videostream>`__. individual_segments (bool): @@ -1338,72 +1363,4 @@ class SegmentSettings(proto.Message): individual_segments = proto.Field(proto.BOOL, number=3,) -class Encryption(proto.Message): - r"""Encryption settings. - Attributes: - key (str): - Required. 128 bit encryption key represented - as lowercase hexadecimal digits. - iv (str): - Required. 128 bit Initialization Vector (IV) - represented as lowercase hexadecimal digits. - aes_128 (google.cloud.video.transcoder_v1.types.Encryption.Aes128Encryption): - Configuration for AES-128 encryption. - sample_aes (google.cloud.video.transcoder_v1.types.Encryption.SampleAesEncryption): - Configuration for SAMPLE-AES encryption. - mpeg_cenc (google.cloud.video.transcoder_v1.types.Encryption.MpegCommonEncryption): - Configuration for MPEG Common Encryption - (MPEG-CENC). - """ - - class Aes128Encryption(proto.Message): - r"""Configuration for AES-128 encryption. - Attributes: - key_uri (str): - Required. URI of the key delivery service. - This URI is inserted into the M3U8 header. - """ - - key_uri = proto.Field(proto.STRING, number=1,) - - class SampleAesEncryption(proto.Message): - r"""Configuration for SAMPLE-AES encryption. - Attributes: - key_uri (str): - Required. URI of the key delivery service. - This URI is inserted into the M3U8 header. - """ - - key_uri = proto.Field(proto.STRING, number=1,) - - class MpegCommonEncryption(proto.Message): - r"""Configuration for MPEG Common Encryption (MPEG-CENC). - Attributes: - key_id (str): - Required. 128 bit Key ID represented as - lowercase hexadecimal digits for use with common - encryption. - scheme (str): - Required. Specify the encryption scheme. - Supported encryption schemes: - - 'cenc' - - 'cbcs' - """ - - key_id = proto.Field(proto.STRING, number=1,) - scheme = proto.Field(proto.STRING, number=2,) - - key = proto.Field(proto.STRING, number=1,) - iv = proto.Field(proto.STRING, number=2,) - aes_128 = proto.Field( - proto.MESSAGE, number=3, oneof="encryption_mode", message=Aes128Encryption, - ) - sample_aes = proto.Field( - proto.MESSAGE, number=4, oneof="encryption_mode", message=SampleAesEncryption, - ) - mpeg_cenc = proto.Field( - proto.MESSAGE, number=5, oneof="encryption_mode", message=MpegCommonEncryption, - ) - - __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/video/transcoder_v1/types/services.py b/google/cloud/video/transcoder_v1/types/services.py index edee4f1..4d67e83 100644 --- a/google/cloud/video/transcoder_v1/types/services.py +++ b/google/cloud/video/transcoder_v1/types/services.py @@ -37,6 +37,7 @@ class CreateJobRequest(proto.Message): r"""Request message for ``TranscoderService.CreateJob``. + Attributes: parent (str): Required. The parent location to create and process this @@ -81,6 +82,7 @@ class ListJobsRequest(proto.Message): class GetJobRequest(proto.Message): r"""Request message for ``TranscoderService.GetJob``. + Attributes: name (str): Required. The name of the job to retrieve. Format: @@ -92,17 +94,24 @@ class GetJobRequest(proto.Message): class DeleteJobRequest(proto.Message): r"""Request message for ``TranscoderService.DeleteJob``. + Attributes: name (str): Required. The name of the job to delete. Format: ``projects/{project}/locations/{location}/jobs/{job}`` + allow_missing (bool): + If set to true, and the job is not found, the + request will succeed but no action will be taken + on the server. """ name = proto.Field(proto.STRING, number=1,) + allow_missing = proto.Field(proto.BOOL, number=2,) class ListJobsResponse(proto.Message): r"""Response message for ``TranscoderService.ListJobs``. + Attributes: jobs (Sequence[google.cloud.video.transcoder_v1.types.Job]): List of jobs in the specified region. @@ -123,6 +132,7 @@ def raw_page(self): class CreateJobTemplateRequest(proto.Message): r"""Request message for ``TranscoderService.CreateJobTemplate``. + Attributes: parent (str): Required. The parent location to create this job template. @@ -147,6 +157,7 @@ class CreateJobTemplateRequest(proto.Message): class ListJobTemplatesRequest(proto.Message): r"""Request message for ``TranscoderService.ListJobTemplates``. + Attributes: parent (str): Required. The parent location from which to retrieve the @@ -175,6 +186,7 @@ class ListJobTemplatesRequest(proto.Message): class GetJobTemplateRequest(proto.Message): r"""Request message for ``TranscoderService.GetJobTemplate``. + Attributes: name (str): Required. The name of the job template to retrieve. Format: @@ -186,17 +198,24 @@ class GetJobTemplateRequest(proto.Message): class DeleteJobTemplateRequest(proto.Message): r"""Request message for ``TranscoderService.DeleteJobTemplate``. + Attributes: name (str): Required. The name of the job template to delete. ``projects/{project}/locations/{location}/jobTemplates/{job_template}`` + allow_missing (bool): + If set to true, and the job template is not + found, the request will succeed but no action + will be taken on the server. """ name = proto.Field(proto.STRING, number=1,) + allow_missing = proto.Field(proto.BOOL, number=2,) class ListJobTemplatesResponse(proto.Message): r"""Response message for ``TranscoderService.ListJobTemplates``. + Attributes: job_templates (Sequence[google.cloud.video.transcoder_v1.types.JobTemplate]): List of job templates in the specified diff --git a/google/cloud/video/transcoder_v1beta1/services/transcoder_service/async_client.py b/google/cloud/video/transcoder_v1beta1/services/transcoder_service/async_client.py index dbdfc03..1929949 100644 --- a/google/cloud/video/transcoder_v1beta1/services/transcoder_service/async_client.py +++ b/google/cloud/video/transcoder_v1beta1/services/transcoder_service/async_client.py @@ -775,6 +775,12 @@ async def delete_job_template( request, retry=retry, timeout=timeout, metadata=metadata, ) + async def __aenter__(self): + return self + + async def __aexit__(self, exc_type, exc, tb): + await self.transport.close() + try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( diff --git a/google/cloud/video/transcoder_v1beta1/services/transcoder_service/client.py b/google/cloud/video/transcoder_v1beta1/services/transcoder_service/client.py index 96e7c28..a6adc6f 100644 --- a/google/cloud/video/transcoder_v1beta1/services/transcoder_service/client.py +++ b/google/cloud/video/transcoder_v1beta1/services/transcoder_service/client.py @@ -371,10 +371,7 @@ def __init__( client_cert_source_for_mtls=client_cert_source_func, quota_project_id=client_options.quota_project_id, client_info=client_info, - always_use_jwt_access=( - Transport == type(self).get_transport_class("grpc") - or Transport == type(self).get_transport_class("grpc_asyncio") - ), + always_use_jwt_access=True, ) def create_job( @@ -978,6 +975,19 @@ def delete_job_template( request, retry=retry, timeout=timeout, metadata=metadata, ) + def __enter__(self): + return self + + def __exit__(self, type, value, traceback): + """Releases underlying transport's resources. + + .. warning:: + ONLY use as a context manager if the transport is NOT shared + with other clients! Exiting the with block will CLOSE the transport + and may cause errors in other clients! + """ + self.transport.close() + try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( diff --git a/google/cloud/video/transcoder_v1beta1/services/transcoder_service/transports/base.py b/google/cloud/video/transcoder_v1beta1/services/transcoder_service/transports/base.py index c938e19..35f9e9b 100644 --- a/google/cloud/video/transcoder_v1beta1/services/transcoder_service/transports/base.py +++ b/google/cloud/video/transcoder_v1beta1/services/transcoder_service/transports/base.py @@ -182,6 +182,15 @@ def _prep_wrapped_messages(self, client_info): ), } + def close(self): + """Closes resources associated with the transport. + + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! + """ + raise NotImplementedError() + @property def create_job( self, diff --git a/google/cloud/video/transcoder_v1beta1/services/transcoder_service/transports/grpc.py b/google/cloud/video/transcoder_v1beta1/services/transcoder_service/transports/grpc.py index ef8e5c7..4f4f46f 100644 --- a/google/cloud/video/transcoder_v1beta1/services/transcoder_service/transports/grpc.py +++ b/google/cloud/video/transcoder_v1beta1/services/transcoder_service/transports/grpc.py @@ -437,5 +437,8 @@ def delete_job_template( ) return self._stubs["delete_job_template"] + def close(self): + self.grpc_channel.close() + __all__ = ("TranscoderServiceGrpcTransport",) diff --git a/google/cloud/video/transcoder_v1beta1/services/transcoder_service/transports/grpc_asyncio.py b/google/cloud/video/transcoder_v1beta1/services/transcoder_service/transports/grpc_asyncio.py index b66a617..2b5324e 100644 --- a/google/cloud/video/transcoder_v1beta1/services/transcoder_service/transports/grpc_asyncio.py +++ b/google/cloud/video/transcoder_v1beta1/services/transcoder_service/transports/grpc_asyncio.py @@ -446,5 +446,8 @@ def delete_job_template( ) return self._stubs["delete_job_template"] + def close(self): + return self.grpc_channel.close() + __all__ = ("TranscoderServiceGrpcAsyncIOTransport",) diff --git a/google/cloud/video/transcoder_v1beta1/types/resources.py b/google/cloud/video/transcoder_v1beta1/types/resources.py index ceeefa0..50341f1 100644 --- a/google/cloud/video/transcoder_v1beta1/types/resources.py +++ b/google/cloud/video/transcoder_v1beta1/types/resources.py @@ -49,6 +49,7 @@ class Job(proto.Message): r"""Transcoding job resource. + Attributes: name (str): The resource name of the job. Format: @@ -132,6 +133,7 @@ class ProcessingState(proto.Enum): class OriginUri(proto.Message): r"""The origin URI. + Attributes: hls (str): HLS manifest URI per @@ -171,6 +173,7 @@ class OriginUri(proto.Message): class JobTemplate(proto.Message): r"""Transcoding job template resource. + Attributes: name (str): The resource name of the job template. Format: @@ -185,6 +188,7 @@ class JobTemplate(proto.Message): class JobConfig(proto.Message): r"""Job configuration + Attributes: inputs (Sequence[google.cloud.video.transcoder_v1beta1.types.Input]): List of input assets stored in Cloud Storage. @@ -230,6 +234,7 @@ class JobConfig(proto.Message): class Input(proto.Message): r"""Input asset. + Attributes: key (str): A unique key for this input. Must be @@ -253,6 +258,7 @@ class Input(proto.Message): class Output(proto.Message): r"""Location of output file(s) in a Cloud Storage bucket. + Attributes: uri (str): URI for the output file(s). For example, @@ -265,6 +271,7 @@ class Output(proto.Message): class EditAtom(proto.Message): r"""Edit atom. + Attributes: key (str): A unique key for this atom. Must be specified @@ -294,6 +301,7 @@ class EditAtom(proto.Message): class AdBreak(proto.Message): r"""Ad break. + Attributes: start_time_offset (google.protobuf.duration_pb2.Duration): Start time in seconds for the ad break, relative to the @@ -336,6 +344,7 @@ class ElementaryStream(proto.Message): class MuxStream(proto.Message): r"""Multiplexing settings for output stream. + Attributes: key (str): A unique key for this multiplexed stream. HLS media @@ -377,6 +386,7 @@ class MuxStream(proto.Message): class Manifest(proto.Message): r"""Manifest configuration. + Attributes: file_name (str): The name of the generated file. The default is @@ -407,6 +417,7 @@ class ManifestType(proto.Enum): class PubsubDestination(proto.Message): r"""A Pub/Sub destination. + Attributes: topic (str): The name of the Pub/Sub topic to publish job completion @@ -506,6 +517,7 @@ class SpriteSheet(proto.Message): class Overlay(proto.Message): r"""Overlay configuration. + Attributes: image (google.cloud.video.transcoder_v1beta1.types.Overlay.Image): Image overlay. @@ -522,6 +534,7 @@ class FadeType(proto.Enum): class NormalizedCoordinate(proto.Message): r"""2D normalized coordinates. Default: ``{0.0, 0.0}`` + Attributes: x (float): Normalized x coordinate. @@ -534,6 +547,7 @@ class NormalizedCoordinate(proto.Message): class Image(proto.Message): r"""Overlaid jpeg image. + Attributes: uri (str): Required. URI of the JPEG image in Cloud Storage. For @@ -559,6 +573,7 @@ class Image(proto.Message): class AnimationStatic(proto.Message): r"""Display static overlay object. + Attributes: xy (google.cloud.video.transcoder_v1beta1.types.Overlay.NormalizedCoordinate): Normalized coordinates based on output video resolution. @@ -581,6 +596,7 @@ class AnimationStatic(proto.Message): class AnimationFade(proto.Message): r"""Display overlay object with fade animation. + Attributes: fade_type (google.cloud.video.transcoder_v1beta1.types.Overlay.FadeType): Required. Type of fade animation: ``FADE_IN`` or @@ -628,6 +644,7 @@ class AnimationEnd(proto.Message): class Animation(proto.Message): r"""Animation types. + Attributes: animation_static (google.cloud.video.transcoder_v1beta1.types.Overlay.AnimationStatic): Display static overlay object. @@ -662,6 +679,7 @@ class Animation(proto.Message): class PreprocessingConfig(proto.Message): r"""Preprocessing configurations. + Attributes: color (google.cloud.video.transcoder_v1beta1.types.PreprocessingConfig.Color): Color preprocessing configuration. @@ -679,6 +697,7 @@ class PreprocessingConfig(proto.Message): class Color(proto.Message): r"""Color preprocessing configuration. + Attributes: saturation (float): Control color saturation of the video. Enter @@ -703,6 +722,7 @@ class Color(proto.Message): class Denoise(proto.Message): r"""Denoise preprocessing configuration. + Attributes: strength (float): Set strength of the denoise. Enter a value @@ -723,6 +743,7 @@ class Denoise(proto.Message): class Deblock(proto.Message): r"""Deblock preprocessing configuration. + Attributes: strength (float): Set strength of the deblocker. Enter a value @@ -738,6 +759,7 @@ class Deblock(proto.Message): class Audio(proto.Message): r"""Audio preprocessing configuration. + Attributes: lufs (float): Specify audio loudness normalization in loudness units @@ -824,6 +846,7 @@ class Pad(proto.Message): class VideoStream(proto.Message): r"""Video stream resource. + Attributes: codec (str): Codec type. The following codecs are supported: @@ -978,6 +1001,7 @@ class VideoStream(proto.Message): class AudioStream(proto.Message): r"""Audio stream resource. + Attributes: codec (str): The codec for this audio stream. The default is ``"aac"``. @@ -1033,6 +1057,7 @@ class AudioAtom(proto.Message): class AudioChannel(proto.Message): r"""The audio channel. + Attributes: inputs (Sequence[google.cloud.video.transcoder_v1beta1.types.AudioStream.AudioAtom.AudioChannel.AudioChannelInput]): List of ``Job.inputs`` for this audio channel. @@ -1120,6 +1145,7 @@ class TextAtom(proto.Message): class TextInput(proto.Message): r"""Identifies which input file and track should be used. + Attributes: key (str): Required. The ``Input.key`` that identifies the input file. @@ -1143,6 +1169,7 @@ class TextInput(proto.Message): class SegmentSettings(proto.Message): r"""Segment settings for ``"ts"``, ``"fmp4"`` and ``"vtt"``. + Attributes: segment_duration (google.protobuf.duration_pb2.Duration): Duration of the segments in seconds. The default is @@ -1163,6 +1190,7 @@ class SegmentSettings(proto.Message): class Encryption(proto.Message): r"""Encryption settings. + Attributes: key (str): Required. 128 bit encryption key represented @@ -1181,6 +1209,7 @@ class Encryption(proto.Message): class Aes128Encryption(proto.Message): r"""Configuration for AES-128 encryption. + Attributes: key_uri (str): Required. URI of the key delivery service. @@ -1191,6 +1220,7 @@ class Aes128Encryption(proto.Message): class SampleAesEncryption(proto.Message): r"""Configuration for SAMPLE-AES encryption. + Attributes: key_uri (str): Required. URI of the key delivery service. @@ -1201,6 +1231,7 @@ class SampleAesEncryption(proto.Message): class MpegCommonEncryption(proto.Message): r"""Configuration for MPEG Common Encryption (MPEG-CENC). + Attributes: key_id (str): Required. 128 bit Key ID represented as @@ -1231,6 +1262,7 @@ class MpegCommonEncryption(proto.Message): class Progress(proto.Message): r"""Estimated fractional progress for each step, from ``0`` to ``1``. + Attributes: analyzed (float): Estimated fractional progress for ``analyzing`` step. @@ -1250,6 +1282,7 @@ class Progress(proto.Message): class FailureDetail(proto.Message): r"""Additional information about the reasons for the failure. + Attributes: description (str): A description of the failure. diff --git a/google/cloud/video/transcoder_v1beta1/types/services.py b/google/cloud/video/transcoder_v1beta1/types/services.py index 4255a53..fe23b03 100644 --- a/google/cloud/video/transcoder_v1beta1/types/services.py +++ b/google/cloud/video/transcoder_v1beta1/types/services.py @@ -37,6 +37,7 @@ class CreateJobRequest(proto.Message): r"""Request message for ``TranscoderService.CreateJob``. + Attributes: parent (str): Required. The parent location to create and process this @@ -72,6 +73,7 @@ class ListJobsRequest(proto.Message): class GetJobRequest(proto.Message): r"""Request message for ``TranscoderService.GetJob``. + Attributes: name (str): Required. The name of the job to retrieve. Format: @@ -83,6 +85,7 @@ class GetJobRequest(proto.Message): class DeleteJobRequest(proto.Message): r"""Request message for ``TranscoderService.DeleteJob``. + Attributes: name (str): Required. The name of the job to delete. Format: @@ -94,6 +97,7 @@ class DeleteJobRequest(proto.Message): class ListJobsResponse(proto.Message): r"""Response message for ``TranscoderService.ListJobs``. + Attributes: jobs (Sequence[google.cloud.video.transcoder_v1beta1.types.Job]): List of jobs in the specified region. @@ -111,6 +115,7 @@ def raw_page(self): class CreateJobTemplateRequest(proto.Message): r"""Request message for ``TranscoderService.CreateJobTemplate``. + Attributes: parent (str): Required. The parent location to create this job template. @@ -135,6 +140,7 @@ class CreateJobTemplateRequest(proto.Message): class ListJobTemplatesRequest(proto.Message): r"""Request message for ``TranscoderService.ListJobTemplates``. + Attributes: parent (str): Required. The parent location from which to retrieve the @@ -154,6 +160,7 @@ class ListJobTemplatesRequest(proto.Message): class GetJobTemplateRequest(proto.Message): r"""Request message for ``TranscoderService.GetJobTemplate``. + Attributes: name (str): Required. The name of the job template to retrieve. Format: @@ -165,6 +172,7 @@ class GetJobTemplateRequest(proto.Message): class DeleteJobTemplateRequest(proto.Message): r"""Request message for ``TranscoderService.DeleteJobTemplate``. + Attributes: name (str): Required. The name of the job template to delete. @@ -176,6 +184,7 @@ class DeleteJobTemplateRequest(proto.Message): class ListJobTemplatesResponse(proto.Message): r"""Response message for ``TranscoderService.ListJobTemplates``. + Attributes: job_templates (Sequence[google.cloud.video.transcoder_v1beta1.types.JobTemplate]): List of job templates in the specified diff --git a/noxfile.py b/noxfile.py index 93ea9b1..f885c68 100644 --- a/noxfile.py +++ b/noxfile.py @@ -29,7 +29,7 @@ DEFAULT_PYTHON_VERSION = "3.8" SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] -UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9"] +UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"] CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() diff --git a/setup.py b/setup.py index 9332c7e..4d79dbd 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ import os import setuptools # type: ignore -version = "1.0.1" +version = "1.1.0" package_root = os.path.abspath(os.path.dirname(__file__)) diff --git a/tests/unit/gapic/transcoder_v1/test_transcoder_service.py b/tests/unit/gapic/transcoder_v1/test_transcoder_service.py index 8bb42af..44a2468 100644 --- a/tests/unit/gapic/transcoder_v1/test_transcoder_service.py +++ b/tests/unit/gapic/transcoder_v1/test_transcoder_service.py @@ -29,6 +29,7 @@ from google.api_core import gapic_v1 from google.api_core import grpc_helpers from google.api_core import grpc_helpers_async +from google.api_core import path_template from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError from google.cloud.video.transcoder_v1.services.transcoder_service import ( @@ -2594,6 +2595,9 @@ def test_transcoder_service_base_transport(): with pytest.raises(NotImplementedError): getattr(transport, method)(request=object()) + with pytest.raises(NotImplementedError): + transport.close() + @requires_google_auth_gte_1_25_0 def test_transcoder_service_base_transport_with_credentials_file(): @@ -3100,3 +3104,49 @@ def test_client_withDEFAULT_CLIENT_INFO(): credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) + + +@pytest.mark.asyncio +async def test_transport_close_async(): + client = TranscoderServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + ) + with mock.patch.object( + type(getattr(client.transport, "grpc_channel")), "close" + ) as close: + async with client: + close.assert_not_called() + close.assert_called_once() + + +def test_transport_close(): + transports = { + "grpc": "_grpc_channel", + } + + for transport, close_name in transports.items(): + client = TranscoderServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport + ) + with mock.patch.object( + type(getattr(client.transport, close_name)), "close" + ) as close: + with client: + close.assert_not_called() + close.assert_called_once() + + +def test_client_ctx(): + transports = [ + "grpc", + ] + for transport in transports: + client = TranscoderServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport + ) + # Test client calls underlying transport. + with mock.patch.object(type(client.transport), "close") as close: + close.assert_not_called() + with client: + pass + close.assert_called() diff --git a/tests/unit/gapic/transcoder_v1beta1/test_transcoder_service.py b/tests/unit/gapic/transcoder_v1beta1/test_transcoder_service.py index bece6f5..83c15c4 100644 --- a/tests/unit/gapic/transcoder_v1beta1/test_transcoder_service.py +++ b/tests/unit/gapic/transcoder_v1beta1/test_transcoder_service.py @@ -29,6 +29,7 @@ from google.api_core import gapic_v1 from google.api_core import grpc_helpers from google.api_core import grpc_helpers_async +from google.api_core import path_template from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError from google.cloud.video.transcoder_v1beta1.services.transcoder_service import ( @@ -2598,6 +2599,9 @@ def test_transcoder_service_base_transport(): with pytest.raises(NotImplementedError): getattr(transport, method)(request=object()) + with pytest.raises(NotImplementedError): + transport.close() + @requires_google_auth_gte_1_25_0 def test_transcoder_service_base_transport_with_credentials_file(): @@ -3104,3 +3108,49 @@ def test_client_withDEFAULT_CLIENT_INFO(): credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, ) prep.assert_called_once_with(client_info) + + +@pytest.mark.asyncio +async def test_transport_close_async(): + client = TranscoderServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + ) + with mock.patch.object( + type(getattr(client.transport, "grpc_channel")), "close" + ) as close: + async with client: + close.assert_not_called() + close.assert_called_once() + + +def test_transport_close(): + transports = { + "grpc": "_grpc_channel", + } + + for transport, close_name in transports.items(): + client = TranscoderServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport + ) + with mock.patch.object( + type(getattr(client.transport, close_name)), "close" + ) as close: + with client: + close.assert_not_called() + close.assert_called_once() + + +def test_client_ctx(): + transports = [ + "grpc", + ] + for transport in transports: + client = TranscoderServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport + ) + # Test client calls underlying transport. + with mock.patch.object(type(client.transport), "close") as close: + close.assert_not_called() + with client: + pass + close.assert_called() pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy