google-cloud-video-transcoder 1.15.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- google/cloud/video/transcoder/__init__.py +93 -0
- google/cloud/video/transcoder/gapic_version.py +16 -0
- google/cloud/video/transcoder/py.typed +2 -0
- google/cloud/video/transcoder_v1/__init__.py +91 -0
- google/cloud/video/transcoder_v1/gapic_metadata.json +148 -0
- google/cloud/video/transcoder_v1/gapic_version.py +16 -0
- google/cloud/video/transcoder_v1/py.typed +2 -0
- google/cloud/video/transcoder_v1/services/__init__.py +15 -0
- google/cloud/video/transcoder_v1/services/transcoder_service/__init__.py +22 -0
- google/cloud/video/transcoder_v1/services/transcoder_service/async_client.py +1242 -0
- google/cloud/video/transcoder_v1/services/transcoder_service/client.py +1669 -0
- google/cloud/video/transcoder_v1/services/transcoder_service/pagers.py +353 -0
- google/cloud/video/transcoder_v1/services/transcoder_service/transports/__init__.py +36 -0
- google/cloud/video/transcoder_v1/services/transcoder_service/transports/base.py +260 -0
- google/cloud/video/transcoder_v1/services/transcoder_service/transports/grpc.py +542 -0
- google/cloud/video/transcoder_v1/services/transcoder_service/transports/grpc_asyncio.py +605 -0
- google/cloud/video/transcoder_v1/services/transcoder_service/transports/rest.py +1709 -0
- google/cloud/video/transcoder_v1/services/transcoder_service/transports/rest_base.py +490 -0
- google/cloud/video/transcoder_v1/types/__init__.py +80 -0
- google/cloud/video/transcoder_v1/types/resources.py +2534 -0
- google/cloud/video/transcoder_v1/types/services.py +326 -0
- google_cloud_video_transcoder-1.15.1.dist-info/LICENSE +202 -0
- google_cloud_video_transcoder-1.15.1.dist-info/METADATA +228 -0
- google_cloud_video_transcoder-1.15.1.dist-info/RECORD +26 -0
- google_cloud_video_transcoder-1.15.1.dist-info/WHEEL +5 -0
- google_cloud_video_transcoder-1.15.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,1242 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Copyright 2024 Google LLC
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
#
|
|
16
|
+
from collections import OrderedDict
|
|
17
|
+
import logging as std_logging
|
|
18
|
+
import re
|
|
19
|
+
from typing import (
|
|
20
|
+
Callable,
|
|
21
|
+
Dict,
|
|
22
|
+
Mapping,
|
|
23
|
+
MutableMapping,
|
|
24
|
+
MutableSequence,
|
|
25
|
+
Optional,
|
|
26
|
+
Sequence,
|
|
27
|
+
Tuple,
|
|
28
|
+
Type,
|
|
29
|
+
Union,
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
from google.api_core import exceptions as core_exceptions
|
|
33
|
+
from google.api_core import gapic_v1
|
|
34
|
+
from google.api_core import retry_async as retries
|
|
35
|
+
from google.api_core.client_options import ClientOptions
|
|
36
|
+
from google.auth import credentials as ga_credentials # type: ignore
|
|
37
|
+
from google.oauth2 import service_account # type: ignore
|
|
38
|
+
|
|
39
|
+
from google.cloud.video.transcoder_v1 import gapic_version as package_version
|
|
40
|
+
|
|
41
|
+
try:
|
|
42
|
+
OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None]
|
|
43
|
+
except AttributeError: # pragma: NO COVER
|
|
44
|
+
OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore
|
|
45
|
+
|
|
46
|
+
from google.protobuf import timestamp_pb2 # type: ignore
|
|
47
|
+
from google.rpc import status_pb2 # type: ignore
|
|
48
|
+
|
|
49
|
+
from google.cloud.video.transcoder_v1.services.transcoder_service import pagers
|
|
50
|
+
from google.cloud.video.transcoder_v1.types import resources, services
|
|
51
|
+
|
|
52
|
+
from .client import TranscoderServiceClient
|
|
53
|
+
from .transports.base import DEFAULT_CLIENT_INFO, TranscoderServiceTransport
|
|
54
|
+
from .transports.grpc_asyncio import TranscoderServiceGrpcAsyncIOTransport
|
|
55
|
+
|
|
56
|
+
try:
|
|
57
|
+
from google.api_core import client_logging # type: ignore
|
|
58
|
+
|
|
59
|
+
CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
|
|
60
|
+
except ImportError: # pragma: NO COVER
|
|
61
|
+
CLIENT_LOGGING_SUPPORTED = False
|
|
62
|
+
|
|
63
|
+
_LOGGER = std_logging.getLogger(__name__)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class TranscoderServiceAsyncClient:
|
|
67
|
+
"""Using the Transcoder API, you can queue asynchronous jobs for
|
|
68
|
+
transcoding media into various output formats. Output formats
|
|
69
|
+
may include different streaming standards such as HTTP Live
|
|
70
|
+
Streaming (HLS) and Dynamic Adaptive Streaming over HTTP (DASH).
|
|
71
|
+
You can also customize jobs using advanced features such as
|
|
72
|
+
Digital Rights Management (DRM), audio equalization, content
|
|
73
|
+
concatenation, and digital ad-stitch ready content generation.
|
|
74
|
+
"""
|
|
75
|
+
|
|
76
|
+
_client: TranscoderServiceClient
|
|
77
|
+
|
|
78
|
+
# Copy defaults from the synchronous client for use here.
|
|
79
|
+
# Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
|
|
80
|
+
DEFAULT_ENDPOINT = TranscoderServiceClient.DEFAULT_ENDPOINT
|
|
81
|
+
DEFAULT_MTLS_ENDPOINT = TranscoderServiceClient.DEFAULT_MTLS_ENDPOINT
|
|
82
|
+
_DEFAULT_ENDPOINT_TEMPLATE = TranscoderServiceClient._DEFAULT_ENDPOINT_TEMPLATE
|
|
83
|
+
_DEFAULT_UNIVERSE = TranscoderServiceClient._DEFAULT_UNIVERSE
|
|
84
|
+
|
|
85
|
+
job_path = staticmethod(TranscoderServiceClient.job_path)
|
|
86
|
+
parse_job_path = staticmethod(TranscoderServiceClient.parse_job_path)
|
|
87
|
+
job_template_path = staticmethod(TranscoderServiceClient.job_template_path)
|
|
88
|
+
parse_job_template_path = staticmethod(
|
|
89
|
+
TranscoderServiceClient.parse_job_template_path
|
|
90
|
+
)
|
|
91
|
+
common_billing_account_path = staticmethod(
|
|
92
|
+
TranscoderServiceClient.common_billing_account_path
|
|
93
|
+
)
|
|
94
|
+
parse_common_billing_account_path = staticmethod(
|
|
95
|
+
TranscoderServiceClient.parse_common_billing_account_path
|
|
96
|
+
)
|
|
97
|
+
common_folder_path = staticmethod(TranscoderServiceClient.common_folder_path)
|
|
98
|
+
parse_common_folder_path = staticmethod(
|
|
99
|
+
TranscoderServiceClient.parse_common_folder_path
|
|
100
|
+
)
|
|
101
|
+
common_organization_path = staticmethod(
|
|
102
|
+
TranscoderServiceClient.common_organization_path
|
|
103
|
+
)
|
|
104
|
+
parse_common_organization_path = staticmethod(
|
|
105
|
+
TranscoderServiceClient.parse_common_organization_path
|
|
106
|
+
)
|
|
107
|
+
common_project_path = staticmethod(TranscoderServiceClient.common_project_path)
|
|
108
|
+
parse_common_project_path = staticmethod(
|
|
109
|
+
TranscoderServiceClient.parse_common_project_path
|
|
110
|
+
)
|
|
111
|
+
common_location_path = staticmethod(TranscoderServiceClient.common_location_path)
|
|
112
|
+
parse_common_location_path = staticmethod(
|
|
113
|
+
TranscoderServiceClient.parse_common_location_path
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
@classmethod
|
|
117
|
+
def from_service_account_info(cls, info: dict, *args, **kwargs):
|
|
118
|
+
"""Creates an instance of this client using the provided credentials
|
|
119
|
+
info.
|
|
120
|
+
|
|
121
|
+
Args:
|
|
122
|
+
info (dict): The service account private key info.
|
|
123
|
+
args: Additional arguments to pass to the constructor.
|
|
124
|
+
kwargs: Additional arguments to pass to the constructor.
|
|
125
|
+
|
|
126
|
+
Returns:
|
|
127
|
+
TranscoderServiceAsyncClient: The constructed client.
|
|
128
|
+
"""
|
|
129
|
+
return TranscoderServiceClient.from_service_account_info.__func__(TranscoderServiceAsyncClient, info, *args, **kwargs) # type: ignore
|
|
130
|
+
|
|
131
|
+
@classmethod
|
|
132
|
+
def from_service_account_file(cls, filename: str, *args, **kwargs):
|
|
133
|
+
"""Creates an instance of this client using the provided credentials
|
|
134
|
+
file.
|
|
135
|
+
|
|
136
|
+
Args:
|
|
137
|
+
filename (str): The path to the service account private key json
|
|
138
|
+
file.
|
|
139
|
+
args: Additional arguments to pass to the constructor.
|
|
140
|
+
kwargs: Additional arguments to pass to the constructor.
|
|
141
|
+
|
|
142
|
+
Returns:
|
|
143
|
+
TranscoderServiceAsyncClient: The constructed client.
|
|
144
|
+
"""
|
|
145
|
+
return TranscoderServiceClient.from_service_account_file.__func__(TranscoderServiceAsyncClient, filename, *args, **kwargs) # type: ignore
|
|
146
|
+
|
|
147
|
+
from_service_account_json = from_service_account_file
|
|
148
|
+
|
|
149
|
+
@classmethod
|
|
150
|
+
def get_mtls_endpoint_and_cert_source(
|
|
151
|
+
cls, client_options: Optional[ClientOptions] = None
|
|
152
|
+
):
|
|
153
|
+
"""Return the API endpoint and client cert source for mutual TLS.
|
|
154
|
+
|
|
155
|
+
The client cert source is determined in the following order:
|
|
156
|
+
(1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the
|
|
157
|
+
client cert source is None.
|
|
158
|
+
(2) if `client_options.client_cert_source` is provided, use the provided one; if the
|
|
159
|
+
default client cert source exists, use the default one; otherwise the client cert
|
|
160
|
+
source is None.
|
|
161
|
+
|
|
162
|
+
The API endpoint is determined in the following order:
|
|
163
|
+
(1) if `client_options.api_endpoint` if provided, use the provided one.
|
|
164
|
+
(2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
|
|
165
|
+
default mTLS endpoint; if the environment variable is "never", use the default API
|
|
166
|
+
endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
|
|
167
|
+
use the default API endpoint.
|
|
168
|
+
|
|
169
|
+
More details can be found at https://google.aip.dev/auth/4114.
|
|
170
|
+
|
|
171
|
+
Args:
|
|
172
|
+
client_options (google.api_core.client_options.ClientOptions): Custom options for the
|
|
173
|
+
client. Only the `api_endpoint` and `client_cert_source` properties may be used
|
|
174
|
+
in this method.
|
|
175
|
+
|
|
176
|
+
Returns:
|
|
177
|
+
Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the
|
|
178
|
+
client cert source to use.
|
|
179
|
+
|
|
180
|
+
Raises:
|
|
181
|
+
google.auth.exceptions.MutualTLSChannelError: If any errors happen.
|
|
182
|
+
"""
|
|
183
|
+
return TranscoderServiceClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore
|
|
184
|
+
|
|
185
|
+
@property
|
|
186
|
+
def transport(self) -> TranscoderServiceTransport:
|
|
187
|
+
"""Returns the transport used by the client instance.
|
|
188
|
+
|
|
189
|
+
Returns:
|
|
190
|
+
TranscoderServiceTransport: The transport used by the client instance.
|
|
191
|
+
"""
|
|
192
|
+
return self._client.transport
|
|
193
|
+
|
|
194
|
+
@property
|
|
195
|
+
def api_endpoint(self):
|
|
196
|
+
"""Return the API endpoint used by the client instance.
|
|
197
|
+
|
|
198
|
+
Returns:
|
|
199
|
+
str: The API endpoint used by the client instance.
|
|
200
|
+
"""
|
|
201
|
+
return self._client._api_endpoint
|
|
202
|
+
|
|
203
|
+
@property
|
|
204
|
+
def universe_domain(self) -> str:
|
|
205
|
+
"""Return the universe domain used by the client instance.
|
|
206
|
+
|
|
207
|
+
Returns:
|
|
208
|
+
str: The universe domain used
|
|
209
|
+
by the client instance.
|
|
210
|
+
"""
|
|
211
|
+
return self._client._universe_domain
|
|
212
|
+
|
|
213
|
+
get_transport_class = TranscoderServiceClient.get_transport_class
|
|
214
|
+
|
|
215
|
+
def __init__(
|
|
216
|
+
self,
|
|
217
|
+
*,
|
|
218
|
+
credentials: Optional[ga_credentials.Credentials] = None,
|
|
219
|
+
transport: Optional[
|
|
220
|
+
Union[
|
|
221
|
+
str,
|
|
222
|
+
TranscoderServiceTransport,
|
|
223
|
+
Callable[..., TranscoderServiceTransport],
|
|
224
|
+
]
|
|
225
|
+
] = "grpc_asyncio",
|
|
226
|
+
client_options: Optional[ClientOptions] = None,
|
|
227
|
+
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
|
|
228
|
+
) -> None:
|
|
229
|
+
"""Instantiates the transcoder service async client.
|
|
230
|
+
|
|
231
|
+
Args:
|
|
232
|
+
credentials (Optional[google.auth.credentials.Credentials]): The
|
|
233
|
+
authorization credentials to attach to requests. These
|
|
234
|
+
credentials identify the application to the service; if none
|
|
235
|
+
are specified, the client will attempt to ascertain the
|
|
236
|
+
credentials from the environment.
|
|
237
|
+
transport (Optional[Union[str,TranscoderServiceTransport,Callable[..., TranscoderServiceTransport]]]):
|
|
238
|
+
The transport to use, or a Callable that constructs and returns a new transport to use.
|
|
239
|
+
If a Callable is given, it will be called with the same set of initialization
|
|
240
|
+
arguments as used in the TranscoderServiceTransport constructor.
|
|
241
|
+
If set to None, a transport is chosen automatically.
|
|
242
|
+
client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
|
|
243
|
+
Custom options for the client.
|
|
244
|
+
|
|
245
|
+
1. The ``api_endpoint`` property can be used to override the
|
|
246
|
+
default endpoint provided by the client when ``transport`` is
|
|
247
|
+
not explicitly provided. Only if this property is not set and
|
|
248
|
+
``transport`` was not explicitly provided, the endpoint is
|
|
249
|
+
determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment
|
|
250
|
+
variable, which have one of the following values:
|
|
251
|
+
"always" (always use the default mTLS endpoint), "never" (always
|
|
252
|
+
use the default regular endpoint) and "auto" (auto-switch to the
|
|
253
|
+
default mTLS endpoint if client certificate is present; this is
|
|
254
|
+
the default value).
|
|
255
|
+
|
|
256
|
+
2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
|
|
257
|
+
is "true", then the ``client_cert_source`` property can be used
|
|
258
|
+
to provide a client certificate for mTLS transport. If
|
|
259
|
+
not provided, the default SSL client certificate will be used if
|
|
260
|
+
present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
|
|
261
|
+
set, no client certificate will be used.
|
|
262
|
+
|
|
263
|
+
3. The ``universe_domain`` property can be used to override the
|
|
264
|
+
default "googleapis.com" universe. Note that ``api_endpoint``
|
|
265
|
+
property still takes precedence; and ``universe_domain`` is
|
|
266
|
+
currently not supported for mTLS.
|
|
267
|
+
|
|
268
|
+
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
|
|
269
|
+
The client info used to send a user-agent string along with
|
|
270
|
+
API requests. If ``None``, then default info will be used.
|
|
271
|
+
Generally, you only need to set this if you're developing
|
|
272
|
+
your own client library.
|
|
273
|
+
|
|
274
|
+
Raises:
|
|
275
|
+
google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
|
|
276
|
+
creation failed for any reason.
|
|
277
|
+
"""
|
|
278
|
+
self._client = TranscoderServiceClient(
|
|
279
|
+
credentials=credentials,
|
|
280
|
+
transport=transport,
|
|
281
|
+
client_options=client_options,
|
|
282
|
+
client_info=client_info,
|
|
283
|
+
)
|
|
284
|
+
|
|
285
|
+
if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
|
|
286
|
+
std_logging.DEBUG
|
|
287
|
+
): # pragma: NO COVER
|
|
288
|
+
_LOGGER.debug(
|
|
289
|
+
"Created client `google.cloud.video.transcoder_v1.TranscoderServiceAsyncClient`.",
|
|
290
|
+
extra={
|
|
291
|
+
"serviceName": "google.cloud.video.transcoder.v1.TranscoderService",
|
|
292
|
+
"universeDomain": getattr(
|
|
293
|
+
self._client._transport._credentials, "universe_domain", ""
|
|
294
|
+
),
|
|
295
|
+
"credentialsType": f"{type(self._client._transport._credentials).__module__}.{type(self._client._transport._credentials).__qualname__}",
|
|
296
|
+
"credentialsInfo": getattr(
|
|
297
|
+
self.transport._credentials, "get_cred_info", lambda: None
|
|
298
|
+
)(),
|
|
299
|
+
}
|
|
300
|
+
if hasattr(self._client._transport, "_credentials")
|
|
301
|
+
else {
|
|
302
|
+
"serviceName": "google.cloud.video.transcoder.v1.TranscoderService",
|
|
303
|
+
"credentialsType": None,
|
|
304
|
+
},
|
|
305
|
+
)
|
|
306
|
+
|
|
307
|
+
async def create_job(
|
|
308
|
+
self,
|
|
309
|
+
request: Optional[Union[services.CreateJobRequest, dict]] = None,
|
|
310
|
+
*,
|
|
311
|
+
parent: Optional[str] = None,
|
|
312
|
+
job: Optional[resources.Job] = None,
|
|
313
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
314
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
315
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
316
|
+
) -> resources.Job:
|
|
317
|
+
r"""Creates a job in the specified region.
|
|
318
|
+
|
|
319
|
+
.. code-block:: python
|
|
320
|
+
|
|
321
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
322
|
+
# code template only.
|
|
323
|
+
# It will require modifications to work:
|
|
324
|
+
# - It may require correct/in-range values for request initialization.
|
|
325
|
+
# - It may require specifying regional endpoints when creating the service
|
|
326
|
+
# client as shown in:
|
|
327
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
328
|
+
from google.cloud.video import transcoder_v1
|
|
329
|
+
|
|
330
|
+
async def sample_create_job():
|
|
331
|
+
# Create a client
|
|
332
|
+
client = transcoder_v1.TranscoderServiceAsyncClient()
|
|
333
|
+
|
|
334
|
+
# Initialize request argument(s)
|
|
335
|
+
job = transcoder_v1.Job()
|
|
336
|
+
job.template_id = "template_id_value"
|
|
337
|
+
|
|
338
|
+
request = transcoder_v1.CreateJobRequest(
|
|
339
|
+
parent="parent_value",
|
|
340
|
+
job=job,
|
|
341
|
+
)
|
|
342
|
+
|
|
343
|
+
# Make the request
|
|
344
|
+
response = await client.create_job(request=request)
|
|
345
|
+
|
|
346
|
+
# Handle the response
|
|
347
|
+
print(response)
|
|
348
|
+
|
|
349
|
+
Args:
|
|
350
|
+
request (Optional[Union[google.cloud.video.transcoder_v1.types.CreateJobRequest, dict]]):
|
|
351
|
+
The request object. Request message for ``TranscoderService.CreateJob``.
|
|
352
|
+
parent (:class:`str`):
|
|
353
|
+
Required. The parent location to create and process this
|
|
354
|
+
job. Format: ``projects/{project}/locations/{location}``
|
|
355
|
+
|
|
356
|
+
This corresponds to the ``parent`` field
|
|
357
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
358
|
+
should not be set.
|
|
359
|
+
job (:class:`google.cloud.video.transcoder_v1.types.Job`):
|
|
360
|
+
Required. Parameters for creating
|
|
361
|
+
transcoding job.
|
|
362
|
+
|
|
363
|
+
This corresponds to the ``job`` field
|
|
364
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
365
|
+
should not be set.
|
|
366
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
|
|
367
|
+
should be retried.
|
|
368
|
+
timeout (float): The timeout for this request.
|
|
369
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
370
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
371
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
372
|
+
be of type `bytes`.
|
|
373
|
+
|
|
374
|
+
Returns:
|
|
375
|
+
google.cloud.video.transcoder_v1.types.Job:
|
|
376
|
+
Transcoding job resource.
|
|
377
|
+
"""
|
|
378
|
+
# Create or coerce a protobuf request object.
|
|
379
|
+
# - Quick check: If we got a request object, we should *not* have
|
|
380
|
+
# gotten any keyword arguments that map to the request.
|
|
381
|
+
flattened_params = [parent, job]
|
|
382
|
+
has_flattened_params = (
|
|
383
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
384
|
+
)
|
|
385
|
+
if request is not None and has_flattened_params:
|
|
386
|
+
raise ValueError(
|
|
387
|
+
"If the `request` argument is set, then none of "
|
|
388
|
+
"the individual field arguments should be set."
|
|
389
|
+
)
|
|
390
|
+
|
|
391
|
+
# - Use the request object if provided (there's no risk of modifying the input as
|
|
392
|
+
# there are no flattened fields), or create one.
|
|
393
|
+
if not isinstance(request, services.CreateJobRequest):
|
|
394
|
+
request = services.CreateJobRequest(request)
|
|
395
|
+
|
|
396
|
+
# If we have keyword arguments corresponding to fields on the
|
|
397
|
+
# request, apply these.
|
|
398
|
+
if parent is not None:
|
|
399
|
+
request.parent = parent
|
|
400
|
+
if job is not None:
|
|
401
|
+
request.job = job
|
|
402
|
+
|
|
403
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
404
|
+
# and friendly error handling.
|
|
405
|
+
rpc = self._client._transport._wrapped_methods[
|
|
406
|
+
self._client._transport.create_job
|
|
407
|
+
]
|
|
408
|
+
|
|
409
|
+
# Certain fields should be provided within the metadata header;
|
|
410
|
+
# add these here.
|
|
411
|
+
metadata = tuple(metadata) + (
|
|
412
|
+
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
|
|
413
|
+
)
|
|
414
|
+
|
|
415
|
+
# Validate the universe domain.
|
|
416
|
+
self._client._validate_universe_domain()
|
|
417
|
+
|
|
418
|
+
# Send the request.
|
|
419
|
+
response = await rpc(
|
|
420
|
+
request,
|
|
421
|
+
retry=retry,
|
|
422
|
+
timeout=timeout,
|
|
423
|
+
metadata=metadata,
|
|
424
|
+
)
|
|
425
|
+
|
|
426
|
+
# Done; return the response.
|
|
427
|
+
return response
|
|
428
|
+
|
|
429
|
+
async def list_jobs(
|
|
430
|
+
self,
|
|
431
|
+
request: Optional[Union[services.ListJobsRequest, dict]] = None,
|
|
432
|
+
*,
|
|
433
|
+
parent: Optional[str] = None,
|
|
434
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
435
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
436
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
437
|
+
) -> pagers.ListJobsAsyncPager:
|
|
438
|
+
r"""Lists jobs in the specified region.
|
|
439
|
+
|
|
440
|
+
.. code-block:: python
|
|
441
|
+
|
|
442
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
443
|
+
# code template only.
|
|
444
|
+
# It will require modifications to work:
|
|
445
|
+
# - It may require correct/in-range values for request initialization.
|
|
446
|
+
# - It may require specifying regional endpoints when creating the service
|
|
447
|
+
# client as shown in:
|
|
448
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
449
|
+
from google.cloud.video import transcoder_v1
|
|
450
|
+
|
|
451
|
+
async def sample_list_jobs():
|
|
452
|
+
# Create a client
|
|
453
|
+
client = transcoder_v1.TranscoderServiceAsyncClient()
|
|
454
|
+
|
|
455
|
+
# Initialize request argument(s)
|
|
456
|
+
request = transcoder_v1.ListJobsRequest(
|
|
457
|
+
parent="parent_value",
|
|
458
|
+
)
|
|
459
|
+
|
|
460
|
+
# Make the request
|
|
461
|
+
page_result = client.list_jobs(request=request)
|
|
462
|
+
|
|
463
|
+
# Handle the response
|
|
464
|
+
async for response in page_result:
|
|
465
|
+
print(response)
|
|
466
|
+
|
|
467
|
+
Args:
|
|
468
|
+
request (Optional[Union[google.cloud.video.transcoder_v1.types.ListJobsRequest, dict]]):
|
|
469
|
+
The request object. Request message for ``TranscoderService.ListJobs``. The
|
|
470
|
+
parent location from which to retrieve the collection of
|
|
471
|
+
jobs.
|
|
472
|
+
parent (:class:`str`):
|
|
473
|
+
Required. Format:
|
|
474
|
+
``projects/{project}/locations/{location}``
|
|
475
|
+
|
|
476
|
+
This corresponds to the ``parent`` field
|
|
477
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
478
|
+
should not be set.
|
|
479
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
|
|
480
|
+
should be retried.
|
|
481
|
+
timeout (float): The timeout for this request.
|
|
482
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
483
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
484
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
485
|
+
be of type `bytes`.
|
|
486
|
+
|
|
487
|
+
Returns:
|
|
488
|
+
google.cloud.video.transcoder_v1.services.transcoder_service.pagers.ListJobsAsyncPager:
|
|
489
|
+
Response message for TranscoderService.ListJobs.
|
|
490
|
+
|
|
491
|
+
Iterating over this object will yield results and
|
|
492
|
+
resolve additional pages automatically.
|
|
493
|
+
|
|
494
|
+
"""
|
|
495
|
+
# Create or coerce a protobuf request object.
|
|
496
|
+
# - Quick check: If we got a request object, we should *not* have
|
|
497
|
+
# gotten any keyword arguments that map to the request.
|
|
498
|
+
flattened_params = [parent]
|
|
499
|
+
has_flattened_params = (
|
|
500
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
501
|
+
)
|
|
502
|
+
if request is not None and has_flattened_params:
|
|
503
|
+
raise ValueError(
|
|
504
|
+
"If the `request` argument is set, then none of "
|
|
505
|
+
"the individual field arguments should be set."
|
|
506
|
+
)
|
|
507
|
+
|
|
508
|
+
# - Use the request object if provided (there's no risk of modifying the input as
|
|
509
|
+
# there are no flattened fields), or create one.
|
|
510
|
+
if not isinstance(request, services.ListJobsRequest):
|
|
511
|
+
request = services.ListJobsRequest(request)
|
|
512
|
+
|
|
513
|
+
# If we have keyword arguments corresponding to fields on the
|
|
514
|
+
# request, apply these.
|
|
515
|
+
if parent is not None:
|
|
516
|
+
request.parent = parent
|
|
517
|
+
|
|
518
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
519
|
+
# and friendly error handling.
|
|
520
|
+
rpc = self._client._transport._wrapped_methods[
|
|
521
|
+
self._client._transport.list_jobs
|
|
522
|
+
]
|
|
523
|
+
|
|
524
|
+
# Certain fields should be provided within the metadata header;
|
|
525
|
+
# add these here.
|
|
526
|
+
metadata = tuple(metadata) + (
|
|
527
|
+
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
|
|
528
|
+
)
|
|
529
|
+
|
|
530
|
+
# Validate the universe domain.
|
|
531
|
+
self._client._validate_universe_domain()
|
|
532
|
+
|
|
533
|
+
# Send the request.
|
|
534
|
+
response = await rpc(
|
|
535
|
+
request,
|
|
536
|
+
retry=retry,
|
|
537
|
+
timeout=timeout,
|
|
538
|
+
metadata=metadata,
|
|
539
|
+
)
|
|
540
|
+
|
|
541
|
+
# This method is paged; wrap the response in a pager, which provides
|
|
542
|
+
# an `__aiter__` convenience method.
|
|
543
|
+
response = pagers.ListJobsAsyncPager(
|
|
544
|
+
method=rpc,
|
|
545
|
+
request=request,
|
|
546
|
+
response=response,
|
|
547
|
+
retry=retry,
|
|
548
|
+
timeout=timeout,
|
|
549
|
+
metadata=metadata,
|
|
550
|
+
)
|
|
551
|
+
|
|
552
|
+
# Done; return the response.
|
|
553
|
+
return response
|
|
554
|
+
|
|
555
|
+
async def get_job(
|
|
556
|
+
self,
|
|
557
|
+
request: Optional[Union[services.GetJobRequest, dict]] = None,
|
|
558
|
+
*,
|
|
559
|
+
name: Optional[str] = None,
|
|
560
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
561
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
562
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
563
|
+
) -> resources.Job:
|
|
564
|
+
r"""Returns the job data.
|
|
565
|
+
|
|
566
|
+
.. code-block:: python
|
|
567
|
+
|
|
568
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
569
|
+
# code template only.
|
|
570
|
+
# It will require modifications to work:
|
|
571
|
+
# - It may require correct/in-range values for request initialization.
|
|
572
|
+
# - It may require specifying regional endpoints when creating the service
|
|
573
|
+
# client as shown in:
|
|
574
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
575
|
+
from google.cloud.video import transcoder_v1
|
|
576
|
+
|
|
577
|
+
async def sample_get_job():
|
|
578
|
+
# Create a client
|
|
579
|
+
client = transcoder_v1.TranscoderServiceAsyncClient()
|
|
580
|
+
|
|
581
|
+
# Initialize request argument(s)
|
|
582
|
+
request = transcoder_v1.GetJobRequest(
|
|
583
|
+
name="name_value",
|
|
584
|
+
)
|
|
585
|
+
|
|
586
|
+
# Make the request
|
|
587
|
+
response = await client.get_job(request=request)
|
|
588
|
+
|
|
589
|
+
# Handle the response
|
|
590
|
+
print(response)
|
|
591
|
+
|
|
592
|
+
Args:
|
|
593
|
+
request (Optional[Union[google.cloud.video.transcoder_v1.types.GetJobRequest, dict]]):
|
|
594
|
+
The request object. Request message for ``TranscoderService.GetJob``.
|
|
595
|
+
name (:class:`str`):
|
|
596
|
+
Required. The name of the job to retrieve. Format:
|
|
597
|
+
``projects/{project}/locations/{location}/jobs/{job}``
|
|
598
|
+
|
|
599
|
+
This corresponds to the ``name`` field
|
|
600
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
601
|
+
should not be set.
|
|
602
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
|
|
603
|
+
should be retried.
|
|
604
|
+
timeout (float): The timeout for this request.
|
|
605
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
606
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
607
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
608
|
+
be of type `bytes`.
|
|
609
|
+
|
|
610
|
+
Returns:
|
|
611
|
+
google.cloud.video.transcoder_v1.types.Job:
|
|
612
|
+
Transcoding job resource.
|
|
613
|
+
"""
|
|
614
|
+
# Create or coerce a protobuf request object.
|
|
615
|
+
# - Quick check: If we got a request object, we should *not* have
|
|
616
|
+
# gotten any keyword arguments that map to the request.
|
|
617
|
+
flattened_params = [name]
|
|
618
|
+
has_flattened_params = (
|
|
619
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
620
|
+
)
|
|
621
|
+
if request is not None and has_flattened_params:
|
|
622
|
+
raise ValueError(
|
|
623
|
+
"If the `request` argument is set, then none of "
|
|
624
|
+
"the individual field arguments should be set."
|
|
625
|
+
)
|
|
626
|
+
|
|
627
|
+
# - Use the request object if provided (there's no risk of modifying the input as
|
|
628
|
+
# there are no flattened fields), or create one.
|
|
629
|
+
if not isinstance(request, services.GetJobRequest):
|
|
630
|
+
request = services.GetJobRequest(request)
|
|
631
|
+
|
|
632
|
+
# If we have keyword arguments corresponding to fields on the
|
|
633
|
+
# request, apply these.
|
|
634
|
+
if name is not None:
|
|
635
|
+
request.name = name
|
|
636
|
+
|
|
637
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
638
|
+
# and friendly error handling.
|
|
639
|
+
rpc = self._client._transport._wrapped_methods[self._client._transport.get_job]
|
|
640
|
+
|
|
641
|
+
# Certain fields should be provided within the metadata header;
|
|
642
|
+
# add these here.
|
|
643
|
+
metadata = tuple(metadata) + (
|
|
644
|
+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
|
|
645
|
+
)
|
|
646
|
+
|
|
647
|
+
# Validate the universe domain.
|
|
648
|
+
self._client._validate_universe_domain()
|
|
649
|
+
|
|
650
|
+
# Send the request.
|
|
651
|
+
response = await rpc(
|
|
652
|
+
request,
|
|
653
|
+
retry=retry,
|
|
654
|
+
timeout=timeout,
|
|
655
|
+
metadata=metadata,
|
|
656
|
+
)
|
|
657
|
+
|
|
658
|
+
# Done; return the response.
|
|
659
|
+
return response
|
|
660
|
+
|
|
661
|
+
async def delete_job(
|
|
662
|
+
self,
|
|
663
|
+
request: Optional[Union[services.DeleteJobRequest, dict]] = None,
|
|
664
|
+
*,
|
|
665
|
+
name: Optional[str] = None,
|
|
666
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
667
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
668
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
669
|
+
) -> None:
|
|
670
|
+
r"""Deletes a job.
|
|
671
|
+
|
|
672
|
+
.. code-block:: python
|
|
673
|
+
|
|
674
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
675
|
+
# code template only.
|
|
676
|
+
# It will require modifications to work:
|
|
677
|
+
# - It may require correct/in-range values for request initialization.
|
|
678
|
+
# - It may require specifying regional endpoints when creating the service
|
|
679
|
+
# client as shown in:
|
|
680
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
681
|
+
from google.cloud.video import transcoder_v1
|
|
682
|
+
|
|
683
|
+
async def sample_delete_job():
|
|
684
|
+
# Create a client
|
|
685
|
+
client = transcoder_v1.TranscoderServiceAsyncClient()
|
|
686
|
+
|
|
687
|
+
# Initialize request argument(s)
|
|
688
|
+
request = transcoder_v1.DeleteJobRequest(
|
|
689
|
+
name="name_value",
|
|
690
|
+
)
|
|
691
|
+
|
|
692
|
+
# Make the request
|
|
693
|
+
await client.delete_job(request=request)
|
|
694
|
+
|
|
695
|
+
Args:
|
|
696
|
+
request (Optional[Union[google.cloud.video.transcoder_v1.types.DeleteJobRequest, dict]]):
|
|
697
|
+
The request object. Request message for ``TranscoderService.DeleteJob``.
|
|
698
|
+
name (:class:`str`):
|
|
699
|
+
Required. The name of the job to delete. Format:
|
|
700
|
+
``projects/{project}/locations/{location}/jobs/{job}``
|
|
701
|
+
|
|
702
|
+
This corresponds to the ``name`` field
|
|
703
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
704
|
+
should not be set.
|
|
705
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
|
|
706
|
+
should be retried.
|
|
707
|
+
timeout (float): The timeout for this request.
|
|
708
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
709
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
710
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
711
|
+
be of type `bytes`.
|
|
712
|
+
"""
|
|
713
|
+
# Create or coerce a protobuf request object.
|
|
714
|
+
# - Quick check: If we got a request object, we should *not* have
|
|
715
|
+
# gotten any keyword arguments that map to the request.
|
|
716
|
+
flattened_params = [name]
|
|
717
|
+
has_flattened_params = (
|
|
718
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
719
|
+
)
|
|
720
|
+
if request is not None and has_flattened_params:
|
|
721
|
+
raise ValueError(
|
|
722
|
+
"If the `request` argument is set, then none of "
|
|
723
|
+
"the individual field arguments should be set."
|
|
724
|
+
)
|
|
725
|
+
|
|
726
|
+
# - Use the request object if provided (there's no risk of modifying the input as
|
|
727
|
+
# there are no flattened fields), or create one.
|
|
728
|
+
if not isinstance(request, services.DeleteJobRequest):
|
|
729
|
+
request = services.DeleteJobRequest(request)
|
|
730
|
+
|
|
731
|
+
# If we have keyword arguments corresponding to fields on the
|
|
732
|
+
# request, apply these.
|
|
733
|
+
if name is not None:
|
|
734
|
+
request.name = name
|
|
735
|
+
|
|
736
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
737
|
+
# and friendly error handling.
|
|
738
|
+
rpc = self._client._transport._wrapped_methods[
|
|
739
|
+
self._client._transport.delete_job
|
|
740
|
+
]
|
|
741
|
+
|
|
742
|
+
# Certain fields should be provided within the metadata header;
|
|
743
|
+
# add these here.
|
|
744
|
+
metadata = tuple(metadata) + (
|
|
745
|
+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
|
|
746
|
+
)
|
|
747
|
+
|
|
748
|
+
# Validate the universe domain.
|
|
749
|
+
self._client._validate_universe_domain()
|
|
750
|
+
|
|
751
|
+
# Send the request.
|
|
752
|
+
await rpc(
|
|
753
|
+
request,
|
|
754
|
+
retry=retry,
|
|
755
|
+
timeout=timeout,
|
|
756
|
+
metadata=metadata,
|
|
757
|
+
)
|
|
758
|
+
|
|
759
|
+
async def create_job_template(
|
|
760
|
+
self,
|
|
761
|
+
request: Optional[Union[services.CreateJobTemplateRequest, dict]] = None,
|
|
762
|
+
*,
|
|
763
|
+
parent: Optional[str] = None,
|
|
764
|
+
job_template: Optional[resources.JobTemplate] = None,
|
|
765
|
+
job_template_id: Optional[str] = None,
|
|
766
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
767
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
768
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
769
|
+
) -> resources.JobTemplate:
|
|
770
|
+
r"""Creates a job template in the specified region.
|
|
771
|
+
|
|
772
|
+
.. code-block:: python
|
|
773
|
+
|
|
774
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
775
|
+
# code template only.
|
|
776
|
+
# It will require modifications to work:
|
|
777
|
+
# - It may require correct/in-range values for request initialization.
|
|
778
|
+
# - It may require specifying regional endpoints when creating the service
|
|
779
|
+
# client as shown in:
|
|
780
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
781
|
+
from google.cloud.video import transcoder_v1
|
|
782
|
+
|
|
783
|
+
async def sample_create_job_template():
|
|
784
|
+
# Create a client
|
|
785
|
+
client = transcoder_v1.TranscoderServiceAsyncClient()
|
|
786
|
+
|
|
787
|
+
# Initialize request argument(s)
|
|
788
|
+
request = transcoder_v1.CreateJobTemplateRequest(
|
|
789
|
+
parent="parent_value",
|
|
790
|
+
job_template_id="job_template_id_value",
|
|
791
|
+
)
|
|
792
|
+
|
|
793
|
+
# Make the request
|
|
794
|
+
response = await client.create_job_template(request=request)
|
|
795
|
+
|
|
796
|
+
# Handle the response
|
|
797
|
+
print(response)
|
|
798
|
+
|
|
799
|
+
Args:
|
|
800
|
+
request (Optional[Union[google.cloud.video.transcoder_v1.types.CreateJobTemplateRequest, dict]]):
|
|
801
|
+
The request object. Request message for
|
|
802
|
+
``TranscoderService.CreateJobTemplate``.
|
|
803
|
+
parent (:class:`str`):
|
|
804
|
+
Required. The parent location to create this job
|
|
805
|
+
template. Format:
|
|
806
|
+
``projects/{project}/locations/{location}``
|
|
807
|
+
|
|
808
|
+
This corresponds to the ``parent`` field
|
|
809
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
810
|
+
should not be set.
|
|
811
|
+
job_template (:class:`google.cloud.video.transcoder_v1.types.JobTemplate`):
|
|
812
|
+
Required. Parameters for creating job
|
|
813
|
+
template.
|
|
814
|
+
|
|
815
|
+
This corresponds to the ``job_template`` field
|
|
816
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
817
|
+
should not be set.
|
|
818
|
+
job_template_id (:class:`str`):
|
|
819
|
+
Required. The ID to use for the job template, which will
|
|
820
|
+
become the final component of the job template's
|
|
821
|
+
resource name.
|
|
822
|
+
|
|
823
|
+
This value should be 4-63 characters, and valid
|
|
824
|
+
characters must match the regular expression
|
|
825
|
+
``[a-zA-Z][a-zA-Z0-9_-]*``.
|
|
826
|
+
|
|
827
|
+
This corresponds to the ``job_template_id`` field
|
|
828
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
829
|
+
should not be set.
|
|
830
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
|
|
831
|
+
should be retried.
|
|
832
|
+
timeout (float): The timeout for this request.
|
|
833
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
834
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
835
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
836
|
+
be of type `bytes`.
|
|
837
|
+
|
|
838
|
+
Returns:
|
|
839
|
+
google.cloud.video.transcoder_v1.types.JobTemplate:
|
|
840
|
+
Transcoding job template resource.
|
|
841
|
+
"""
|
|
842
|
+
# Create or coerce a protobuf request object.
|
|
843
|
+
# - Quick check: If we got a request object, we should *not* have
|
|
844
|
+
# gotten any keyword arguments that map to the request.
|
|
845
|
+
flattened_params = [parent, job_template, job_template_id]
|
|
846
|
+
has_flattened_params = (
|
|
847
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
848
|
+
)
|
|
849
|
+
if request is not None and has_flattened_params:
|
|
850
|
+
raise ValueError(
|
|
851
|
+
"If the `request` argument is set, then none of "
|
|
852
|
+
"the individual field arguments should be set."
|
|
853
|
+
)
|
|
854
|
+
|
|
855
|
+
# - Use the request object if provided (there's no risk of modifying the input as
|
|
856
|
+
# there are no flattened fields), or create one.
|
|
857
|
+
if not isinstance(request, services.CreateJobTemplateRequest):
|
|
858
|
+
request = services.CreateJobTemplateRequest(request)
|
|
859
|
+
|
|
860
|
+
# If we have keyword arguments corresponding to fields on the
|
|
861
|
+
# request, apply these.
|
|
862
|
+
if parent is not None:
|
|
863
|
+
request.parent = parent
|
|
864
|
+
if job_template is not None:
|
|
865
|
+
request.job_template = job_template
|
|
866
|
+
if job_template_id is not None:
|
|
867
|
+
request.job_template_id = job_template_id
|
|
868
|
+
|
|
869
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
870
|
+
# and friendly error handling.
|
|
871
|
+
rpc = self._client._transport._wrapped_methods[
|
|
872
|
+
self._client._transport.create_job_template
|
|
873
|
+
]
|
|
874
|
+
|
|
875
|
+
# Certain fields should be provided within the metadata header;
|
|
876
|
+
# add these here.
|
|
877
|
+
metadata = tuple(metadata) + (
|
|
878
|
+
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
|
|
879
|
+
)
|
|
880
|
+
|
|
881
|
+
# Validate the universe domain.
|
|
882
|
+
self._client._validate_universe_domain()
|
|
883
|
+
|
|
884
|
+
# Send the request.
|
|
885
|
+
response = await rpc(
|
|
886
|
+
request,
|
|
887
|
+
retry=retry,
|
|
888
|
+
timeout=timeout,
|
|
889
|
+
metadata=metadata,
|
|
890
|
+
)
|
|
891
|
+
|
|
892
|
+
# Done; return the response.
|
|
893
|
+
return response
|
|
894
|
+
|
|
895
|
+
async def list_job_templates(
|
|
896
|
+
self,
|
|
897
|
+
request: Optional[Union[services.ListJobTemplatesRequest, dict]] = None,
|
|
898
|
+
*,
|
|
899
|
+
parent: Optional[str] = None,
|
|
900
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
901
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
902
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
903
|
+
) -> pagers.ListJobTemplatesAsyncPager:
|
|
904
|
+
r"""Lists job templates in the specified region.
|
|
905
|
+
|
|
906
|
+
.. code-block:: python
|
|
907
|
+
|
|
908
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
909
|
+
# code template only.
|
|
910
|
+
# It will require modifications to work:
|
|
911
|
+
# - It may require correct/in-range values for request initialization.
|
|
912
|
+
# - It may require specifying regional endpoints when creating the service
|
|
913
|
+
# client as shown in:
|
|
914
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
915
|
+
from google.cloud.video import transcoder_v1
|
|
916
|
+
|
|
917
|
+
async def sample_list_job_templates():
|
|
918
|
+
# Create a client
|
|
919
|
+
client = transcoder_v1.TranscoderServiceAsyncClient()
|
|
920
|
+
|
|
921
|
+
# Initialize request argument(s)
|
|
922
|
+
request = transcoder_v1.ListJobTemplatesRequest(
|
|
923
|
+
parent="parent_value",
|
|
924
|
+
)
|
|
925
|
+
|
|
926
|
+
# Make the request
|
|
927
|
+
page_result = client.list_job_templates(request=request)
|
|
928
|
+
|
|
929
|
+
# Handle the response
|
|
930
|
+
async for response in page_result:
|
|
931
|
+
print(response)
|
|
932
|
+
|
|
933
|
+
Args:
|
|
934
|
+
request (Optional[Union[google.cloud.video.transcoder_v1.types.ListJobTemplatesRequest, dict]]):
|
|
935
|
+
The request object. Request message for
|
|
936
|
+
``TranscoderService.ListJobTemplates``.
|
|
937
|
+
parent (:class:`str`):
|
|
938
|
+
Required. The parent location from which to retrieve the
|
|
939
|
+
collection of job templates. Format:
|
|
940
|
+
``projects/{project}/locations/{location}``
|
|
941
|
+
|
|
942
|
+
This corresponds to the ``parent`` field
|
|
943
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
944
|
+
should not be set.
|
|
945
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
|
|
946
|
+
should be retried.
|
|
947
|
+
timeout (float): The timeout for this request.
|
|
948
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
949
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
950
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
951
|
+
be of type `bytes`.
|
|
952
|
+
|
|
953
|
+
Returns:
|
|
954
|
+
google.cloud.video.transcoder_v1.services.transcoder_service.pagers.ListJobTemplatesAsyncPager:
|
|
955
|
+
Response message for TranscoderService.ListJobTemplates.
|
|
956
|
+
|
|
957
|
+
Iterating over this object will yield results and
|
|
958
|
+
resolve additional pages automatically.
|
|
959
|
+
|
|
960
|
+
"""
|
|
961
|
+
# Create or coerce a protobuf request object.
|
|
962
|
+
# - Quick check: If we got a request object, we should *not* have
|
|
963
|
+
# gotten any keyword arguments that map to the request.
|
|
964
|
+
flattened_params = [parent]
|
|
965
|
+
has_flattened_params = (
|
|
966
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
967
|
+
)
|
|
968
|
+
if request is not None and has_flattened_params:
|
|
969
|
+
raise ValueError(
|
|
970
|
+
"If the `request` argument is set, then none of "
|
|
971
|
+
"the individual field arguments should be set."
|
|
972
|
+
)
|
|
973
|
+
|
|
974
|
+
# - Use the request object if provided (there's no risk of modifying the input as
|
|
975
|
+
# there are no flattened fields), or create one.
|
|
976
|
+
if not isinstance(request, services.ListJobTemplatesRequest):
|
|
977
|
+
request = services.ListJobTemplatesRequest(request)
|
|
978
|
+
|
|
979
|
+
# If we have keyword arguments corresponding to fields on the
|
|
980
|
+
# request, apply these.
|
|
981
|
+
if parent is not None:
|
|
982
|
+
request.parent = parent
|
|
983
|
+
|
|
984
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
985
|
+
# and friendly error handling.
|
|
986
|
+
rpc = self._client._transport._wrapped_methods[
|
|
987
|
+
self._client._transport.list_job_templates
|
|
988
|
+
]
|
|
989
|
+
|
|
990
|
+
# Certain fields should be provided within the metadata header;
|
|
991
|
+
# add these here.
|
|
992
|
+
metadata = tuple(metadata) + (
|
|
993
|
+
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
|
|
994
|
+
)
|
|
995
|
+
|
|
996
|
+
# Validate the universe domain.
|
|
997
|
+
self._client._validate_universe_domain()
|
|
998
|
+
|
|
999
|
+
# Send the request.
|
|
1000
|
+
response = await rpc(
|
|
1001
|
+
request,
|
|
1002
|
+
retry=retry,
|
|
1003
|
+
timeout=timeout,
|
|
1004
|
+
metadata=metadata,
|
|
1005
|
+
)
|
|
1006
|
+
|
|
1007
|
+
# This method is paged; wrap the response in a pager, which provides
|
|
1008
|
+
# an `__aiter__` convenience method.
|
|
1009
|
+
response = pagers.ListJobTemplatesAsyncPager(
|
|
1010
|
+
method=rpc,
|
|
1011
|
+
request=request,
|
|
1012
|
+
response=response,
|
|
1013
|
+
retry=retry,
|
|
1014
|
+
timeout=timeout,
|
|
1015
|
+
metadata=metadata,
|
|
1016
|
+
)
|
|
1017
|
+
|
|
1018
|
+
# Done; return the response.
|
|
1019
|
+
return response
|
|
1020
|
+
|
|
1021
|
+
async def get_job_template(
|
|
1022
|
+
self,
|
|
1023
|
+
request: Optional[Union[services.GetJobTemplateRequest, dict]] = None,
|
|
1024
|
+
*,
|
|
1025
|
+
name: Optional[str] = None,
|
|
1026
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
1027
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
1028
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
1029
|
+
) -> resources.JobTemplate:
|
|
1030
|
+
r"""Returns the job template data.
|
|
1031
|
+
|
|
1032
|
+
.. code-block:: python
|
|
1033
|
+
|
|
1034
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
1035
|
+
# code template only.
|
|
1036
|
+
# It will require modifications to work:
|
|
1037
|
+
# - It may require correct/in-range values for request initialization.
|
|
1038
|
+
# - It may require specifying regional endpoints when creating the service
|
|
1039
|
+
# client as shown in:
|
|
1040
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
1041
|
+
from google.cloud.video import transcoder_v1
|
|
1042
|
+
|
|
1043
|
+
async def sample_get_job_template():
|
|
1044
|
+
# Create a client
|
|
1045
|
+
client = transcoder_v1.TranscoderServiceAsyncClient()
|
|
1046
|
+
|
|
1047
|
+
# Initialize request argument(s)
|
|
1048
|
+
request = transcoder_v1.GetJobTemplateRequest(
|
|
1049
|
+
name="name_value",
|
|
1050
|
+
)
|
|
1051
|
+
|
|
1052
|
+
# Make the request
|
|
1053
|
+
response = await client.get_job_template(request=request)
|
|
1054
|
+
|
|
1055
|
+
# Handle the response
|
|
1056
|
+
print(response)
|
|
1057
|
+
|
|
1058
|
+
Args:
|
|
1059
|
+
request (Optional[Union[google.cloud.video.transcoder_v1.types.GetJobTemplateRequest, dict]]):
|
|
1060
|
+
The request object. Request message for
|
|
1061
|
+
``TranscoderService.GetJobTemplate``.
|
|
1062
|
+
name (:class:`str`):
|
|
1063
|
+
Required. The name of the job template to retrieve.
|
|
1064
|
+
Format:
|
|
1065
|
+
``projects/{project}/locations/{location}/jobTemplates/{job_template}``
|
|
1066
|
+
|
|
1067
|
+
This corresponds to the ``name`` field
|
|
1068
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
1069
|
+
should not be set.
|
|
1070
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
|
|
1071
|
+
should be retried.
|
|
1072
|
+
timeout (float): The timeout for this request.
|
|
1073
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
1074
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
1075
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
1076
|
+
be of type `bytes`.
|
|
1077
|
+
|
|
1078
|
+
Returns:
|
|
1079
|
+
google.cloud.video.transcoder_v1.types.JobTemplate:
|
|
1080
|
+
Transcoding job template resource.
|
|
1081
|
+
"""
|
|
1082
|
+
# Create or coerce a protobuf request object.
|
|
1083
|
+
# - Quick check: If we got a request object, we should *not* have
|
|
1084
|
+
# gotten any keyword arguments that map to the request.
|
|
1085
|
+
flattened_params = [name]
|
|
1086
|
+
has_flattened_params = (
|
|
1087
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
1088
|
+
)
|
|
1089
|
+
if request is not None and has_flattened_params:
|
|
1090
|
+
raise ValueError(
|
|
1091
|
+
"If the `request` argument is set, then none of "
|
|
1092
|
+
"the individual field arguments should be set."
|
|
1093
|
+
)
|
|
1094
|
+
|
|
1095
|
+
# - Use the request object if provided (there's no risk of modifying the input as
|
|
1096
|
+
# there are no flattened fields), or create one.
|
|
1097
|
+
if not isinstance(request, services.GetJobTemplateRequest):
|
|
1098
|
+
request = services.GetJobTemplateRequest(request)
|
|
1099
|
+
|
|
1100
|
+
# If we have keyword arguments corresponding to fields on the
|
|
1101
|
+
# request, apply these.
|
|
1102
|
+
if name is not None:
|
|
1103
|
+
request.name = name
|
|
1104
|
+
|
|
1105
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
1106
|
+
# and friendly error handling.
|
|
1107
|
+
rpc = self._client._transport._wrapped_methods[
|
|
1108
|
+
self._client._transport.get_job_template
|
|
1109
|
+
]
|
|
1110
|
+
|
|
1111
|
+
# Certain fields should be provided within the metadata header;
|
|
1112
|
+
# add these here.
|
|
1113
|
+
metadata = tuple(metadata) + (
|
|
1114
|
+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
|
|
1115
|
+
)
|
|
1116
|
+
|
|
1117
|
+
# Validate the universe domain.
|
|
1118
|
+
self._client._validate_universe_domain()
|
|
1119
|
+
|
|
1120
|
+
# Send the request.
|
|
1121
|
+
response = await rpc(
|
|
1122
|
+
request,
|
|
1123
|
+
retry=retry,
|
|
1124
|
+
timeout=timeout,
|
|
1125
|
+
metadata=metadata,
|
|
1126
|
+
)
|
|
1127
|
+
|
|
1128
|
+
# Done; return the response.
|
|
1129
|
+
return response
|
|
1130
|
+
|
|
1131
|
+
async def delete_job_template(
|
|
1132
|
+
self,
|
|
1133
|
+
request: Optional[Union[services.DeleteJobTemplateRequest, dict]] = None,
|
|
1134
|
+
*,
|
|
1135
|
+
name: Optional[str] = None,
|
|
1136
|
+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
|
|
1137
|
+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
|
|
1138
|
+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
|
|
1139
|
+
) -> None:
|
|
1140
|
+
r"""Deletes a job template.
|
|
1141
|
+
|
|
1142
|
+
.. code-block:: python
|
|
1143
|
+
|
|
1144
|
+
# This snippet has been automatically generated and should be regarded as a
|
|
1145
|
+
# code template only.
|
|
1146
|
+
# It will require modifications to work:
|
|
1147
|
+
# - It may require correct/in-range values for request initialization.
|
|
1148
|
+
# - It may require specifying regional endpoints when creating the service
|
|
1149
|
+
# client as shown in:
|
|
1150
|
+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
|
|
1151
|
+
from google.cloud.video import transcoder_v1
|
|
1152
|
+
|
|
1153
|
+
async def sample_delete_job_template():
|
|
1154
|
+
# Create a client
|
|
1155
|
+
client = transcoder_v1.TranscoderServiceAsyncClient()
|
|
1156
|
+
|
|
1157
|
+
# Initialize request argument(s)
|
|
1158
|
+
request = transcoder_v1.DeleteJobTemplateRequest(
|
|
1159
|
+
name="name_value",
|
|
1160
|
+
)
|
|
1161
|
+
|
|
1162
|
+
# Make the request
|
|
1163
|
+
await client.delete_job_template(request=request)
|
|
1164
|
+
|
|
1165
|
+
Args:
|
|
1166
|
+
request (Optional[Union[google.cloud.video.transcoder_v1.types.DeleteJobTemplateRequest, dict]]):
|
|
1167
|
+
The request object. Request message for
|
|
1168
|
+
``TranscoderService.DeleteJobTemplate``.
|
|
1169
|
+
name (:class:`str`):
|
|
1170
|
+
Required. The name of the job template to delete.
|
|
1171
|
+
``projects/{project}/locations/{location}/jobTemplates/{job_template}``
|
|
1172
|
+
|
|
1173
|
+
This corresponds to the ``name`` field
|
|
1174
|
+
on the ``request`` instance; if ``request`` is provided, this
|
|
1175
|
+
should not be set.
|
|
1176
|
+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
|
|
1177
|
+
should be retried.
|
|
1178
|
+
timeout (float): The timeout for this request.
|
|
1179
|
+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
|
|
1180
|
+
sent along with the request as metadata. Normally, each value must be of type `str`,
|
|
1181
|
+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
|
|
1182
|
+
be of type `bytes`.
|
|
1183
|
+
"""
|
|
1184
|
+
# Create or coerce a protobuf request object.
|
|
1185
|
+
# - Quick check: If we got a request object, we should *not* have
|
|
1186
|
+
# gotten any keyword arguments that map to the request.
|
|
1187
|
+
flattened_params = [name]
|
|
1188
|
+
has_flattened_params = (
|
|
1189
|
+
len([param for param in flattened_params if param is not None]) > 0
|
|
1190
|
+
)
|
|
1191
|
+
if request is not None and has_flattened_params:
|
|
1192
|
+
raise ValueError(
|
|
1193
|
+
"If the `request` argument is set, then none of "
|
|
1194
|
+
"the individual field arguments should be set."
|
|
1195
|
+
)
|
|
1196
|
+
|
|
1197
|
+
# - Use the request object if provided (there's no risk of modifying the input as
|
|
1198
|
+
# there are no flattened fields), or create one.
|
|
1199
|
+
if not isinstance(request, services.DeleteJobTemplateRequest):
|
|
1200
|
+
request = services.DeleteJobTemplateRequest(request)
|
|
1201
|
+
|
|
1202
|
+
# If we have keyword arguments corresponding to fields on the
|
|
1203
|
+
# request, apply these.
|
|
1204
|
+
if name is not None:
|
|
1205
|
+
request.name = name
|
|
1206
|
+
|
|
1207
|
+
# Wrap the RPC method; this adds retry and timeout information,
|
|
1208
|
+
# and friendly error handling.
|
|
1209
|
+
rpc = self._client._transport._wrapped_methods[
|
|
1210
|
+
self._client._transport.delete_job_template
|
|
1211
|
+
]
|
|
1212
|
+
|
|
1213
|
+
# Certain fields should be provided within the metadata header;
|
|
1214
|
+
# add these here.
|
|
1215
|
+
metadata = tuple(metadata) + (
|
|
1216
|
+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
|
|
1217
|
+
)
|
|
1218
|
+
|
|
1219
|
+
# Validate the universe domain.
|
|
1220
|
+
self._client._validate_universe_domain()
|
|
1221
|
+
|
|
1222
|
+
# Send the request.
|
|
1223
|
+
await rpc(
|
|
1224
|
+
request,
|
|
1225
|
+
retry=retry,
|
|
1226
|
+
timeout=timeout,
|
|
1227
|
+
metadata=metadata,
|
|
1228
|
+
)
|
|
1229
|
+
|
|
1230
|
+
async def __aenter__(self) -> "TranscoderServiceAsyncClient":
|
|
1231
|
+
return self
|
|
1232
|
+
|
|
1233
|
+
async def __aexit__(self, exc_type, exc, tb):
|
|
1234
|
+
await self.transport.close()
|
|
1235
|
+
|
|
1236
|
+
|
|
1237
|
+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
|
|
1238
|
+
gapic_version=package_version.__version__
|
|
1239
|
+
)
|
|
1240
|
+
|
|
1241
|
+
|
|
1242
|
+
__all__ = ("TranscoderServiceAsyncClient",)
|