google_transcoder1/api.rs
1#![allow(clippy::ptr_arg)]
2
3use std::collections::{BTreeSet, HashMap};
4
5use tokio::time::sleep;
6
7// ##############
8// UTILITIES ###
9// ############
10
11/// Identifies the an OAuth2 authorization scope.
12/// A scope is needed when requesting an
13/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
14#[derive(PartialEq, Eq, Ord, PartialOrd, Hash, Debug, Clone, Copy)]
15pub enum Scope {
16 /// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
17 CloudPlatform,
18}
19
20impl AsRef<str> for Scope {
21 fn as_ref(&self) -> &str {
22 match *self {
23 Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
24 }
25 }
26}
27
28#[allow(clippy::derivable_impls)]
29impl Default for Scope {
30 fn default() -> Scope {
31 Scope::CloudPlatform
32 }
33}
34
35// ########
36// HUB ###
37// ######
38
39/// Central instance to access all Transcoder related resource activities
40///
41/// # Examples
42///
43/// Instantiate a new hub
44///
45/// ```test_harness,no_run
46/// extern crate hyper;
47/// extern crate hyper_rustls;
48/// extern crate google_transcoder1 as transcoder1;
49/// use transcoder1::api::Job;
50/// use transcoder1::{Result, Error};
51/// # async fn dox() {
52/// use transcoder1::{Transcoder, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
53///
54/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
55/// // `client_secret`, among other things.
56/// let secret: yup_oauth2::ApplicationSecret = Default::default();
57/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
58/// // unless you replace `None` with the desired Flow.
59/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
60/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
61/// // retrieve them from storage.
62/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
63/// .with_native_roots()
64/// .unwrap()
65/// .https_only()
66/// .enable_http2()
67/// .build();
68///
69/// let executor = hyper_util::rt::TokioExecutor::new();
70/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
71/// secret,
72/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
73/// yup_oauth2::client::CustomHyperClientBuilder::from(
74/// hyper_util::client::legacy::Client::builder(executor).build(connector),
75/// ),
76/// ).build().await.unwrap();
77///
78/// let client = hyper_util::client::legacy::Client::builder(
79/// hyper_util::rt::TokioExecutor::new()
80/// )
81/// .build(
82/// hyper_rustls::HttpsConnectorBuilder::new()
83/// .with_native_roots()
84/// .unwrap()
85/// .https_or_http()
86/// .enable_http2()
87/// .build()
88/// );
89/// let mut hub = Transcoder::new(client, auth);
90/// // As the method needs a request, you would usually fill it with the desired information
91/// // into the respective structure. Some of the parts shown here might not be applicable !
92/// // Values shown here are possibly random and not representative !
93/// let mut req = Job::default();
94///
95/// // You can configure optional parameters by calling the respective setters at will, and
96/// // execute the final call using `doit()`.
97/// // Values shown here are possibly random and not representative !
98/// let result = hub.projects().locations_jobs_create(req, "parent")
99/// .doit().await;
100///
101/// match result {
102/// Err(e) => match e {
103/// // The Error enum provides details about what exactly happened.
104/// // You can also just use its `Debug`, `Display` or `Error` traits
105/// Error::HttpError(_)
106/// |Error::Io(_)
107/// |Error::MissingAPIKey
108/// |Error::MissingToken(_)
109/// |Error::Cancelled
110/// |Error::UploadSizeLimitExceeded(_, _)
111/// |Error::Failure(_)
112/// |Error::BadRequest(_)
113/// |Error::FieldClash(_)
114/// |Error::JsonDecodeError(_, _) => println!("{}", e),
115/// },
116/// Ok(res) => println!("Success: {:?}", res),
117/// }
118/// # }
119/// ```
120#[derive(Clone)]
121pub struct Transcoder<C> {
122 pub client: common::Client<C>,
123 pub auth: Box<dyn common::GetToken>,
124 _user_agent: String,
125 _base_url: String,
126 _root_url: String,
127}
128
129impl<C> common::Hub for Transcoder<C> {}
130
131impl<'a, C> Transcoder<C> {
132 pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> Transcoder<C> {
133 Transcoder {
134 client,
135 auth: Box::new(auth),
136 _user_agent: "google-api-rust-client/7.0.0".to_string(),
137 _base_url: "https://transcoder.googleapis.com/".to_string(),
138 _root_url: "https://transcoder.googleapis.com/".to_string(),
139 }
140 }
141
142 pub fn projects(&'a self) -> ProjectMethods<'a, C> {
143 ProjectMethods { hub: self }
144 }
145
146 /// Set the user-agent header field to use in all requests to the server.
147 /// It defaults to `google-api-rust-client/7.0.0`.
148 ///
149 /// Returns the previously set user-agent.
150 pub fn user_agent(&mut self, agent_name: String) -> String {
151 std::mem::replace(&mut self._user_agent, agent_name)
152 }
153
154 /// Set the base url to use in all requests to the server.
155 /// It defaults to `https://transcoder.googleapis.com/`.
156 ///
157 /// Returns the previously set base url.
158 pub fn base_url(&mut self, new_base_url: String) -> String {
159 std::mem::replace(&mut self._base_url, new_base_url)
160 }
161
162 /// Set the root url to use in all requests to the server.
163 /// It defaults to `https://transcoder.googleapis.com/`.
164 ///
165 /// Returns the previously set root url.
166 pub fn root_url(&mut self, new_root_url: String) -> String {
167 std::mem::replace(&mut self._root_url, new_root_url)
168 }
169}
170
171// ############
172// SCHEMAS ###
173// ##########
174/// Ad break.
175///
176/// This type is not used in any activity, and only used as *part* of another schema.
177///
178#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
179#[serde_with::serde_as]
180#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
181pub struct AdBreak {
182 /// Start time in seconds for the ad break, relative to the output file timeline. The default is `0s`.
183 #[serde(rename = "startTimeOffset")]
184 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
185 pub start_time_offset: Option<chrono::Duration>,
186}
187
188impl common::Part for AdBreak {}
189
190/// Configuration for AES-128 encryption.
191///
192/// This type is not used in any activity, and only used as *part* of another schema.
193///
194#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
195#[serde_with::serde_as]
196#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
197pub struct Aes128Encryption {
198 _never_set: Option<bool>,
199}
200
201impl common::Part for Aes128Encryption {}
202
203/// Animation types.
204///
205/// This type is not used in any activity, and only used as *part* of another schema.
206///
207#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
208#[serde_with::serde_as]
209#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
210pub struct Animation {
211 /// End previous animation.
212 #[serde(rename = "animationEnd")]
213 pub animation_end: Option<AnimationEnd>,
214 /// Display overlay object with fade animation.
215 #[serde(rename = "animationFade")]
216 pub animation_fade: Option<AnimationFade>,
217 /// Display static overlay object.
218 #[serde(rename = "animationStatic")]
219 pub animation_static: Option<AnimationStatic>,
220}
221
222impl common::Part for Animation {}
223
224/// End previous overlay animation from the video. Without `AnimationEnd`, the overlay object will keep the state of previous animation until the end of the video.
225///
226/// This type is not used in any activity, and only used as *part* of another schema.
227///
228#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
229#[serde_with::serde_as]
230#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
231pub struct AnimationEnd {
232 /// The time to end overlay object, in seconds. Default: 0
233 #[serde(rename = "startTimeOffset")]
234 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
235 pub start_time_offset: Option<chrono::Duration>,
236}
237
238impl common::Part for AnimationEnd {}
239
240/// Display overlay object with fade animation.
241///
242/// This type is not used in any activity, and only used as *part* of another schema.
243///
244#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
245#[serde_with::serde_as]
246#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
247pub struct AnimationFade {
248 /// The time to end the fade animation, in seconds. Default: `start_time_offset` + 1s
249 #[serde(rename = "endTimeOffset")]
250 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
251 pub end_time_offset: Option<chrono::Duration>,
252 /// Required. Type of fade animation: `FADE_IN` or `FADE_OUT`.
253 #[serde(rename = "fadeType")]
254 pub fade_type: Option<String>,
255 /// The time to start the fade animation, in seconds. Default: 0
256 #[serde(rename = "startTimeOffset")]
257 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
258 pub start_time_offset: Option<chrono::Duration>,
259 /// Normalized coordinates based on output video resolution. Valid values: `0.0`–`1.0`. `xy` is the upper-left coordinate of the overlay object. For example, use the x and y coordinates {0,0} to position the top-left corner of the overlay animation in the top-left corner of the output video.
260 pub xy: Option<NormalizedCoordinate>,
261}
262
263impl common::Part for AnimationFade {}
264
265/// Display static overlay object.
266///
267/// This type is not used in any activity, and only used as *part* of another schema.
268///
269#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
270#[serde_with::serde_as]
271#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
272pub struct AnimationStatic {
273 /// The time to start displaying the overlay object, in seconds. Default: 0
274 #[serde(rename = "startTimeOffset")]
275 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
276 pub start_time_offset: Option<chrono::Duration>,
277 /// Normalized coordinates based on output video resolution. Valid values: `0.0`–`1.0`. `xy` is the upper-left coordinate of the overlay object. For example, use the x and y coordinates {0,0} to position the top-left corner of the overlay animation in the top-left corner of the output video.
278 pub xy: Option<NormalizedCoordinate>,
279}
280
281impl common::Part for AnimationStatic {}
282
283/// Audio preprocessing configuration.
284///
285/// This type is not used in any activity, and only used as *part* of another schema.
286///
287#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
288#[serde_with::serde_as]
289#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
290pub struct Audio {
291 /// Enable boosting high frequency components. The default is `false`. **Note:** This field is not supported.
292 #[serde(rename = "highBoost")]
293 pub high_boost: Option<bool>,
294 /// Enable boosting low frequency components. The default is `false`. **Note:** This field is not supported.
295 #[serde(rename = "lowBoost")]
296 pub low_boost: Option<bool>,
297 /// Specify audio loudness normalization in loudness units relative to full scale (LUFS). Enter a value between -24 and 0 (the default), where: * -24 is the Advanced Television Systems Committee (ATSC A/85) standard * -23 is the EU R128 broadcast standard * -19 is the prior standard for online mono audio * -18 is the ReplayGain standard * -16 is the prior standard for stereo audio * -14 is the new online audio standard recommended by Spotify, as well as Amazon Echo * 0 disables normalization
298 pub lufs: Option<f64>,
299}
300
301impl common::Part for Audio {}
302
303/// The mapping for the JobConfig.edit_list atoms with audio EditAtom.inputs.
304///
305/// This type is not used in any activity, and only used as *part* of another schema.
306///
307#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
308#[serde_with::serde_as]
309#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
310pub struct AudioMapping {
311 /// Required. The EditAtom.key that references the atom with audio inputs in the JobConfig.edit_list.
312 #[serde(rename = "atomKey")]
313 pub atom_key: Option<String>,
314 /// Audio volume control in dB. Negative values decrease volume, positive values increase. The default is 0.
315 #[serde(rename = "gainDb")]
316 pub gain_db: Option<f64>,
317 /// Required. The zero-based index of the channel in the input audio stream.
318 #[serde(rename = "inputChannel")]
319 pub input_channel: Option<i32>,
320 /// Required. The Input.key that identifies the input file.
321 #[serde(rename = "inputKey")]
322 pub input_key: Option<String>,
323 /// Required. The zero-based index of the track in the input file.
324 #[serde(rename = "inputTrack")]
325 pub input_track: Option<i32>,
326 /// Required. The zero-based index of the channel in the output audio stream.
327 #[serde(rename = "outputChannel")]
328 pub output_channel: Option<i32>,
329}
330
331impl common::Part for AudioMapping {}
332
333/// Audio stream resource.
334///
335/// This type is not used in any activity, and only used as *part* of another schema.
336///
337#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
338#[serde_with::serde_as]
339#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
340pub struct AudioStream {
341 /// Required. Audio bitrate in bits per second. Must be between 1 and 10,000,000.
342 #[serde(rename = "bitrateBps")]
343 pub bitrate_bps: Option<i32>,
344 /// Number of audio channels. Must be between 1 and 6. The default is 2.
345 #[serde(rename = "channelCount")]
346 pub channel_count: Option<i32>,
347 /// A list of channel names specifying layout of the audio channels. This only affects the metadata embedded in the container headers, if supported by the specified format. The default is `["fl", "fr"]`. 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
348 #[serde(rename = "channelLayout")]
349 pub channel_layout: Option<Vec<String>>,
350 /// The codec for this audio stream. The default is `aac`. Supported audio codecs: - `aac` - `aac-he` - `aac-he-v2` - `mp3` - `ac3` - `eac3` - `vorbis`
351 pub codec: Option<String>,
352 /// The name for this particular audio stream that will be added to the HLS/DASH manifest. Not supported in MP4 files.
353 #[serde(rename = "displayName")]
354 pub display_name: Option<String>,
355 /// The BCP-47 language code, such as `en-US` or `sr-Latn`. For more information, see https://www.unicode.org/reports/tr35/#Unicode_locale_identifier. Not supported in MP4 files.
356 #[serde(rename = "languageCode")]
357 pub language_code: Option<String>,
358 /// The mapping for the JobConfig.edit_list atoms with audio EditAtom.inputs.
359 pub mapping: Option<Vec<AudioMapping>>,
360 /// The audio sample rate in Hertz. The default is 48000 Hertz.
361 #[serde(rename = "sampleRateHertz")]
362 pub sample_rate_hertz: Option<i32>,
363}
364
365impl common::Part for AudioStream {}
366
367/// Bob Weaver Deinterlacing Filter Configuration.
368///
369/// This type is not used in any activity, and only used as *part* of another schema.
370///
371#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
372#[serde_with::serde_as]
373#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
374pub struct BwdifConfig {
375 /// Deinterlace all frames rather than just the frames identified as interlaced. The default is `false`.
376 #[serde(rename = "deinterlaceAllFrames")]
377 pub deinterlace_all_frames: Option<bool>,
378 /// Specifies the deinterlacing mode to adopt. The default is `send_frame`. Supported values: - `send_frame`: Output one frame for each frame - `send_field`: Output one frame for each field
379 pub mode: Option<String>,
380 /// The picture field parity assumed for the input interlaced video. The default is `auto`. Supported values: - `tff`: Assume the top field is first - `bff`: Assume the bottom field is first - `auto`: Enable automatic detection of field parity
381 pub parity: Option<String>,
382}
383
384impl common::Part for BwdifConfig {}
385
386/// Clearkey configuration.
387///
388/// This type is not used in any activity, and only used as *part* of another schema.
389///
390#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
391#[serde_with::serde_as]
392#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
393pub struct Clearkey {
394 _never_set: Option<bool>,
395}
396
397impl common::Part for Clearkey {}
398
399/// Color preprocessing configuration. **Note:** This configuration is not supported.
400///
401/// This type is not used in any activity, and only used as *part* of another schema.
402///
403#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
404#[serde_with::serde_as]
405#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
406pub struct Color {
407 /// Control brightness of the video. Enter a value between -1 and 1, where -1 is minimum brightness and 1 is maximum brightness. 0 is no change. The default is 0.
408 pub brightness: Option<f64>,
409 /// Control black and white contrast of the video. Enter a value between -1 and 1, where -1 is minimum contrast and 1 is maximum contrast. 0 is no change. The default is 0.
410 pub contrast: Option<f64>,
411 /// Control color saturation of the video. Enter a value between -1 and 1, where -1 is fully desaturated and 1 is maximum saturation. 0 is no change. The default is 0.
412 pub saturation: Option<f64>,
413}
414
415impl common::Part for Color {}
416
417/// Video cropping configuration for the input video. The cropped input video is scaled to match the output resolution.
418///
419/// This type is not used in any activity, and only used as *part* of another schema.
420///
421#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
422#[serde_with::serde_as]
423#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
424pub struct Crop {
425 /// The number of pixels to crop from the bottom. The default is 0.
426 #[serde(rename = "bottomPixels")]
427 pub bottom_pixels: Option<i32>,
428 /// The number of pixels to crop from the left. The default is 0.
429 #[serde(rename = "leftPixels")]
430 pub left_pixels: Option<i32>,
431 /// The number of pixels to crop from the right. The default is 0.
432 #[serde(rename = "rightPixels")]
433 pub right_pixels: Option<i32>,
434 /// The number of pixels to crop from the top. The default is 0.
435 #[serde(rename = "topPixels")]
436 pub top_pixels: Option<i32>,
437}
438
439impl common::Part for Crop {}
440
441/// `DASH` manifest configuration.
442///
443/// This type is not used in any activity, and only used as *part* of another schema.
444///
445#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
446#[serde_with::serde_as]
447#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
448pub struct DashConfig {
449 /// The segment reference scheme for a `DASH` manifest. The default is `SEGMENT_LIST`.
450 #[serde(rename = "segmentReferenceScheme")]
451 pub segment_reference_scheme: Option<String>,
452}
453
454impl common::Part for DashConfig {}
455
456/// Deblock preprocessing configuration. **Note:** This configuration is not supported.
457///
458/// This type is not used in any activity, and only used as *part* of another schema.
459///
460#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
461#[serde_with::serde_as]
462#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
463pub struct Deblock {
464 /// Enable deblocker. The default is `false`.
465 pub enabled: Option<bool>,
466 /// Set strength of the deblocker. Enter a value between 0 and 1. The higher the value, the stronger the block removal. 0 is no deblocking. The default is 0.
467 pub strength: Option<f64>,
468}
469
470impl common::Part for Deblock {}
471
472/// Deinterlace configuration for input video.
473///
474/// This type is not used in any activity, and only used as *part* of another schema.
475///
476#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
477#[serde_with::serde_as]
478#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
479pub struct Deinterlace {
480 /// Specifies the Bob Weaver Deinterlacing Filter Configuration.
481 pub bwdif: Option<BwdifConfig>,
482 /// Specifies the Yet Another Deinterlacing Filter Configuration.
483 pub yadif: Option<YadifConfig>,
484}
485
486impl common::Part for Deinterlace {}
487
488/// Denoise preprocessing configuration. **Note:** This configuration is not supported.
489///
490/// This type is not used in any activity, and only used as *part* of another schema.
491///
492#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
493#[serde_with::serde_as]
494#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
495pub struct Denoise {
496 /// Set strength of the denoise. Enter a value between 0 and 1. The higher the value, the smoother the image. 0 is no denoising. The default is 0.
497 pub strength: Option<f64>,
498 /// Set the denoiser mode. The default is `standard`. Supported denoiser modes: - `standard` - `grain`
499 pub tune: Option<String>,
500}
501
502impl common::Part for Denoise {}
503
504/// Defines configuration for DRM systems in use.
505///
506/// This type is not used in any activity, and only used as *part* of another schema.
507///
508#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
509#[serde_with::serde_as]
510#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
511pub struct DrmSystems {
512 /// Clearkey configuration.
513 pub clearkey: Option<Clearkey>,
514 /// Fairplay configuration.
515 pub fairplay: Option<Fairplay>,
516 /// Playready configuration.
517 pub playready: Option<Playready>,
518 /// Widevine configuration.
519 pub widevine: Option<Widevine>,
520}
521
522impl common::Part for DrmSystems {}
523
524/// Edit atom.
525///
526/// This type is not used in any activity, and only used as *part* of another schema.
527///
528#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
529#[serde_with::serde_as]
530#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
531pub struct EditAtom {
532 /// End time in seconds for the atom, relative to the input file timeline. When `end_time_offset` is not specified, the `inputs` are used until the end of the atom.
533 #[serde(rename = "endTimeOffset")]
534 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
535 pub end_time_offset: Option<chrono::Duration>,
536 /// List of Input.key values identifying files that should be used in this atom. The listed `inputs` must have the same timeline.
537 pub inputs: Option<Vec<String>>,
538 /// A unique key for this atom. Must be specified when using advanced mapping.
539 pub key: Option<String>,
540 /// Start time in seconds for the atom, relative to the input file timeline. The default is `0s`.
541 #[serde(rename = "startTimeOffset")]
542 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
543 pub start_time_offset: Option<chrono::Duration>,
544}
545
546impl common::Part for EditAtom {}
547
548/// Encoding of an input file such as an audio, video, or text track. Elementary streams must be packaged before mapping and sharing between different output formats.
549///
550/// This type is not used in any activity, and only used as *part* of another schema.
551///
552#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
553#[serde_with::serde_as]
554#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
555pub struct ElementaryStream {
556 /// Encoding of an audio stream.
557 #[serde(rename = "audioStream")]
558 pub audio_stream: Option<AudioStream>,
559 /// A unique key for this elementary stream.
560 pub key: Option<String>,
561 /// Encoding of a text stream. For example, closed captions or subtitles.
562 #[serde(rename = "textStream")]
563 pub text_stream: Option<TextStream>,
564 /// Encoding of a video stream.
565 #[serde(rename = "videoStream")]
566 pub video_stream: Option<VideoStream>,
567}
568
569impl common::Part for ElementaryStream {}
570
571/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
572///
573/// # Activities
574///
575/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
576/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
577///
578/// * [locations job templates delete projects](ProjectLocationJobTemplateDeleteCall) (response)
579/// * [locations jobs delete projects](ProjectLocationJobDeleteCall) (response)
580#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
581#[serde_with::serde_as]
582#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
583pub struct Empty {
584 _never_set: Option<bool>,
585}
586
587impl common::ResponseResult for Empty {}
588
589/// Encryption settings.
590///
591/// This type is not used in any activity, and only used as *part* of another schema.
592///
593#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
594#[serde_with::serde_as]
595#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
596pub struct Encryption {
597 /// Configuration for AES-128 encryption.
598 pub aes128: Option<Aes128Encryption>,
599 /// Required. DRM system(s) to use; at least one must be specified. If a DRM system is omitted, it is considered disabled.
600 #[serde(rename = "drmSystems")]
601 pub drm_systems: Option<DrmSystems>,
602 /// Required. Identifier for this set of encryption options.
603 pub id: Option<String>,
604 /// Configuration for MPEG Common Encryption (MPEG-CENC).
605 #[serde(rename = "mpegCenc")]
606 pub mpeg_cenc: Option<MpegCommonEncryption>,
607 /// Configuration for SAMPLE-AES encryption.
608 #[serde(rename = "sampleAes")]
609 pub sample_aes: Option<SampleAesEncryption>,
610 /// Keys are stored in Google Secret Manager.
611 #[serde(rename = "secretManagerKeySource")]
612 pub secret_manager_key_source: Option<SecretManagerSource>,
613}
614
615impl common::Part for Encryption {}
616
617/// Fairplay configuration.
618///
619/// This type is not used in any activity, and only used as *part* of another schema.
620///
621#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
622#[serde_with::serde_as]
623#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
624pub struct Fairplay {
625 _never_set: Option<bool>,
626}
627
628impl common::Part for Fairplay {}
629
630/// `fmp4` container configuration.
631///
632/// This type is not used in any activity, and only used as *part* of another schema.
633///
634#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
635#[serde_with::serde_as]
636#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
637pub struct Fmp4Config {
638 /// Optional. Specify the codec tag string that will be used in the media bitstream. When not specified, the codec appropriate value is used. Supported H265 codec tags: - `hvc1` (default) - `hev1`
639 #[serde(rename = "codecTag")]
640 pub codec_tag: Option<String>,
641}
642
643impl common::Part for Fmp4Config {}
644
645/// H264 codec settings.
646///
647/// This type is not used in any activity, and only used as *part* of another schema.
648///
649#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
650#[serde_with::serde_as]
651#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
652pub struct H264CodecSettings {
653 /// Specifies whether an open Group of Pictures (GOP) structure should be allowed or not. The default is `false`.
654 #[serde(rename = "allowOpenGop")]
655 pub allow_open_gop: Option<bool>,
656 /// Specify the intensity of the adaptive quantizer (AQ). Must be between 0 and 1, where 0 disables the quantizer and 1 maximizes the quantizer. A higher value equals a lower bitrate but smoother image. The default is 0.
657 #[serde(rename = "aqStrength")]
658 pub aq_strength: Option<f64>,
659 /// The number of consecutive B-frames. Must be greater than or equal to zero. Must be less than H264CodecSettings.gop_frame_count if set. The default is 0.
660 #[serde(rename = "bFrameCount")]
661 pub b_frame_count: Option<i32>,
662 /// Allow B-pyramid for reference frame selection. This may not be supported on all decoders. The default is `false`.
663 #[serde(rename = "bPyramid")]
664 pub b_pyramid: Option<bool>,
665 /// Required. The video bitrate in bits per second. The minimum value is 1,000. The maximum value is 800,000,000.
666 #[serde(rename = "bitrateBps")]
667 pub bitrate_bps: Option<i32>,
668 /// Target CRF level. Must be between 10 and 36, where 10 is the highest quality and 36 is the most efficient compression. The default is 21.
669 #[serde(rename = "crfLevel")]
670 pub crf_level: Option<i32>,
671 /// Use two-pass encoding strategy to achieve better video quality. H264CodecSettings.rate_control_mode must be `vbr`. The default is `false`.
672 #[serde(rename = "enableTwoPass")]
673 pub enable_two_pass: Option<bool>,
674 /// The entropy coder to use. The default is `cabac`. Supported entropy coders: - `cavlc` - `cabac`
675 #[serde(rename = "entropyCoder")]
676 pub entropy_coder: Option<String>,
677 /// Required. The target video frame rate in frames per second (FPS). Must be less than or equal to 120.
678 #[serde(rename = "frameRate")]
679 pub frame_rate: Option<f64>,
680 /// Optional. Frame rate conversion strategy for desired frame rate. The default is `DOWNSAMPLE`.
681 #[serde(rename = "frameRateConversionStrategy")]
682 pub frame_rate_conversion_strategy: Option<String>,
683 /// Select the GOP size based on the specified duration. The default is `3s`. Note that `gopDuration` must be less than or equal to [`segmentDuration`](#SegmentSettings), and [`segmentDuration`](#SegmentSettings) must be divisible by `gopDuration`.
684 #[serde(rename = "gopDuration")]
685 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
686 pub gop_duration: Option<chrono::Duration>,
687 /// Select the GOP size based on the specified frame count. Must be greater than zero.
688 #[serde(rename = "gopFrameCount")]
689 pub gop_frame_count: Option<i32>,
690 /// The height of the video in pixels. Must be an even integer. When not specified, the height is adjusted to match the specified width and input aspect ratio. If both are omitted, the input height is used. For portrait videos that contain horizontal ASR and rotation metadata, provide the height, in pixels, per the horizontal ASR. The API calculates the width per the horizontal ASR. The API detects any rotation metadata and swaps the requested height and width for the output.
691 #[serde(rename = "heightPixels")]
692 pub height_pixels: Option<i32>,
693 /// Optional. HLG color format setting for H264.
694 pub hlg: Option<H264ColorFormatHLG>,
695 /// 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
696 #[serde(rename = "pixelFormat")]
697 pub pixel_format: Option<String>,
698 /// Enforces the specified codec preset. The default is `veryfast`. The available options are [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.264#Preset). Note that certain values for this field may cause the transcoder to override other fields you set in the `H264CodecSettings` message.
699 pub preset: Option<String>,
700 /// Enforces the specified codec profile. The following profiles are supported: * `baseline` * `main` * `high` (default) The available options are [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.264#Tune). Note that certain values for this field may cause the transcoder to override other fields you set in the `H264CodecSettings` message.
701 pub profile: Option<String>,
702 /// Specify the mode. The default is `vbr`. Supported rate control modes: - `vbr` - variable bitrate - `crf` - constant rate factor
703 #[serde(rename = "rateControlMode")]
704 pub rate_control_mode: Option<String>,
705 /// Optional. SDR color format setting for H264.
706 pub sdr: Option<H264ColorFormatSDR>,
707 /// Enforces the specified codec tune. The available options are [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.264#Tune). Note that certain values for this field may cause the transcoder to override other fields you set in the `H264CodecSettings` message.
708 pub tune: Option<String>,
709 /// Initial fullness of the Video Buffering Verifier (VBV) buffer in bits. Must be greater than zero. The default is equal to 90% of H264CodecSettings.vbv_size_bits.
710 #[serde(rename = "vbvFullnessBits")]
711 pub vbv_fullness_bits: Option<i32>,
712 /// Size of the Video Buffering Verifier (VBV) buffer in bits. Must be greater than zero. The default is equal to H264CodecSettings.bitrate_bps.
713 #[serde(rename = "vbvSizeBits")]
714 pub vbv_size_bits: Option<i32>,
715 /// The width of the video in pixels. Must be an even integer. When not specified, the width is adjusted to match the specified height and input aspect ratio. If both are omitted, the input width is used. For portrait videos that contain horizontal ASR and rotation metadata, provide the width, in pixels, per the horizontal ASR. The API calculates the height per the horizontal ASR. The API detects any rotation metadata and swaps the requested height and width for the output.
716 #[serde(rename = "widthPixels")]
717 pub width_pixels: Option<i32>,
718}
719
720impl common::Part for H264CodecSettings {}
721
722/// Convert the input video to a Hybrid Log Gamma (HLG) video.
723///
724/// This type is not used in any activity, and only used as *part* of another schema.
725///
726#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
727#[serde_with::serde_as]
728#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
729pub struct H264ColorFormatHLG {
730 _never_set: Option<bool>,
731}
732
733impl common::Part for H264ColorFormatHLG {}
734
735/// Convert the input video to a Standard Dynamic Range (SDR) video.
736///
737/// This type is not used in any activity, and only used as *part* of another schema.
738///
739#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
740#[serde_with::serde_as]
741#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
742pub struct H264ColorFormatSDR {
743 _never_set: Option<bool>,
744}
745
746impl common::Part for H264ColorFormatSDR {}
747
748/// H265 codec settings.
749///
750/// This type is not used in any activity, and only used as *part* of another schema.
751///
752#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
753#[serde_with::serde_as]
754#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
755pub struct H265CodecSettings {
756 /// Specifies whether an open Group of Pictures (GOP) structure should be allowed or not. The default is `false`.
757 #[serde(rename = "allowOpenGop")]
758 pub allow_open_gop: Option<bool>,
759 /// Specify the intensity of the adaptive quantizer (AQ). Must be between 0 and 1, where 0 disables the quantizer and 1 maximizes the quantizer. A higher value equals a lower bitrate but smoother image. The default is 0.
760 #[serde(rename = "aqStrength")]
761 pub aq_strength: Option<f64>,
762 /// The number of consecutive B-frames. Must be greater than or equal to zero. Must be less than H265CodecSettings.gop_frame_count if set. The default is 0.
763 #[serde(rename = "bFrameCount")]
764 pub b_frame_count: Option<i32>,
765 /// Allow B-pyramid for reference frame selection. This may not be supported on all decoders. The default is `false`.
766 #[serde(rename = "bPyramid")]
767 pub b_pyramid: Option<bool>,
768 /// Required. The video bitrate in bits per second. The minimum value is 1,000. The maximum value is 800,000,000.
769 #[serde(rename = "bitrateBps")]
770 pub bitrate_bps: Option<i32>,
771 /// Target CRF level. Must be between 10 and 36, where 10 is the highest quality and 36 is the most efficient compression. The default is 21.
772 #[serde(rename = "crfLevel")]
773 pub crf_level: Option<i32>,
774 /// Use two-pass encoding strategy to achieve better video quality. H265CodecSettings.rate_control_mode must be `vbr`. The default is `false`.
775 #[serde(rename = "enableTwoPass")]
776 pub enable_two_pass: Option<bool>,
777 /// Required. The target video frame rate in frames per second (FPS). Must be less than or equal to 120.
778 #[serde(rename = "frameRate")]
779 pub frame_rate: Option<f64>,
780 /// Optional. Frame rate conversion strategy for desired frame rate. The default is `DOWNSAMPLE`.
781 #[serde(rename = "frameRateConversionStrategy")]
782 pub frame_rate_conversion_strategy: Option<String>,
783 /// Select the GOP size based on the specified duration. The default is `3s`. Note that `gopDuration` must be less than or equal to [`segmentDuration`](#SegmentSettings), and [`segmentDuration`](#SegmentSettings) must be divisible by `gopDuration`.
784 #[serde(rename = "gopDuration")]
785 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
786 pub gop_duration: Option<chrono::Duration>,
787 /// Select the GOP size based on the specified frame count. Must be greater than zero.
788 #[serde(rename = "gopFrameCount")]
789 pub gop_frame_count: Option<i32>,
790 /// Optional. HDR10 color format setting for H265.
791 pub hdr10: Option<H265ColorFormatHDR10>,
792 /// The height of the video in pixels. Must be an even integer. When not specified, the height is adjusted to match the specified width and input aspect ratio. If both are omitted, the input height is used. For portrait videos that contain horizontal ASR and rotation metadata, provide the height, in pixels, per the horizontal ASR. The API calculates the width per the horizontal ASR. The API detects any rotation metadata and swaps the requested height and width for the output.
793 #[serde(rename = "heightPixels")]
794 pub height_pixels: Option<i32>,
795 /// Optional. HLG color format setting for H265.
796 pub hlg: Option<H265ColorFormatHLG>,
797 /// 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
798 #[serde(rename = "pixelFormat")]
799 pub pixel_format: Option<String>,
800 /// Enforces the specified codec preset. The default is `veryfast`. The available options are [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.265). Note that certain values for this field may cause the transcoder to override other fields you set in the `H265CodecSettings` message.
801 pub preset: Option<String>,
802 /// Enforces the specified codec profile. The following profiles are supported: * 8-bit profiles * `main` (default) * `main-intra` * `mainstillpicture` * 10-bit profiles * `main10` (default) * `main10-intra` * `main422-10` * `main422-10-intra` * `main444-10` * `main444-10-intra` * 12-bit profiles * `main12` (default) * `main12-intra` * `main422-12` * `main422-12-intra` * `main444-12` * `main444-12-intra` The available options are [FFmpeg-compatible](https://x265.readthedocs.io/). Note that certain values for this field may cause the transcoder to override other fields you set in the `H265CodecSettings` message.
803 pub profile: Option<String>,
804 /// Specify the mode. The default is `vbr`. Supported rate control modes: - `vbr` - variable bitrate - `crf` - constant rate factor
805 #[serde(rename = "rateControlMode")]
806 pub rate_control_mode: Option<String>,
807 /// Optional. SDR color format setting for H265.
808 pub sdr: Option<H265ColorFormatSDR>,
809 /// Enforces the specified codec tune. The available options are [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.265). Note that certain values for this field may cause the transcoder to override other fields you set in the `H265CodecSettings` message.
810 pub tune: Option<String>,
811 /// Initial fullness of the Video Buffering Verifier (VBV) buffer in bits. Must be greater than zero. The default is equal to 90% of H265CodecSettings.vbv_size_bits.
812 #[serde(rename = "vbvFullnessBits")]
813 pub vbv_fullness_bits: Option<i32>,
814 /// Size of the Video Buffering Verifier (VBV) buffer in bits. Must be greater than zero. The default is equal to `VideoStream.bitrate_bps`.
815 #[serde(rename = "vbvSizeBits")]
816 pub vbv_size_bits: Option<i32>,
817 /// The width of the video in pixels. Must be an even integer. When not specified, the width is adjusted to match the specified height and input aspect ratio. If both are omitted, the input width is used. For portrait videos that contain horizontal ASR and rotation metadata, provide the width, in pixels, per the horizontal ASR. The API calculates the height per the horizontal ASR. The API detects any rotation metadata and swaps the requested height and width for the output.
818 #[serde(rename = "widthPixels")]
819 pub width_pixels: Option<i32>,
820}
821
822impl common::Part for H265CodecSettings {}
823
824/// Convert the input video to a High Dynamic Range 10 (HDR10) video.
825///
826/// This type is not used in any activity, and only used as *part* of another schema.
827///
828#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
829#[serde_with::serde_as]
830#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
831pub struct H265ColorFormatHDR10 {
832 _never_set: Option<bool>,
833}
834
835impl common::Part for H265ColorFormatHDR10 {}
836
837/// Convert the input video to a Hybrid Log Gamma (HLG) video.
838///
839/// This type is not used in any activity, and only used as *part* of another schema.
840///
841#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
842#[serde_with::serde_as]
843#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
844pub struct H265ColorFormatHLG {
845 _never_set: Option<bool>,
846}
847
848impl common::Part for H265ColorFormatHLG {}
849
850/// Convert the input video to a Standard Dynamic Range (SDR) video.
851///
852/// This type is not used in any activity, and only used as *part* of another schema.
853///
854#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
855#[serde_with::serde_as]
856#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
857pub struct H265ColorFormatSDR {
858 _never_set: Option<bool>,
859}
860
861impl common::Part for H265ColorFormatSDR {}
862
863/// Overlaid image.
864///
865/// This type is not used in any activity, and only used as *part* of another schema.
866///
867#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
868#[serde_with::serde_as]
869#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
870pub struct Image {
871 /// Target image opacity. Valid values are from `1.0` (solid, default) to `0.0` (transparent), exclusive. Set this to a value greater than `0.0`.
872 pub alpha: Option<f64>,
873 /// Normalized image resolution, based on output video resolution. Valid values: `0.0`–`1.0`. To respect the original image aspect ratio, set either `x` or `y` to `0.0`. To use the original image resolution, set both `x` and `y` to `0.0`.
874 pub resolution: Option<NormalizedCoordinate>,
875 /// Required. URI of the image in Cloud Storage. For example, `gs://bucket/inputs/image.png`. Only PNG and JPEG images are supported.
876 pub uri: Option<String>,
877}
878
879impl common::Part for Image {}
880
881/// Input asset.
882///
883/// This type is not used in any activity, and only used as *part* of another schema.
884///
885#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
886#[serde_with::serde_as]
887#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
888pub struct Input {
889 /// Optional. Input Attributes.
890 pub attributes: Option<InputAttributes>,
891 /// A unique key for this input. Must be specified when using advanced mapping and edit lists.
892 pub key: Option<String>,
893 /// Preprocessing configurations.
894 #[serde(rename = "preprocessingConfig")]
895 pub preprocessing_config: Option<PreprocessingConfig>,
896 /// URI of the media. Input files must be at least 5 seconds in duration and stored in Cloud Storage (for example, `gs://bucket/inputs/file.mp4`). If empty, the value is populated from Job.input_uri. See [Supported input and output formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats).
897 pub uri: Option<String>,
898}
899
900impl common::Part for Input {}
901
902/// Input attributes that provide additional information about the input asset.
903///
904/// This type is not used in any activity, and only used as *part* of another schema.
905///
906#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
907#[serde_with::serde_as]
908#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
909pub struct InputAttributes {
910 /// Optional. A list of track definitions for the input asset.
911 #[serde(rename = "trackDefinitions")]
912 pub track_definitions: Option<Vec<TrackDefinition>>,
913}
914
915impl common::Part for InputAttributes {}
916
917/// Transcoding job resource.
918///
919/// # Activities
920///
921/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
922/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
923///
924/// * [locations jobs create projects](ProjectLocationJobCreateCall) (request|response)
925/// * [locations jobs get projects](ProjectLocationJobGetCall) (response)
926#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
927#[serde_with::serde_as]
928#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
929pub struct Job {
930 /// The processing priority of a batch job. This field can only be set for batch mode jobs. The default value is 0. This value cannot be negative. Higher values correspond to higher priorities for the job.
931 #[serde(rename = "batchModePriority")]
932 pub batch_mode_priority: Option<i32>,
933 /// The configuration for this job.
934 pub config: Option<JobConfig>,
935 /// Output only. The time the job was created.
936 #[serde(rename = "createTime")]
937 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
938 /// Output only. The time the transcoding finished.
939 #[serde(rename = "endTime")]
940 pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
941 /// Output only. An error object that describes the reason for the failure. This property is always present when ProcessingState is `FAILED`.
942 pub error: Option<Status>,
943 /// Optional. Insert silence and duplicate frames when timestamp gaps are detected in a given stream.
944 #[serde(rename = "fillContentGaps")]
945 pub fill_content_gaps: Option<bool>,
946 /// Input only. Specify the `input_uri` to populate empty `uri` fields in each element of `Job.config.inputs` or `JobTemplate.config.inputs` when using template. URI of the media. Input files must be at least 5 seconds in duration and stored in Cloud Storage (for example, `gs://bucket/inputs/file.mp4`). See [Supported input and output formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats).
947 #[serde(rename = "inputUri")]
948 pub input_uri: Option<String>,
949 /// The labels associated with this job. You can use these to organize and group your jobs.
950 pub labels: Option<HashMap<String, String>>,
951 /// The processing mode of the job. The default is `PROCESSING_MODE_INTERACTIVE`.
952 pub mode: Option<String>,
953 /// The resource name of the job. Format: `projects/{project_number}/locations/{location}/jobs/{job}`
954 pub name: Option<String>,
955 /// Optional. The optimization strategy of the job. The default is `AUTODETECT`.
956 pub optimization: Option<String>,
957 /// Input only. Specify the `output_uri` to populate an empty `Job.config.output.uri` or `JobTemplate.config.output.uri` when using template. URI for the output file(s). For example, `gs://my-bucket/outputs/`. See [Supported input and output formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats).
958 #[serde(rename = "outputUri")]
959 pub output_uri: Option<String>,
960 /// Output only. The time the transcoding started.
961 #[serde(rename = "startTime")]
962 pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
963 /// Output only. The current state of the job.
964 pub state: Option<String>,
965 /// Input only. Specify the `template_id` to use for populating `Job.config`. The default is `preset/web-hd`, which is the only supported preset. User defined JobTemplate: `{job_template_id}`
966 #[serde(rename = "templateId")]
967 pub template_id: Option<String>,
968 /// Job time to live value in days, which will be effective after job completion. Job should be deleted automatically after the given TTL. Enter a value between 1 and 90. The default is 30.
969 #[serde(rename = "ttlAfterCompletionDays")]
970 pub ttl_after_completion_days: Option<i32>,
971}
972
973impl common::RequestValue for Job {}
974impl common::ResponseResult for Job {}
975
976/// Job configuration
977///
978/// This type is not used in any activity, and only used as *part* of another schema.
979///
980#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
981#[serde_with::serde_as]
982#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
983pub struct JobConfig {
984 /// List of ad breaks. Specifies where to insert ad break tags in the output manifests.
985 #[serde(rename = "adBreaks")]
986 pub ad_breaks: Option<Vec<AdBreak>>,
987 /// List of edit atoms. Defines the ultimate timeline of the resulting file or manifest.
988 #[serde(rename = "editList")]
989 pub edit_list: Option<Vec<EditAtom>>,
990 /// List of elementary streams.
991 #[serde(rename = "elementaryStreams")]
992 pub elementary_streams: Option<Vec<ElementaryStream>>,
993 /// List of encryption configurations for the content. Each configuration has an ID. Specify this ID in the MuxStream.encryption_id field to indicate the configuration to use for that `MuxStream` output.
994 pub encryptions: Option<Vec<Encryption>>,
995 /// List of input assets stored in Cloud Storage.
996 pub inputs: Option<Vec<Input>>,
997 /// List of output manifests.
998 pub manifests: Option<Vec<Manifest>>,
999 /// List of multiplexing settings for output streams.
1000 #[serde(rename = "muxStreams")]
1001 pub mux_streams: Option<Vec<MuxStream>>,
1002 /// Output configuration.
1003 pub output: Option<Output>,
1004 /// List of overlays on the output video, in descending Z-order.
1005 pub overlays: Option<Vec<Overlay>>,
1006 /// Destination on Pub/Sub.
1007 #[serde(rename = "pubsubDestination")]
1008 pub pubsub_destination: Option<PubsubDestination>,
1009 /// List of output sprite sheets. Spritesheets require at least one VideoStream in the Jobconfig.
1010 #[serde(rename = "spriteSheets")]
1011 pub sprite_sheets: Option<Vec<SpriteSheet>>,
1012}
1013
1014impl common::Part for JobConfig {}
1015
1016/// Transcoding job template resource.
1017///
1018/// # Activities
1019///
1020/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1021/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1022///
1023/// * [locations job templates create projects](ProjectLocationJobTemplateCreateCall) (request|response)
1024/// * [locations job templates get projects](ProjectLocationJobTemplateGetCall) (response)
1025#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1026#[serde_with::serde_as]
1027#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1028pub struct JobTemplate {
1029 /// The configuration for this template.
1030 pub config: Option<JobConfig>,
1031 /// The labels associated with this job template. You can use these to organize and group your job templates.
1032 pub labels: Option<HashMap<String, String>>,
1033 /// The resource name of the job template. Format: `projects/{project_number}/locations/{location}/jobTemplates/{job_template}`
1034 pub name: Option<String>,
1035}
1036
1037impl common::RequestValue for JobTemplate {}
1038impl common::ResponseResult for JobTemplate {}
1039
1040/// Response message for `TranscoderService.ListJobTemplates`.
1041///
1042/// # Activities
1043///
1044/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1045/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1046///
1047/// * [locations job templates list projects](ProjectLocationJobTemplateListCall) (response)
1048#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1049#[serde_with::serde_as]
1050#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1051pub struct ListJobTemplatesResponse {
1052 /// List of job templates in the specified region.
1053 #[serde(rename = "jobTemplates")]
1054 pub job_templates: Option<Vec<JobTemplate>>,
1055 /// The pagination token.
1056 #[serde(rename = "nextPageToken")]
1057 pub next_page_token: Option<String>,
1058 /// List of regions that could not be reached.
1059 pub unreachable: Option<Vec<String>>,
1060}
1061
1062impl common::ResponseResult for ListJobTemplatesResponse {}
1063
1064/// Response message for `TranscoderService.ListJobs`.
1065///
1066/// # Activities
1067///
1068/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1069/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1070///
1071/// * [locations jobs list projects](ProjectLocationJobListCall) (response)
1072#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1073#[serde_with::serde_as]
1074#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1075pub struct ListJobsResponse {
1076 /// List of jobs in the specified region.
1077 pub jobs: Option<Vec<Job>>,
1078 /// The pagination token.
1079 #[serde(rename = "nextPageToken")]
1080 pub next_page_token: Option<String>,
1081 /// List of regions that could not be reached.
1082 pub unreachable: Option<Vec<String>>,
1083}
1084
1085impl common::ResponseResult for ListJobsResponse {}
1086
1087/// Manifest configuration.
1088///
1089/// This type is not used in any activity, and only used as *part* of another schema.
1090///
1091#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1092#[serde_with::serde_as]
1093#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1094pub struct Manifest {
1095 /// `DASH` manifest configuration.
1096 pub dash: Option<DashConfig>,
1097 /// The name of the generated file. The default is `manifest` with the extension suffix corresponding to the Manifest.type.
1098 #[serde(rename = "fileName")]
1099 pub file_name: Option<String>,
1100 /// Required. List of user supplied MuxStream.key values that should appear in this manifest. When Manifest.type is `HLS`, a media manifest with name MuxStream.key and `.m3u8` extension is generated for each element in this list.
1101 #[serde(rename = "muxStreams")]
1102 pub mux_streams: Option<Vec<String>>,
1103 /// Required. Type of the manifest.
1104 #[serde(rename = "type")]
1105 pub type_: Option<String>,
1106}
1107
1108impl common::Part for Manifest {}
1109
1110/// Configuration for MPEG Common Encryption (MPEG-CENC).
1111///
1112/// This type is not used in any activity, and only used as *part* of another schema.
1113///
1114#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1115#[serde_with::serde_as]
1116#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1117pub struct MpegCommonEncryption {
1118 /// Required. Specify the encryption scheme. Supported encryption schemes: - `cenc` - `cbcs`
1119 pub scheme: Option<String>,
1120}
1121
1122impl common::Part for MpegCommonEncryption {}
1123
1124/// Multiplexing settings for output stream.
1125///
1126/// This type is not used in any activity, and only used as *part* of another schema.
1127///
1128#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1129#[serde_with::serde_as]
1130#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1131pub struct MuxStream {
1132 /// The container format. The default is `mp4` Supported streaming formats: - `ts` - `fmp4`- the corresponding file extension is `.m4s` Supported standalone file formats: - `mp4` - `mp3` - `ogg` - `vtt` See also: [Supported input and output formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats)
1133 pub container: Option<String>,
1134 /// List of ElementaryStream.key values multiplexed in this stream.
1135 #[serde(rename = "elementaryStreams")]
1136 pub elementary_streams: Option<Vec<String>>,
1137 /// Identifier of the encryption configuration to use. If omitted, output will be unencrypted.
1138 #[serde(rename = "encryptionId")]
1139 pub encryption_id: Option<String>,
1140 /// The name of the generated file. The default is MuxStream.key with the extension suffix corresponding to the MuxStream.container. Individual segments also have an incremental 10-digit zero-padded suffix starting from 0 before the extension, such as `mux_stream0000000123.ts`.
1141 #[serde(rename = "fileName")]
1142 pub file_name: Option<String>,
1143 /// Optional. `fmp4` container configuration.
1144 pub fmp4: Option<Fmp4Config>,
1145 /// A unique key for this multiplexed stream.
1146 pub key: Option<String>,
1147 /// Segment settings for `ts`, `fmp4` and `vtt`.
1148 #[serde(rename = "segmentSettings")]
1149 pub segment_settings: Option<SegmentSettings>,
1150}
1151
1152impl common::Part for MuxStream {}
1153
1154/// 2D normalized coordinates. Default: `{0.0, 0.0}`
1155///
1156/// This type is not used in any activity, and only used as *part* of another schema.
1157///
1158#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1159#[serde_with::serde_as]
1160#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1161pub struct NormalizedCoordinate {
1162 /// Normalized x coordinate.
1163 pub x: Option<f64>,
1164 /// Normalized y coordinate.
1165 pub y: Option<f64>,
1166}
1167
1168impl common::Part for NormalizedCoordinate {}
1169
1170/// Location of output file(s) in a Cloud Storage bucket.
1171///
1172/// This type is not used in any activity, and only used as *part* of another schema.
1173///
1174#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1175#[serde_with::serde_as]
1176#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1177pub struct Output {
1178 /// URI for the output file(s). For example, `gs://my-bucket/outputs/`. Must be a directory and not a top-level bucket. If empty, the value is populated from Job.output_uri. See [Supported input and output formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats).
1179 pub uri: Option<String>,
1180}
1181
1182impl common::Part for Output {}
1183
1184/// Overlay configuration.
1185///
1186/// This type is not used in any activity, and only used as *part* of another schema.
1187///
1188#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1189#[serde_with::serde_as]
1190#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1191pub struct Overlay {
1192 /// List of animations. The list should be chronological, without any time overlap.
1193 pub animations: Option<Vec<Animation>>,
1194 /// Image overlay.
1195 pub image: Option<Image>,
1196}
1197
1198impl common::Part for Overlay {}
1199
1200/// Pad filter configuration for the input video. The padded input video is scaled after padding with black to match the output resolution.
1201///
1202/// This type is not used in any activity, and only used as *part* of another schema.
1203///
1204#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1205#[serde_with::serde_as]
1206#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1207pub struct Pad {
1208 /// The number of pixels to add to the bottom. The default is 0.
1209 #[serde(rename = "bottomPixels")]
1210 pub bottom_pixels: Option<i32>,
1211 /// The number of pixels to add to the left. The default is 0.
1212 #[serde(rename = "leftPixels")]
1213 pub left_pixels: Option<i32>,
1214 /// The number of pixels to add to the right. The default is 0.
1215 #[serde(rename = "rightPixels")]
1216 pub right_pixels: Option<i32>,
1217 /// The number of pixels to add to the top. The default is 0.
1218 #[serde(rename = "topPixels")]
1219 pub top_pixels: Option<i32>,
1220}
1221
1222impl common::Part for Pad {}
1223
1224/// Playready configuration.
1225///
1226/// This type is not used in any activity, and only used as *part* of another schema.
1227///
1228#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1229#[serde_with::serde_as]
1230#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1231pub struct Playready {
1232 _never_set: Option<bool>,
1233}
1234
1235impl common::Part for Playready {}
1236
1237/// Preprocessing configurations.
1238///
1239/// This type is not used in any activity, and only used as *part* of another schema.
1240///
1241#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1242#[serde_with::serde_as]
1243#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1244pub struct PreprocessingConfig {
1245 /// Audio preprocessing configuration.
1246 pub audio: Option<Audio>,
1247 /// Color preprocessing configuration.
1248 pub color: Option<Color>,
1249 /// Specify the video cropping configuration.
1250 pub crop: Option<Crop>,
1251 /// Deblock preprocessing configuration.
1252 pub deblock: Option<Deblock>,
1253 /// Specify the video deinterlace configuration.
1254 pub deinterlace: Option<Deinterlace>,
1255 /// Denoise preprocessing configuration.
1256 pub denoise: Option<Denoise>,
1257 /// Specify the video pad filter configuration.
1258 pub pad: Option<Pad>,
1259}
1260
1261impl common::Part for PreprocessingConfig {}
1262
1263/// A Pub/Sub destination.
1264///
1265/// This type is not used in any activity, and only used as *part* of another schema.
1266///
1267#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1268#[serde_with::serde_as]
1269#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1270pub struct PubsubDestination {
1271 /// The name of the Pub/Sub topic to publish job completion notification to. For example: `projects/{project}/topics/{topic}`.
1272 pub topic: Option<String>,
1273}
1274
1275impl common::Part for PubsubDestination {}
1276
1277/// Configuration for SAMPLE-AES encryption.
1278///
1279/// This type is not used in any activity, and only used as *part* of another schema.
1280///
1281#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1282#[serde_with::serde_as]
1283#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1284pub struct SampleAesEncryption {
1285 _never_set: Option<bool>,
1286}
1287
1288impl common::Part for SampleAesEncryption {}
1289
1290/// Configuration for secrets stored in Google Secret Manager.
1291///
1292/// This type is not used in any activity, and only used as *part* of another schema.
1293///
1294#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1295#[serde_with::serde_as]
1296#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1297pub struct SecretManagerSource {
1298 /// Required. The name of the Secret Version containing the encryption key in the following format: `projects/{project}/secrets/{secret_id}/versions/{version_number}` Note that only numbered versions are supported. Aliases like "latest" are not supported.
1299 #[serde(rename = "secretVersion")]
1300 pub secret_version: Option<String>,
1301}
1302
1303impl common::Part for SecretManagerSource {}
1304
1305/// Segment settings for `ts`, `fmp4` and `vtt`.
1306///
1307/// This type is not used in any activity, and only used as *part* of another schema.
1308///
1309#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1310#[serde_with::serde_as]
1311#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1312pub struct SegmentSettings {
1313 /// Required. Create an individual segment file. The default is `false`.
1314 #[serde(rename = "individualSegments")]
1315 pub individual_segments: Option<bool>,
1316 /// Duration of the segments in seconds. The default is `6.0s`. Note that `segmentDuration` must be greater than or equal to [`gopDuration`](#videostream), and `segmentDuration` must be divisible by [`gopDuration`](#videostream).
1317 #[serde(rename = "segmentDuration")]
1318 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1319 pub segment_duration: Option<chrono::Duration>,
1320}
1321
1322impl common::Part for SegmentSettings {}
1323
1324/// Sprite sheet configuration.
1325///
1326/// This type is not used in any activity, and only used as *part* of another schema.
1327///
1328#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1329#[serde_with::serde_as]
1330#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1331pub struct SpriteSheet {
1332 /// The maximum number of sprites per row in a sprite sheet. The default is 0, which indicates no maximum limit.
1333 #[serde(rename = "columnCount")]
1334 pub column_count: Option<i32>,
1335 /// End time in seconds, relative to the output file timeline. When `end_time_offset` is not specified, the sprites are generated until the end of the output file.
1336 #[serde(rename = "endTimeOffset")]
1337 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1338 pub end_time_offset: Option<chrono::Duration>,
1339 /// 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`.
1340 #[serde(rename = "filePrefix")]
1341 pub file_prefix: Option<String>,
1342 /// Format type. The default is `jpeg`. Supported formats: - `jpeg`
1343 pub format: Option<String>,
1344 /// Starting from `0s`, create sprites at regular intervals. Specify the interval value in seconds.
1345 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1346 pub interval: Option<chrono::Duration>,
1347 /// The quality of the generated sprite sheet. Enter a value between 1 and 100, where 1 is the lowest quality and 100 is the highest quality. The default is 100. A high quality value corresponds to a low image data compression ratio.
1348 pub quality: Option<i32>,
1349 /// The maximum number of rows per sprite sheet. When the sprite sheet is full, a new sprite sheet is created. The default is 0, which indicates no maximum limit.
1350 #[serde(rename = "rowCount")]
1351 pub row_count: Option<i32>,
1352 /// Required. The height of sprite in pixels. Must be an even integer. To preserve the source aspect ratio, set the SpriteSheet.sprite_height_pixels field or the SpriteSheet.sprite_width_pixels field, but not both (the API will automatically calculate the missing field). For portrait videos that contain horizontal ASR and rotation metadata, provide the height, in pixels, per the horizontal ASR. The API calculates the width per the horizontal ASR. The API detects any rotation metadata and swaps the requested height and width for the output.
1353 #[serde(rename = "spriteHeightPixels")]
1354 pub sprite_height_pixels: Option<i32>,
1355 /// Required. The width of sprite in pixels. Must be an even integer. To preserve the source aspect ratio, set the SpriteSheet.sprite_width_pixels field or the SpriteSheet.sprite_height_pixels field, but not both (the API will automatically calculate the missing field). For portrait videos that contain horizontal ASR and rotation metadata, provide the width, in pixels, per the horizontal ASR. The API calculates the height per the horizontal ASR. The API detects any rotation metadata and swaps the requested height and width for the output.
1356 #[serde(rename = "spriteWidthPixels")]
1357 pub sprite_width_pixels: Option<i32>,
1358 /// Start time in seconds, relative to the output file timeline. Determines the first sprite to pick. The default is `0s`.
1359 #[serde(rename = "startTimeOffset")]
1360 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1361 pub start_time_offset: Option<chrono::Duration>,
1362 /// Total number of sprites. Create the specified number of sprites distributed evenly across the timeline of the output media. The default is 100.
1363 #[serde(rename = "totalCount")]
1364 pub total_count: Option<i32>,
1365}
1366
1367impl common::Part for SpriteSheet {}
1368
1369/// The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
1370///
1371/// This type is not used in any activity, and only used as *part* of another schema.
1372///
1373#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1374#[serde_with::serde_as]
1375#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1376pub struct Status {
1377 /// The status code, which should be an enum value of google.rpc.Code.
1378 pub code: Option<i32>,
1379 /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
1380 pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
1381 /// A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
1382 pub message: Option<String>,
1383}
1384
1385impl common::Part for Status {}
1386
1387/// The mapping for the JobConfig.edit_list atoms with text EditAtom.inputs.
1388///
1389/// This type is not used in any activity, and only used as *part* of another schema.
1390///
1391#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1392#[serde_with::serde_as]
1393#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1394pub struct TextMapping {
1395 /// Required. The EditAtom.key that references atom with text inputs in the JobConfig.edit_list.
1396 #[serde(rename = "atomKey")]
1397 pub atom_key: Option<String>,
1398 /// Required. The Input.key that identifies the input file.
1399 #[serde(rename = "inputKey")]
1400 pub input_key: Option<String>,
1401 /// Required. The zero-based index of the track in the input file.
1402 #[serde(rename = "inputTrack")]
1403 pub input_track: Option<i32>,
1404}
1405
1406impl common::Part for TextMapping {}
1407
1408/// Encoding of a text stream. For example, closed captions or subtitles.
1409///
1410/// This type is not used in any activity, and only used as *part* of another schema.
1411///
1412#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1413#[serde_with::serde_as]
1414#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1415pub struct TextStream {
1416 /// The codec for this text stream. The default is `webvtt`. Supported text codecs: - `srt` - `ttml` - `cea608` - `cea708` - `webvtt`
1417 pub codec: Option<String>,
1418 /// The name for this particular text stream that will be added to the HLS/DASH manifest. Not supported in MP4 files.
1419 #[serde(rename = "displayName")]
1420 pub display_name: Option<String>,
1421 /// The BCP-47 language code, such as `en-US` or `sr-Latn`. For more information, see https://www.unicode.org/reports/tr35/#Unicode_locale_identifier. Not supported in MP4 files.
1422 #[serde(rename = "languageCode")]
1423 pub language_code: Option<String>,
1424 /// The mapping for the JobConfig.edit_list atoms with text EditAtom.inputs.
1425 pub mapping: Option<Vec<TextMapping>>,
1426}
1427
1428impl common::Part for TextStream {}
1429
1430/// Track definition for the input asset.
1431///
1432/// This type is not used in any activity, and only used as *part* of another schema.
1433///
1434#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1435#[serde_with::serde_as]
1436#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1437pub struct TrackDefinition {
1438 /// Optional. Whether to automatically detect the languages present in the track. If true, the system will attempt to identify all the languages present in the track and populate the languages field.
1439 #[serde(rename = "detectLanguages")]
1440 pub detect_languages: Option<bool>,
1441 /// Output only. A list of languages detected in the input asset, represented by a BCP 47 language code, such as "en-US" or "sr-Latn". For more information, see https://www.unicode.org/reports/tr35/#Unicode_locale_identifier. This field is only populated if the detect_languages field is set to true.
1442 #[serde(rename = "detectedLanguages")]
1443 pub detected_languages: Option<Vec<String>>,
1444 /// The input track.
1445 #[serde(rename = "inputTrack")]
1446 pub input_track: Option<i32>,
1447 /// Optional. A list of languages spoken in the input asset, represented by a BCP 47 language code, such as "en-US" or "sr-Latn". For more information, see https://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
1448 pub languages: Option<Vec<String>>,
1449}
1450
1451impl common::Part for TrackDefinition {}
1452
1453/// Video stream resource.
1454///
1455/// This type is not used in any activity, and only used as *part* of another schema.
1456///
1457#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1458#[serde_with::serde_as]
1459#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1460pub struct VideoStream {
1461 /// H264 codec settings.
1462 pub h264: Option<H264CodecSettings>,
1463 /// H265 codec settings.
1464 pub h265: Option<H265CodecSettings>,
1465 /// VP9 codec settings.
1466 pub vp9: Option<Vp9CodecSettings>,
1467}
1468
1469impl common::Part for VideoStream {}
1470
1471/// VP9 codec settings.
1472///
1473/// This type is not used in any activity, and only used as *part* of another schema.
1474///
1475#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1476#[serde_with::serde_as]
1477#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1478pub struct Vp9CodecSettings {
1479 /// Required. The video bitrate in bits per second. The minimum value is 1,000. The maximum value is 480,000,000.
1480 #[serde(rename = "bitrateBps")]
1481 pub bitrate_bps: Option<i32>,
1482 /// Target CRF level. Must be between 10 and 36, where 10 is the highest quality and 36 is the most efficient compression. The default is 21. **Note:** This field is not supported.
1483 #[serde(rename = "crfLevel")]
1484 pub crf_level: Option<i32>,
1485 /// Required. The target video frame rate in frames per second (FPS). Must be less than or equal to 120.
1486 #[serde(rename = "frameRate")]
1487 pub frame_rate: Option<f64>,
1488 /// Optional. Frame rate conversion strategy for desired frame rate. The default is `DOWNSAMPLE`.
1489 #[serde(rename = "frameRateConversionStrategy")]
1490 pub frame_rate_conversion_strategy: Option<String>,
1491 /// Select the GOP size based on the specified duration. The default is `3s`. Note that `gopDuration` must be less than or equal to [`segmentDuration`](#SegmentSettings), and [`segmentDuration`](#SegmentSettings) must be divisible by `gopDuration`.
1492 #[serde(rename = "gopDuration")]
1493 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1494 pub gop_duration: Option<chrono::Duration>,
1495 /// Select the GOP size based on the specified frame count. Must be greater than zero.
1496 #[serde(rename = "gopFrameCount")]
1497 pub gop_frame_count: Option<i32>,
1498 /// The height of the video in pixels. Must be an even integer. When not specified, the height is adjusted to match the specified width and input aspect ratio. If both are omitted, the input height is used. For portrait videos that contain horizontal ASR and rotation metadata, provide the height, in pixels, per the horizontal ASR. The API calculates the width per the horizontal ASR. The API detects any rotation metadata and swaps the requested height and width for the output.
1499 #[serde(rename = "heightPixels")]
1500 pub height_pixels: Option<i32>,
1501 /// Optional. HLG color format setting for VP9.
1502 pub hlg: Option<Vp9ColorFormatHLG>,
1503 /// 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
1504 #[serde(rename = "pixelFormat")]
1505 pub pixel_format: Option<String>,
1506 /// Enforces the specified codec profile. The following profiles are supported: * `profile0` (default) * `profile1` * `profile2` * `profile3` The available options are [WebM-compatible](https://www.webmproject.org/vp9/profiles/). Note that certain values for this field may cause the transcoder to override other fields you set in the `Vp9CodecSettings` message.
1507 pub profile: Option<String>,
1508 /// Specify the mode. The default is `vbr`. Supported rate control modes: - `vbr` - variable bitrate
1509 #[serde(rename = "rateControlMode")]
1510 pub rate_control_mode: Option<String>,
1511 /// Optional. SDR color format setting for VP9.
1512 pub sdr: Option<Vp9ColorFormatSDR>,
1513 /// The width of the video in pixels. Must be an even integer. When not specified, the width is adjusted to match the specified height and input aspect ratio. If both are omitted, the input width is used. For portrait videos that contain horizontal ASR and rotation metadata, provide the width, in pixels, per the horizontal ASR. The API calculates the height per the horizontal ASR. The API detects any rotation metadata and swaps the requested height and width for the output.
1514 #[serde(rename = "widthPixels")]
1515 pub width_pixels: Option<i32>,
1516}
1517
1518impl common::Part for Vp9CodecSettings {}
1519
1520/// Convert the input video to a Hybrid Log Gamma (HLG) video.
1521///
1522/// This type is not used in any activity, and only used as *part* of another schema.
1523///
1524#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1525#[serde_with::serde_as]
1526#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1527pub struct Vp9ColorFormatHLG {
1528 _never_set: Option<bool>,
1529}
1530
1531impl common::Part for Vp9ColorFormatHLG {}
1532
1533/// Convert the input video to a Standard Dynamic Range (SDR) video.
1534///
1535/// This type is not used in any activity, and only used as *part* of another schema.
1536///
1537#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1538#[serde_with::serde_as]
1539#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1540pub struct Vp9ColorFormatSDR {
1541 _never_set: Option<bool>,
1542}
1543
1544impl common::Part for Vp9ColorFormatSDR {}
1545
1546/// Widevine configuration.
1547///
1548/// This type is not used in any activity, and only used as *part* of another schema.
1549///
1550#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1551#[serde_with::serde_as]
1552#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1553pub struct Widevine {
1554 _never_set: Option<bool>,
1555}
1556
1557impl common::Part for Widevine {}
1558
1559/// Yet Another Deinterlacing Filter Configuration.
1560///
1561/// This type is not used in any activity, and only used as *part* of another schema.
1562///
1563#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1564#[serde_with::serde_as]
1565#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1566pub struct YadifConfig {
1567 /// Deinterlace all frames rather than just the frames identified as interlaced. The default is `false`.
1568 #[serde(rename = "deinterlaceAllFrames")]
1569 pub deinterlace_all_frames: Option<bool>,
1570 /// Disable spacial interlacing. The default is `false`.
1571 #[serde(rename = "disableSpatialInterlacing")]
1572 pub disable_spatial_interlacing: Option<bool>,
1573 /// Specifies the deinterlacing mode to adopt. The default is `send_frame`. Supported values: - `send_frame`: Output one frame for each frame - `send_field`: Output one frame for each field
1574 pub mode: Option<String>,
1575 /// The picture field parity assumed for the input interlaced video. The default is `auto`. Supported values: - `tff`: Assume the top field is first - `bff`: Assume the bottom field is first - `auto`: Enable automatic detection of field parity
1576 pub parity: Option<String>,
1577}
1578
1579impl common::Part for YadifConfig {}
1580
1581// ###################
1582// MethodBuilders ###
1583// #################
1584
1585/// A builder providing access to all methods supported on *project* resources.
1586/// It is not used directly, but through the [`Transcoder`] hub.
1587///
1588/// # Example
1589///
1590/// Instantiate a resource builder
1591///
1592/// ```test_harness,no_run
1593/// extern crate hyper;
1594/// extern crate hyper_rustls;
1595/// extern crate google_transcoder1 as transcoder1;
1596///
1597/// # async fn dox() {
1598/// use transcoder1::{Transcoder, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1599///
1600/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1601/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1602/// .with_native_roots()
1603/// .unwrap()
1604/// .https_only()
1605/// .enable_http2()
1606/// .build();
1607///
1608/// let executor = hyper_util::rt::TokioExecutor::new();
1609/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1610/// secret,
1611/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1612/// yup_oauth2::client::CustomHyperClientBuilder::from(
1613/// hyper_util::client::legacy::Client::builder(executor).build(connector),
1614/// ),
1615/// ).build().await.unwrap();
1616///
1617/// let client = hyper_util::client::legacy::Client::builder(
1618/// hyper_util::rt::TokioExecutor::new()
1619/// )
1620/// .build(
1621/// hyper_rustls::HttpsConnectorBuilder::new()
1622/// .with_native_roots()
1623/// .unwrap()
1624/// .https_or_http()
1625/// .enable_http2()
1626/// .build()
1627/// );
1628/// let mut hub = Transcoder::new(client, auth);
1629/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1630/// // like `locations_job_templates_create(...)`, `locations_job_templates_delete(...)`, `locations_job_templates_get(...)`, `locations_job_templates_list(...)`, `locations_jobs_create(...)`, `locations_jobs_delete(...)`, `locations_jobs_get(...)` and `locations_jobs_list(...)`
1631/// // to build up your call.
1632/// let rb = hub.projects();
1633/// # }
1634/// ```
1635pub struct ProjectMethods<'a, C>
1636where
1637 C: 'a,
1638{
1639 hub: &'a Transcoder<C>,
1640}
1641
1642impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
1643
1644impl<'a, C> ProjectMethods<'a, C> {
1645 /// Create a builder to help you perform the following task:
1646 ///
1647 /// Creates a job template in the specified region.
1648 ///
1649 /// # Arguments
1650 ///
1651 /// * `request` - No description provided.
1652 /// * `parent` - Required. The parent location to create this job template. Format: `projects/{project}/locations/{location}`
1653 pub fn locations_job_templates_create(
1654 &self,
1655 request: JobTemplate,
1656 parent: &str,
1657 ) -> ProjectLocationJobTemplateCreateCall<'a, C> {
1658 ProjectLocationJobTemplateCreateCall {
1659 hub: self.hub,
1660 _request: request,
1661 _parent: parent.to_string(),
1662 _job_template_id: Default::default(),
1663 _delegate: Default::default(),
1664 _additional_params: Default::default(),
1665 _scopes: Default::default(),
1666 }
1667 }
1668
1669 /// Create a builder to help you perform the following task:
1670 ///
1671 /// Deletes a job template.
1672 ///
1673 /// # Arguments
1674 ///
1675 /// * `name` - Required. The name of the job template to delete. `projects/{project}/locations/{location}/jobTemplates/{job_template}`
1676 pub fn locations_job_templates_delete(
1677 &self,
1678 name: &str,
1679 ) -> ProjectLocationJobTemplateDeleteCall<'a, C> {
1680 ProjectLocationJobTemplateDeleteCall {
1681 hub: self.hub,
1682 _name: name.to_string(),
1683 _allow_missing: Default::default(),
1684 _delegate: Default::default(),
1685 _additional_params: Default::default(),
1686 _scopes: Default::default(),
1687 }
1688 }
1689
1690 /// Create a builder to help you perform the following task:
1691 ///
1692 /// Returns the job template data.
1693 ///
1694 /// # Arguments
1695 ///
1696 /// * `name` - Required. The name of the job template to retrieve. Format: `projects/{project}/locations/{location}/jobTemplates/{job_template}`
1697 pub fn locations_job_templates_get(
1698 &self,
1699 name: &str,
1700 ) -> ProjectLocationJobTemplateGetCall<'a, C> {
1701 ProjectLocationJobTemplateGetCall {
1702 hub: self.hub,
1703 _name: name.to_string(),
1704 _delegate: Default::default(),
1705 _additional_params: Default::default(),
1706 _scopes: Default::default(),
1707 }
1708 }
1709
1710 /// Create a builder to help you perform the following task:
1711 ///
1712 /// Lists job templates in the specified region.
1713 ///
1714 /// # Arguments
1715 ///
1716 /// * `parent` - Required. The parent location from which to retrieve the collection of job templates. Format: `projects/{project}/locations/{location}`
1717 pub fn locations_job_templates_list(
1718 &self,
1719 parent: &str,
1720 ) -> ProjectLocationJobTemplateListCall<'a, C> {
1721 ProjectLocationJobTemplateListCall {
1722 hub: self.hub,
1723 _parent: parent.to_string(),
1724 _page_token: Default::default(),
1725 _page_size: Default::default(),
1726 _order_by: Default::default(),
1727 _filter: Default::default(),
1728 _delegate: Default::default(),
1729 _additional_params: Default::default(),
1730 _scopes: Default::default(),
1731 }
1732 }
1733
1734 /// Create a builder to help you perform the following task:
1735 ///
1736 /// Creates a job in the specified region.
1737 ///
1738 /// # Arguments
1739 ///
1740 /// * `request` - No description provided.
1741 /// * `parent` - Required. The parent location to create and process this job. Format: `projects/{project}/locations/{location}`
1742 pub fn locations_jobs_create(
1743 &self,
1744 request: Job,
1745 parent: &str,
1746 ) -> ProjectLocationJobCreateCall<'a, C> {
1747 ProjectLocationJobCreateCall {
1748 hub: self.hub,
1749 _request: request,
1750 _parent: parent.to_string(),
1751 _delegate: Default::default(),
1752 _additional_params: Default::default(),
1753 _scopes: Default::default(),
1754 }
1755 }
1756
1757 /// Create a builder to help you perform the following task:
1758 ///
1759 /// Deletes a job.
1760 ///
1761 /// # Arguments
1762 ///
1763 /// * `name` - Required. The name of the job to delete. Format: `projects/{project}/locations/{location}/jobs/{job}`
1764 pub fn locations_jobs_delete(&self, name: &str) -> ProjectLocationJobDeleteCall<'a, C> {
1765 ProjectLocationJobDeleteCall {
1766 hub: self.hub,
1767 _name: name.to_string(),
1768 _allow_missing: Default::default(),
1769 _delegate: Default::default(),
1770 _additional_params: Default::default(),
1771 _scopes: Default::default(),
1772 }
1773 }
1774
1775 /// Create a builder to help you perform the following task:
1776 ///
1777 /// Returns the job data.
1778 ///
1779 /// # Arguments
1780 ///
1781 /// * `name` - Required. The name of the job to retrieve. Format: `projects/{project}/locations/{location}/jobs/{job}`
1782 pub fn locations_jobs_get(&self, name: &str) -> ProjectLocationJobGetCall<'a, C> {
1783 ProjectLocationJobGetCall {
1784 hub: self.hub,
1785 _name: name.to_string(),
1786 _delegate: Default::default(),
1787 _additional_params: Default::default(),
1788 _scopes: Default::default(),
1789 }
1790 }
1791
1792 /// Create a builder to help you perform the following task:
1793 ///
1794 /// Lists jobs in the specified region.
1795 ///
1796 /// # Arguments
1797 ///
1798 /// * `parent` - Required. Format: `projects/{project}/locations/{location}`
1799 pub fn locations_jobs_list(&self, parent: &str) -> ProjectLocationJobListCall<'a, C> {
1800 ProjectLocationJobListCall {
1801 hub: self.hub,
1802 _parent: parent.to_string(),
1803 _page_token: Default::default(),
1804 _page_size: Default::default(),
1805 _order_by: Default::default(),
1806 _filter: Default::default(),
1807 _delegate: Default::default(),
1808 _additional_params: Default::default(),
1809 _scopes: Default::default(),
1810 }
1811 }
1812}
1813
1814// ###################
1815// CallBuilders ###
1816// #################
1817
1818/// Creates a job template in the specified region.
1819///
1820/// A builder for the *locations.jobTemplates.create* method supported by a *project* resource.
1821/// It is not used directly, but through a [`ProjectMethods`] instance.
1822///
1823/// # Example
1824///
1825/// Instantiate a resource method builder
1826///
1827/// ```test_harness,no_run
1828/// # extern crate hyper;
1829/// # extern crate hyper_rustls;
1830/// # extern crate google_transcoder1 as transcoder1;
1831/// use transcoder1::api::JobTemplate;
1832/// # async fn dox() {
1833/// # use transcoder1::{Transcoder, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1834///
1835/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
1836/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
1837/// # .with_native_roots()
1838/// # .unwrap()
1839/// # .https_only()
1840/// # .enable_http2()
1841/// # .build();
1842///
1843/// # let executor = hyper_util::rt::TokioExecutor::new();
1844/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1845/// # secret,
1846/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1847/// # yup_oauth2::client::CustomHyperClientBuilder::from(
1848/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
1849/// # ),
1850/// # ).build().await.unwrap();
1851///
1852/// # let client = hyper_util::client::legacy::Client::builder(
1853/// # hyper_util::rt::TokioExecutor::new()
1854/// # )
1855/// # .build(
1856/// # hyper_rustls::HttpsConnectorBuilder::new()
1857/// # .with_native_roots()
1858/// # .unwrap()
1859/// # .https_or_http()
1860/// # .enable_http2()
1861/// # .build()
1862/// # );
1863/// # let mut hub = Transcoder::new(client, auth);
1864/// // As the method needs a request, you would usually fill it with the desired information
1865/// // into the respective structure. Some of the parts shown here might not be applicable !
1866/// // Values shown here are possibly random and not representative !
1867/// let mut req = JobTemplate::default();
1868///
1869/// // You can configure optional parameters by calling the respective setters at will, and
1870/// // execute the final call using `doit()`.
1871/// // Values shown here are possibly random and not representative !
1872/// let result = hub.projects().locations_job_templates_create(req, "parent")
1873/// .job_template_id("voluptua.")
1874/// .doit().await;
1875/// # }
1876/// ```
1877pub struct ProjectLocationJobTemplateCreateCall<'a, C>
1878where
1879 C: 'a,
1880{
1881 hub: &'a Transcoder<C>,
1882 _request: JobTemplate,
1883 _parent: String,
1884 _job_template_id: Option<String>,
1885 _delegate: Option<&'a mut dyn common::Delegate>,
1886 _additional_params: HashMap<String, String>,
1887 _scopes: BTreeSet<String>,
1888}
1889
1890impl<'a, C> common::CallBuilder for ProjectLocationJobTemplateCreateCall<'a, C> {}
1891
1892impl<'a, C> ProjectLocationJobTemplateCreateCall<'a, C>
1893where
1894 C: common::Connector,
1895{
1896 /// Perform the operation you have build so far.
1897 pub async fn doit(mut self) -> common::Result<(common::Response, JobTemplate)> {
1898 use std::borrow::Cow;
1899 use std::io::{Read, Seek};
1900
1901 use common::{url::Params, ToParts};
1902 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
1903
1904 let mut dd = common::DefaultDelegate;
1905 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
1906 dlg.begin(common::MethodInfo {
1907 id: "transcoder.projects.locations.jobTemplates.create",
1908 http_method: hyper::Method::POST,
1909 });
1910
1911 for &field in ["alt", "parent", "jobTemplateId"].iter() {
1912 if self._additional_params.contains_key(field) {
1913 dlg.finished(false);
1914 return Err(common::Error::FieldClash(field));
1915 }
1916 }
1917
1918 let mut params = Params::with_capacity(5 + self._additional_params.len());
1919 params.push("parent", self._parent);
1920 if let Some(value) = self._job_template_id.as_ref() {
1921 params.push("jobTemplateId", value);
1922 }
1923
1924 params.extend(self._additional_params.iter());
1925
1926 params.push("alt", "json");
1927 let mut url = self.hub._base_url.clone() + "v1/{+parent}/jobTemplates";
1928 if self._scopes.is_empty() {
1929 self._scopes
1930 .insert(Scope::CloudPlatform.as_ref().to_string());
1931 }
1932
1933 #[allow(clippy::single_element_loop)]
1934 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
1935 url = params.uri_replacement(url, param_name, find_this, true);
1936 }
1937 {
1938 let to_remove = ["parent"];
1939 params.remove_params(&to_remove);
1940 }
1941
1942 let url = params.parse_with_url(&url);
1943
1944 let mut json_mime_type = mime::APPLICATION_JSON;
1945 let mut request_value_reader = {
1946 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
1947 common::remove_json_null_values(&mut value);
1948 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
1949 serde_json::to_writer(&mut dst, &value).unwrap();
1950 dst
1951 };
1952 let request_size = request_value_reader
1953 .seek(std::io::SeekFrom::End(0))
1954 .unwrap();
1955 request_value_reader
1956 .seek(std::io::SeekFrom::Start(0))
1957 .unwrap();
1958
1959 loop {
1960 let token = match self
1961 .hub
1962 .auth
1963 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
1964 .await
1965 {
1966 Ok(token) => token,
1967 Err(e) => match dlg.token(e) {
1968 Ok(token) => token,
1969 Err(e) => {
1970 dlg.finished(false);
1971 return Err(common::Error::MissingToken(e));
1972 }
1973 },
1974 };
1975 request_value_reader
1976 .seek(std::io::SeekFrom::Start(0))
1977 .unwrap();
1978 let mut req_result = {
1979 let client = &self.hub.client;
1980 dlg.pre_request();
1981 let mut req_builder = hyper::Request::builder()
1982 .method(hyper::Method::POST)
1983 .uri(url.as_str())
1984 .header(USER_AGENT, self.hub._user_agent.clone());
1985
1986 if let Some(token) = token.as_ref() {
1987 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
1988 }
1989
1990 let request = req_builder
1991 .header(CONTENT_TYPE, json_mime_type.to_string())
1992 .header(CONTENT_LENGTH, request_size as u64)
1993 .body(common::to_body(
1994 request_value_reader.get_ref().clone().into(),
1995 ));
1996
1997 client.request(request.unwrap()).await
1998 };
1999
2000 match req_result {
2001 Err(err) => {
2002 if let common::Retry::After(d) = dlg.http_error(&err) {
2003 sleep(d).await;
2004 continue;
2005 }
2006 dlg.finished(false);
2007 return Err(common::Error::HttpError(err));
2008 }
2009 Ok(res) => {
2010 let (mut parts, body) = res.into_parts();
2011 let mut body = common::Body::new(body);
2012 if !parts.status.is_success() {
2013 let bytes = common::to_bytes(body).await.unwrap_or_default();
2014 let error = serde_json::from_str(&common::to_string(&bytes));
2015 let response = common::to_response(parts, bytes.into());
2016
2017 if let common::Retry::After(d) =
2018 dlg.http_failure(&response, error.as_ref().ok())
2019 {
2020 sleep(d).await;
2021 continue;
2022 }
2023
2024 dlg.finished(false);
2025
2026 return Err(match error {
2027 Ok(value) => common::Error::BadRequest(value),
2028 _ => common::Error::Failure(response),
2029 });
2030 }
2031 let response = {
2032 let bytes = common::to_bytes(body).await.unwrap_or_default();
2033 let encoded = common::to_string(&bytes);
2034 match serde_json::from_str(&encoded) {
2035 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2036 Err(error) => {
2037 dlg.response_json_decode_error(&encoded, &error);
2038 return Err(common::Error::JsonDecodeError(
2039 encoded.to_string(),
2040 error,
2041 ));
2042 }
2043 }
2044 };
2045
2046 dlg.finished(true);
2047 return Ok(response);
2048 }
2049 }
2050 }
2051 }
2052
2053 ///
2054 /// Sets the *request* property to the given value.
2055 ///
2056 /// Even though the property as already been set when instantiating this call,
2057 /// we provide this method for API completeness.
2058 pub fn request(
2059 mut self,
2060 new_value: JobTemplate,
2061 ) -> ProjectLocationJobTemplateCreateCall<'a, C> {
2062 self._request = new_value;
2063 self
2064 }
2065 /// Required. The parent location to create this job template. Format: `projects/{project}/locations/{location}`
2066 ///
2067 /// Sets the *parent* path property to the given value.
2068 ///
2069 /// Even though the property as already been set when instantiating this call,
2070 /// we provide this method for API completeness.
2071 pub fn parent(mut self, new_value: &str) -> ProjectLocationJobTemplateCreateCall<'a, C> {
2072 self._parent = new_value.to_string();
2073 self
2074 }
2075 /// Required. The ID to use for the job template, which will become the final component of the job template's resource name. This value should be 4-63 characters, and valid characters must match the regular expression `a-zA-Z*`.
2076 ///
2077 /// Sets the *job template id* query property to the given value.
2078 pub fn job_template_id(
2079 mut self,
2080 new_value: &str,
2081 ) -> ProjectLocationJobTemplateCreateCall<'a, C> {
2082 self._job_template_id = Some(new_value.to_string());
2083 self
2084 }
2085 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2086 /// while executing the actual API request.
2087 ///
2088 /// ````text
2089 /// It should be used to handle progress information, and to implement a certain level of resilience.
2090 /// ````
2091 ///
2092 /// Sets the *delegate* property to the given value.
2093 pub fn delegate(
2094 mut self,
2095 new_value: &'a mut dyn common::Delegate,
2096 ) -> ProjectLocationJobTemplateCreateCall<'a, C> {
2097 self._delegate = Some(new_value);
2098 self
2099 }
2100
2101 /// Set any additional parameter of the query string used in the request.
2102 /// It should be used to set parameters which are not yet available through their own
2103 /// setters.
2104 ///
2105 /// Please note that this method must not be used to set any of the known parameters
2106 /// which have their own setter method. If done anyway, the request will fail.
2107 ///
2108 /// # Additional Parameters
2109 ///
2110 /// * *$.xgafv* (query-string) - V1 error format.
2111 /// * *access_token* (query-string) - OAuth access token.
2112 /// * *alt* (query-string) - Data format for response.
2113 /// * *callback* (query-string) - JSONP
2114 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2115 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2116 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2117 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2118 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2119 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2120 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2121 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobTemplateCreateCall<'a, C>
2122 where
2123 T: AsRef<str>,
2124 {
2125 self._additional_params
2126 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2127 self
2128 }
2129
2130 /// Identifies the authorization scope for the method you are building.
2131 ///
2132 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2133 /// [`Scope::CloudPlatform`].
2134 ///
2135 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2136 /// tokens for more than one scope.
2137 ///
2138 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2139 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2140 /// sufficient, a read-write scope will do as well.
2141 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobTemplateCreateCall<'a, C>
2142 where
2143 St: AsRef<str>,
2144 {
2145 self._scopes.insert(String::from(scope.as_ref()));
2146 self
2147 }
2148 /// Identifies the authorization scope(s) for the method you are building.
2149 ///
2150 /// See [`Self::add_scope()`] for details.
2151 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobTemplateCreateCall<'a, C>
2152 where
2153 I: IntoIterator<Item = St>,
2154 St: AsRef<str>,
2155 {
2156 self._scopes
2157 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2158 self
2159 }
2160
2161 /// Removes all scopes, and no default scope will be used either.
2162 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2163 /// for details).
2164 pub fn clear_scopes(mut self) -> ProjectLocationJobTemplateCreateCall<'a, C> {
2165 self._scopes.clear();
2166 self
2167 }
2168}
2169
2170/// Deletes a job template.
2171///
2172/// A builder for the *locations.jobTemplates.delete* method supported by a *project* resource.
2173/// It is not used directly, but through a [`ProjectMethods`] instance.
2174///
2175/// # Example
2176///
2177/// Instantiate a resource method builder
2178///
2179/// ```test_harness,no_run
2180/// # extern crate hyper;
2181/// # extern crate hyper_rustls;
2182/// # extern crate google_transcoder1 as transcoder1;
2183/// # async fn dox() {
2184/// # use transcoder1::{Transcoder, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2185///
2186/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2187/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2188/// # .with_native_roots()
2189/// # .unwrap()
2190/// # .https_only()
2191/// # .enable_http2()
2192/// # .build();
2193///
2194/// # let executor = hyper_util::rt::TokioExecutor::new();
2195/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2196/// # secret,
2197/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2198/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2199/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2200/// # ),
2201/// # ).build().await.unwrap();
2202///
2203/// # let client = hyper_util::client::legacy::Client::builder(
2204/// # hyper_util::rt::TokioExecutor::new()
2205/// # )
2206/// # .build(
2207/// # hyper_rustls::HttpsConnectorBuilder::new()
2208/// # .with_native_roots()
2209/// # .unwrap()
2210/// # .https_or_http()
2211/// # .enable_http2()
2212/// # .build()
2213/// # );
2214/// # let mut hub = Transcoder::new(client, auth);
2215/// // You can configure optional parameters by calling the respective setters at will, and
2216/// // execute the final call using `doit()`.
2217/// // Values shown here are possibly random and not representative !
2218/// let result = hub.projects().locations_job_templates_delete("name")
2219/// .allow_missing(false)
2220/// .doit().await;
2221/// # }
2222/// ```
2223pub struct ProjectLocationJobTemplateDeleteCall<'a, C>
2224where
2225 C: 'a,
2226{
2227 hub: &'a Transcoder<C>,
2228 _name: String,
2229 _allow_missing: Option<bool>,
2230 _delegate: Option<&'a mut dyn common::Delegate>,
2231 _additional_params: HashMap<String, String>,
2232 _scopes: BTreeSet<String>,
2233}
2234
2235impl<'a, C> common::CallBuilder for ProjectLocationJobTemplateDeleteCall<'a, C> {}
2236
2237impl<'a, C> ProjectLocationJobTemplateDeleteCall<'a, C>
2238where
2239 C: common::Connector,
2240{
2241 /// Perform the operation you have build so far.
2242 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
2243 use std::borrow::Cow;
2244 use std::io::{Read, Seek};
2245
2246 use common::{url::Params, ToParts};
2247 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2248
2249 let mut dd = common::DefaultDelegate;
2250 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2251 dlg.begin(common::MethodInfo {
2252 id: "transcoder.projects.locations.jobTemplates.delete",
2253 http_method: hyper::Method::DELETE,
2254 });
2255
2256 for &field in ["alt", "name", "allowMissing"].iter() {
2257 if self._additional_params.contains_key(field) {
2258 dlg.finished(false);
2259 return Err(common::Error::FieldClash(field));
2260 }
2261 }
2262
2263 let mut params = Params::with_capacity(4 + self._additional_params.len());
2264 params.push("name", self._name);
2265 if let Some(value) = self._allow_missing.as_ref() {
2266 params.push("allowMissing", value.to_string());
2267 }
2268
2269 params.extend(self._additional_params.iter());
2270
2271 params.push("alt", "json");
2272 let mut url = self.hub._base_url.clone() + "v1/{+name}";
2273 if self._scopes.is_empty() {
2274 self._scopes
2275 .insert(Scope::CloudPlatform.as_ref().to_string());
2276 }
2277
2278 #[allow(clippy::single_element_loop)]
2279 for &(find_this, param_name) in [("{+name}", "name")].iter() {
2280 url = params.uri_replacement(url, param_name, find_this, true);
2281 }
2282 {
2283 let to_remove = ["name"];
2284 params.remove_params(&to_remove);
2285 }
2286
2287 let url = params.parse_with_url(&url);
2288
2289 loop {
2290 let token = match self
2291 .hub
2292 .auth
2293 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2294 .await
2295 {
2296 Ok(token) => token,
2297 Err(e) => match dlg.token(e) {
2298 Ok(token) => token,
2299 Err(e) => {
2300 dlg.finished(false);
2301 return Err(common::Error::MissingToken(e));
2302 }
2303 },
2304 };
2305 let mut req_result = {
2306 let client = &self.hub.client;
2307 dlg.pre_request();
2308 let mut req_builder = hyper::Request::builder()
2309 .method(hyper::Method::DELETE)
2310 .uri(url.as_str())
2311 .header(USER_AGENT, self.hub._user_agent.clone());
2312
2313 if let Some(token) = token.as_ref() {
2314 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2315 }
2316
2317 let request = req_builder
2318 .header(CONTENT_LENGTH, 0_u64)
2319 .body(common::to_body::<String>(None));
2320
2321 client.request(request.unwrap()).await
2322 };
2323
2324 match req_result {
2325 Err(err) => {
2326 if let common::Retry::After(d) = dlg.http_error(&err) {
2327 sleep(d).await;
2328 continue;
2329 }
2330 dlg.finished(false);
2331 return Err(common::Error::HttpError(err));
2332 }
2333 Ok(res) => {
2334 let (mut parts, body) = res.into_parts();
2335 let mut body = common::Body::new(body);
2336 if !parts.status.is_success() {
2337 let bytes = common::to_bytes(body).await.unwrap_or_default();
2338 let error = serde_json::from_str(&common::to_string(&bytes));
2339 let response = common::to_response(parts, bytes.into());
2340
2341 if let common::Retry::After(d) =
2342 dlg.http_failure(&response, error.as_ref().ok())
2343 {
2344 sleep(d).await;
2345 continue;
2346 }
2347
2348 dlg.finished(false);
2349
2350 return Err(match error {
2351 Ok(value) => common::Error::BadRequest(value),
2352 _ => common::Error::Failure(response),
2353 });
2354 }
2355 let response = {
2356 let bytes = common::to_bytes(body).await.unwrap_or_default();
2357 let encoded = common::to_string(&bytes);
2358 match serde_json::from_str(&encoded) {
2359 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2360 Err(error) => {
2361 dlg.response_json_decode_error(&encoded, &error);
2362 return Err(common::Error::JsonDecodeError(
2363 encoded.to_string(),
2364 error,
2365 ));
2366 }
2367 }
2368 };
2369
2370 dlg.finished(true);
2371 return Ok(response);
2372 }
2373 }
2374 }
2375 }
2376
2377 /// Required. The name of the job template to delete. `projects/{project}/locations/{location}/jobTemplates/{job_template}`
2378 ///
2379 /// Sets the *name* path property to the given value.
2380 ///
2381 /// Even though the property as already been set when instantiating this call,
2382 /// we provide this method for API completeness.
2383 pub fn name(mut self, new_value: &str) -> ProjectLocationJobTemplateDeleteCall<'a, C> {
2384 self._name = new_value.to_string();
2385 self
2386 }
2387 /// If set to true, and the job template is not found, the request will succeed but no action will be taken on the server.
2388 ///
2389 /// Sets the *allow missing* query property to the given value.
2390 pub fn allow_missing(mut self, new_value: bool) -> ProjectLocationJobTemplateDeleteCall<'a, C> {
2391 self._allow_missing = Some(new_value);
2392 self
2393 }
2394 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2395 /// while executing the actual API request.
2396 ///
2397 /// ````text
2398 /// It should be used to handle progress information, and to implement a certain level of resilience.
2399 /// ````
2400 ///
2401 /// Sets the *delegate* property to the given value.
2402 pub fn delegate(
2403 mut self,
2404 new_value: &'a mut dyn common::Delegate,
2405 ) -> ProjectLocationJobTemplateDeleteCall<'a, C> {
2406 self._delegate = Some(new_value);
2407 self
2408 }
2409
2410 /// Set any additional parameter of the query string used in the request.
2411 /// It should be used to set parameters which are not yet available through their own
2412 /// setters.
2413 ///
2414 /// Please note that this method must not be used to set any of the known parameters
2415 /// which have their own setter method. If done anyway, the request will fail.
2416 ///
2417 /// # Additional Parameters
2418 ///
2419 /// * *$.xgafv* (query-string) - V1 error format.
2420 /// * *access_token* (query-string) - OAuth access token.
2421 /// * *alt* (query-string) - Data format for response.
2422 /// * *callback* (query-string) - JSONP
2423 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2424 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2425 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2426 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2427 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2428 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2429 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2430 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobTemplateDeleteCall<'a, C>
2431 where
2432 T: AsRef<str>,
2433 {
2434 self._additional_params
2435 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2436 self
2437 }
2438
2439 /// Identifies the authorization scope for the method you are building.
2440 ///
2441 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2442 /// [`Scope::CloudPlatform`].
2443 ///
2444 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2445 /// tokens for more than one scope.
2446 ///
2447 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2448 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2449 /// sufficient, a read-write scope will do as well.
2450 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobTemplateDeleteCall<'a, C>
2451 where
2452 St: AsRef<str>,
2453 {
2454 self._scopes.insert(String::from(scope.as_ref()));
2455 self
2456 }
2457 /// Identifies the authorization scope(s) for the method you are building.
2458 ///
2459 /// See [`Self::add_scope()`] for details.
2460 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobTemplateDeleteCall<'a, C>
2461 where
2462 I: IntoIterator<Item = St>,
2463 St: AsRef<str>,
2464 {
2465 self._scopes
2466 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2467 self
2468 }
2469
2470 /// Removes all scopes, and no default scope will be used either.
2471 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2472 /// for details).
2473 pub fn clear_scopes(mut self) -> ProjectLocationJobTemplateDeleteCall<'a, C> {
2474 self._scopes.clear();
2475 self
2476 }
2477}
2478
2479/// Returns the job template data.
2480///
2481/// A builder for the *locations.jobTemplates.get* method supported by a *project* resource.
2482/// It is not used directly, but through a [`ProjectMethods`] instance.
2483///
2484/// # Example
2485///
2486/// Instantiate a resource method builder
2487///
2488/// ```test_harness,no_run
2489/// # extern crate hyper;
2490/// # extern crate hyper_rustls;
2491/// # extern crate google_transcoder1 as transcoder1;
2492/// # async fn dox() {
2493/// # use transcoder1::{Transcoder, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2494///
2495/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2496/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2497/// # .with_native_roots()
2498/// # .unwrap()
2499/// # .https_only()
2500/// # .enable_http2()
2501/// # .build();
2502///
2503/// # let executor = hyper_util::rt::TokioExecutor::new();
2504/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2505/// # secret,
2506/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2507/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2508/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2509/// # ),
2510/// # ).build().await.unwrap();
2511///
2512/// # let client = hyper_util::client::legacy::Client::builder(
2513/// # hyper_util::rt::TokioExecutor::new()
2514/// # )
2515/// # .build(
2516/// # hyper_rustls::HttpsConnectorBuilder::new()
2517/// # .with_native_roots()
2518/// # .unwrap()
2519/// # .https_or_http()
2520/// # .enable_http2()
2521/// # .build()
2522/// # );
2523/// # let mut hub = Transcoder::new(client, auth);
2524/// // You can configure optional parameters by calling the respective setters at will, and
2525/// // execute the final call using `doit()`.
2526/// // Values shown here are possibly random and not representative !
2527/// let result = hub.projects().locations_job_templates_get("name")
2528/// .doit().await;
2529/// # }
2530/// ```
2531pub struct ProjectLocationJobTemplateGetCall<'a, C>
2532where
2533 C: 'a,
2534{
2535 hub: &'a Transcoder<C>,
2536 _name: String,
2537 _delegate: Option<&'a mut dyn common::Delegate>,
2538 _additional_params: HashMap<String, String>,
2539 _scopes: BTreeSet<String>,
2540}
2541
2542impl<'a, C> common::CallBuilder for ProjectLocationJobTemplateGetCall<'a, C> {}
2543
2544impl<'a, C> ProjectLocationJobTemplateGetCall<'a, C>
2545where
2546 C: common::Connector,
2547{
2548 /// Perform the operation you have build so far.
2549 pub async fn doit(mut self) -> common::Result<(common::Response, JobTemplate)> {
2550 use std::borrow::Cow;
2551 use std::io::{Read, Seek};
2552
2553 use common::{url::Params, ToParts};
2554 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2555
2556 let mut dd = common::DefaultDelegate;
2557 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2558 dlg.begin(common::MethodInfo {
2559 id: "transcoder.projects.locations.jobTemplates.get",
2560 http_method: hyper::Method::GET,
2561 });
2562
2563 for &field in ["alt", "name"].iter() {
2564 if self._additional_params.contains_key(field) {
2565 dlg.finished(false);
2566 return Err(common::Error::FieldClash(field));
2567 }
2568 }
2569
2570 let mut params = Params::with_capacity(3 + self._additional_params.len());
2571 params.push("name", self._name);
2572
2573 params.extend(self._additional_params.iter());
2574
2575 params.push("alt", "json");
2576 let mut url = self.hub._base_url.clone() + "v1/{+name}";
2577 if self._scopes.is_empty() {
2578 self._scopes
2579 .insert(Scope::CloudPlatform.as_ref().to_string());
2580 }
2581
2582 #[allow(clippy::single_element_loop)]
2583 for &(find_this, param_name) in [("{+name}", "name")].iter() {
2584 url = params.uri_replacement(url, param_name, find_this, true);
2585 }
2586 {
2587 let to_remove = ["name"];
2588 params.remove_params(&to_remove);
2589 }
2590
2591 let url = params.parse_with_url(&url);
2592
2593 loop {
2594 let token = match self
2595 .hub
2596 .auth
2597 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2598 .await
2599 {
2600 Ok(token) => token,
2601 Err(e) => match dlg.token(e) {
2602 Ok(token) => token,
2603 Err(e) => {
2604 dlg.finished(false);
2605 return Err(common::Error::MissingToken(e));
2606 }
2607 },
2608 };
2609 let mut req_result = {
2610 let client = &self.hub.client;
2611 dlg.pre_request();
2612 let mut req_builder = hyper::Request::builder()
2613 .method(hyper::Method::GET)
2614 .uri(url.as_str())
2615 .header(USER_AGENT, self.hub._user_agent.clone());
2616
2617 if let Some(token) = token.as_ref() {
2618 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2619 }
2620
2621 let request = req_builder
2622 .header(CONTENT_LENGTH, 0_u64)
2623 .body(common::to_body::<String>(None));
2624
2625 client.request(request.unwrap()).await
2626 };
2627
2628 match req_result {
2629 Err(err) => {
2630 if let common::Retry::After(d) = dlg.http_error(&err) {
2631 sleep(d).await;
2632 continue;
2633 }
2634 dlg.finished(false);
2635 return Err(common::Error::HttpError(err));
2636 }
2637 Ok(res) => {
2638 let (mut parts, body) = res.into_parts();
2639 let mut body = common::Body::new(body);
2640 if !parts.status.is_success() {
2641 let bytes = common::to_bytes(body).await.unwrap_or_default();
2642 let error = serde_json::from_str(&common::to_string(&bytes));
2643 let response = common::to_response(parts, bytes.into());
2644
2645 if let common::Retry::After(d) =
2646 dlg.http_failure(&response, error.as_ref().ok())
2647 {
2648 sleep(d).await;
2649 continue;
2650 }
2651
2652 dlg.finished(false);
2653
2654 return Err(match error {
2655 Ok(value) => common::Error::BadRequest(value),
2656 _ => common::Error::Failure(response),
2657 });
2658 }
2659 let response = {
2660 let bytes = common::to_bytes(body).await.unwrap_or_default();
2661 let encoded = common::to_string(&bytes);
2662 match serde_json::from_str(&encoded) {
2663 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2664 Err(error) => {
2665 dlg.response_json_decode_error(&encoded, &error);
2666 return Err(common::Error::JsonDecodeError(
2667 encoded.to_string(),
2668 error,
2669 ));
2670 }
2671 }
2672 };
2673
2674 dlg.finished(true);
2675 return Ok(response);
2676 }
2677 }
2678 }
2679 }
2680
2681 /// Required. The name of the job template to retrieve. Format: `projects/{project}/locations/{location}/jobTemplates/{job_template}`
2682 ///
2683 /// Sets the *name* path property to the given value.
2684 ///
2685 /// Even though the property as already been set when instantiating this call,
2686 /// we provide this method for API completeness.
2687 pub fn name(mut self, new_value: &str) -> ProjectLocationJobTemplateGetCall<'a, C> {
2688 self._name = new_value.to_string();
2689 self
2690 }
2691 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2692 /// while executing the actual API request.
2693 ///
2694 /// ````text
2695 /// It should be used to handle progress information, and to implement a certain level of resilience.
2696 /// ````
2697 ///
2698 /// Sets the *delegate* property to the given value.
2699 pub fn delegate(
2700 mut self,
2701 new_value: &'a mut dyn common::Delegate,
2702 ) -> ProjectLocationJobTemplateGetCall<'a, C> {
2703 self._delegate = Some(new_value);
2704 self
2705 }
2706
2707 /// Set any additional parameter of the query string used in the request.
2708 /// It should be used to set parameters which are not yet available through their own
2709 /// setters.
2710 ///
2711 /// Please note that this method must not be used to set any of the known parameters
2712 /// which have their own setter method. If done anyway, the request will fail.
2713 ///
2714 /// # Additional Parameters
2715 ///
2716 /// * *$.xgafv* (query-string) - V1 error format.
2717 /// * *access_token* (query-string) - OAuth access token.
2718 /// * *alt* (query-string) - Data format for response.
2719 /// * *callback* (query-string) - JSONP
2720 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2721 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2722 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2723 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2724 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2725 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2726 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2727 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobTemplateGetCall<'a, C>
2728 where
2729 T: AsRef<str>,
2730 {
2731 self._additional_params
2732 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2733 self
2734 }
2735
2736 /// Identifies the authorization scope for the method you are building.
2737 ///
2738 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2739 /// [`Scope::CloudPlatform`].
2740 ///
2741 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2742 /// tokens for more than one scope.
2743 ///
2744 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2745 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2746 /// sufficient, a read-write scope will do as well.
2747 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobTemplateGetCall<'a, C>
2748 where
2749 St: AsRef<str>,
2750 {
2751 self._scopes.insert(String::from(scope.as_ref()));
2752 self
2753 }
2754 /// Identifies the authorization scope(s) for the method you are building.
2755 ///
2756 /// See [`Self::add_scope()`] for details.
2757 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobTemplateGetCall<'a, C>
2758 where
2759 I: IntoIterator<Item = St>,
2760 St: AsRef<str>,
2761 {
2762 self._scopes
2763 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2764 self
2765 }
2766
2767 /// Removes all scopes, and no default scope will be used either.
2768 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2769 /// for details).
2770 pub fn clear_scopes(mut self) -> ProjectLocationJobTemplateGetCall<'a, C> {
2771 self._scopes.clear();
2772 self
2773 }
2774}
2775
2776/// Lists job templates in the specified region.
2777///
2778/// A builder for the *locations.jobTemplates.list* method supported by a *project* resource.
2779/// It is not used directly, but through a [`ProjectMethods`] instance.
2780///
2781/// # Example
2782///
2783/// Instantiate a resource method builder
2784///
2785/// ```test_harness,no_run
2786/// # extern crate hyper;
2787/// # extern crate hyper_rustls;
2788/// # extern crate google_transcoder1 as transcoder1;
2789/// # async fn dox() {
2790/// # use transcoder1::{Transcoder, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2791///
2792/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2793/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2794/// # .with_native_roots()
2795/// # .unwrap()
2796/// # .https_only()
2797/// # .enable_http2()
2798/// # .build();
2799///
2800/// # let executor = hyper_util::rt::TokioExecutor::new();
2801/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2802/// # secret,
2803/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2804/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2805/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2806/// # ),
2807/// # ).build().await.unwrap();
2808///
2809/// # let client = hyper_util::client::legacy::Client::builder(
2810/// # hyper_util::rt::TokioExecutor::new()
2811/// # )
2812/// # .build(
2813/// # hyper_rustls::HttpsConnectorBuilder::new()
2814/// # .with_native_roots()
2815/// # .unwrap()
2816/// # .https_or_http()
2817/// # .enable_http2()
2818/// # .build()
2819/// # );
2820/// # let mut hub = Transcoder::new(client, auth);
2821/// // You can configure optional parameters by calling the respective setters at will, and
2822/// // execute the final call using `doit()`.
2823/// // Values shown here are possibly random and not representative !
2824/// let result = hub.projects().locations_job_templates_list("parent")
2825/// .page_token("amet.")
2826/// .page_size(-20)
2827/// .order_by("ipsum")
2828/// .filter("gubergren")
2829/// .doit().await;
2830/// # }
2831/// ```
2832pub struct ProjectLocationJobTemplateListCall<'a, C>
2833where
2834 C: 'a,
2835{
2836 hub: &'a Transcoder<C>,
2837 _parent: String,
2838 _page_token: Option<String>,
2839 _page_size: Option<i32>,
2840 _order_by: Option<String>,
2841 _filter: Option<String>,
2842 _delegate: Option<&'a mut dyn common::Delegate>,
2843 _additional_params: HashMap<String, String>,
2844 _scopes: BTreeSet<String>,
2845}
2846
2847impl<'a, C> common::CallBuilder for ProjectLocationJobTemplateListCall<'a, C> {}
2848
2849impl<'a, C> ProjectLocationJobTemplateListCall<'a, C>
2850where
2851 C: common::Connector,
2852{
2853 /// Perform the operation you have build so far.
2854 pub async fn doit(mut self) -> common::Result<(common::Response, ListJobTemplatesResponse)> {
2855 use std::borrow::Cow;
2856 use std::io::{Read, Seek};
2857
2858 use common::{url::Params, ToParts};
2859 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2860
2861 let mut dd = common::DefaultDelegate;
2862 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2863 dlg.begin(common::MethodInfo {
2864 id: "transcoder.projects.locations.jobTemplates.list",
2865 http_method: hyper::Method::GET,
2866 });
2867
2868 for &field in [
2869 "alt",
2870 "parent",
2871 "pageToken",
2872 "pageSize",
2873 "orderBy",
2874 "filter",
2875 ]
2876 .iter()
2877 {
2878 if self._additional_params.contains_key(field) {
2879 dlg.finished(false);
2880 return Err(common::Error::FieldClash(field));
2881 }
2882 }
2883
2884 let mut params = Params::with_capacity(7 + self._additional_params.len());
2885 params.push("parent", self._parent);
2886 if let Some(value) = self._page_token.as_ref() {
2887 params.push("pageToken", value);
2888 }
2889 if let Some(value) = self._page_size.as_ref() {
2890 params.push("pageSize", value.to_string());
2891 }
2892 if let Some(value) = self._order_by.as_ref() {
2893 params.push("orderBy", value);
2894 }
2895 if let Some(value) = self._filter.as_ref() {
2896 params.push("filter", value);
2897 }
2898
2899 params.extend(self._additional_params.iter());
2900
2901 params.push("alt", "json");
2902 let mut url = self.hub._base_url.clone() + "v1/{+parent}/jobTemplates";
2903 if self._scopes.is_empty() {
2904 self._scopes
2905 .insert(Scope::CloudPlatform.as_ref().to_string());
2906 }
2907
2908 #[allow(clippy::single_element_loop)]
2909 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
2910 url = params.uri_replacement(url, param_name, find_this, true);
2911 }
2912 {
2913 let to_remove = ["parent"];
2914 params.remove_params(&to_remove);
2915 }
2916
2917 let url = params.parse_with_url(&url);
2918
2919 loop {
2920 let token = match self
2921 .hub
2922 .auth
2923 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2924 .await
2925 {
2926 Ok(token) => token,
2927 Err(e) => match dlg.token(e) {
2928 Ok(token) => token,
2929 Err(e) => {
2930 dlg.finished(false);
2931 return Err(common::Error::MissingToken(e));
2932 }
2933 },
2934 };
2935 let mut req_result = {
2936 let client = &self.hub.client;
2937 dlg.pre_request();
2938 let mut req_builder = hyper::Request::builder()
2939 .method(hyper::Method::GET)
2940 .uri(url.as_str())
2941 .header(USER_AGENT, self.hub._user_agent.clone());
2942
2943 if let Some(token) = token.as_ref() {
2944 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2945 }
2946
2947 let request = req_builder
2948 .header(CONTENT_LENGTH, 0_u64)
2949 .body(common::to_body::<String>(None));
2950
2951 client.request(request.unwrap()).await
2952 };
2953
2954 match req_result {
2955 Err(err) => {
2956 if let common::Retry::After(d) = dlg.http_error(&err) {
2957 sleep(d).await;
2958 continue;
2959 }
2960 dlg.finished(false);
2961 return Err(common::Error::HttpError(err));
2962 }
2963 Ok(res) => {
2964 let (mut parts, body) = res.into_parts();
2965 let mut body = common::Body::new(body);
2966 if !parts.status.is_success() {
2967 let bytes = common::to_bytes(body).await.unwrap_or_default();
2968 let error = serde_json::from_str(&common::to_string(&bytes));
2969 let response = common::to_response(parts, bytes.into());
2970
2971 if let common::Retry::After(d) =
2972 dlg.http_failure(&response, error.as_ref().ok())
2973 {
2974 sleep(d).await;
2975 continue;
2976 }
2977
2978 dlg.finished(false);
2979
2980 return Err(match error {
2981 Ok(value) => common::Error::BadRequest(value),
2982 _ => common::Error::Failure(response),
2983 });
2984 }
2985 let response = {
2986 let bytes = common::to_bytes(body).await.unwrap_or_default();
2987 let encoded = common::to_string(&bytes);
2988 match serde_json::from_str(&encoded) {
2989 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2990 Err(error) => {
2991 dlg.response_json_decode_error(&encoded, &error);
2992 return Err(common::Error::JsonDecodeError(
2993 encoded.to_string(),
2994 error,
2995 ));
2996 }
2997 }
2998 };
2999
3000 dlg.finished(true);
3001 return Ok(response);
3002 }
3003 }
3004 }
3005 }
3006
3007 /// Required. The parent location from which to retrieve the collection of job templates. Format: `projects/{project}/locations/{location}`
3008 ///
3009 /// Sets the *parent* path property to the given value.
3010 ///
3011 /// Even though the property as already been set when instantiating this call,
3012 /// we provide this method for API completeness.
3013 pub fn parent(mut self, new_value: &str) -> ProjectLocationJobTemplateListCall<'a, C> {
3014 self._parent = new_value.to_string();
3015 self
3016 }
3017 /// The `next_page_token` value returned from a previous List request, if any.
3018 ///
3019 /// Sets the *page token* query property to the given value.
3020 pub fn page_token(mut self, new_value: &str) -> ProjectLocationJobTemplateListCall<'a, C> {
3021 self._page_token = Some(new_value.to_string());
3022 self
3023 }
3024 /// The maximum number of items to return.
3025 ///
3026 /// Sets the *page size* query property to the given value.
3027 pub fn page_size(mut self, new_value: i32) -> ProjectLocationJobTemplateListCall<'a, C> {
3028 self._page_size = Some(new_value);
3029 self
3030 }
3031 /// One or more fields to compare and use to sort the output. See https://google.aip.dev/132#ordering.
3032 ///
3033 /// Sets the *order by* query property to the given value.
3034 pub fn order_by(mut self, new_value: &str) -> ProjectLocationJobTemplateListCall<'a, C> {
3035 self._order_by = Some(new_value.to_string());
3036 self
3037 }
3038 /// The filter expression, following the syntax outlined in https://google.aip.dev/160.
3039 ///
3040 /// Sets the *filter* query property to the given value.
3041 pub fn filter(mut self, new_value: &str) -> ProjectLocationJobTemplateListCall<'a, C> {
3042 self._filter = Some(new_value.to_string());
3043 self
3044 }
3045 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3046 /// while executing the actual API request.
3047 ///
3048 /// ````text
3049 /// It should be used to handle progress information, and to implement a certain level of resilience.
3050 /// ````
3051 ///
3052 /// Sets the *delegate* property to the given value.
3053 pub fn delegate(
3054 mut self,
3055 new_value: &'a mut dyn common::Delegate,
3056 ) -> ProjectLocationJobTemplateListCall<'a, C> {
3057 self._delegate = Some(new_value);
3058 self
3059 }
3060
3061 /// Set any additional parameter of the query string used in the request.
3062 /// It should be used to set parameters which are not yet available through their own
3063 /// setters.
3064 ///
3065 /// Please note that this method must not be used to set any of the known parameters
3066 /// which have their own setter method. If done anyway, the request will fail.
3067 ///
3068 /// # Additional Parameters
3069 ///
3070 /// * *$.xgafv* (query-string) - V1 error format.
3071 /// * *access_token* (query-string) - OAuth access token.
3072 /// * *alt* (query-string) - Data format for response.
3073 /// * *callback* (query-string) - JSONP
3074 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3075 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3076 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3077 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3078 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3079 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3080 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3081 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobTemplateListCall<'a, C>
3082 where
3083 T: AsRef<str>,
3084 {
3085 self._additional_params
3086 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3087 self
3088 }
3089
3090 /// Identifies the authorization scope for the method you are building.
3091 ///
3092 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3093 /// [`Scope::CloudPlatform`].
3094 ///
3095 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3096 /// tokens for more than one scope.
3097 ///
3098 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3099 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3100 /// sufficient, a read-write scope will do as well.
3101 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobTemplateListCall<'a, C>
3102 where
3103 St: AsRef<str>,
3104 {
3105 self._scopes.insert(String::from(scope.as_ref()));
3106 self
3107 }
3108 /// Identifies the authorization scope(s) for the method you are building.
3109 ///
3110 /// See [`Self::add_scope()`] for details.
3111 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobTemplateListCall<'a, C>
3112 where
3113 I: IntoIterator<Item = St>,
3114 St: AsRef<str>,
3115 {
3116 self._scopes
3117 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3118 self
3119 }
3120
3121 /// Removes all scopes, and no default scope will be used either.
3122 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3123 /// for details).
3124 pub fn clear_scopes(mut self) -> ProjectLocationJobTemplateListCall<'a, C> {
3125 self._scopes.clear();
3126 self
3127 }
3128}
3129
3130/// Creates a job in the specified region.
3131///
3132/// A builder for the *locations.jobs.create* method supported by a *project* resource.
3133/// It is not used directly, but through a [`ProjectMethods`] instance.
3134///
3135/// # Example
3136///
3137/// Instantiate a resource method builder
3138///
3139/// ```test_harness,no_run
3140/// # extern crate hyper;
3141/// # extern crate hyper_rustls;
3142/// # extern crate google_transcoder1 as transcoder1;
3143/// use transcoder1::api::Job;
3144/// # async fn dox() {
3145/// # use transcoder1::{Transcoder, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3146///
3147/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3148/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3149/// # .with_native_roots()
3150/// # .unwrap()
3151/// # .https_only()
3152/// # .enable_http2()
3153/// # .build();
3154///
3155/// # let executor = hyper_util::rt::TokioExecutor::new();
3156/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3157/// # secret,
3158/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3159/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3160/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3161/// # ),
3162/// # ).build().await.unwrap();
3163///
3164/// # let client = hyper_util::client::legacy::Client::builder(
3165/// # hyper_util::rt::TokioExecutor::new()
3166/// # )
3167/// # .build(
3168/// # hyper_rustls::HttpsConnectorBuilder::new()
3169/// # .with_native_roots()
3170/// # .unwrap()
3171/// # .https_or_http()
3172/// # .enable_http2()
3173/// # .build()
3174/// # );
3175/// # let mut hub = Transcoder::new(client, auth);
3176/// // As the method needs a request, you would usually fill it with the desired information
3177/// // into the respective structure. Some of the parts shown here might not be applicable !
3178/// // Values shown here are possibly random and not representative !
3179/// let mut req = Job::default();
3180///
3181/// // You can configure optional parameters by calling the respective setters at will, and
3182/// // execute the final call using `doit()`.
3183/// // Values shown here are possibly random and not representative !
3184/// let result = hub.projects().locations_jobs_create(req, "parent")
3185/// .doit().await;
3186/// # }
3187/// ```
3188pub struct ProjectLocationJobCreateCall<'a, C>
3189where
3190 C: 'a,
3191{
3192 hub: &'a Transcoder<C>,
3193 _request: Job,
3194 _parent: String,
3195 _delegate: Option<&'a mut dyn common::Delegate>,
3196 _additional_params: HashMap<String, String>,
3197 _scopes: BTreeSet<String>,
3198}
3199
3200impl<'a, C> common::CallBuilder for ProjectLocationJobCreateCall<'a, C> {}
3201
3202impl<'a, C> ProjectLocationJobCreateCall<'a, C>
3203where
3204 C: common::Connector,
3205{
3206 /// Perform the operation you have build so far.
3207 pub async fn doit(mut self) -> common::Result<(common::Response, Job)> {
3208 use std::borrow::Cow;
3209 use std::io::{Read, Seek};
3210
3211 use common::{url::Params, ToParts};
3212 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3213
3214 let mut dd = common::DefaultDelegate;
3215 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3216 dlg.begin(common::MethodInfo {
3217 id: "transcoder.projects.locations.jobs.create",
3218 http_method: hyper::Method::POST,
3219 });
3220
3221 for &field in ["alt", "parent"].iter() {
3222 if self._additional_params.contains_key(field) {
3223 dlg.finished(false);
3224 return Err(common::Error::FieldClash(field));
3225 }
3226 }
3227
3228 let mut params = Params::with_capacity(4 + self._additional_params.len());
3229 params.push("parent", self._parent);
3230
3231 params.extend(self._additional_params.iter());
3232
3233 params.push("alt", "json");
3234 let mut url = self.hub._base_url.clone() + "v1/{+parent}/jobs";
3235 if self._scopes.is_empty() {
3236 self._scopes
3237 .insert(Scope::CloudPlatform.as_ref().to_string());
3238 }
3239
3240 #[allow(clippy::single_element_loop)]
3241 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3242 url = params.uri_replacement(url, param_name, find_this, true);
3243 }
3244 {
3245 let to_remove = ["parent"];
3246 params.remove_params(&to_remove);
3247 }
3248
3249 let url = params.parse_with_url(&url);
3250
3251 let mut json_mime_type = mime::APPLICATION_JSON;
3252 let mut request_value_reader = {
3253 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3254 common::remove_json_null_values(&mut value);
3255 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3256 serde_json::to_writer(&mut dst, &value).unwrap();
3257 dst
3258 };
3259 let request_size = request_value_reader
3260 .seek(std::io::SeekFrom::End(0))
3261 .unwrap();
3262 request_value_reader
3263 .seek(std::io::SeekFrom::Start(0))
3264 .unwrap();
3265
3266 loop {
3267 let token = match self
3268 .hub
3269 .auth
3270 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3271 .await
3272 {
3273 Ok(token) => token,
3274 Err(e) => match dlg.token(e) {
3275 Ok(token) => token,
3276 Err(e) => {
3277 dlg.finished(false);
3278 return Err(common::Error::MissingToken(e));
3279 }
3280 },
3281 };
3282 request_value_reader
3283 .seek(std::io::SeekFrom::Start(0))
3284 .unwrap();
3285 let mut req_result = {
3286 let client = &self.hub.client;
3287 dlg.pre_request();
3288 let mut req_builder = hyper::Request::builder()
3289 .method(hyper::Method::POST)
3290 .uri(url.as_str())
3291 .header(USER_AGENT, self.hub._user_agent.clone());
3292
3293 if let Some(token) = token.as_ref() {
3294 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3295 }
3296
3297 let request = req_builder
3298 .header(CONTENT_TYPE, json_mime_type.to_string())
3299 .header(CONTENT_LENGTH, request_size as u64)
3300 .body(common::to_body(
3301 request_value_reader.get_ref().clone().into(),
3302 ));
3303
3304 client.request(request.unwrap()).await
3305 };
3306
3307 match req_result {
3308 Err(err) => {
3309 if let common::Retry::After(d) = dlg.http_error(&err) {
3310 sleep(d).await;
3311 continue;
3312 }
3313 dlg.finished(false);
3314 return Err(common::Error::HttpError(err));
3315 }
3316 Ok(res) => {
3317 let (mut parts, body) = res.into_parts();
3318 let mut body = common::Body::new(body);
3319 if !parts.status.is_success() {
3320 let bytes = common::to_bytes(body).await.unwrap_or_default();
3321 let error = serde_json::from_str(&common::to_string(&bytes));
3322 let response = common::to_response(parts, bytes.into());
3323
3324 if let common::Retry::After(d) =
3325 dlg.http_failure(&response, error.as_ref().ok())
3326 {
3327 sleep(d).await;
3328 continue;
3329 }
3330
3331 dlg.finished(false);
3332
3333 return Err(match error {
3334 Ok(value) => common::Error::BadRequest(value),
3335 _ => common::Error::Failure(response),
3336 });
3337 }
3338 let response = {
3339 let bytes = common::to_bytes(body).await.unwrap_or_default();
3340 let encoded = common::to_string(&bytes);
3341 match serde_json::from_str(&encoded) {
3342 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3343 Err(error) => {
3344 dlg.response_json_decode_error(&encoded, &error);
3345 return Err(common::Error::JsonDecodeError(
3346 encoded.to_string(),
3347 error,
3348 ));
3349 }
3350 }
3351 };
3352
3353 dlg.finished(true);
3354 return Ok(response);
3355 }
3356 }
3357 }
3358 }
3359
3360 ///
3361 /// Sets the *request* property to the given value.
3362 ///
3363 /// Even though the property as already been set when instantiating this call,
3364 /// we provide this method for API completeness.
3365 pub fn request(mut self, new_value: Job) -> ProjectLocationJobCreateCall<'a, C> {
3366 self._request = new_value;
3367 self
3368 }
3369 /// Required. The parent location to create and process this job. Format: `projects/{project}/locations/{location}`
3370 ///
3371 /// Sets the *parent* path property to the given value.
3372 ///
3373 /// Even though the property as already been set when instantiating this call,
3374 /// we provide this method for API completeness.
3375 pub fn parent(mut self, new_value: &str) -> ProjectLocationJobCreateCall<'a, C> {
3376 self._parent = new_value.to_string();
3377 self
3378 }
3379 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3380 /// while executing the actual API request.
3381 ///
3382 /// ````text
3383 /// It should be used to handle progress information, and to implement a certain level of resilience.
3384 /// ````
3385 ///
3386 /// Sets the *delegate* property to the given value.
3387 pub fn delegate(
3388 mut self,
3389 new_value: &'a mut dyn common::Delegate,
3390 ) -> ProjectLocationJobCreateCall<'a, C> {
3391 self._delegate = Some(new_value);
3392 self
3393 }
3394
3395 /// Set any additional parameter of the query string used in the request.
3396 /// It should be used to set parameters which are not yet available through their own
3397 /// setters.
3398 ///
3399 /// Please note that this method must not be used to set any of the known parameters
3400 /// which have their own setter method. If done anyway, the request will fail.
3401 ///
3402 /// # Additional Parameters
3403 ///
3404 /// * *$.xgafv* (query-string) - V1 error format.
3405 /// * *access_token* (query-string) - OAuth access token.
3406 /// * *alt* (query-string) - Data format for response.
3407 /// * *callback* (query-string) - JSONP
3408 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3409 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3410 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3411 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3412 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3413 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3414 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3415 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobCreateCall<'a, C>
3416 where
3417 T: AsRef<str>,
3418 {
3419 self._additional_params
3420 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3421 self
3422 }
3423
3424 /// Identifies the authorization scope for the method you are building.
3425 ///
3426 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3427 /// [`Scope::CloudPlatform`].
3428 ///
3429 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3430 /// tokens for more than one scope.
3431 ///
3432 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3433 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3434 /// sufficient, a read-write scope will do as well.
3435 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobCreateCall<'a, C>
3436 where
3437 St: AsRef<str>,
3438 {
3439 self._scopes.insert(String::from(scope.as_ref()));
3440 self
3441 }
3442 /// Identifies the authorization scope(s) for the method you are building.
3443 ///
3444 /// See [`Self::add_scope()`] for details.
3445 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobCreateCall<'a, C>
3446 where
3447 I: IntoIterator<Item = St>,
3448 St: AsRef<str>,
3449 {
3450 self._scopes
3451 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3452 self
3453 }
3454
3455 /// Removes all scopes, and no default scope will be used either.
3456 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3457 /// for details).
3458 pub fn clear_scopes(mut self) -> ProjectLocationJobCreateCall<'a, C> {
3459 self._scopes.clear();
3460 self
3461 }
3462}
3463
3464/// Deletes a job.
3465///
3466/// A builder for the *locations.jobs.delete* method supported by a *project* resource.
3467/// It is not used directly, but through a [`ProjectMethods`] instance.
3468///
3469/// # Example
3470///
3471/// Instantiate a resource method builder
3472///
3473/// ```test_harness,no_run
3474/// # extern crate hyper;
3475/// # extern crate hyper_rustls;
3476/// # extern crate google_transcoder1 as transcoder1;
3477/// # async fn dox() {
3478/// # use transcoder1::{Transcoder, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3479///
3480/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3481/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3482/// # .with_native_roots()
3483/// # .unwrap()
3484/// # .https_only()
3485/// # .enable_http2()
3486/// # .build();
3487///
3488/// # let executor = hyper_util::rt::TokioExecutor::new();
3489/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3490/// # secret,
3491/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3492/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3493/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3494/// # ),
3495/// # ).build().await.unwrap();
3496///
3497/// # let client = hyper_util::client::legacy::Client::builder(
3498/// # hyper_util::rt::TokioExecutor::new()
3499/// # )
3500/// # .build(
3501/// # hyper_rustls::HttpsConnectorBuilder::new()
3502/// # .with_native_roots()
3503/// # .unwrap()
3504/// # .https_or_http()
3505/// # .enable_http2()
3506/// # .build()
3507/// # );
3508/// # let mut hub = Transcoder::new(client, auth);
3509/// // You can configure optional parameters by calling the respective setters at will, and
3510/// // execute the final call using `doit()`.
3511/// // Values shown here are possibly random and not representative !
3512/// let result = hub.projects().locations_jobs_delete("name")
3513/// .allow_missing(false)
3514/// .doit().await;
3515/// # }
3516/// ```
3517pub struct ProjectLocationJobDeleteCall<'a, C>
3518where
3519 C: 'a,
3520{
3521 hub: &'a Transcoder<C>,
3522 _name: String,
3523 _allow_missing: Option<bool>,
3524 _delegate: Option<&'a mut dyn common::Delegate>,
3525 _additional_params: HashMap<String, String>,
3526 _scopes: BTreeSet<String>,
3527}
3528
3529impl<'a, C> common::CallBuilder for ProjectLocationJobDeleteCall<'a, C> {}
3530
3531impl<'a, C> ProjectLocationJobDeleteCall<'a, C>
3532where
3533 C: common::Connector,
3534{
3535 /// Perform the operation you have build so far.
3536 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
3537 use std::borrow::Cow;
3538 use std::io::{Read, Seek};
3539
3540 use common::{url::Params, ToParts};
3541 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3542
3543 let mut dd = common::DefaultDelegate;
3544 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3545 dlg.begin(common::MethodInfo {
3546 id: "transcoder.projects.locations.jobs.delete",
3547 http_method: hyper::Method::DELETE,
3548 });
3549
3550 for &field in ["alt", "name", "allowMissing"].iter() {
3551 if self._additional_params.contains_key(field) {
3552 dlg.finished(false);
3553 return Err(common::Error::FieldClash(field));
3554 }
3555 }
3556
3557 let mut params = Params::with_capacity(4 + self._additional_params.len());
3558 params.push("name", self._name);
3559 if let Some(value) = self._allow_missing.as_ref() {
3560 params.push("allowMissing", value.to_string());
3561 }
3562
3563 params.extend(self._additional_params.iter());
3564
3565 params.push("alt", "json");
3566 let mut url = self.hub._base_url.clone() + "v1/{+name}";
3567 if self._scopes.is_empty() {
3568 self._scopes
3569 .insert(Scope::CloudPlatform.as_ref().to_string());
3570 }
3571
3572 #[allow(clippy::single_element_loop)]
3573 for &(find_this, param_name) in [("{+name}", "name")].iter() {
3574 url = params.uri_replacement(url, param_name, find_this, true);
3575 }
3576 {
3577 let to_remove = ["name"];
3578 params.remove_params(&to_remove);
3579 }
3580
3581 let url = params.parse_with_url(&url);
3582
3583 loop {
3584 let token = match self
3585 .hub
3586 .auth
3587 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3588 .await
3589 {
3590 Ok(token) => token,
3591 Err(e) => match dlg.token(e) {
3592 Ok(token) => token,
3593 Err(e) => {
3594 dlg.finished(false);
3595 return Err(common::Error::MissingToken(e));
3596 }
3597 },
3598 };
3599 let mut req_result = {
3600 let client = &self.hub.client;
3601 dlg.pre_request();
3602 let mut req_builder = hyper::Request::builder()
3603 .method(hyper::Method::DELETE)
3604 .uri(url.as_str())
3605 .header(USER_AGENT, self.hub._user_agent.clone());
3606
3607 if let Some(token) = token.as_ref() {
3608 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3609 }
3610
3611 let request = req_builder
3612 .header(CONTENT_LENGTH, 0_u64)
3613 .body(common::to_body::<String>(None));
3614
3615 client.request(request.unwrap()).await
3616 };
3617
3618 match req_result {
3619 Err(err) => {
3620 if let common::Retry::After(d) = dlg.http_error(&err) {
3621 sleep(d).await;
3622 continue;
3623 }
3624 dlg.finished(false);
3625 return Err(common::Error::HttpError(err));
3626 }
3627 Ok(res) => {
3628 let (mut parts, body) = res.into_parts();
3629 let mut body = common::Body::new(body);
3630 if !parts.status.is_success() {
3631 let bytes = common::to_bytes(body).await.unwrap_or_default();
3632 let error = serde_json::from_str(&common::to_string(&bytes));
3633 let response = common::to_response(parts, bytes.into());
3634
3635 if let common::Retry::After(d) =
3636 dlg.http_failure(&response, error.as_ref().ok())
3637 {
3638 sleep(d).await;
3639 continue;
3640 }
3641
3642 dlg.finished(false);
3643
3644 return Err(match error {
3645 Ok(value) => common::Error::BadRequest(value),
3646 _ => common::Error::Failure(response),
3647 });
3648 }
3649 let response = {
3650 let bytes = common::to_bytes(body).await.unwrap_or_default();
3651 let encoded = common::to_string(&bytes);
3652 match serde_json::from_str(&encoded) {
3653 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3654 Err(error) => {
3655 dlg.response_json_decode_error(&encoded, &error);
3656 return Err(common::Error::JsonDecodeError(
3657 encoded.to_string(),
3658 error,
3659 ));
3660 }
3661 }
3662 };
3663
3664 dlg.finished(true);
3665 return Ok(response);
3666 }
3667 }
3668 }
3669 }
3670
3671 /// Required. The name of the job to delete. Format: `projects/{project}/locations/{location}/jobs/{job}`
3672 ///
3673 /// Sets the *name* path property to the given value.
3674 ///
3675 /// Even though the property as already been set when instantiating this call,
3676 /// we provide this method for API completeness.
3677 pub fn name(mut self, new_value: &str) -> ProjectLocationJobDeleteCall<'a, C> {
3678 self._name = new_value.to_string();
3679 self
3680 }
3681 /// If set to true, and the job is not found, the request will succeed but no action will be taken on the server.
3682 ///
3683 /// Sets the *allow missing* query property to the given value.
3684 pub fn allow_missing(mut self, new_value: bool) -> ProjectLocationJobDeleteCall<'a, C> {
3685 self._allow_missing = Some(new_value);
3686 self
3687 }
3688 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3689 /// while executing the actual API request.
3690 ///
3691 /// ````text
3692 /// It should be used to handle progress information, and to implement a certain level of resilience.
3693 /// ````
3694 ///
3695 /// Sets the *delegate* property to the given value.
3696 pub fn delegate(
3697 mut self,
3698 new_value: &'a mut dyn common::Delegate,
3699 ) -> ProjectLocationJobDeleteCall<'a, C> {
3700 self._delegate = Some(new_value);
3701 self
3702 }
3703
3704 /// Set any additional parameter of the query string used in the request.
3705 /// It should be used to set parameters which are not yet available through their own
3706 /// setters.
3707 ///
3708 /// Please note that this method must not be used to set any of the known parameters
3709 /// which have their own setter method. If done anyway, the request will fail.
3710 ///
3711 /// # Additional Parameters
3712 ///
3713 /// * *$.xgafv* (query-string) - V1 error format.
3714 /// * *access_token* (query-string) - OAuth access token.
3715 /// * *alt* (query-string) - Data format for response.
3716 /// * *callback* (query-string) - JSONP
3717 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3718 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3719 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3720 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3721 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3722 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3723 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3724 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobDeleteCall<'a, C>
3725 where
3726 T: AsRef<str>,
3727 {
3728 self._additional_params
3729 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3730 self
3731 }
3732
3733 /// Identifies the authorization scope for the method you are building.
3734 ///
3735 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3736 /// [`Scope::CloudPlatform`].
3737 ///
3738 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3739 /// tokens for more than one scope.
3740 ///
3741 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3742 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3743 /// sufficient, a read-write scope will do as well.
3744 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobDeleteCall<'a, C>
3745 where
3746 St: AsRef<str>,
3747 {
3748 self._scopes.insert(String::from(scope.as_ref()));
3749 self
3750 }
3751 /// Identifies the authorization scope(s) for the method you are building.
3752 ///
3753 /// See [`Self::add_scope()`] for details.
3754 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobDeleteCall<'a, C>
3755 where
3756 I: IntoIterator<Item = St>,
3757 St: AsRef<str>,
3758 {
3759 self._scopes
3760 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3761 self
3762 }
3763
3764 /// Removes all scopes, and no default scope will be used either.
3765 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3766 /// for details).
3767 pub fn clear_scopes(mut self) -> ProjectLocationJobDeleteCall<'a, C> {
3768 self._scopes.clear();
3769 self
3770 }
3771}
3772
3773/// Returns the job data.
3774///
3775/// A builder for the *locations.jobs.get* method supported by a *project* resource.
3776/// It is not used directly, but through a [`ProjectMethods`] instance.
3777///
3778/// # Example
3779///
3780/// Instantiate a resource method builder
3781///
3782/// ```test_harness,no_run
3783/// # extern crate hyper;
3784/// # extern crate hyper_rustls;
3785/// # extern crate google_transcoder1 as transcoder1;
3786/// # async fn dox() {
3787/// # use transcoder1::{Transcoder, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3788///
3789/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3790/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3791/// # .with_native_roots()
3792/// # .unwrap()
3793/// # .https_only()
3794/// # .enable_http2()
3795/// # .build();
3796///
3797/// # let executor = hyper_util::rt::TokioExecutor::new();
3798/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3799/// # secret,
3800/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3801/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3802/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3803/// # ),
3804/// # ).build().await.unwrap();
3805///
3806/// # let client = hyper_util::client::legacy::Client::builder(
3807/// # hyper_util::rt::TokioExecutor::new()
3808/// # )
3809/// # .build(
3810/// # hyper_rustls::HttpsConnectorBuilder::new()
3811/// # .with_native_roots()
3812/// # .unwrap()
3813/// # .https_or_http()
3814/// # .enable_http2()
3815/// # .build()
3816/// # );
3817/// # let mut hub = Transcoder::new(client, auth);
3818/// // You can configure optional parameters by calling the respective setters at will, and
3819/// // execute the final call using `doit()`.
3820/// // Values shown here are possibly random and not representative !
3821/// let result = hub.projects().locations_jobs_get("name")
3822/// .doit().await;
3823/// # }
3824/// ```
3825pub struct ProjectLocationJobGetCall<'a, C>
3826where
3827 C: 'a,
3828{
3829 hub: &'a Transcoder<C>,
3830 _name: String,
3831 _delegate: Option<&'a mut dyn common::Delegate>,
3832 _additional_params: HashMap<String, String>,
3833 _scopes: BTreeSet<String>,
3834}
3835
3836impl<'a, C> common::CallBuilder for ProjectLocationJobGetCall<'a, C> {}
3837
3838impl<'a, C> ProjectLocationJobGetCall<'a, C>
3839where
3840 C: common::Connector,
3841{
3842 /// Perform the operation you have build so far.
3843 pub async fn doit(mut self) -> common::Result<(common::Response, Job)> {
3844 use std::borrow::Cow;
3845 use std::io::{Read, Seek};
3846
3847 use common::{url::Params, ToParts};
3848 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3849
3850 let mut dd = common::DefaultDelegate;
3851 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3852 dlg.begin(common::MethodInfo {
3853 id: "transcoder.projects.locations.jobs.get",
3854 http_method: hyper::Method::GET,
3855 });
3856
3857 for &field in ["alt", "name"].iter() {
3858 if self._additional_params.contains_key(field) {
3859 dlg.finished(false);
3860 return Err(common::Error::FieldClash(field));
3861 }
3862 }
3863
3864 let mut params = Params::with_capacity(3 + self._additional_params.len());
3865 params.push("name", self._name);
3866
3867 params.extend(self._additional_params.iter());
3868
3869 params.push("alt", "json");
3870 let mut url = self.hub._base_url.clone() + "v1/{+name}";
3871 if self._scopes.is_empty() {
3872 self._scopes
3873 .insert(Scope::CloudPlatform.as_ref().to_string());
3874 }
3875
3876 #[allow(clippy::single_element_loop)]
3877 for &(find_this, param_name) in [("{+name}", "name")].iter() {
3878 url = params.uri_replacement(url, param_name, find_this, true);
3879 }
3880 {
3881 let to_remove = ["name"];
3882 params.remove_params(&to_remove);
3883 }
3884
3885 let url = params.parse_with_url(&url);
3886
3887 loop {
3888 let token = match self
3889 .hub
3890 .auth
3891 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3892 .await
3893 {
3894 Ok(token) => token,
3895 Err(e) => match dlg.token(e) {
3896 Ok(token) => token,
3897 Err(e) => {
3898 dlg.finished(false);
3899 return Err(common::Error::MissingToken(e));
3900 }
3901 },
3902 };
3903 let mut req_result = {
3904 let client = &self.hub.client;
3905 dlg.pre_request();
3906 let mut req_builder = hyper::Request::builder()
3907 .method(hyper::Method::GET)
3908 .uri(url.as_str())
3909 .header(USER_AGENT, self.hub._user_agent.clone());
3910
3911 if let Some(token) = token.as_ref() {
3912 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3913 }
3914
3915 let request = req_builder
3916 .header(CONTENT_LENGTH, 0_u64)
3917 .body(common::to_body::<String>(None));
3918
3919 client.request(request.unwrap()).await
3920 };
3921
3922 match req_result {
3923 Err(err) => {
3924 if let common::Retry::After(d) = dlg.http_error(&err) {
3925 sleep(d).await;
3926 continue;
3927 }
3928 dlg.finished(false);
3929 return Err(common::Error::HttpError(err));
3930 }
3931 Ok(res) => {
3932 let (mut parts, body) = res.into_parts();
3933 let mut body = common::Body::new(body);
3934 if !parts.status.is_success() {
3935 let bytes = common::to_bytes(body).await.unwrap_or_default();
3936 let error = serde_json::from_str(&common::to_string(&bytes));
3937 let response = common::to_response(parts, bytes.into());
3938
3939 if let common::Retry::After(d) =
3940 dlg.http_failure(&response, error.as_ref().ok())
3941 {
3942 sleep(d).await;
3943 continue;
3944 }
3945
3946 dlg.finished(false);
3947
3948 return Err(match error {
3949 Ok(value) => common::Error::BadRequest(value),
3950 _ => common::Error::Failure(response),
3951 });
3952 }
3953 let response = {
3954 let bytes = common::to_bytes(body).await.unwrap_or_default();
3955 let encoded = common::to_string(&bytes);
3956 match serde_json::from_str(&encoded) {
3957 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3958 Err(error) => {
3959 dlg.response_json_decode_error(&encoded, &error);
3960 return Err(common::Error::JsonDecodeError(
3961 encoded.to_string(),
3962 error,
3963 ));
3964 }
3965 }
3966 };
3967
3968 dlg.finished(true);
3969 return Ok(response);
3970 }
3971 }
3972 }
3973 }
3974
3975 /// Required. The name of the job to retrieve. Format: `projects/{project}/locations/{location}/jobs/{job}`
3976 ///
3977 /// Sets the *name* path property to the given value.
3978 ///
3979 /// Even though the property as already been set when instantiating this call,
3980 /// we provide this method for API completeness.
3981 pub fn name(mut self, new_value: &str) -> ProjectLocationJobGetCall<'a, C> {
3982 self._name = new_value.to_string();
3983 self
3984 }
3985 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3986 /// while executing the actual API request.
3987 ///
3988 /// ````text
3989 /// It should be used to handle progress information, and to implement a certain level of resilience.
3990 /// ````
3991 ///
3992 /// Sets the *delegate* property to the given value.
3993 pub fn delegate(
3994 mut self,
3995 new_value: &'a mut dyn common::Delegate,
3996 ) -> ProjectLocationJobGetCall<'a, C> {
3997 self._delegate = Some(new_value);
3998 self
3999 }
4000
4001 /// Set any additional parameter of the query string used in the request.
4002 /// It should be used to set parameters which are not yet available through their own
4003 /// setters.
4004 ///
4005 /// Please note that this method must not be used to set any of the known parameters
4006 /// which have their own setter method. If done anyway, the request will fail.
4007 ///
4008 /// # Additional Parameters
4009 ///
4010 /// * *$.xgafv* (query-string) - V1 error format.
4011 /// * *access_token* (query-string) - OAuth access token.
4012 /// * *alt* (query-string) - Data format for response.
4013 /// * *callback* (query-string) - JSONP
4014 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4015 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4016 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4017 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4018 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4019 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4020 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4021 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobGetCall<'a, C>
4022 where
4023 T: AsRef<str>,
4024 {
4025 self._additional_params
4026 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4027 self
4028 }
4029
4030 /// Identifies the authorization scope for the method you are building.
4031 ///
4032 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4033 /// [`Scope::CloudPlatform`].
4034 ///
4035 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4036 /// tokens for more than one scope.
4037 ///
4038 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4039 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4040 /// sufficient, a read-write scope will do as well.
4041 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobGetCall<'a, C>
4042 where
4043 St: AsRef<str>,
4044 {
4045 self._scopes.insert(String::from(scope.as_ref()));
4046 self
4047 }
4048 /// Identifies the authorization scope(s) for the method you are building.
4049 ///
4050 /// See [`Self::add_scope()`] for details.
4051 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobGetCall<'a, C>
4052 where
4053 I: IntoIterator<Item = St>,
4054 St: AsRef<str>,
4055 {
4056 self._scopes
4057 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4058 self
4059 }
4060
4061 /// Removes all scopes, and no default scope will be used either.
4062 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4063 /// for details).
4064 pub fn clear_scopes(mut self) -> ProjectLocationJobGetCall<'a, C> {
4065 self._scopes.clear();
4066 self
4067 }
4068}
4069
4070/// Lists jobs in the specified region.
4071///
4072/// A builder for the *locations.jobs.list* method supported by a *project* resource.
4073/// It is not used directly, but through a [`ProjectMethods`] instance.
4074///
4075/// # Example
4076///
4077/// Instantiate a resource method builder
4078///
4079/// ```test_harness,no_run
4080/// # extern crate hyper;
4081/// # extern crate hyper_rustls;
4082/// # extern crate google_transcoder1 as transcoder1;
4083/// # async fn dox() {
4084/// # use transcoder1::{Transcoder, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4085///
4086/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4087/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4088/// # .with_native_roots()
4089/// # .unwrap()
4090/// # .https_only()
4091/// # .enable_http2()
4092/// # .build();
4093///
4094/// # let executor = hyper_util::rt::TokioExecutor::new();
4095/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4096/// # secret,
4097/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4098/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4099/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4100/// # ),
4101/// # ).build().await.unwrap();
4102///
4103/// # let client = hyper_util::client::legacy::Client::builder(
4104/// # hyper_util::rt::TokioExecutor::new()
4105/// # )
4106/// # .build(
4107/// # hyper_rustls::HttpsConnectorBuilder::new()
4108/// # .with_native_roots()
4109/// # .unwrap()
4110/// # .https_or_http()
4111/// # .enable_http2()
4112/// # .build()
4113/// # );
4114/// # let mut hub = Transcoder::new(client, auth);
4115/// // You can configure optional parameters by calling the respective setters at will, and
4116/// // execute the final call using `doit()`.
4117/// // Values shown here are possibly random and not representative !
4118/// let result = hub.projects().locations_jobs_list("parent")
4119/// .page_token("ipsum")
4120/// .page_size(-88)
4121/// .order_by("amet")
4122/// .filter("duo")
4123/// .doit().await;
4124/// # }
4125/// ```
4126pub struct ProjectLocationJobListCall<'a, C>
4127where
4128 C: 'a,
4129{
4130 hub: &'a Transcoder<C>,
4131 _parent: String,
4132 _page_token: Option<String>,
4133 _page_size: Option<i32>,
4134 _order_by: Option<String>,
4135 _filter: Option<String>,
4136 _delegate: Option<&'a mut dyn common::Delegate>,
4137 _additional_params: HashMap<String, String>,
4138 _scopes: BTreeSet<String>,
4139}
4140
4141impl<'a, C> common::CallBuilder for ProjectLocationJobListCall<'a, C> {}
4142
4143impl<'a, C> ProjectLocationJobListCall<'a, C>
4144where
4145 C: common::Connector,
4146{
4147 /// Perform the operation you have build so far.
4148 pub async fn doit(mut self) -> common::Result<(common::Response, ListJobsResponse)> {
4149 use std::borrow::Cow;
4150 use std::io::{Read, Seek};
4151
4152 use common::{url::Params, ToParts};
4153 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4154
4155 let mut dd = common::DefaultDelegate;
4156 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4157 dlg.begin(common::MethodInfo {
4158 id: "transcoder.projects.locations.jobs.list",
4159 http_method: hyper::Method::GET,
4160 });
4161
4162 for &field in [
4163 "alt",
4164 "parent",
4165 "pageToken",
4166 "pageSize",
4167 "orderBy",
4168 "filter",
4169 ]
4170 .iter()
4171 {
4172 if self._additional_params.contains_key(field) {
4173 dlg.finished(false);
4174 return Err(common::Error::FieldClash(field));
4175 }
4176 }
4177
4178 let mut params = Params::with_capacity(7 + self._additional_params.len());
4179 params.push("parent", self._parent);
4180 if let Some(value) = self._page_token.as_ref() {
4181 params.push("pageToken", value);
4182 }
4183 if let Some(value) = self._page_size.as_ref() {
4184 params.push("pageSize", value.to_string());
4185 }
4186 if let Some(value) = self._order_by.as_ref() {
4187 params.push("orderBy", value);
4188 }
4189 if let Some(value) = self._filter.as_ref() {
4190 params.push("filter", value);
4191 }
4192
4193 params.extend(self._additional_params.iter());
4194
4195 params.push("alt", "json");
4196 let mut url = self.hub._base_url.clone() + "v1/{+parent}/jobs";
4197 if self._scopes.is_empty() {
4198 self._scopes
4199 .insert(Scope::CloudPlatform.as_ref().to_string());
4200 }
4201
4202 #[allow(clippy::single_element_loop)]
4203 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4204 url = params.uri_replacement(url, param_name, find_this, true);
4205 }
4206 {
4207 let to_remove = ["parent"];
4208 params.remove_params(&to_remove);
4209 }
4210
4211 let url = params.parse_with_url(&url);
4212
4213 loop {
4214 let token = match self
4215 .hub
4216 .auth
4217 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4218 .await
4219 {
4220 Ok(token) => token,
4221 Err(e) => match dlg.token(e) {
4222 Ok(token) => token,
4223 Err(e) => {
4224 dlg.finished(false);
4225 return Err(common::Error::MissingToken(e));
4226 }
4227 },
4228 };
4229 let mut req_result = {
4230 let client = &self.hub.client;
4231 dlg.pre_request();
4232 let mut req_builder = hyper::Request::builder()
4233 .method(hyper::Method::GET)
4234 .uri(url.as_str())
4235 .header(USER_AGENT, self.hub._user_agent.clone());
4236
4237 if let Some(token) = token.as_ref() {
4238 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4239 }
4240
4241 let request = req_builder
4242 .header(CONTENT_LENGTH, 0_u64)
4243 .body(common::to_body::<String>(None));
4244
4245 client.request(request.unwrap()).await
4246 };
4247
4248 match req_result {
4249 Err(err) => {
4250 if let common::Retry::After(d) = dlg.http_error(&err) {
4251 sleep(d).await;
4252 continue;
4253 }
4254 dlg.finished(false);
4255 return Err(common::Error::HttpError(err));
4256 }
4257 Ok(res) => {
4258 let (mut parts, body) = res.into_parts();
4259 let mut body = common::Body::new(body);
4260 if !parts.status.is_success() {
4261 let bytes = common::to_bytes(body).await.unwrap_or_default();
4262 let error = serde_json::from_str(&common::to_string(&bytes));
4263 let response = common::to_response(parts, bytes.into());
4264
4265 if let common::Retry::After(d) =
4266 dlg.http_failure(&response, error.as_ref().ok())
4267 {
4268 sleep(d).await;
4269 continue;
4270 }
4271
4272 dlg.finished(false);
4273
4274 return Err(match error {
4275 Ok(value) => common::Error::BadRequest(value),
4276 _ => common::Error::Failure(response),
4277 });
4278 }
4279 let response = {
4280 let bytes = common::to_bytes(body).await.unwrap_or_default();
4281 let encoded = common::to_string(&bytes);
4282 match serde_json::from_str(&encoded) {
4283 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4284 Err(error) => {
4285 dlg.response_json_decode_error(&encoded, &error);
4286 return Err(common::Error::JsonDecodeError(
4287 encoded.to_string(),
4288 error,
4289 ));
4290 }
4291 }
4292 };
4293
4294 dlg.finished(true);
4295 return Ok(response);
4296 }
4297 }
4298 }
4299 }
4300
4301 /// Required. Format: `projects/{project}/locations/{location}`
4302 ///
4303 /// Sets the *parent* path property to the given value.
4304 ///
4305 /// Even though the property as already been set when instantiating this call,
4306 /// we provide this method for API completeness.
4307 pub fn parent(mut self, new_value: &str) -> ProjectLocationJobListCall<'a, C> {
4308 self._parent = new_value.to_string();
4309 self
4310 }
4311 /// The `next_page_token` value returned from a previous List request, if any.
4312 ///
4313 /// Sets the *page token* query property to the given value.
4314 pub fn page_token(mut self, new_value: &str) -> ProjectLocationJobListCall<'a, C> {
4315 self._page_token = Some(new_value.to_string());
4316 self
4317 }
4318 /// The maximum number of items to return.
4319 ///
4320 /// Sets the *page size* query property to the given value.
4321 pub fn page_size(mut self, new_value: i32) -> ProjectLocationJobListCall<'a, C> {
4322 self._page_size = Some(new_value);
4323 self
4324 }
4325 /// One or more fields to compare and use to sort the output. See https://google.aip.dev/132#ordering.
4326 ///
4327 /// Sets the *order by* query property to the given value.
4328 pub fn order_by(mut self, new_value: &str) -> ProjectLocationJobListCall<'a, C> {
4329 self._order_by = Some(new_value.to_string());
4330 self
4331 }
4332 /// The filter expression, following the syntax outlined in https://google.aip.dev/160.
4333 ///
4334 /// Sets the *filter* query property to the given value.
4335 pub fn filter(mut self, new_value: &str) -> ProjectLocationJobListCall<'a, C> {
4336 self._filter = Some(new_value.to_string());
4337 self
4338 }
4339 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4340 /// while executing the actual API request.
4341 ///
4342 /// ````text
4343 /// It should be used to handle progress information, and to implement a certain level of resilience.
4344 /// ````
4345 ///
4346 /// Sets the *delegate* property to the given value.
4347 pub fn delegate(
4348 mut self,
4349 new_value: &'a mut dyn common::Delegate,
4350 ) -> ProjectLocationJobListCall<'a, C> {
4351 self._delegate = Some(new_value);
4352 self
4353 }
4354
4355 /// Set any additional parameter of the query string used in the request.
4356 /// It should be used to set parameters which are not yet available through their own
4357 /// setters.
4358 ///
4359 /// Please note that this method must not be used to set any of the known parameters
4360 /// which have their own setter method. If done anyway, the request will fail.
4361 ///
4362 /// # Additional Parameters
4363 ///
4364 /// * *$.xgafv* (query-string) - V1 error format.
4365 /// * *access_token* (query-string) - OAuth access token.
4366 /// * *alt* (query-string) - Data format for response.
4367 /// * *callback* (query-string) - JSONP
4368 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4369 /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4370 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4371 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4372 /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4373 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4374 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4375 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationJobListCall<'a, C>
4376 where
4377 T: AsRef<str>,
4378 {
4379 self._additional_params
4380 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4381 self
4382 }
4383
4384 /// Identifies the authorization scope for the method you are building.
4385 ///
4386 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4387 /// [`Scope::CloudPlatform`].
4388 ///
4389 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4390 /// tokens for more than one scope.
4391 ///
4392 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4393 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4394 /// sufficient, a read-write scope will do as well.
4395 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationJobListCall<'a, C>
4396 where
4397 St: AsRef<str>,
4398 {
4399 self._scopes.insert(String::from(scope.as_ref()));
4400 self
4401 }
4402 /// Identifies the authorization scope(s) for the method you are building.
4403 ///
4404 /// See [`Self::add_scope()`] for details.
4405 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationJobListCall<'a, C>
4406 where
4407 I: IntoIterator<Item = St>,
4408 St: AsRef<str>,
4409 {
4410 self._scopes
4411 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4412 self
4413 }
4414
4415 /// Removes all scopes, and no default scope will be used either.
4416 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4417 /// for details).
4418 pub fn clear_scopes(mut self) -> ProjectLocationJobListCall<'a, C> {
4419 self._scopes.clear();
4420 self
4421 }
4422}