google_testing1/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 /// View your data across Google Cloud services and see the email address of your Google Account
20 CloudPlatformReadOnly,
21}
22
23impl AsRef<str> for Scope {
24 fn as_ref(&self) -> &str {
25 match *self {
26 Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
27 Scope::CloudPlatformReadOnly => {
28 "https://www.googleapis.com/auth/cloud-platform.read-only"
29 }
30 }
31 }
32}
33
34#[allow(clippy::derivable_impls)]
35impl Default for Scope {
36 fn default() -> Scope {
37 Scope::CloudPlatform
38 }
39}
40
41// ########
42// HUB ###
43// ######
44
45/// Central instance to access all Testing related resource activities
46///
47/// # Examples
48///
49/// Instantiate a new hub
50///
51/// ```test_harness,no_run
52/// extern crate hyper;
53/// extern crate hyper_rustls;
54/// extern crate google_testing1 as testing1;
55/// use testing1::api::DeviceSession;
56/// use testing1::{Result, Error};
57/// # async fn dox() {
58/// use testing1::{Testing, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
59///
60/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
61/// // `client_secret`, among other things.
62/// let secret: yup_oauth2::ApplicationSecret = Default::default();
63/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
64/// // unless you replace `None` with the desired Flow.
65/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
66/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
67/// // retrieve them from storage.
68/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
69/// secret,
70/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
71/// ).build().await.unwrap();
72///
73/// let client = hyper_util::client::legacy::Client::builder(
74/// hyper_util::rt::TokioExecutor::new()
75/// )
76/// .build(
77/// hyper_rustls::HttpsConnectorBuilder::new()
78/// .with_native_roots()
79/// .unwrap()
80/// .https_or_http()
81/// .enable_http1()
82/// .build()
83/// );
84/// let mut hub = Testing::new(client, auth);
85/// // As the method needs a request, you would usually fill it with the desired information
86/// // into the respective structure. Some of the parts shown here might not be applicable !
87/// // Values shown here are possibly random and not representative !
88/// let mut req = DeviceSession::default();
89///
90/// // You can configure optional parameters by calling the respective setters at will, and
91/// // execute the final call using `doit()`.
92/// // Values shown here are possibly random and not representative !
93/// let result = hub.projects().device_sessions_patch(req, "name")
94/// .update_mask(FieldMask::new::<&str>(&[]))
95/// .doit().await;
96///
97/// match result {
98/// Err(e) => match e {
99/// // The Error enum provides details about what exactly happened.
100/// // You can also just use its `Debug`, `Display` or `Error` traits
101/// Error::HttpError(_)
102/// |Error::Io(_)
103/// |Error::MissingAPIKey
104/// |Error::MissingToken(_)
105/// |Error::Cancelled
106/// |Error::UploadSizeLimitExceeded(_, _)
107/// |Error::Failure(_)
108/// |Error::BadRequest(_)
109/// |Error::FieldClash(_)
110/// |Error::JsonDecodeError(_, _) => println!("{}", e),
111/// },
112/// Ok(res) => println!("Success: {:?}", res),
113/// }
114/// # }
115/// ```
116#[derive(Clone)]
117pub struct Testing<C> {
118 pub client: common::Client<C>,
119 pub auth: Box<dyn common::GetToken>,
120 _user_agent: String,
121 _base_url: String,
122 _root_url: String,
123}
124
125impl<C> common::Hub for Testing<C> {}
126
127impl<'a, C> Testing<C> {
128 pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> Testing<C> {
129 Testing {
130 client,
131 auth: Box::new(auth),
132 _user_agent: "google-api-rust-client/6.0.0".to_string(),
133 _base_url: "https://testing.googleapis.com/".to_string(),
134 _root_url: "https://testing.googleapis.com/".to_string(),
135 }
136 }
137
138 pub fn application_detail_service(&'a self) -> ApplicationDetailServiceMethods<'a, C> {
139 ApplicationDetailServiceMethods { hub: self }
140 }
141 pub fn projects(&'a self) -> ProjectMethods<'a, C> {
142 ProjectMethods { hub: self }
143 }
144 pub fn test_environment_catalog(&'a self) -> TestEnvironmentCatalogMethods<'a, C> {
145 TestEnvironmentCatalogMethods { hub: self }
146 }
147
148 /// Set the user-agent header field to use in all requests to the server.
149 /// It defaults to `google-api-rust-client/6.0.0`.
150 ///
151 /// Returns the previously set user-agent.
152 pub fn user_agent(&mut self, agent_name: String) -> String {
153 std::mem::replace(&mut self._user_agent, agent_name)
154 }
155
156 /// Set the base url to use in all requests to the server.
157 /// It defaults to `https://testing.googleapis.com/`.
158 ///
159 /// Returns the previously set base url.
160 pub fn base_url(&mut self, new_base_url: String) -> String {
161 std::mem::replace(&mut self._base_url, new_base_url)
162 }
163
164 /// Set the root url to use in all requests to the server.
165 /// It defaults to `https://testing.googleapis.com/`.
166 ///
167 /// Returns the previously set root url.
168 pub fn root_url(&mut self, new_root_url: String) -> String {
169 std::mem::replace(&mut self._root_url, new_root_url)
170 }
171}
172
173// ############
174// SCHEMAS ###
175// ##########
176/// Identifies an account and how to log into it.
177///
178/// This type is not used in any activity, and only used as *part* of another schema.
179///
180#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
181#[serde_with::serde_as]
182#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
183pub struct Account {
184 /// An automatic google login account.
185 #[serde(rename = "googleAuto")]
186 pub google_auto: Option<GoogleAuto>,
187}
188
189impl common::Part for Account {}
190
191/// A single Android device.
192///
193/// This type is not used in any activity, and only used as *part* of another schema.
194///
195#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
196#[serde_with::serde_as]
197#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
198pub struct AndroidDevice {
199 /// Required. The id of the Android device to be used. Use the TestEnvironmentDiscoveryService to get supported options.
200 #[serde(rename = "androidModelId")]
201 pub android_model_id: Option<String>,
202 /// Required. The id of the Android OS version to be used. Use the TestEnvironmentDiscoveryService to get supported options.
203 #[serde(rename = "androidVersionId")]
204 pub android_version_id: Option<String>,
205 /// Required. The locale the test device used for testing. Use the TestEnvironmentDiscoveryService to get supported options.
206 pub locale: Option<String>,
207 /// Required. How the device is oriented during the test. Use the TestEnvironmentDiscoveryService to get supported options.
208 pub orientation: Option<String>,
209}
210
211impl common::Part for AndroidDevice {}
212
213/// The currently supported Android devices.
214///
215/// This type is not used in any activity, and only used as *part* of another schema.
216///
217#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
218#[serde_with::serde_as]
219#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
220pub struct AndroidDeviceCatalog {
221 /// The set of supported Android device models.
222 pub models: Option<Vec<AndroidModel>>,
223 /// The set of supported runtime configurations.
224 #[serde(rename = "runtimeConfiguration")]
225 pub runtime_configuration: Option<AndroidRuntimeConfiguration>,
226 /// The set of supported Android OS versions.
227 pub versions: Option<Vec<AndroidVersion>>,
228}
229
230impl common::Part for AndroidDeviceCatalog {}
231
232/// A list of Android device configurations in which the test is to be executed.
233///
234/// This type is not used in any activity, and only used as *part* of another schema.
235///
236#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
237#[serde_with::serde_as]
238#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
239pub struct AndroidDeviceList {
240 /// Required. A list of Android devices.
241 #[serde(rename = "androidDevices")]
242 pub android_devices: Option<Vec<AndroidDevice>>,
243}
244
245impl common::Part for AndroidDeviceList {}
246
247/// A test of an Android application that can control an Android component independently of its normal lifecycle. Android instrumentation tests run an application APK and test APK inside the same process on a virtual or physical AndroidDevice. They also specify a test runner class, such as com.google.GoogleTestRunner, which can vary on the specific instrumentation framework chosen. See for more information on types of Android tests.
248///
249/// This type is not used in any activity, and only used as *part* of another schema.
250///
251#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
252#[serde_with::serde_as]
253#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
254pub struct AndroidInstrumentationTest {
255 /// The APK for the application under test.
256 #[serde(rename = "appApk")]
257 pub app_apk: Option<FileReference>,
258 /// A multi-apk app bundle for the application under test.
259 #[serde(rename = "appBundle")]
260 pub app_bundle: Option<AppBundle>,
261 /// The java package for the application under test. The default value is determined by examining the application's manifest.
262 #[serde(rename = "appPackageId")]
263 pub app_package_id: Option<String>,
264 /// The option of whether running each test within its own invocation of instrumentation with Android Test Orchestrator or not. ** Orchestrator is only compatible with AndroidJUnitRunner version 1.1 or higher! ** Orchestrator offers the following benefits: - No shared state - Crashes are isolated - Logs are scoped per test See for more information about Android Test Orchestrator. If not set, the test will be run without the orchestrator.
265 #[serde(rename = "orchestratorOption")]
266 pub orchestrator_option: Option<String>,
267 /// The option to run tests in multiple shards in parallel.
268 #[serde(rename = "shardingOption")]
269 pub sharding_option: Option<ShardingOption>,
270 /// Required. The APK containing the test code to be executed.
271 #[serde(rename = "testApk")]
272 pub test_apk: Option<FileReference>,
273 /// The java package for the test to be executed. The default value is determined by examining the application's manifest.
274 #[serde(rename = "testPackageId")]
275 pub test_package_id: Option<String>,
276 /// The InstrumentationTestRunner class. The default value is determined by examining the application's manifest.
277 #[serde(rename = "testRunnerClass")]
278 pub test_runner_class: Option<String>,
279 /// Each target must be fully qualified with the package name or class name, in one of these formats: - "package package_name" - "class package_name.class_name" - "class package_name.class_name#method_name" If empty, all targets in the module will be run.
280 #[serde(rename = "testTargets")]
281 pub test_targets: Option<Vec<String>>,
282}
283
284impl common::Part for AndroidInstrumentationTest {}
285
286/// A set of Android device configuration permutations is defined by the the cross-product of the given axes. Internally, the given AndroidMatrix will be expanded into a set of AndroidDevices. Only supported permutations will be instantiated. Invalid permutations (e.g., incompatible models/versions) are ignored.
287///
288/// This type is not used in any activity, and only used as *part* of another schema.
289///
290#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
291#[serde_with::serde_as]
292#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
293pub struct AndroidMatrix {
294 /// Required. The ids of the set of Android device to be used. Use the TestEnvironmentDiscoveryService to get supported options.
295 #[serde(rename = "androidModelIds")]
296 pub android_model_ids: Option<Vec<String>>,
297 /// Required. The ids of the set of Android OS version to be used. Use the TestEnvironmentDiscoveryService to get supported options.
298 #[serde(rename = "androidVersionIds")]
299 pub android_version_ids: Option<Vec<String>>,
300 /// Required. The set of locales the test device will enable for testing. Use the TestEnvironmentDiscoveryService to get supported options.
301 pub locales: Option<Vec<String>>,
302 /// Required. The set of orientations to test with. Use the TestEnvironmentDiscoveryService to get supported options.
303 pub orientations: Option<Vec<String>>,
304}
305
306impl common::Part for AndroidMatrix {}
307
308/// A description of an Android device tests may be run on.
309///
310/// This type is not used in any activity, and only used as *part* of another schema.
311///
312#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
313#[serde_with::serde_as]
314#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
315pub struct AndroidModel {
316 /// The company that this device is branded with. Example: "Google", "Samsung".
317 pub brand: Option<String>,
318 /// The name of the industrial design. This corresponds to android.os.Build.DEVICE.
319 pub codename: Option<String>,
320 /// Whether this device is virtual or physical.
321 pub form: Option<String>,
322 /// Whether this device is a phone, tablet, wearable, etc.
323 #[serde(rename = "formFactor")]
324 pub form_factor: Option<String>,
325 /// The unique opaque id for this model. Use this for invoking the TestExecutionService.
326 pub id: Option<String>,
327 /// True if and only if tests with this model are recorded by stitching together screenshots. See use_low_spec_video_recording in device config.
328 #[serde(rename = "lowFpsVideoRecording")]
329 pub low_fps_video_recording: Option<bool>,
330 /// The manufacturer of this device.
331 pub manufacturer: Option<String>,
332 /// The human-readable marketing name for this device model. Examples: "Nexus 5", "Galaxy S5".
333 pub name: Option<String>,
334 /// Version-specific information of an Android model.
335 #[serde(rename = "perVersionInfo")]
336 pub per_version_info: Option<Vec<PerAndroidVersionInfo>>,
337 /// Screen density in DPI. This corresponds to ro.sf.lcd_density
338 #[serde(rename = "screenDensity")]
339 pub screen_density: Option<i32>,
340 /// Screen size in the horizontal (X) dimension measured in pixels.
341 #[serde(rename = "screenX")]
342 pub screen_x: Option<i32>,
343 /// Screen size in the vertical (Y) dimension measured in pixels.
344 #[serde(rename = "screenY")]
345 pub screen_y: Option<i32>,
346 /// The list of supported ABIs for this device. This corresponds to either android.os.Build.SUPPORTED_ABIS (for API level 21 and above) or android.os.Build.CPU_ABI/CPU_ABI2. The most preferred ABI is the first element in the list. Elements are optionally prefixed by "version_id:" (where version_id is the id of an AndroidVersion), denoting an ABI that is supported only on a particular version.
347 #[serde(rename = "supportedAbis")]
348 pub supported_abis: Option<Vec<String>>,
349 /// The set of Android versions this device supports.
350 #[serde(rename = "supportedVersionIds")]
351 pub supported_version_ids: Option<Vec<String>>,
352 /// Tags for this dimension. Examples: "default", "preview", "deprecated".
353 pub tags: Option<Vec<String>>,
354 /// URL of a thumbnail image (photo) of the device.
355 #[serde(rename = "thumbnailUrl")]
356 pub thumbnail_url: Option<String>,
357}
358
359impl common::Part for AndroidModel {}
360
361/// A test of an android application that explores the application on a virtual or physical Android Device, finding culprits and crashes as it goes.
362///
363/// This type is not used in any activity, and only used as *part* of another schema.
364///
365#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
366#[serde_with::serde_as]
367#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
368pub struct AndroidRoboTest {
369 /// The APK for the application under test.
370 #[serde(rename = "appApk")]
371 pub app_apk: Option<FileReference>,
372 /// A multi-apk app bundle for the application under test.
373 #[serde(rename = "appBundle")]
374 pub app_bundle: Option<AppBundle>,
375 /// The initial activity that should be used to start the app.
376 #[serde(rename = "appInitialActivity")]
377 pub app_initial_activity: Option<String>,
378 /// The java package for the application under test. The default value is determined by examining the application's manifest.
379 #[serde(rename = "appPackageId")]
380 pub app_package_id: Option<String>,
381 /// The max depth of the traversal stack Robo can explore. Needs to be at least 2 to make Robo explore the app beyond the first activity. Default is 50.
382 #[serde(rename = "maxDepth")]
383 pub max_depth: Option<i32>,
384 /// The max number of steps Robo can execute. Default is no limit.
385 #[serde(rename = "maxSteps")]
386 pub max_steps: Option<i32>,
387 /// A set of directives Robo should apply during the crawl. This allows users to customize the crawl. For example, the username and password for a test account can be provided.
388 #[serde(rename = "roboDirectives")]
389 pub robo_directives: Option<Vec<RoboDirective>>,
390 /// The mode in which Robo should run. Most clients should allow the server to populate this field automatically.
391 #[serde(rename = "roboMode")]
392 pub robo_mode: Option<String>,
393 /// A JSON file with a sequence of actions Robo should perform as a prologue for the crawl.
394 #[serde(rename = "roboScript")]
395 pub robo_script: Option<FileReference>,
396 /// The intents used to launch the app for the crawl. If none are provided, then the main launcher activity is launched. If some are provided, then only those provided are launched (the main launcher activity must be provided explicitly).
397 #[serde(rename = "startingIntents")]
398 pub starting_intents: Option<Vec<RoboStartingIntent>>,
399}
400
401impl common::Part for AndroidRoboTest {}
402
403/// Android configuration that can be selected at the time a test is run.
404///
405/// This type is not used in any activity, and only used as *part* of another schema.
406///
407#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
408#[serde_with::serde_as]
409#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
410pub struct AndroidRuntimeConfiguration {
411 /// The set of available locales.
412 pub locales: Option<Vec<Locale>>,
413 /// The set of available orientations.
414 pub orientations: Option<Vec<Orientation>>,
415}
416
417impl common::Part for AndroidRuntimeConfiguration {}
418
419/// A test of an Android Application with a Test Loop. The intent \ will be implicitly added, since Games is the only user of this api, for the time being.
420///
421/// This type is not used in any activity, and only used as *part* of another schema.
422///
423#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
424#[serde_with::serde_as]
425#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
426pub struct AndroidTestLoop {
427 /// The APK for the application under test.
428 #[serde(rename = "appApk")]
429 pub app_apk: Option<FileReference>,
430 /// A multi-apk app bundle for the application under test.
431 #[serde(rename = "appBundle")]
432 pub app_bundle: Option<AppBundle>,
433 /// The java package for the application under test. The default is determined by examining the application's manifest.
434 #[serde(rename = "appPackageId")]
435 pub app_package_id: Option<String>,
436 /// The list of scenario labels that should be run during the test. The scenario labels should map to labels defined in the application's manifest. For example, player_experience and com.google.test.loops.player_experience add all of the loops labeled in the manifest with the com.google.test.loops.player_experience name to the execution. Scenarios can also be specified in the scenarios field.
437 #[serde(rename = "scenarioLabels")]
438 pub scenario_labels: Option<Vec<String>>,
439 /// The list of scenarios that should be run during the test. The default is all test loops, derived from the application's manifest.
440 pub scenarios: Option<Vec<i32>>,
441}
442
443impl common::Part for AndroidTestLoop {}
444
445/// A version of the Android OS.
446///
447/// This type is not used in any activity, and only used as *part* of another schema.
448///
449#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
450#[serde_with::serde_as]
451#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
452pub struct AndroidVersion {
453 /// The API level for this Android version. Examples: 18, 19.
454 #[serde(rename = "apiLevel")]
455 pub api_level: Option<i32>,
456 /// The code name for this Android version. Examples: "JellyBean", "KitKat".
457 #[serde(rename = "codeName")]
458 pub code_name: Option<String>,
459 /// Market share for this version.
460 pub distribution: Option<Distribution>,
461 /// An opaque id for this Android version. Use this id to invoke the TestExecutionService.
462 pub id: Option<String>,
463 /// The date this Android version became available in the market.
464 #[serde(rename = "releaseDate")]
465 pub release_date: Option<Date>,
466 /// Tags for this dimension. Examples: "default", "preview", "deprecated".
467 pub tags: Option<Vec<String>>,
468 /// A string representing this version of the Android OS. Examples: "4.3", "4.4".
469 #[serde(rename = "versionString")]
470 pub version_string: Option<String>,
471}
472
473impl common::Part for AndroidVersion {}
474
475/// An Android package file to install.
476///
477/// This type is not used in any activity, and only used as *part* of another schema.
478///
479#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
480#[serde_with::serde_as]
481#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
482pub struct Apk {
483 /// The path to an APK to be installed on the device before the test begins.
484 pub location: Option<FileReference>,
485 /// The java package for the APK to be installed. Value is determined by examining the application's manifest.
486 #[serde(rename = "packageName")]
487 pub package_name: Option<String>,
488}
489
490impl common::Part for Apk {}
491
492/// Android application details based on application manifest and archive contents.
493///
494/// This type is not used in any activity, and only used as *part* of another schema.
495///
496#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
497#[serde_with::serde_as]
498#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
499pub struct ApkDetail {
500 /// no description provided
501 #[serde(rename = "apkManifest")]
502 pub apk_manifest: Option<ApkManifest>,
503}
504
505impl common::Part for ApkDetail {}
506
507/// An Android app manifest. See http://developer.android.com/guide/topics/manifest/manifest-intro.html
508///
509/// This type is not used in any activity, and only used as *part* of another schema.
510///
511#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
512#[serde_with::serde_as]
513#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
514pub struct ApkManifest {
515 /// User-readable name for the application.
516 #[serde(rename = "applicationLabel")]
517 pub application_label: Option<String>,
518 /// no description provided
519 #[serde(rename = "intentFilters")]
520 pub intent_filters: Option<Vec<IntentFilter>>,
521 /// Maximum API level on which the application is designed to run.
522 #[serde(rename = "maxSdkVersion")]
523 pub max_sdk_version: Option<i32>,
524 /// Meta-data tags defined in the manifest.
525 pub metadata: Option<Vec<Metadata>>,
526 /// Minimum API level required for the application to run.
527 #[serde(rename = "minSdkVersion")]
528 pub min_sdk_version: Option<i32>,
529 /// Full Java-style package name for this application, e.g. "com.example.foo".
530 #[serde(rename = "packageName")]
531 pub package_name: Option<String>,
532 /// Services contained in the tag.
533 pub services: Option<Vec<Service>>,
534 /// Specifies the API Level on which the application is designed to run.
535 #[serde(rename = "targetSdkVersion")]
536 pub target_sdk_version: Option<i32>,
537 /// Feature usage tags defined in the manifest.
538 #[serde(rename = "usesFeature")]
539 pub uses_feature: Option<Vec<UsesFeature>>,
540 /// Permissions declared to be used by the application
541 #[serde(rename = "usesPermission")]
542 pub uses_permission: Option<Vec<String>>,
543 /// Version number used internally by the app.
544 #[serde(rename = "versionCode")]
545 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
546 pub version_code: Option<i64>,
547 /// Version number shown to users.
548 #[serde(rename = "versionName")]
549 pub version_name: Option<String>,
550}
551
552impl common::Part for ApkManifest {}
553
554/// An Android App Bundle file format, containing a BundleConfig.pb file, a base module directory, zero or more dynamic feature module directories. See https://developer.android.com/guide/app-bundle/build for guidance on building App Bundles.
555///
556/// This type is not used in any activity, and only used as *part* of another schema.
557///
558#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
559#[serde_with::serde_as]
560#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
561pub struct AppBundle {
562 /// .aab file representing the app bundle under test.
563 #[serde(rename = "bundleLocation")]
564 pub bundle_location: Option<FileReference>,
565}
566
567impl common::Part for AppBundle {}
568
569/// The request object for cancelling a Device Session.
570///
571/// # Activities
572///
573/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
574/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
575///
576/// * [device sessions cancel projects](ProjectDeviceSessionCancelCall) (request)
577#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
578#[serde_with::serde_as]
579#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
580pub struct CancelDeviceSessionRequest {
581 _never_set: Option<bool>,
582}
583
584impl common::RequestValue for CancelDeviceSessionRequest {}
585
586/// Response containing the current state of the specified test matrix.
587///
588/// # Activities
589///
590/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
591/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
592///
593/// * [test matrices cancel projects](ProjectTestMatriceCancelCall) (response)
594#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
595#[serde_with::serde_as]
596#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
597pub struct CancelTestMatrixResponse {
598 /// The current rolled-up state of the test matrix. If this state is already final, then the cancelation request will have no effect.
599 #[serde(rename = "testState")]
600 pub test_state: Option<String>,
601}
602
603impl common::ResponseResult for CancelTestMatrixResponse {}
604
605/// Information about the client which invoked the test.
606///
607/// This type is not used in any activity, and only used as *part* of another schema.
608///
609#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
610#[serde_with::serde_as]
611#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
612pub struct ClientInfo {
613 /// The list of detailed information about client.
614 #[serde(rename = "clientInfoDetails")]
615 pub client_info_details: Option<Vec<ClientInfoDetail>>,
616 /// Required. Client name, such as gcloud.
617 pub name: Option<String>,
618}
619
620impl common::Part for ClientInfo {}
621
622/// Key-value pair of detailed information about the client which invoked the test. Examples: {'Version', '1.0'}, {'Release Track', 'BETA'}.
623///
624/// This type is not used in any activity, and only used as *part* of another schema.
625///
626#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
627#[serde_with::serde_as]
628#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
629pub struct ClientInfoDetail {
630 /// Required. The key of detailed client information.
631 pub key: Option<String>,
632 /// Required. The value of detailed client information.
633 pub value: Option<String>,
634}
635
636impl common::Part for ClientInfoDetail {}
637
638/// Represents a whole or partial calendar date, such as a birthday. The time of day and time zone are either specified elsewhere or are insignificant. The date is relative to the Gregorian Calendar. This can represent one of the following: * A full date, with non-zero year, month, and day values. * A month and day, with a zero year (for example, an anniversary). * A year on its own, with a zero month and a zero day. * A year and month, with a zero day (for example, a credit card expiration date). Related types: * google.type.TimeOfDay * google.type.DateTime * google.protobuf.Timestamp
639///
640/// This type is not used in any activity, and only used as *part* of another schema.
641///
642#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
643#[serde_with::serde_as]
644#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
645pub struct Date {
646 /// Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.
647 pub day: Option<i32>,
648 /// Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
649 pub month: Option<i32>,
650 /// Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
651 pub year: Option<i32>,
652}
653
654impl common::Part for Date {}
655
656/// A single device file description.
657///
658/// This type is not used in any activity, and only used as *part* of another schema.
659///
660#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
661#[serde_with::serde_as]
662#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
663pub struct DeviceFile {
664 /// A reference to an opaque binary blob file.
665 #[serde(rename = "obbFile")]
666 pub obb_file: Option<ObbFile>,
667 /// A reference to a regular file.
668 #[serde(rename = "regularFile")]
669 pub regular_file: Option<RegularFile>,
670}
671
672impl common::Part for DeviceFile {}
673
674/// A single device IP block
675///
676/// This type is not used in any activity, and only used as *part* of another schema.
677///
678#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
679#[serde_with::serde_as]
680#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
681pub struct DeviceIpBlock {
682 /// The date this block was added to Firebase Test Lab
683 #[serde(rename = "addedDate")]
684 pub added_date: Option<Date>,
685 /// An IP address block in CIDR notation eg: 34.68.194.64/29
686 pub block: Option<String>,
687 /// Whether this block is used by physical or virtual devices
688 pub form: Option<String>,
689}
690
691impl common::Part for DeviceIpBlock {}
692
693/// List of IP blocks used by the Firebase Test Lab
694///
695/// This type is not used in any activity, and only used as *part* of another schema.
696///
697#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
698#[serde_with::serde_as]
699#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
700pub struct DeviceIpBlockCatalog {
701 /// The device IP blocks used by Firebase Test Lab
702 #[serde(rename = "ipBlocks")]
703 pub ip_blocks: Option<Vec<DeviceIpBlock>>,
704}
705
706impl common::Part for DeviceIpBlockCatalog {}
707
708/// Protobuf message describing the device message, used from several RPCs.
709///
710/// # Activities
711///
712/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
713/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
714///
715/// * [device sessions create projects](ProjectDeviceSessionCreateCall) (request|response)
716/// * [device sessions get projects](ProjectDeviceSessionGetCall) (response)
717/// * [device sessions patch projects](ProjectDeviceSessionPatchCall) (request|response)
718#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
719#[serde_with::serde_as]
720#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
721pub struct DeviceSession {
722 /// Output only. The timestamp that the session first became ACTIVE.
723 #[serde(rename = "activeStartTime")]
724 pub active_start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
725 /// Required. The requested device
726 #[serde(rename = "androidDevice")]
727 pub android_device: Option<AndroidDevice>,
728 /// Output only. The time that the Session was created.
729 #[serde(rename = "createTime")]
730 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
731 /// Output only. The title of the DeviceSession to be presented in the UI.
732 #[serde(rename = "displayName")]
733 pub display_name: Option<String>,
734 /// Optional. If the device is still in use at this time, any connections will be ended and the SessionState will transition from ACTIVE to FINISHED.
735 #[serde(rename = "expireTime")]
736 pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
737 /// Output only. The interval of time that this device must be interacted with before it transitions from ACTIVE to TIMEOUT_INACTIVITY.
738 #[serde(rename = "inactivityTimeout")]
739 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
740 pub inactivity_timeout: Option<chrono::Duration>,
741 /// Optional. Name of the DeviceSession, e.g. "projects/{project_id}/deviceSessions/{session_id}"
742 pub name: Option<String>,
743 /// Output only. Current state of the DeviceSession.
744 pub state: Option<String>,
745 /// Output only. The historical state transitions of the session_state message including the current session state.
746 #[serde(rename = "stateHistories")]
747 pub state_histories: Option<Vec<SessionStateEvent>>,
748 /// Optional. The amount of time that a device will be initially allocated for. This can eventually be extended with the UpdateDeviceSession RPC. Default: 15 minutes.
749 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
750 pub ttl: Option<chrono::Duration>,
751}
752
753impl common::RequestValue for DeviceSession {}
754impl common::ResponseResult for DeviceSession {}
755
756/// Denotes whether Direct Access is supported, and by which client versions. DirectAccessService is currently available as a preview to select developers. You can register today on behalf of you and your team at https://developer.android.com/studio/preview/android-device-streaming
757///
758/// This type is not used in any activity, and only used as *part* of another schema.
759///
760#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
761#[serde_with::serde_as]
762#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
763pub struct DirectAccessVersionInfo {
764 /// Whether direct access is supported at all. Clients are expected to filter down the device list to only android models and versions which support Direct Access when that is the user intent.
765 #[serde(rename = "directAccessSupported")]
766 pub direct_access_supported: Option<bool>,
767 /// Output only. Indicates client-device compatibility, where a device is known to work only with certain workarounds implemented in the Android Studio client. Expected format "major.minor.micro.patch", e.g. "5921.22.2211.8881706".
768 #[serde(rename = "minimumAndroidStudioVersion")]
769 pub minimum_android_studio_version: Option<String>,
770}
771
772impl common::Part for DirectAccessVersionInfo {}
773
774/// Data about the relative number of devices running a given configuration of the Android platform.
775///
776/// This type is not used in any activity, and only used as *part* of another schema.
777///
778#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
779#[serde_with::serde_as]
780#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
781pub struct Distribution {
782 /// Output only. The estimated fraction (0-1) of the total market with this configuration.
783 #[serde(rename = "marketShare")]
784 pub market_share: Option<f64>,
785 /// Output only. The time this distribution was measured.
786 #[serde(rename = "measurementTime")]
787 pub measurement_time: Option<chrono::DateTime<chrono::offset::Utc>>,
788}
789
790impl common::Part for Distribution {}
791
792/// 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); }
793///
794/// # Activities
795///
796/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
797/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
798///
799/// * [device sessions cancel projects](ProjectDeviceSessionCancelCall) (response)
800#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
801#[serde_with::serde_as]
802#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
803pub struct Empty {
804 _never_set: Option<bool>,
805}
806
807impl common::ResponseResult for Empty {}
808
809/// The environment in which the test is run.
810///
811/// This type is not used in any activity, and only used as *part* of another schema.
812///
813#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
814#[serde_with::serde_as]
815#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
816pub struct Environment {
817 /// An Android device which must be used with an Android test.
818 #[serde(rename = "androidDevice")]
819 pub android_device: Option<AndroidDevice>,
820 /// An iOS device which must be used with an iOS test.
821 #[serde(rename = "iosDevice")]
822 pub ios_device: Option<IosDevice>,
823}
824
825impl common::Part for Environment {}
826
827/// The matrix of environments in which the test is to be executed.
828///
829/// This type is not used in any activity, and only used as *part* of another schema.
830///
831#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
832#[serde_with::serde_as]
833#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
834pub struct EnvironmentMatrix {
835 /// A list of Android devices; the test will be run only on the specified devices.
836 #[serde(rename = "androidDeviceList")]
837 pub android_device_list: Option<AndroidDeviceList>,
838 /// A matrix of Android devices.
839 #[serde(rename = "androidMatrix")]
840 pub android_matrix: Option<AndroidMatrix>,
841 /// A list of iOS devices.
842 #[serde(rename = "iosDeviceList")]
843 pub ios_device_list: Option<IosDeviceList>,
844}
845
846impl common::Part for EnvironmentMatrix {}
847
848/// A key-value pair passed as an environment variable to the test.
849///
850/// This type is not used in any activity, and only used as *part* of another schema.
851///
852#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
853#[serde_with::serde_as]
854#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
855pub struct EnvironmentVariable {
856 /// Key for the environment variable.
857 pub key: Option<String>,
858 /// Value for the environment variable.
859 pub value: Option<String>,
860}
861
862impl common::Part for EnvironmentVariable {}
863
864/// A reference to a file, used for user inputs.
865///
866/// # Activities
867///
868/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
869/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
870///
871/// * [get apk details application detail service](ApplicationDetailServiceGetApkDetailCall) (request)
872#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
873#[serde_with::serde_as]
874#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
875pub struct FileReference {
876 /// A path to a file in Google Cloud Storage. Example: gs://build-app-1414623860166/app%40debug-unaligned.apk These paths are expected to be url encoded (percent encoding)
877 #[serde(rename = "gcsPath")]
878 pub gcs_path: Option<String>,
879}
880
881impl common::RequestValue for FileReference {}
882
883/// Response containing the details of the specified Android application.
884///
885/// # Activities
886///
887/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
888/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
889///
890/// * [get apk details application detail service](ApplicationDetailServiceGetApkDetailCall) (response)
891#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
892#[serde_with::serde_as]
893#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
894pub struct GetApkDetailsResponse {
895 /// Details of the Android App.
896 #[serde(rename = "apkDetail")]
897 pub apk_detail: Option<ApkDetail>,
898}
899
900impl common::ResponseResult for GetApkDetailsResponse {}
901
902/// Enables automatic Google account login. If set, the service automatically generates a Google test account and adds it to the device, before executing the test. Note that test accounts might be reused. Many applications show their full set of functionalities when an account is present on the device. Logging into the device with these generated accounts allows testing more functionalities.
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 GoogleAuto {
910 _never_set: Option<bool>,
911}
912
913impl common::Part for GoogleAuto {}
914
915/// A storage location within Google cloud storage (GCS).
916///
917/// This type is not used in any activity, and only used as *part* of another schema.
918///
919#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
920#[serde_with::serde_as]
921#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
922pub struct GoogleCloudStorage {
923 /// Required. The path to a directory in GCS that will eventually contain the results for this test. The requesting user must have write access on the bucket in the supplied path.
924 #[serde(rename = "gcsPath")]
925 pub gcs_path: Option<String>,
926}
927
928impl common::Part for GoogleCloudStorage {}
929
930/// The section of an tag. https://developer.android.com/guide/topics/manifest/intent-filter-element.html
931///
932/// This type is not used in any activity, and only used as *part* of another schema.
933///
934#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
935#[serde_with::serde_as]
936#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
937pub struct IntentFilter {
938 /// The android:name value of the tag.
939 #[serde(rename = "actionNames")]
940 pub action_names: Option<Vec<String>>,
941 /// The android:name value of the tag.
942 #[serde(rename = "categoryNames")]
943 pub category_names: Option<Vec<String>>,
944 /// The android:mimeType value of the tag.
945 #[serde(rename = "mimeType")]
946 pub mime_type: Option<String>,
947}
948
949impl common::Part for IntentFilter {}
950
951/// A single iOS device.
952///
953/// This type is not used in any activity, and only used as *part* of another schema.
954///
955#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
956#[serde_with::serde_as]
957#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
958pub struct IosDevice {
959 /// Required. The id of the iOS device to be used. Use the TestEnvironmentDiscoveryService to get supported options.
960 #[serde(rename = "iosModelId")]
961 pub ios_model_id: Option<String>,
962 /// Required. The id of the iOS major software version to be used. Use the TestEnvironmentDiscoveryService to get supported options.
963 #[serde(rename = "iosVersionId")]
964 pub ios_version_id: Option<String>,
965 /// Required. The locale the test device used for testing. Use the TestEnvironmentDiscoveryService to get supported options.
966 pub locale: Option<String>,
967 /// Required. How the device is oriented during the test. Use the TestEnvironmentDiscoveryService to get supported options.
968 pub orientation: Option<String>,
969}
970
971impl common::Part for IosDevice {}
972
973/// The currently supported iOS devices.
974///
975/// This type is not used in any activity, and only used as *part* of another schema.
976///
977#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
978#[serde_with::serde_as]
979#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
980pub struct IosDeviceCatalog {
981 /// The set of supported iOS device models.
982 pub models: Option<Vec<IosModel>>,
983 /// The set of supported runtime configurations.
984 #[serde(rename = "runtimeConfiguration")]
985 pub runtime_configuration: Option<IosRuntimeConfiguration>,
986 /// The set of supported iOS software versions.
987 pub versions: Option<Vec<IosVersion>>,
988 /// The set of supported Xcode versions.
989 #[serde(rename = "xcodeVersions")]
990 pub xcode_versions: Option<Vec<XcodeVersion>>,
991}
992
993impl common::Part for IosDeviceCatalog {}
994
995/// A file or directory to install on the device before the test starts.
996///
997/// This type is not used in any activity, and only used as *part* of another schema.
998///
999#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1000#[serde_with::serde_as]
1001#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1002pub struct IosDeviceFile {
1003 /// The bundle id of the app where this file lives. iOS apps sandbox their own filesystem, so app files must specify which app installed on the device.
1004 #[serde(rename = "bundleId")]
1005 pub bundle_id: Option<String>,
1006 /// The source file
1007 pub content: Option<FileReference>,
1008 /// Location of the file on the device, inside the app's sandboxed filesystem
1009 #[serde(rename = "devicePath")]
1010 pub device_path: Option<String>,
1011}
1012
1013impl common::Part for IosDeviceFile {}
1014
1015/// A list of iOS device configurations in which the test is to be executed.
1016///
1017/// This type is not used in any activity, and only used as *part* of another schema.
1018///
1019#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1020#[serde_with::serde_as]
1021#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1022pub struct IosDeviceList {
1023 /// Required. A list of iOS devices.
1024 #[serde(rename = "iosDevices")]
1025 pub ios_devices: Option<Vec<IosDevice>>,
1026}
1027
1028impl common::Part for IosDeviceList {}
1029
1030/// A description of an iOS device tests may be run on.
1031///
1032/// This type is not used in any activity, and only used as *part* of another schema.
1033///
1034#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1035#[serde_with::serde_as]
1036#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1037pub struct IosModel {
1038 /// Device capabilities. Copied from https://developer.apple.com/library/archive/documentation/DeviceInformation/Reference/iOSDeviceCompatibility/DeviceCompatibilityMatrix/DeviceCompatibilityMatrix.html
1039 #[serde(rename = "deviceCapabilities")]
1040 pub device_capabilities: Option<Vec<String>>,
1041 /// Whether this device is a phone, tablet, wearable, etc.
1042 #[serde(rename = "formFactor")]
1043 pub form_factor: Option<String>,
1044 /// The unique opaque id for this model. Use this for invoking the TestExecutionService.
1045 pub id: Option<String>,
1046 /// The human-readable name for this device model. Examples: "iPhone 4s", "iPad Mini 2".
1047 pub name: Option<String>,
1048 /// Version-specific information of an iOS model.
1049 #[serde(rename = "perVersionInfo")]
1050 pub per_version_info: Option<Vec<PerIosVersionInfo>>,
1051 /// Screen density in DPI.
1052 #[serde(rename = "screenDensity")]
1053 pub screen_density: Option<i32>,
1054 /// Screen size in the horizontal (X) dimension measured in pixels.
1055 #[serde(rename = "screenX")]
1056 pub screen_x: Option<i32>,
1057 /// Screen size in the vertical (Y) dimension measured in pixels.
1058 #[serde(rename = "screenY")]
1059 pub screen_y: Option<i32>,
1060 /// The set of iOS major software versions this device supports.
1061 #[serde(rename = "supportedVersionIds")]
1062 pub supported_version_ids: Option<Vec<String>>,
1063 /// Tags for this dimension. Examples: "default", "preview", "deprecated".
1064 pub tags: Option<Vec<String>>,
1065}
1066
1067impl common::Part for IosModel {}
1068
1069/// A test that explores an iOS application on an iOS device.
1070///
1071/// This type is not used in any activity, and only used as *part* of another schema.
1072///
1073#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1074#[serde_with::serde_as]
1075#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1076pub struct IosRoboTest {
1077 /// The bundle ID for the app-under-test. This is determined by examining the application's "Info.plist" file.
1078 #[serde(rename = "appBundleId")]
1079 pub app_bundle_id: Option<String>,
1080 /// Required. The ipa stored at this file should be used to run the test.
1081 #[serde(rename = "appIpa")]
1082 pub app_ipa: Option<FileReference>,
1083 /// An optional Roboscript to customize the crawl. See https://firebase.google.com/docs/test-lab/android/robo-scripts-reference for more information about Roboscripts.
1084 #[serde(rename = "roboScript")]
1085 pub robo_script: Option<FileReference>,
1086}
1087
1088impl common::Part for IosRoboTest {}
1089
1090/// iOS configuration that can be selected at the time a test is run.
1091///
1092/// This type is not used in any activity, and only used as *part* of another schema.
1093///
1094#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1095#[serde_with::serde_as]
1096#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1097pub struct IosRuntimeConfiguration {
1098 /// The set of available locales.
1099 pub locales: Option<Vec<Locale>>,
1100 /// The set of available orientations.
1101 pub orientations: Option<Vec<Orientation>>,
1102}
1103
1104impl common::Part for IosRuntimeConfiguration {}
1105
1106/// A test of an iOS application that implements one or more game loop scenarios. This test type accepts an archived application (.ipa file) and a list of integer scenarios that will be executed on the app sequentially.
1107///
1108/// This type is not used in any activity, and only used as *part* of another schema.
1109///
1110#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1111#[serde_with::serde_as]
1112#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1113pub struct IosTestLoop {
1114 /// Output only. The bundle id for the application under test.
1115 #[serde(rename = "appBundleId")]
1116 pub app_bundle_id: Option<String>,
1117 /// Required. The .ipa of the application to test.
1118 #[serde(rename = "appIpa")]
1119 pub app_ipa: Option<FileReference>,
1120 /// The list of scenarios that should be run during the test. Defaults to the single scenario 0 if unspecified.
1121 pub scenarios: Option<Vec<i32>>,
1122}
1123
1124impl common::Part for IosTestLoop {}
1125
1126/// A description of how to set up an iOS device prior to running the test.
1127///
1128/// This type is not used in any activity, and only used as *part* of another schema.
1129///
1130#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1131#[serde_with::serde_as]
1132#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1133pub struct IosTestSetup {
1134 /// iOS apps to install in addition to those being directly tested.
1135 #[serde(rename = "additionalIpas")]
1136 pub additional_ipas: Option<Vec<FileReference>>,
1137 /// The network traffic profile used for running the test. Available network profiles can be queried by using the NETWORK_CONFIGURATION environment type when calling TestEnvironmentDiscoveryService.GetTestEnvironmentCatalog.
1138 #[serde(rename = "networkProfile")]
1139 pub network_profile: Option<String>,
1140 /// List of directories on the device to upload to Cloud Storage at the end of the test. Directories should either be in a shared directory (such as /private/var/mobile/Media) or within an accessible directory inside the app's filesystem (such as /Documents) by specifying the bundle ID.
1141 #[serde(rename = "pullDirectories")]
1142 pub pull_directories: Option<Vec<IosDeviceFile>>,
1143 /// List of files to push to the device before starting the test.
1144 #[serde(rename = "pushFiles")]
1145 pub push_files: Option<Vec<IosDeviceFile>>,
1146}
1147
1148impl common::Part for IosTestSetup {}
1149
1150/// An iOS version.
1151///
1152/// This type is not used in any activity, and only used as *part* of another schema.
1153///
1154#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1155#[serde_with::serde_as]
1156#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1157pub struct IosVersion {
1158 /// An opaque id for this iOS version. Use this id to invoke the TestExecutionService.
1159 pub id: Option<String>,
1160 /// An integer representing the major iOS version. Examples: "8", "9".
1161 #[serde(rename = "majorVersion")]
1162 pub major_version: Option<i32>,
1163 /// An integer representing the minor iOS version. Examples: "1", "2".
1164 #[serde(rename = "minorVersion")]
1165 pub minor_version: Option<i32>,
1166 /// The available Xcode versions for this version.
1167 #[serde(rename = "supportedXcodeVersionIds")]
1168 pub supported_xcode_version_ids: Option<Vec<String>>,
1169 /// Tags for this dimension. Examples: "default", "preview", "deprecated".
1170 pub tags: Option<Vec<String>>,
1171}
1172
1173impl common::Part for IosVersion {}
1174
1175/// A test of an iOS application that uses the XCTest framework. Xcode supports the option to "build for testing", which generates an .xctestrun file that contains a test specification (arguments, test methods, etc). This test type accepts a zip file containing the .xctestrun file and the corresponding contents of the Build/Products directory that contains all the binaries needed to run the tests.
1176///
1177/// This type is not used in any activity, and only used as *part* of another schema.
1178///
1179#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1180#[serde_with::serde_as]
1181#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1182pub struct IosXcTest {
1183 /// Output only. The bundle id for the application under test.
1184 #[serde(rename = "appBundleId")]
1185 pub app_bundle_id: Option<String>,
1186 /// The option to test special app entitlements. Setting this would re-sign the app having special entitlements with an explicit application-identifier. Currently supports testing aps-environment entitlement.
1187 #[serde(rename = "testSpecialEntitlements")]
1188 pub test_special_entitlements: Option<bool>,
1189 /// Required. The .zip containing the .xctestrun file and the contents of the DerivedData/Build/Products directory. The .xctestrun file in this zip is ignored if the xctestrun field is specified.
1190 #[serde(rename = "testsZip")]
1191 pub tests_zip: Option<FileReference>,
1192 /// The Xcode version that should be used for the test. Use the TestEnvironmentDiscoveryService to get supported options. Defaults to the latest Xcode version Firebase Test Lab supports.
1193 #[serde(rename = "xcodeVersion")]
1194 pub xcode_version: Option<String>,
1195 /// An .xctestrun file that will override the .xctestrun file in the tests zip. Because the .xctestrun file contains environment variables along with test methods to run and/or ignore, this can be useful for sharding tests. Default is taken from the tests zip.
1196 pub xctestrun: Option<FileReference>,
1197}
1198
1199impl common::Part for IosXcTest {}
1200
1201/// Specifies an intent that starts the main launcher activity.
1202///
1203/// This type is not used in any activity, and only used as *part* of another schema.
1204///
1205#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1206#[serde_with::serde_as]
1207#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1208pub struct LauncherActivityIntent {
1209 _never_set: Option<bool>,
1210}
1211
1212impl common::Part for LauncherActivityIntent {}
1213
1214/// A list of device sessions.
1215///
1216/// # Activities
1217///
1218/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1219/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1220///
1221/// * [device sessions list projects](ProjectDeviceSessionListCall) (response)
1222#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1223#[serde_with::serde_as]
1224#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1225pub struct ListDeviceSessionsResponse {
1226 /// The sessions matching the specified filter in the given cloud project.
1227 #[serde(rename = "deviceSessions")]
1228 pub device_sessions: Option<Vec<DeviceSession>>,
1229 /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1230 #[serde(rename = "nextPageToken")]
1231 pub next_page_token: Option<String>,
1232}
1233
1234impl common::ResponseResult for ListDeviceSessionsResponse {}
1235
1236/// A location/region designation for language.
1237///
1238/// This type is not used in any activity, and only used as *part* of another schema.
1239///
1240#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1241#[serde_with::serde_as]
1242#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1243pub struct Locale {
1244 /// The id for this locale. Example: "en_US".
1245 pub id: Option<String>,
1246 /// A human-friendly name for this language/locale. Example: "English".
1247 pub name: Option<String>,
1248 /// A human-friendly string representing the region for this locale. Example: "United States". Not present for every locale.
1249 pub region: Option<String>,
1250 /// Tags for this dimension. Example: "default".
1251 pub tags: Option<Vec<String>>,
1252}
1253
1254impl common::Part for Locale {}
1255
1256/// Shards test cases into the specified groups of packages, classes, and/or methods. With manual sharding enabled, specifying test targets via environment_variables or in InstrumentationTest is invalid.
1257///
1258/// This type is not used in any activity, and only used as *part* of another schema.
1259///
1260#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1261#[serde_with::serde_as]
1262#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1263pub struct ManualSharding {
1264 /// Required. Group of packages, classes, and/or test methods to be run for each manually-created shard. You must specify at least one shard if this field is present. When you select one or more physical devices, the number of repeated test_targets_for_shard must be <= 50. When you select one or more ARM virtual devices, it must be <= 200. When you select only x86 virtual devices, it must be <= 500.
1265 #[serde(rename = "testTargetsForShard")]
1266 pub test_targets_for_shard: Option<Vec<TestTargetsForShard>>,
1267}
1268
1269impl common::Part for ManualSharding {}
1270
1271/// Describes a single error or issue with a matrix.
1272///
1273/// This type is not used in any activity, and only used as *part* of another schema.
1274///
1275#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1276#[serde_with::serde_as]
1277#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1278pub struct MatrixErrorDetail {
1279 /// Output only. A human-readable message about how the error in the TestMatrix. Expands on the `reason` field with additional details and possible options to fix the issue.
1280 pub message: Option<String>,
1281 /// Output only. The reason for the error. This is a constant value in UPPER_SNAKE_CASE that identifies the cause of the error.
1282 pub reason: Option<String>,
1283}
1284
1285impl common::Part for MatrixErrorDetail {}
1286
1287/// A tag within a manifest. https://developer.android.com/guide/topics/manifest/meta-data-element.html
1288///
1289/// This type is not used in any activity, and only used as *part* of another schema.
1290///
1291#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1292#[serde_with::serde_as]
1293#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1294pub struct Metadata {
1295 /// The android:name value
1296 pub name: Option<String>,
1297 /// The android:value value
1298 pub value: Option<String>,
1299}
1300
1301impl common::Part for Metadata {}
1302
1303/// There is no detailed description.
1304///
1305/// This type is not used in any activity, and only used as *part* of another schema.
1306///
1307#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1308#[serde_with::serde_as]
1309#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1310pub struct NetworkConfiguration {
1311 /// The emulation rule applying to the download traffic.
1312 #[serde(rename = "downRule")]
1313 pub down_rule: Option<TrafficRule>,
1314 /// The unique opaque id for this network traffic configuration.
1315 pub id: Option<String>,
1316 /// The emulation rule applying to the upload traffic.
1317 #[serde(rename = "upRule")]
1318 pub up_rule: Option<TrafficRule>,
1319}
1320
1321impl common::Part for NetworkConfiguration {}
1322
1323/// There is no detailed description.
1324///
1325/// This type is not used in any activity, and only used as *part* of another schema.
1326///
1327#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1328#[serde_with::serde_as]
1329#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1330pub struct NetworkConfigurationCatalog {
1331 /// no description provided
1332 pub configurations: Option<Vec<NetworkConfiguration>>,
1333}
1334
1335impl common::Part for NetworkConfigurationCatalog {}
1336
1337/// Skips the starting activity
1338///
1339/// This type is not used in any activity, and only used as *part* of another schema.
1340///
1341#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1342#[serde_with::serde_as]
1343#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1344pub struct NoActivityIntent {
1345 _never_set: Option<bool>,
1346}
1347
1348impl common::Part for NoActivityIntent {}
1349
1350/// An opaque binary blob file to install on the device before the test starts.
1351///
1352/// This type is not used in any activity, and only used as *part* of another schema.
1353///
1354#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1355#[serde_with::serde_as]
1356#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1357pub struct ObbFile {
1358 /// Required. Opaque Binary Blob (OBB) file(s) to install on the device.
1359 pub obb: Option<FileReference>,
1360 /// Required. OBB file name which must conform to the format as specified by Android e.g. [main|patch].0300110.com.example.android.obb which will be installed into \/Android/obb/\/ on the device.
1361 #[serde(rename = "obbFileName")]
1362 pub obb_file_name: Option<String>,
1363}
1364
1365impl common::Part for ObbFile {}
1366
1367/// Screen orientation of the device.
1368///
1369/// This type is not used in any activity, and only used as *part* of another schema.
1370///
1371#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1372#[serde_with::serde_as]
1373#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1374pub struct Orientation {
1375 /// The id for this orientation. Example: "portrait".
1376 pub id: Option<String>,
1377 /// A human-friendly name for this orientation. Example: "portrait".
1378 pub name: Option<String>,
1379 /// Tags for this dimension. Example: "default".
1380 pub tags: Option<Vec<String>>,
1381}
1382
1383impl common::Part for Orientation {}
1384
1385/// A version-specific information of an Android model.
1386///
1387/// This type is not used in any activity, and only used as *part* of another schema.
1388///
1389#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1390#[serde_with::serde_as]
1391#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1392pub struct PerAndroidVersionInfo {
1393 /// The number of online devices for an Android version.
1394 #[serde(rename = "deviceCapacity")]
1395 pub device_capacity: Option<String>,
1396 /// Output only. Identifies supported clients for DirectAccess for this Android version.
1397 #[serde(rename = "directAccessVersionInfo")]
1398 pub direct_access_version_info: Option<DirectAccessVersionInfo>,
1399 /// Output only. The estimated wait time for a single interactive device session using Direct Access.
1400 #[serde(rename = "interactiveDeviceAvailabilityEstimate")]
1401 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1402 pub interactive_device_availability_estimate: Option<chrono::Duration>,
1403 /// An Android version.
1404 #[serde(rename = "versionId")]
1405 pub version_id: Option<String>,
1406}
1407
1408impl common::Part for PerAndroidVersionInfo {}
1409
1410/// A version-specific information of an iOS model.
1411///
1412/// This type is not used in any activity, and only used as *part* of another schema.
1413///
1414#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1415#[serde_with::serde_as]
1416#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1417pub struct PerIosVersionInfo {
1418 /// The number of online devices for an iOS version.
1419 #[serde(rename = "deviceCapacity")]
1420 pub device_capacity: Option<String>,
1421 /// An iOS version.
1422 #[serde(rename = "versionId")]
1423 pub version_id: Option<String>,
1424}
1425
1426impl common::Part for PerIosVersionInfo {}
1427
1428/// The currently provided software environment on the devices under test.
1429///
1430/// This type is not used in any activity, and only used as *part* of another schema.
1431///
1432#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1433#[serde_with::serde_as]
1434#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1435pub struct ProvidedSoftwareCatalog {
1436 /// A string representing the current version of AndroidX Test Orchestrator that is used in the environment. The package is available at https://maven.google.com/web/index.html#androidx.test:orchestrator.
1437 #[serde(rename = "androidxOrchestratorVersion")]
1438 pub androidx_orchestrator_version: Option<String>,
1439 /// Deprecated: Use AndroidX Test Orchestrator going forward. A string representing the current version of Android Test Orchestrator that is used in the environment. The package is available at https://maven.google.com/web/index.html#com.android.support.test:orchestrator.
1440 #[serde(rename = "orchestratorVersion")]
1441 pub orchestrator_version: Option<String>,
1442}
1443
1444impl common::Part for ProvidedSoftwareCatalog {}
1445
1446/// A file or directory to install on the device before the test starts.
1447///
1448/// This type is not used in any activity, and only used as *part* of another schema.
1449///
1450#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1451#[serde_with::serde_as]
1452#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1453pub struct RegularFile {
1454 /// Required. The source file.
1455 pub content: Option<FileReference>,
1456 /// Required. Where to put the content on the device. Must be an absolute, allowlisted path. If the file exists, it will be replaced. The following device-side directories and any of their subdirectories are allowlisted: ${EXTERNAL_STORAGE}, /sdcard, or /storage ${ANDROID_DATA}/local/tmp, or /data/local/tmp Specifying a path outside of these directory trees is invalid. The paths /sdcard and /data will be made available and treated as implicit path substitutions. E.g. if /sdcard on a particular device does not map to external storage, the system will replace it with the external storage path prefix for that device and copy the file there. It is strongly advised to use the Environment API in app and test code to access files on the device in a portable way.
1457 #[serde(rename = "devicePath")]
1458 pub device_path: Option<String>,
1459}
1460
1461impl common::Part for RegularFile {}
1462
1463/// Locations where the results of running the test are stored.
1464///
1465/// This type is not used in any activity, and only used as *part* of another schema.
1466///
1467#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1468#[serde_with::serde_as]
1469#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1470pub struct ResultStorage {
1471 /// Required.
1472 #[serde(rename = "googleCloudStorage")]
1473 pub google_cloud_storage: Option<GoogleCloudStorage>,
1474 /// Output only. URL to the results in the Firebase Web Console.
1475 #[serde(rename = "resultsUrl")]
1476 pub results_url: Option<String>,
1477 /// Output only. The tool results execution that results are written to.
1478 #[serde(rename = "toolResultsExecution")]
1479 pub tool_results_execution: Option<ToolResultsExecution>,
1480 /// The tool results history that contains the tool results execution that results are written to. If not provided, the service will choose an appropriate value.
1481 #[serde(rename = "toolResultsHistory")]
1482 pub tool_results_history: Option<ToolResultsHistory>,
1483}
1484
1485impl common::Part for ResultStorage {}
1486
1487/// Directs Robo to interact with a specific UI element if it is encountered during the crawl. Currently, Robo can perform text entry or element click.
1488///
1489/// This type is not used in any activity, and only used as *part* of another schema.
1490///
1491#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1492#[serde_with::serde_as]
1493#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1494pub struct RoboDirective {
1495 /// Required. The type of action that Robo should perform on the specified element.
1496 #[serde(rename = "actionType")]
1497 pub action_type: Option<String>,
1498 /// The text that Robo is directed to set. If left empty, the directive will be treated as a CLICK on the element matching the resource_name.
1499 #[serde(rename = "inputText")]
1500 pub input_text: Option<String>,
1501 /// Required. The android resource name of the target UI element. For example, in Java: R.string.foo in xml: @string/foo Only the "foo" part is needed. Reference doc: https://developer.android.com/guide/topics/resources/accessing-resources.html
1502 #[serde(rename = "resourceName")]
1503 pub resource_name: Option<String>,
1504}
1505
1506impl common::Part for RoboDirective {}
1507
1508/// Message for specifying the start activities to crawl.
1509///
1510/// This type is not used in any activity, and only used as *part* of another schema.
1511///
1512#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1513#[serde_with::serde_as]
1514#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1515pub struct RoboStartingIntent {
1516 /// An intent that starts the main launcher activity.
1517 #[serde(rename = "launcherActivity")]
1518 pub launcher_activity: Option<LauncherActivityIntent>,
1519 /// Skips the starting activity
1520 #[serde(rename = "noActivity")]
1521 pub no_activity: Option<NoActivityIntent>,
1522 /// An intent that starts an activity with specific details.
1523 #[serde(rename = "startActivity")]
1524 pub start_activity: Option<StartActivityIntent>,
1525 /// Timeout in seconds for each intent.
1526 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1527 pub timeout: Option<chrono::Duration>,
1528}
1529
1530impl common::Part for RoboStartingIntent {}
1531
1532/// The section of an tag. https://developer.android.com/guide/topics/manifest/service-element
1533///
1534/// This type is not used in any activity, and only used as *part* of another schema.
1535///
1536#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1537#[serde_with::serde_as]
1538#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1539pub struct Service {
1540 /// Intent filters in the service
1541 #[serde(rename = "intentFilter")]
1542 pub intent_filter: Option<Vec<IntentFilter>>,
1543 /// The android:name value
1544 pub name: Option<String>,
1545}
1546
1547impl common::Part for Service {}
1548
1549/// A message encapsulating a series of Session states and the time that the DeviceSession first entered those states.
1550///
1551/// This type is not used in any activity, and only used as *part* of another schema.
1552///
1553#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1554#[serde_with::serde_as]
1555#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1556pub struct SessionStateEvent {
1557 /// Output only. The time that the session_state first encountered that state.
1558 #[serde(rename = "eventTime")]
1559 pub event_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1560 /// Output only. The session_state tracked by this event
1561 #[serde(rename = "sessionState")]
1562 pub session_state: Option<String>,
1563 /// Output only. A human-readable message to explain the state.
1564 #[serde(rename = "stateMessage")]
1565 pub state_message: Option<String>,
1566}
1567
1568impl common::Part for SessionStateEvent {}
1569
1570/// Output only. Details about the shard.
1571///
1572/// This type is not used in any activity, and only used as *part* of another schema.
1573///
1574#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1575#[serde_with::serde_as]
1576#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1577pub struct Shard {
1578 /// Output only. The estimated shard duration based on previous test case timing records, if available.
1579 #[serde(rename = "estimatedShardDuration")]
1580 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1581 pub estimated_shard_duration: Option<chrono::Duration>,
1582 /// Output only. The total number of shards.
1583 #[serde(rename = "numShards")]
1584 pub num_shards: Option<i32>,
1585 /// Output only. The index of the shard among all the shards.
1586 #[serde(rename = "shardIndex")]
1587 pub shard_index: Option<i32>,
1588 /// Output only. Test targets for each shard. Only set for manual sharding.
1589 #[serde(rename = "testTargetsForShard")]
1590 pub test_targets_for_shard: Option<TestTargetsForShard>,
1591}
1592
1593impl common::Part for Shard {}
1594
1595/// Options for enabling sharding.
1596///
1597/// This type is not used in any activity, and only used as *part* of another schema.
1598///
1599#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1600#[serde_with::serde_as]
1601#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1602pub struct ShardingOption {
1603 /// Shards test cases into the specified groups of packages, classes, and/or methods.
1604 #[serde(rename = "manualSharding")]
1605 pub manual_sharding: Option<ManualSharding>,
1606 /// Shards test based on previous test case timing records.
1607 #[serde(rename = "smartSharding")]
1608 pub smart_sharding: Option<SmartSharding>,
1609 /// Uniformly shards test cases given a total number of shards.
1610 #[serde(rename = "uniformSharding")]
1611 pub uniform_sharding: Option<UniformSharding>,
1612}
1613
1614impl common::Part for ShardingOption {}
1615
1616/// Shards test based on previous test case timing records.
1617///
1618/// This type is not used in any activity, and only used as *part* of another schema.
1619///
1620#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1621#[serde_with::serde_as]
1622#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1623pub struct SmartSharding {
1624 /// The amount of time tests within a shard should take. Default: 300 seconds (5 minutes). The minimum allowed: 120 seconds (2 minutes). The shard count is dynamically set based on time, up to the maximum shard limit (described below). To guarantee at least one test case for each shard, the number of shards will not exceed the number of test cases. Shard duration will be exceeded if: - The maximum shard limit is reached and there is more calculated test time remaining to allocate into shards. - Any individual test is estimated to be longer than the targeted shard duration. Shard duration is not guaranteed because smart sharding uses test case history and default durations which may not be accurate. The rules for finding the test case timing records are: - If the service has processed a test case in the last 30 days, the record of the latest successful test case will be used. - For new test cases, the average duration of other known test cases will be used. - If there are no previous test case timing records available, the default test case duration is 15 seconds. Because the actual shard duration can exceed the targeted shard duration, we recommend that you set the targeted value at least 5 minutes less than the maximum allowed test timeout (45 minutes for physical devices and 60 minutes for virtual), or that you use the custom test timeout value that you set. This approach avoids cancelling the shard before all tests can finish. Note that there is a limit for maximum number of shards. When you select one or more physical devices, the number of shards must be <= 50. When you select one or more ARM virtual devices, it must be <= 200. When you select only x86 virtual devices, it must be <= 500. To guarantee at least one test case for per shard, the number of shards will not exceed the number of test cases. Each shard created counts toward daily test quota.
1625 #[serde(rename = "targetedShardDuration")]
1626 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1627 pub targeted_shard_duration: Option<chrono::Duration>,
1628}
1629
1630impl common::Part for SmartSharding {}
1631
1632/// A starting intent specified by an action, uri, and categories.
1633///
1634/// This type is not used in any activity, and only used as *part* of another schema.
1635///
1636#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1637#[serde_with::serde_as]
1638#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1639pub struct StartActivityIntent {
1640 /// Action name. Required for START_ACTIVITY.
1641 pub action: Option<String>,
1642 /// Intent categories to set on the intent.
1643 pub categories: Option<Vec<String>>,
1644 /// URI for the action.
1645 pub uri: Option<String>,
1646}
1647
1648impl common::Part for StartActivityIntent {}
1649
1650/// There is no detailed description.
1651///
1652/// This type is not used in any activity, and only used as *part* of another schema.
1653///
1654#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1655#[serde_with::serde_as]
1656#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1657pub struct SystraceSetup {
1658 /// Systrace duration in seconds. Should be between 1 and 30 seconds. 0 disables systrace.
1659 #[serde(rename = "durationSeconds")]
1660 pub duration_seconds: Option<i32>,
1661}
1662
1663impl common::Part for SystraceSetup {}
1664
1665/// Additional details about the progress of the running test.
1666///
1667/// This type is not used in any activity, and only used as *part* of another schema.
1668///
1669#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1670#[serde_with::serde_as]
1671#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1672pub struct TestDetails {
1673 /// Output only. If the TestState is ERROR, then this string will contain human-readable details about the error.
1674 #[serde(rename = "errorMessage")]
1675 pub error_message: Option<String>,
1676 /// Output only. Human-readable, detailed descriptions of the test's progress. For example: "Provisioning a device", "Starting Test". During the course of execution new data may be appended to the end of progress_messages.
1677 #[serde(rename = "progressMessages")]
1678 pub progress_messages: Option<Vec<String>>,
1679}
1680
1681impl common::Part for TestDetails {}
1682
1683/// A description of a test environment.
1684///
1685/// # Activities
1686///
1687/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1688/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1689///
1690/// * [get test environment catalog](TestEnvironmentCatalogGetCall) (response)
1691#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1692#[serde_with::serde_as]
1693#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1694pub struct TestEnvironmentCatalog {
1695 /// Supported Android devices.
1696 #[serde(rename = "androidDeviceCatalog")]
1697 pub android_device_catalog: Option<AndroidDeviceCatalog>,
1698 /// The IP blocks used by devices in the test environment.
1699 #[serde(rename = "deviceIpBlockCatalog")]
1700 pub device_ip_block_catalog: Option<DeviceIpBlockCatalog>,
1701 /// Supported iOS devices.
1702 #[serde(rename = "iosDeviceCatalog")]
1703 pub ios_device_catalog: Option<IosDeviceCatalog>,
1704 /// Supported network configurations.
1705 #[serde(rename = "networkConfigurationCatalog")]
1706 pub network_configuration_catalog: Option<NetworkConfigurationCatalog>,
1707 /// The software test environment provided by TestExecutionService.
1708 #[serde(rename = "softwareCatalog")]
1709 pub software_catalog: Option<ProvidedSoftwareCatalog>,
1710}
1711
1712impl common::ResponseResult for TestEnvironmentCatalog {}
1713
1714/// A single test executed in a single environment.
1715///
1716/// This type is not used in any activity, and only used as *part* of another schema.
1717///
1718#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1719#[serde_with::serde_as]
1720#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1721pub struct TestExecution {
1722 /// Output only. How the host machine(s) are configured.
1723 pub environment: Option<Environment>,
1724 /// Output only. Unique id set by the service.
1725 pub id: Option<String>,
1726 /// Output only. Id of the containing TestMatrix.
1727 #[serde(rename = "matrixId")]
1728 pub matrix_id: Option<String>,
1729 /// Output only. The cloud project that owns the test execution.
1730 #[serde(rename = "projectId")]
1731 pub project_id: Option<String>,
1732 /// Output only. Details about the shard.
1733 pub shard: Option<Shard>,
1734 /// Output only. Indicates the current progress of the test execution (e.g., FINISHED).
1735 pub state: Option<String>,
1736 /// Output only. Additional details about the running test.
1737 #[serde(rename = "testDetails")]
1738 pub test_details: Option<TestDetails>,
1739 /// Output only. How to run the test.
1740 #[serde(rename = "testSpecification")]
1741 pub test_specification: Option<TestSpecification>,
1742 /// Output only. The time this test execution was initially created.
1743 pub timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
1744 /// Output only. Where the results for this execution are written.
1745 #[serde(rename = "toolResultsStep")]
1746 pub tool_results_step: Option<ToolResultsStep>,
1747}
1748
1749impl common::Part for TestExecution {}
1750
1751/// TestMatrix captures all details about a test. It contains the environment configuration, test specification, test executions and overall state and outcome.
1752///
1753/// # Activities
1754///
1755/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1756/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1757///
1758/// * [test matrices create projects](ProjectTestMatriceCreateCall) (request|response)
1759/// * [test matrices get projects](ProjectTestMatriceGetCall) (response)
1760#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1761#[serde_with::serde_as]
1762#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1763pub struct TestMatrix {
1764 /// Information about the client which invoked the test.
1765 #[serde(rename = "clientInfo")]
1766 pub client_info: Option<ClientInfo>,
1767 /// Required. The devices the tests are being executed on.
1768 #[serde(rename = "environmentMatrix")]
1769 pub environment_matrix: Option<EnvironmentMatrix>,
1770 /// Output only. Details about why a matrix was deemed invalid. If multiple checks can be safely performed, they will be reported but no assumptions should be made about the length of this list.
1771 #[serde(rename = "extendedInvalidMatrixDetails")]
1772 pub extended_invalid_matrix_details: Option<Vec<MatrixErrorDetail>>,
1773 /// If true, only a single attempt at most will be made to run each execution/shard in the matrix. Flaky test attempts are not affected. Normally, 2 or more attempts are made if a potential infrastructure issue is detected. This feature is for latency sensitive workloads. The incidence of execution failures may be significantly greater for fail-fast matrices and support is more limited because of that expectation.
1774 #[serde(rename = "failFast")]
1775 pub fail_fast: Option<bool>,
1776 /// The number of times a TestExecution should be re-attempted if one or more of its test cases fail for any reason. The maximum number of reruns allowed is 10. Default is 0, which implies no reruns.
1777 #[serde(rename = "flakyTestAttempts")]
1778 pub flaky_test_attempts: Option<i32>,
1779 /// Output only. Describes why the matrix is considered invalid. Only useful for matrices in the INVALID state.
1780 #[serde(rename = "invalidMatrixDetails")]
1781 pub invalid_matrix_details: Option<String>,
1782 /// Output Only. The overall outcome of the test. Only set when the test matrix state is FINISHED.
1783 #[serde(rename = "outcomeSummary")]
1784 pub outcome_summary: Option<String>,
1785 /// The cloud project that owns the test matrix.
1786 #[serde(rename = "projectId")]
1787 pub project_id: Option<String>,
1788 /// Required. Where the results for the matrix are written.
1789 #[serde(rename = "resultStorage")]
1790 pub result_storage: Option<ResultStorage>,
1791 /// Output only. Indicates the current progress of the test matrix.
1792 pub state: Option<String>,
1793 /// Output only. The list of test executions that the service creates for this matrix.
1794 #[serde(rename = "testExecutions")]
1795 pub test_executions: Option<Vec<TestExecution>>,
1796 /// Output only. Unique id set by the service.
1797 #[serde(rename = "testMatrixId")]
1798 pub test_matrix_id: Option<String>,
1799 /// Required. How to run the test.
1800 #[serde(rename = "testSpecification")]
1801 pub test_specification: Option<TestSpecification>,
1802 /// Output only. The time this test matrix was initially created.
1803 pub timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
1804}
1805
1806impl common::RequestValue for TestMatrix {}
1807impl common::ResponseResult for TestMatrix {}
1808
1809/// A description of how to set up the Android device prior to running the test.
1810///
1811/// This type is not used in any activity, and only used as *part* of another schema.
1812///
1813#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1814#[serde_with::serde_as]
1815#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1816pub struct TestSetup {
1817 /// The device will be logged in on this account for the duration of the test.
1818 pub account: Option<Account>,
1819 /// APKs to install in addition to those being directly tested. These will be installed after the app under test. Currently capped at 100.
1820 #[serde(rename = "additionalApks")]
1821 pub additional_apks: Option<Vec<Apk>>,
1822 /// List of directories on the device to upload to GCS at the end of the test; they must be absolute paths under /sdcard, /storage or /data/local/tmp. Path names are restricted to characters a-z A-Z 0-9 _ - . + and / Note: The paths /sdcard and /data will be made available and treated as implicit path substitutions. E.g. if /sdcard on a particular device does not map to external storage, the system will replace it with the external storage path prefix for that device.
1823 #[serde(rename = "directoriesToPull")]
1824 pub directories_to_pull: Option<Vec<String>>,
1825 /// Whether to prevent all runtime permissions to be granted at app install
1826 #[serde(rename = "dontAutograntPermissions")]
1827 pub dont_autogrant_permissions: Option<bool>,
1828 /// Environment variables to set for the test (only applicable for instrumentation tests).
1829 #[serde(rename = "environmentVariables")]
1830 pub environment_variables: Option<Vec<EnvironmentVariable>>,
1831 /// List of files to push to the device before starting the test.
1832 #[serde(rename = "filesToPush")]
1833 pub files_to_push: Option<Vec<DeviceFile>>,
1834 /// Optional. Initial setup APKs to install before the app under test is installed. Currently capped at 100.
1835 #[serde(rename = "initialSetupApks")]
1836 pub initial_setup_apks: Option<Vec<Apk>>,
1837 /// The network traffic profile used for running the test. Available network profiles can be queried by using the NETWORK_CONFIGURATION environment type when calling TestEnvironmentDiscoveryService.GetTestEnvironmentCatalog.
1838 #[serde(rename = "networkProfile")]
1839 pub network_profile: Option<String>,
1840 /// Systrace configuration for the run. Deprecated: Systrace used Python 2 which was sunsetted on 2020-01-01. Systrace is no longer supported in the Cloud Testing API, and no Systrace file will be provided in the results.
1841 pub systrace: Option<SystraceSetup>,
1842}
1843
1844impl common::Part for TestSetup {}
1845
1846/// A description of how to run the test.
1847///
1848/// This type is not used in any activity, and only used as *part* of another schema.
1849///
1850#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1851#[serde_with::serde_as]
1852#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1853pub struct TestSpecification {
1854 /// An Android instrumentation test.
1855 #[serde(rename = "androidInstrumentationTest")]
1856 pub android_instrumentation_test: Option<AndroidInstrumentationTest>,
1857 /// An Android robo test.
1858 #[serde(rename = "androidRoboTest")]
1859 pub android_robo_test: Option<AndroidRoboTest>,
1860 /// An Android Application with a Test Loop.
1861 #[serde(rename = "androidTestLoop")]
1862 pub android_test_loop: Option<AndroidTestLoop>,
1863 /// Disables performance metrics recording. May reduce test latency.
1864 #[serde(rename = "disablePerformanceMetrics")]
1865 pub disable_performance_metrics: Option<bool>,
1866 /// Disables video recording. May reduce test latency.
1867 #[serde(rename = "disableVideoRecording")]
1868 pub disable_video_recording: Option<bool>,
1869 /// An iOS Robo test.
1870 #[serde(rename = "iosRoboTest")]
1871 pub ios_robo_test: Option<IosRoboTest>,
1872 /// An iOS application with a test loop.
1873 #[serde(rename = "iosTestLoop")]
1874 pub ios_test_loop: Option<IosTestLoop>,
1875 /// Test setup requirements for iOS.
1876 #[serde(rename = "iosTestSetup")]
1877 pub ios_test_setup: Option<IosTestSetup>,
1878 /// An iOS XCTest, via an .xctestrun file.
1879 #[serde(rename = "iosXcTest")]
1880 pub ios_xc_test: Option<IosXcTest>,
1881 /// Test setup requirements for Android e.g. files to install, bootstrap scripts.
1882 #[serde(rename = "testSetup")]
1883 pub test_setup: Option<TestSetup>,
1884 /// Max time a test execution is allowed to run before it is automatically cancelled. The default value is 5 min.
1885 #[serde(rename = "testTimeout")]
1886 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1887 pub test_timeout: Option<chrono::Duration>,
1888}
1889
1890impl common::Part for TestSpecification {}
1891
1892/// Test targets for a shard.
1893///
1894/// This type is not used in any activity, and only used as *part* of another schema.
1895///
1896#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1897#[serde_with::serde_as]
1898#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1899pub struct TestTargetsForShard {
1900 /// Group of packages, classes, and/or test methods to be run for each shard. The targets need to be specified in AndroidJUnitRunner argument format. For example, "package com.my.packages" "class com.my.package.MyClass". The number of test_targets must be greater than 0.
1901 #[serde(rename = "testTargets")]
1902 pub test_targets: Option<Vec<String>>,
1903}
1904
1905impl common::Part for TestTargetsForShard {}
1906
1907/// Represents a tool results execution resource. This has the results of a TestMatrix.
1908///
1909/// This type is not used in any activity, and only used as *part* of another schema.
1910///
1911#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1912#[serde_with::serde_as]
1913#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1914pub struct ToolResultsExecution {
1915 /// Output only. A tool results execution ID.
1916 #[serde(rename = "executionId")]
1917 pub execution_id: Option<String>,
1918 /// Output only. A tool results history ID.
1919 #[serde(rename = "historyId")]
1920 pub history_id: Option<String>,
1921 /// Output only. The cloud project that owns the tool results execution.
1922 #[serde(rename = "projectId")]
1923 pub project_id: Option<String>,
1924}
1925
1926impl common::Part for ToolResultsExecution {}
1927
1928/// Represents a tool results history resource.
1929///
1930/// This type is not used in any activity, and only used as *part* of another schema.
1931///
1932#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1933#[serde_with::serde_as]
1934#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1935pub struct ToolResultsHistory {
1936 /// Required. A tool results history ID.
1937 #[serde(rename = "historyId")]
1938 pub history_id: Option<String>,
1939 /// Required. The cloud project that owns the tool results history.
1940 #[serde(rename = "projectId")]
1941 pub project_id: Option<String>,
1942}
1943
1944impl common::Part for ToolResultsHistory {}
1945
1946/// Represents a tool results step resource. This has the results of a TestExecution.
1947///
1948/// This type is not used in any activity, and only used as *part* of another schema.
1949///
1950#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1951#[serde_with::serde_as]
1952#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1953pub struct ToolResultsStep {
1954 /// Output only. A tool results execution ID.
1955 #[serde(rename = "executionId")]
1956 pub execution_id: Option<String>,
1957 /// Output only. A tool results history ID.
1958 #[serde(rename = "historyId")]
1959 pub history_id: Option<String>,
1960 /// Output only. The cloud project that owns the tool results step.
1961 #[serde(rename = "projectId")]
1962 pub project_id: Option<String>,
1963 /// Output only. A tool results step ID.
1964 #[serde(rename = "stepId")]
1965 pub step_id: Option<String>,
1966}
1967
1968impl common::Part for ToolResultsStep {}
1969
1970/// Network emulation parameters.
1971///
1972/// This type is not used in any activity, and only used as *part* of another schema.
1973///
1974#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1975#[serde_with::serde_as]
1976#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1977pub struct TrafficRule {
1978 /// Bandwidth in kbits/second.
1979 pub bandwidth: Option<f32>,
1980 /// Burst size in kbits.
1981 pub burst: Option<f32>,
1982 /// Packet delay, must be >= 0.
1983 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1984 pub delay: Option<chrono::Duration>,
1985 /// Packet duplication ratio (0.0 - 1.0).
1986 #[serde(rename = "packetDuplicationRatio")]
1987 pub packet_duplication_ratio: Option<f32>,
1988 /// Packet loss ratio (0.0 - 1.0).
1989 #[serde(rename = "packetLossRatio")]
1990 pub packet_loss_ratio: Option<f32>,
1991}
1992
1993impl common::Part for TrafficRule {}
1994
1995/// Uniformly shards test cases given a total number of shards. For instrumentation tests, it will be translated to "-e numShard" and "-e shardIndex" AndroidJUnitRunner arguments. With uniform sharding enabled, specifying either of these sharding arguments via `environment_variables` is invalid. Based on the sharding mechanism AndroidJUnitRunner uses, there is no guarantee that test cases will be distributed uniformly across all shards.
1996///
1997/// This type is not used in any activity, and only used as *part* of another schema.
1998///
1999#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2000#[serde_with::serde_as]
2001#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2002pub struct UniformSharding {
2003 /// Required. The total number of shards to create. This must always be a positive number that is no greater than the total number of test cases. When you select one or more physical devices, the number of shards must be <= 50. When you select one or more ARM virtual devices, it must be <= 200. When you select only x86 virtual devices, it must be <= 500.
2004 #[serde(rename = "numShards")]
2005 pub num_shards: Option<i32>,
2006}
2007
2008impl common::Part for UniformSharding {}
2009
2010/// A tag within a manifest. https://developer.android.com/guide/topics/manifest/uses-feature-element.html
2011///
2012/// This type is not used in any activity, and only used as *part* of another schema.
2013///
2014#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2015#[serde_with::serde_as]
2016#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2017pub struct UsesFeature {
2018 /// The android:required value
2019 #[serde(rename = "isRequired")]
2020 pub is_required: Option<bool>,
2021 /// The android:name value
2022 pub name: Option<String>,
2023}
2024
2025impl common::Part for UsesFeature {}
2026
2027/// An Xcode version that an iOS version is compatible with.
2028///
2029/// This type is not used in any activity, and only used as *part* of another schema.
2030///
2031#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2032#[serde_with::serde_as]
2033#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2034pub struct XcodeVersion {
2035 /// Tags for this Xcode version. Example: "default".
2036 pub tags: Option<Vec<String>>,
2037 /// The id for this version. Example: "9.2".
2038 pub version: Option<String>,
2039}
2040
2041impl common::Part for XcodeVersion {}
2042
2043// ###################
2044// MethodBuilders ###
2045// #################
2046
2047/// A builder providing access to all methods supported on *applicationDetailService* resources.
2048/// It is not used directly, but through the [`Testing`] hub.
2049///
2050/// # Example
2051///
2052/// Instantiate a resource builder
2053///
2054/// ```test_harness,no_run
2055/// extern crate hyper;
2056/// extern crate hyper_rustls;
2057/// extern crate google_testing1 as testing1;
2058///
2059/// # async fn dox() {
2060/// use testing1::{Testing, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2061///
2062/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2063/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2064/// secret,
2065/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2066/// ).build().await.unwrap();
2067///
2068/// let client = hyper_util::client::legacy::Client::builder(
2069/// hyper_util::rt::TokioExecutor::new()
2070/// )
2071/// .build(
2072/// hyper_rustls::HttpsConnectorBuilder::new()
2073/// .with_native_roots()
2074/// .unwrap()
2075/// .https_or_http()
2076/// .enable_http1()
2077/// .build()
2078/// );
2079/// let mut hub = Testing::new(client, auth);
2080/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2081/// // like `get_apk_details(...)`
2082/// // to build up your call.
2083/// let rb = hub.application_detail_service();
2084/// # }
2085/// ```
2086pub struct ApplicationDetailServiceMethods<'a, C>
2087where
2088 C: 'a,
2089{
2090 hub: &'a Testing<C>,
2091}
2092
2093impl<'a, C> common::MethodsBuilder for ApplicationDetailServiceMethods<'a, C> {}
2094
2095impl<'a, C> ApplicationDetailServiceMethods<'a, C> {
2096 /// Create a builder to help you perform the following task:
2097 ///
2098 /// Gets the details of an Android application APK.
2099 ///
2100 /// # Arguments
2101 ///
2102 /// * `request` - No description provided.
2103 pub fn get_apk_details(
2104 &self,
2105 request: FileReference,
2106 ) -> ApplicationDetailServiceGetApkDetailCall<'a, C> {
2107 ApplicationDetailServiceGetApkDetailCall {
2108 hub: self.hub,
2109 _request: request,
2110 _bundle_location_gcs_path: Default::default(),
2111 _delegate: Default::default(),
2112 _additional_params: Default::default(),
2113 _scopes: Default::default(),
2114 }
2115 }
2116}
2117
2118/// A builder providing access to all methods supported on *project* resources.
2119/// It is not used directly, but through the [`Testing`] hub.
2120///
2121/// # Example
2122///
2123/// Instantiate a resource builder
2124///
2125/// ```test_harness,no_run
2126/// extern crate hyper;
2127/// extern crate hyper_rustls;
2128/// extern crate google_testing1 as testing1;
2129///
2130/// # async fn dox() {
2131/// use testing1::{Testing, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2132///
2133/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2134/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2135/// secret,
2136/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2137/// ).build().await.unwrap();
2138///
2139/// let client = hyper_util::client::legacy::Client::builder(
2140/// hyper_util::rt::TokioExecutor::new()
2141/// )
2142/// .build(
2143/// hyper_rustls::HttpsConnectorBuilder::new()
2144/// .with_native_roots()
2145/// .unwrap()
2146/// .https_or_http()
2147/// .enable_http1()
2148/// .build()
2149/// );
2150/// let mut hub = Testing::new(client, auth);
2151/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2152/// // like `device_sessions_cancel(...)`, `device_sessions_create(...)`, `device_sessions_get(...)`, `device_sessions_list(...)`, `device_sessions_patch(...)`, `test_matrices_cancel(...)`, `test_matrices_create(...)` and `test_matrices_get(...)`
2153/// // to build up your call.
2154/// let rb = hub.projects();
2155/// # }
2156/// ```
2157pub struct ProjectMethods<'a, C>
2158where
2159 C: 'a,
2160{
2161 hub: &'a Testing<C>,
2162}
2163
2164impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
2165
2166impl<'a, C> ProjectMethods<'a, C> {
2167 /// Create a builder to help you perform the following task:
2168 ///
2169 /// POST /v1/projects/{project_id}/deviceSessions/{device_session_id}:cancel Changes the DeviceSession to state FINISHED and terminates all connections. Canceled sessions are not deleted and can be retrieved or listed by the user until they expire based on the 28 day deletion policy.
2170 ///
2171 /// # Arguments
2172 ///
2173 /// * `request` - No description provided.
2174 /// * `name` - Required. Name of the DeviceSession, e.g. "projects/{project_id}/deviceSessions/{session_id}"
2175 pub fn device_sessions_cancel(
2176 &self,
2177 request: CancelDeviceSessionRequest,
2178 name: &str,
2179 ) -> ProjectDeviceSessionCancelCall<'a, C> {
2180 ProjectDeviceSessionCancelCall {
2181 hub: self.hub,
2182 _request: request,
2183 _name: name.to_string(),
2184 _delegate: Default::default(),
2185 _additional_params: Default::default(),
2186 _scopes: Default::default(),
2187 }
2188 }
2189
2190 /// Create a builder to help you perform the following task:
2191 ///
2192 /// POST /v1/projects/{project_id}/deviceSessions
2193 ///
2194 /// # Arguments
2195 ///
2196 /// * `request` - No description provided.
2197 /// * `parent` - Required. The Compute Engine project under which this device will be allocated. "projects/{project_id}"
2198 pub fn device_sessions_create(
2199 &self,
2200 request: DeviceSession,
2201 parent: &str,
2202 ) -> ProjectDeviceSessionCreateCall<'a, C> {
2203 ProjectDeviceSessionCreateCall {
2204 hub: self.hub,
2205 _request: request,
2206 _parent: parent.to_string(),
2207 _delegate: Default::default(),
2208 _additional_params: Default::default(),
2209 _scopes: Default::default(),
2210 }
2211 }
2212
2213 /// Create a builder to help you perform the following task:
2214 ///
2215 /// GET /v1/projects/{project_id}/deviceSessions/{device_session_id} Return a DeviceSession, which documents the allocation status and whether the device is allocated. Clients making requests from this API must poll GetDeviceSession.
2216 ///
2217 /// # Arguments
2218 ///
2219 /// * `name` - Required. Name of the DeviceSession, e.g. "projects/{project_id}/deviceSessions/{session_id}"
2220 pub fn device_sessions_get(&self, name: &str) -> ProjectDeviceSessionGetCall<'a, C> {
2221 ProjectDeviceSessionGetCall {
2222 hub: self.hub,
2223 _name: name.to_string(),
2224 _delegate: Default::default(),
2225 _additional_params: Default::default(),
2226 _scopes: Default::default(),
2227 }
2228 }
2229
2230 /// Create a builder to help you perform the following task:
2231 ///
2232 /// GET /v1/projects/{project_id}/deviceSessions Lists device Sessions owned by the project user.
2233 ///
2234 /// # Arguments
2235 ///
2236 /// * `parent` - Required. The name of the parent to request, e.g. "projects/{project_id}"
2237 pub fn device_sessions_list(&self, parent: &str) -> ProjectDeviceSessionListCall<'a, C> {
2238 ProjectDeviceSessionListCall {
2239 hub: self.hub,
2240 _parent: parent.to_string(),
2241 _page_token: Default::default(),
2242 _page_size: Default::default(),
2243 _filter: Default::default(),
2244 _delegate: Default::default(),
2245 _additional_params: Default::default(),
2246 _scopes: Default::default(),
2247 }
2248 }
2249
2250 /// Create a builder to help you perform the following task:
2251 ///
2252 /// PATCH /v1/projects/{projectId}/deviceSessions/deviceSessionId}:updateDeviceSession Updates the current device session to the fields described by the update_mask.
2253 ///
2254 /// # Arguments
2255 ///
2256 /// * `request` - No description provided.
2257 /// * `name` - Optional. Name of the DeviceSession, e.g. "projects/{project_id}/deviceSessions/{session_id}"
2258 pub fn device_sessions_patch(
2259 &self,
2260 request: DeviceSession,
2261 name: &str,
2262 ) -> ProjectDeviceSessionPatchCall<'a, C> {
2263 ProjectDeviceSessionPatchCall {
2264 hub: self.hub,
2265 _request: request,
2266 _name: name.to_string(),
2267 _update_mask: Default::default(),
2268 _delegate: Default::default(),
2269 _additional_params: Default::default(),
2270 _scopes: Default::default(),
2271 }
2272 }
2273
2274 /// Create a builder to help you perform the following task:
2275 ///
2276 /// Cancels unfinished test executions in a test matrix. This call returns immediately and cancellation proceeds asynchronously. If the matrix is already final, this operation will have no effect. May return any of the following canonical error codes: - PERMISSION_DENIED - if the user is not authorized to read project - INVALID_ARGUMENT - if the request is malformed - NOT_FOUND - if the Test Matrix does not exist
2277 ///
2278 /// # Arguments
2279 ///
2280 /// * `projectId` - Cloud project that owns the test.
2281 /// * `testMatrixId` - Test matrix that will be canceled.
2282 pub fn test_matrices_cancel(
2283 &self,
2284 project_id: &str,
2285 test_matrix_id: &str,
2286 ) -> ProjectTestMatriceCancelCall<'a, C> {
2287 ProjectTestMatriceCancelCall {
2288 hub: self.hub,
2289 _project_id: project_id.to_string(),
2290 _test_matrix_id: test_matrix_id.to_string(),
2291 _delegate: Default::default(),
2292 _additional_params: Default::default(),
2293 _scopes: Default::default(),
2294 }
2295 }
2296
2297 /// Create a builder to help you perform the following task:
2298 ///
2299 /// Creates and runs a matrix of tests according to the given specifications. Unsupported environments will be returned in the state UNSUPPORTED. A test matrix is limited to use at most 2000 devices in parallel. The returned matrix will not yet contain the executions that will be created for this matrix. Execution creation happens later on and will require a call to GetTestMatrix. May return any of the following canonical error codes: - PERMISSION_DENIED - if the user is not authorized to write to project - INVALID_ARGUMENT - if the request is malformed or if the matrix tries to use too many simultaneous devices.
2300 ///
2301 /// # Arguments
2302 ///
2303 /// * `request` - No description provided.
2304 /// * `projectId` - The GCE project under which this job will run.
2305 pub fn test_matrices_create(
2306 &self,
2307 request: TestMatrix,
2308 project_id: &str,
2309 ) -> ProjectTestMatriceCreateCall<'a, C> {
2310 ProjectTestMatriceCreateCall {
2311 hub: self.hub,
2312 _request: request,
2313 _project_id: project_id.to_string(),
2314 _request_id: Default::default(),
2315 _delegate: Default::default(),
2316 _additional_params: Default::default(),
2317 _scopes: Default::default(),
2318 }
2319 }
2320
2321 /// Create a builder to help you perform the following task:
2322 ///
2323 /// Checks the status of a test matrix and the executions once they are created. The test matrix will contain the list of test executions to run if and only if the resultStorage.toolResultsExecution fields have been populated. Note: Flaky test executions may be added to the matrix at a later stage. May return any of the following canonical error codes: - PERMISSION_DENIED - if the user is not authorized to read project - INVALID_ARGUMENT - if the request is malformed - NOT_FOUND - if the Test Matrix does not exist
2324 ///
2325 /// # Arguments
2326 ///
2327 /// * `projectId` - Cloud project that owns the test matrix.
2328 /// * `testMatrixId` - Unique test matrix id which was assigned by the service.
2329 pub fn test_matrices_get(
2330 &self,
2331 project_id: &str,
2332 test_matrix_id: &str,
2333 ) -> ProjectTestMatriceGetCall<'a, C> {
2334 ProjectTestMatriceGetCall {
2335 hub: self.hub,
2336 _project_id: project_id.to_string(),
2337 _test_matrix_id: test_matrix_id.to_string(),
2338 _delegate: Default::default(),
2339 _additional_params: Default::default(),
2340 _scopes: Default::default(),
2341 }
2342 }
2343}
2344
2345/// A builder providing access to all methods supported on *testEnvironmentCatalog* resources.
2346/// It is not used directly, but through the [`Testing`] hub.
2347///
2348/// # Example
2349///
2350/// Instantiate a resource builder
2351///
2352/// ```test_harness,no_run
2353/// extern crate hyper;
2354/// extern crate hyper_rustls;
2355/// extern crate google_testing1 as testing1;
2356///
2357/// # async fn dox() {
2358/// use testing1::{Testing, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2359///
2360/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2361/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2362/// secret,
2363/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2364/// ).build().await.unwrap();
2365///
2366/// let client = hyper_util::client::legacy::Client::builder(
2367/// hyper_util::rt::TokioExecutor::new()
2368/// )
2369/// .build(
2370/// hyper_rustls::HttpsConnectorBuilder::new()
2371/// .with_native_roots()
2372/// .unwrap()
2373/// .https_or_http()
2374/// .enable_http1()
2375/// .build()
2376/// );
2377/// let mut hub = Testing::new(client, auth);
2378/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2379/// // like `get(...)`
2380/// // to build up your call.
2381/// let rb = hub.test_environment_catalog();
2382/// # }
2383/// ```
2384pub struct TestEnvironmentCatalogMethods<'a, C>
2385where
2386 C: 'a,
2387{
2388 hub: &'a Testing<C>,
2389}
2390
2391impl<'a, C> common::MethodsBuilder for TestEnvironmentCatalogMethods<'a, C> {}
2392
2393impl<'a, C> TestEnvironmentCatalogMethods<'a, C> {
2394 /// Create a builder to help you perform the following task:
2395 ///
2396 /// Gets the catalog of supported test environments. May return any of the following canonical error codes: - INVALID_ARGUMENT - if the request is malformed - NOT_FOUND - if the environment type does not exist - INTERNAL - if an internal error occurred
2397 ///
2398 /// # Arguments
2399 ///
2400 /// * `environmentType` - Required. The type of environment that should be listed.
2401 pub fn get(&self, environment_type: &str) -> TestEnvironmentCatalogGetCall<'a, C> {
2402 TestEnvironmentCatalogGetCall {
2403 hub: self.hub,
2404 _environment_type: environment_type.to_string(),
2405 _project_id: Default::default(),
2406 _delegate: Default::default(),
2407 _additional_params: Default::default(),
2408 _scopes: Default::default(),
2409 }
2410 }
2411}
2412
2413// ###################
2414// CallBuilders ###
2415// #################
2416
2417/// Gets the details of an Android application APK.
2418///
2419/// A builder for the *getApkDetails* method supported by a *applicationDetailService* resource.
2420/// It is not used directly, but through a [`ApplicationDetailServiceMethods`] instance.
2421///
2422/// # Example
2423///
2424/// Instantiate a resource method builder
2425///
2426/// ```test_harness,no_run
2427/// # extern crate hyper;
2428/// # extern crate hyper_rustls;
2429/// # extern crate google_testing1 as testing1;
2430/// use testing1::api::FileReference;
2431/// # async fn dox() {
2432/// # use testing1::{Testing, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2433///
2434/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2435/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2436/// # secret,
2437/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2438/// # ).build().await.unwrap();
2439///
2440/// # let client = hyper_util::client::legacy::Client::builder(
2441/// # hyper_util::rt::TokioExecutor::new()
2442/// # )
2443/// # .build(
2444/// # hyper_rustls::HttpsConnectorBuilder::new()
2445/// # .with_native_roots()
2446/// # .unwrap()
2447/// # .https_or_http()
2448/// # .enable_http1()
2449/// # .build()
2450/// # );
2451/// # let mut hub = Testing::new(client, auth);
2452/// // As the method needs a request, you would usually fill it with the desired information
2453/// // into the respective structure. Some of the parts shown here might not be applicable !
2454/// // Values shown here are possibly random and not representative !
2455/// let mut req = FileReference::default();
2456///
2457/// // You can configure optional parameters by calling the respective setters at will, and
2458/// // execute the final call using `doit()`.
2459/// // Values shown here are possibly random and not representative !
2460/// let result = hub.application_detail_service().get_apk_details(req)
2461/// .bundle_location_gcs_path("ipsum")
2462/// .doit().await;
2463/// # }
2464/// ```
2465pub struct ApplicationDetailServiceGetApkDetailCall<'a, C>
2466where
2467 C: 'a,
2468{
2469 hub: &'a Testing<C>,
2470 _request: FileReference,
2471 _bundle_location_gcs_path: Option<String>,
2472 _delegate: Option<&'a mut dyn common::Delegate>,
2473 _additional_params: HashMap<String, String>,
2474 _scopes: BTreeSet<String>,
2475}
2476
2477impl<'a, C> common::CallBuilder for ApplicationDetailServiceGetApkDetailCall<'a, C> {}
2478
2479impl<'a, C> ApplicationDetailServiceGetApkDetailCall<'a, C>
2480where
2481 C: common::Connector,
2482{
2483 /// Perform the operation you have build so far.
2484 pub async fn doit(mut self) -> common::Result<(common::Response, GetApkDetailsResponse)> {
2485 use std::borrow::Cow;
2486 use std::io::{Read, Seek};
2487
2488 use common::{url::Params, ToParts};
2489 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2490
2491 let mut dd = common::DefaultDelegate;
2492 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2493 dlg.begin(common::MethodInfo {
2494 id: "testing.applicationDetailService.getApkDetails",
2495 http_method: hyper::Method::POST,
2496 });
2497
2498 for &field in ["alt", "bundleLocation.gcsPath"].iter() {
2499 if self._additional_params.contains_key(field) {
2500 dlg.finished(false);
2501 return Err(common::Error::FieldClash(field));
2502 }
2503 }
2504
2505 let mut params = Params::with_capacity(4 + self._additional_params.len());
2506 if let Some(value) = self._bundle_location_gcs_path.as_ref() {
2507 params.push("bundleLocation.gcsPath", value);
2508 }
2509
2510 params.extend(self._additional_params.iter());
2511
2512 params.push("alt", "json");
2513 let mut url = self.hub._base_url.clone() + "v1/applicationDetailService/getApkDetails";
2514 if self._scopes.is_empty() {
2515 self._scopes
2516 .insert(Scope::CloudPlatform.as_ref().to_string());
2517 }
2518
2519 let url = params.parse_with_url(&url);
2520
2521 let mut json_mime_type = mime::APPLICATION_JSON;
2522 let mut request_value_reader = {
2523 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2524 common::remove_json_null_values(&mut value);
2525 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2526 serde_json::to_writer(&mut dst, &value).unwrap();
2527 dst
2528 };
2529 let request_size = request_value_reader
2530 .seek(std::io::SeekFrom::End(0))
2531 .unwrap();
2532 request_value_reader
2533 .seek(std::io::SeekFrom::Start(0))
2534 .unwrap();
2535
2536 loop {
2537 let token = match self
2538 .hub
2539 .auth
2540 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2541 .await
2542 {
2543 Ok(token) => token,
2544 Err(e) => match dlg.token(e) {
2545 Ok(token) => token,
2546 Err(e) => {
2547 dlg.finished(false);
2548 return Err(common::Error::MissingToken(e));
2549 }
2550 },
2551 };
2552 request_value_reader
2553 .seek(std::io::SeekFrom::Start(0))
2554 .unwrap();
2555 let mut req_result = {
2556 let client = &self.hub.client;
2557 dlg.pre_request();
2558 let mut req_builder = hyper::Request::builder()
2559 .method(hyper::Method::POST)
2560 .uri(url.as_str())
2561 .header(USER_AGENT, self.hub._user_agent.clone());
2562
2563 if let Some(token) = token.as_ref() {
2564 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2565 }
2566
2567 let request = req_builder
2568 .header(CONTENT_TYPE, json_mime_type.to_string())
2569 .header(CONTENT_LENGTH, request_size as u64)
2570 .body(common::to_body(
2571 request_value_reader.get_ref().clone().into(),
2572 ));
2573
2574 client.request(request.unwrap()).await
2575 };
2576
2577 match req_result {
2578 Err(err) => {
2579 if let common::Retry::After(d) = dlg.http_error(&err) {
2580 sleep(d).await;
2581 continue;
2582 }
2583 dlg.finished(false);
2584 return Err(common::Error::HttpError(err));
2585 }
2586 Ok(res) => {
2587 let (mut parts, body) = res.into_parts();
2588 let mut body = common::Body::new(body);
2589 if !parts.status.is_success() {
2590 let bytes = common::to_bytes(body).await.unwrap_or_default();
2591 let error = serde_json::from_str(&common::to_string(&bytes));
2592 let response = common::to_response(parts, bytes.into());
2593
2594 if let common::Retry::After(d) =
2595 dlg.http_failure(&response, error.as_ref().ok())
2596 {
2597 sleep(d).await;
2598 continue;
2599 }
2600
2601 dlg.finished(false);
2602
2603 return Err(match error {
2604 Ok(value) => common::Error::BadRequest(value),
2605 _ => common::Error::Failure(response),
2606 });
2607 }
2608 let response = {
2609 let bytes = common::to_bytes(body).await.unwrap_or_default();
2610 let encoded = common::to_string(&bytes);
2611 match serde_json::from_str(&encoded) {
2612 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2613 Err(error) => {
2614 dlg.response_json_decode_error(&encoded, &error);
2615 return Err(common::Error::JsonDecodeError(
2616 encoded.to_string(),
2617 error,
2618 ));
2619 }
2620 }
2621 };
2622
2623 dlg.finished(true);
2624 return Ok(response);
2625 }
2626 }
2627 }
2628 }
2629
2630 ///
2631 /// Sets the *request* property to the given value.
2632 ///
2633 /// Even though the property as already been set when instantiating this call,
2634 /// we provide this method for API completeness.
2635 pub fn request(
2636 mut self,
2637 new_value: FileReference,
2638 ) -> ApplicationDetailServiceGetApkDetailCall<'a, C> {
2639 self._request = new_value;
2640 self
2641 }
2642 /// A path to a file in Google Cloud Storage. Example: gs://build-app-1414623860166/app%40debug-unaligned.apk These paths are expected to be url encoded (percent encoding)
2643 ///
2644 /// Sets the *bundle location.gcs path* query property to the given value.
2645 pub fn bundle_location_gcs_path(
2646 mut self,
2647 new_value: &str,
2648 ) -> ApplicationDetailServiceGetApkDetailCall<'a, C> {
2649 self._bundle_location_gcs_path = Some(new_value.to_string());
2650 self
2651 }
2652 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2653 /// while executing the actual API request.
2654 ///
2655 /// ````text
2656 /// It should be used to handle progress information, and to implement a certain level of resilience.
2657 /// ````
2658 ///
2659 /// Sets the *delegate* property to the given value.
2660 pub fn delegate(
2661 mut self,
2662 new_value: &'a mut dyn common::Delegate,
2663 ) -> ApplicationDetailServiceGetApkDetailCall<'a, C> {
2664 self._delegate = Some(new_value);
2665 self
2666 }
2667
2668 /// Set any additional parameter of the query string used in the request.
2669 /// It should be used to set parameters which are not yet available through their own
2670 /// setters.
2671 ///
2672 /// Please note that this method must not be used to set any of the known parameters
2673 /// which have their own setter method. If done anyway, the request will fail.
2674 ///
2675 /// # Additional Parameters
2676 ///
2677 /// * *$.xgafv* (query-string) - V1 error format.
2678 /// * *access_token* (query-string) - OAuth access token.
2679 /// * *alt* (query-string) - Data format for response.
2680 /// * *callback* (query-string) - JSONP
2681 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2682 /// * *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.
2683 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2684 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2685 /// * *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.
2686 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2687 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2688 pub fn param<T>(mut self, name: T, value: T) -> ApplicationDetailServiceGetApkDetailCall<'a, C>
2689 where
2690 T: AsRef<str>,
2691 {
2692 self._additional_params
2693 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2694 self
2695 }
2696
2697 /// Identifies the authorization scope for the method you are building.
2698 ///
2699 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2700 /// [`Scope::CloudPlatform`].
2701 ///
2702 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2703 /// tokens for more than one scope.
2704 ///
2705 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2706 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2707 /// sufficient, a read-write scope will do as well.
2708 pub fn add_scope<St>(mut self, scope: St) -> ApplicationDetailServiceGetApkDetailCall<'a, C>
2709 where
2710 St: AsRef<str>,
2711 {
2712 self._scopes.insert(String::from(scope.as_ref()));
2713 self
2714 }
2715 /// Identifies the authorization scope(s) for the method you are building.
2716 ///
2717 /// See [`Self::add_scope()`] for details.
2718 pub fn add_scopes<I, St>(mut self, scopes: I) -> ApplicationDetailServiceGetApkDetailCall<'a, C>
2719 where
2720 I: IntoIterator<Item = St>,
2721 St: AsRef<str>,
2722 {
2723 self._scopes
2724 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2725 self
2726 }
2727
2728 /// Removes all scopes, and no default scope will be used either.
2729 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2730 /// for details).
2731 pub fn clear_scopes(mut self) -> ApplicationDetailServiceGetApkDetailCall<'a, C> {
2732 self._scopes.clear();
2733 self
2734 }
2735}
2736
2737/// POST /v1/projects/{project_id}/deviceSessions/{device_session_id}:cancel Changes the DeviceSession to state FINISHED and terminates all connections. Canceled sessions are not deleted and can be retrieved or listed by the user until they expire based on the 28 day deletion policy.
2738///
2739/// A builder for the *deviceSessions.cancel* method supported by a *project* resource.
2740/// It is not used directly, but through a [`ProjectMethods`] instance.
2741///
2742/// # Example
2743///
2744/// Instantiate a resource method builder
2745///
2746/// ```test_harness,no_run
2747/// # extern crate hyper;
2748/// # extern crate hyper_rustls;
2749/// # extern crate google_testing1 as testing1;
2750/// use testing1::api::CancelDeviceSessionRequest;
2751/// # async fn dox() {
2752/// # use testing1::{Testing, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2753///
2754/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2755/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2756/// # secret,
2757/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2758/// # ).build().await.unwrap();
2759///
2760/// # let client = hyper_util::client::legacy::Client::builder(
2761/// # hyper_util::rt::TokioExecutor::new()
2762/// # )
2763/// # .build(
2764/// # hyper_rustls::HttpsConnectorBuilder::new()
2765/// # .with_native_roots()
2766/// # .unwrap()
2767/// # .https_or_http()
2768/// # .enable_http1()
2769/// # .build()
2770/// # );
2771/// # let mut hub = Testing::new(client, auth);
2772/// // As the method needs a request, you would usually fill it with the desired information
2773/// // into the respective structure. Some of the parts shown here might not be applicable !
2774/// // Values shown here are possibly random and not representative !
2775/// let mut req = CancelDeviceSessionRequest::default();
2776///
2777/// // You can configure optional parameters by calling the respective setters at will, and
2778/// // execute the final call using `doit()`.
2779/// // Values shown here are possibly random and not representative !
2780/// let result = hub.projects().device_sessions_cancel(req, "name")
2781/// .doit().await;
2782/// # }
2783/// ```
2784pub struct ProjectDeviceSessionCancelCall<'a, C>
2785where
2786 C: 'a,
2787{
2788 hub: &'a Testing<C>,
2789 _request: CancelDeviceSessionRequest,
2790 _name: String,
2791 _delegate: Option<&'a mut dyn common::Delegate>,
2792 _additional_params: HashMap<String, String>,
2793 _scopes: BTreeSet<String>,
2794}
2795
2796impl<'a, C> common::CallBuilder for ProjectDeviceSessionCancelCall<'a, C> {}
2797
2798impl<'a, C> ProjectDeviceSessionCancelCall<'a, C>
2799where
2800 C: common::Connector,
2801{
2802 /// Perform the operation you have build so far.
2803 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
2804 use std::borrow::Cow;
2805 use std::io::{Read, Seek};
2806
2807 use common::{url::Params, ToParts};
2808 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2809
2810 let mut dd = common::DefaultDelegate;
2811 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2812 dlg.begin(common::MethodInfo {
2813 id: "testing.projects.deviceSessions.cancel",
2814 http_method: hyper::Method::POST,
2815 });
2816
2817 for &field in ["alt", "name"].iter() {
2818 if self._additional_params.contains_key(field) {
2819 dlg.finished(false);
2820 return Err(common::Error::FieldClash(field));
2821 }
2822 }
2823
2824 let mut params = Params::with_capacity(4 + self._additional_params.len());
2825 params.push("name", self._name);
2826
2827 params.extend(self._additional_params.iter());
2828
2829 params.push("alt", "json");
2830 let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
2831 if self._scopes.is_empty() {
2832 self._scopes
2833 .insert(Scope::CloudPlatform.as_ref().to_string());
2834 }
2835
2836 #[allow(clippy::single_element_loop)]
2837 for &(find_this, param_name) in [("{+name}", "name")].iter() {
2838 url = params.uri_replacement(url, param_name, find_this, true);
2839 }
2840 {
2841 let to_remove = ["name"];
2842 params.remove_params(&to_remove);
2843 }
2844
2845 let url = params.parse_with_url(&url);
2846
2847 let mut json_mime_type = mime::APPLICATION_JSON;
2848 let mut request_value_reader = {
2849 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2850 common::remove_json_null_values(&mut value);
2851 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2852 serde_json::to_writer(&mut dst, &value).unwrap();
2853 dst
2854 };
2855 let request_size = request_value_reader
2856 .seek(std::io::SeekFrom::End(0))
2857 .unwrap();
2858 request_value_reader
2859 .seek(std::io::SeekFrom::Start(0))
2860 .unwrap();
2861
2862 loop {
2863 let token = match self
2864 .hub
2865 .auth
2866 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2867 .await
2868 {
2869 Ok(token) => token,
2870 Err(e) => match dlg.token(e) {
2871 Ok(token) => token,
2872 Err(e) => {
2873 dlg.finished(false);
2874 return Err(common::Error::MissingToken(e));
2875 }
2876 },
2877 };
2878 request_value_reader
2879 .seek(std::io::SeekFrom::Start(0))
2880 .unwrap();
2881 let mut req_result = {
2882 let client = &self.hub.client;
2883 dlg.pre_request();
2884 let mut req_builder = hyper::Request::builder()
2885 .method(hyper::Method::POST)
2886 .uri(url.as_str())
2887 .header(USER_AGENT, self.hub._user_agent.clone());
2888
2889 if let Some(token) = token.as_ref() {
2890 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2891 }
2892
2893 let request = req_builder
2894 .header(CONTENT_TYPE, json_mime_type.to_string())
2895 .header(CONTENT_LENGTH, request_size as u64)
2896 .body(common::to_body(
2897 request_value_reader.get_ref().clone().into(),
2898 ));
2899
2900 client.request(request.unwrap()).await
2901 };
2902
2903 match req_result {
2904 Err(err) => {
2905 if let common::Retry::After(d) = dlg.http_error(&err) {
2906 sleep(d).await;
2907 continue;
2908 }
2909 dlg.finished(false);
2910 return Err(common::Error::HttpError(err));
2911 }
2912 Ok(res) => {
2913 let (mut parts, body) = res.into_parts();
2914 let mut body = common::Body::new(body);
2915 if !parts.status.is_success() {
2916 let bytes = common::to_bytes(body).await.unwrap_or_default();
2917 let error = serde_json::from_str(&common::to_string(&bytes));
2918 let response = common::to_response(parts, bytes.into());
2919
2920 if let common::Retry::After(d) =
2921 dlg.http_failure(&response, error.as_ref().ok())
2922 {
2923 sleep(d).await;
2924 continue;
2925 }
2926
2927 dlg.finished(false);
2928
2929 return Err(match error {
2930 Ok(value) => common::Error::BadRequest(value),
2931 _ => common::Error::Failure(response),
2932 });
2933 }
2934 let response = {
2935 let bytes = common::to_bytes(body).await.unwrap_or_default();
2936 let encoded = common::to_string(&bytes);
2937 match serde_json::from_str(&encoded) {
2938 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2939 Err(error) => {
2940 dlg.response_json_decode_error(&encoded, &error);
2941 return Err(common::Error::JsonDecodeError(
2942 encoded.to_string(),
2943 error,
2944 ));
2945 }
2946 }
2947 };
2948
2949 dlg.finished(true);
2950 return Ok(response);
2951 }
2952 }
2953 }
2954 }
2955
2956 ///
2957 /// Sets the *request* property to the given value.
2958 ///
2959 /// Even though the property as already been set when instantiating this call,
2960 /// we provide this method for API completeness.
2961 pub fn request(
2962 mut self,
2963 new_value: CancelDeviceSessionRequest,
2964 ) -> ProjectDeviceSessionCancelCall<'a, C> {
2965 self._request = new_value;
2966 self
2967 }
2968 /// Required. Name of the DeviceSession, e.g. "projects/{project_id}/deviceSessions/{session_id}"
2969 ///
2970 /// Sets the *name* path property to the given value.
2971 ///
2972 /// Even though the property as already been set when instantiating this call,
2973 /// we provide this method for API completeness.
2974 pub fn name(mut self, new_value: &str) -> ProjectDeviceSessionCancelCall<'a, C> {
2975 self._name = new_value.to_string();
2976 self
2977 }
2978 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2979 /// while executing the actual API request.
2980 ///
2981 /// ````text
2982 /// It should be used to handle progress information, and to implement a certain level of resilience.
2983 /// ````
2984 ///
2985 /// Sets the *delegate* property to the given value.
2986 pub fn delegate(
2987 mut self,
2988 new_value: &'a mut dyn common::Delegate,
2989 ) -> ProjectDeviceSessionCancelCall<'a, C> {
2990 self._delegate = Some(new_value);
2991 self
2992 }
2993
2994 /// Set any additional parameter of the query string used in the request.
2995 /// It should be used to set parameters which are not yet available through their own
2996 /// setters.
2997 ///
2998 /// Please note that this method must not be used to set any of the known parameters
2999 /// which have their own setter method. If done anyway, the request will fail.
3000 ///
3001 /// # Additional Parameters
3002 ///
3003 /// * *$.xgafv* (query-string) - V1 error format.
3004 /// * *access_token* (query-string) - OAuth access token.
3005 /// * *alt* (query-string) - Data format for response.
3006 /// * *callback* (query-string) - JSONP
3007 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3008 /// * *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.
3009 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3010 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3011 /// * *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.
3012 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3013 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3014 pub fn param<T>(mut self, name: T, value: T) -> ProjectDeviceSessionCancelCall<'a, C>
3015 where
3016 T: AsRef<str>,
3017 {
3018 self._additional_params
3019 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3020 self
3021 }
3022
3023 /// Identifies the authorization scope for the method you are building.
3024 ///
3025 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3026 /// [`Scope::CloudPlatform`].
3027 ///
3028 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3029 /// tokens for more than one scope.
3030 ///
3031 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3032 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3033 /// sufficient, a read-write scope will do as well.
3034 pub fn add_scope<St>(mut self, scope: St) -> ProjectDeviceSessionCancelCall<'a, C>
3035 where
3036 St: AsRef<str>,
3037 {
3038 self._scopes.insert(String::from(scope.as_ref()));
3039 self
3040 }
3041 /// Identifies the authorization scope(s) for the method you are building.
3042 ///
3043 /// See [`Self::add_scope()`] for details.
3044 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectDeviceSessionCancelCall<'a, C>
3045 where
3046 I: IntoIterator<Item = St>,
3047 St: AsRef<str>,
3048 {
3049 self._scopes
3050 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3051 self
3052 }
3053
3054 /// Removes all scopes, and no default scope will be used either.
3055 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3056 /// for details).
3057 pub fn clear_scopes(mut self) -> ProjectDeviceSessionCancelCall<'a, C> {
3058 self._scopes.clear();
3059 self
3060 }
3061}
3062
3063/// POST /v1/projects/{project_id}/deviceSessions
3064///
3065/// A builder for the *deviceSessions.create* method supported by a *project* resource.
3066/// It is not used directly, but through a [`ProjectMethods`] instance.
3067///
3068/// # Example
3069///
3070/// Instantiate a resource method builder
3071///
3072/// ```test_harness,no_run
3073/// # extern crate hyper;
3074/// # extern crate hyper_rustls;
3075/// # extern crate google_testing1 as testing1;
3076/// use testing1::api::DeviceSession;
3077/// # async fn dox() {
3078/// # use testing1::{Testing, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3079///
3080/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3081/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3082/// # secret,
3083/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3084/// # ).build().await.unwrap();
3085///
3086/// # let client = hyper_util::client::legacy::Client::builder(
3087/// # hyper_util::rt::TokioExecutor::new()
3088/// # )
3089/// # .build(
3090/// # hyper_rustls::HttpsConnectorBuilder::new()
3091/// # .with_native_roots()
3092/// # .unwrap()
3093/// # .https_or_http()
3094/// # .enable_http1()
3095/// # .build()
3096/// # );
3097/// # let mut hub = Testing::new(client, auth);
3098/// // As the method needs a request, you would usually fill it with the desired information
3099/// // into the respective structure. Some of the parts shown here might not be applicable !
3100/// // Values shown here are possibly random and not representative !
3101/// let mut req = DeviceSession::default();
3102///
3103/// // You can configure optional parameters by calling the respective setters at will, and
3104/// // execute the final call using `doit()`.
3105/// // Values shown here are possibly random and not representative !
3106/// let result = hub.projects().device_sessions_create(req, "parent")
3107/// .doit().await;
3108/// # }
3109/// ```
3110pub struct ProjectDeviceSessionCreateCall<'a, C>
3111where
3112 C: 'a,
3113{
3114 hub: &'a Testing<C>,
3115 _request: DeviceSession,
3116 _parent: String,
3117 _delegate: Option<&'a mut dyn common::Delegate>,
3118 _additional_params: HashMap<String, String>,
3119 _scopes: BTreeSet<String>,
3120}
3121
3122impl<'a, C> common::CallBuilder for ProjectDeviceSessionCreateCall<'a, C> {}
3123
3124impl<'a, C> ProjectDeviceSessionCreateCall<'a, C>
3125where
3126 C: common::Connector,
3127{
3128 /// Perform the operation you have build so far.
3129 pub async fn doit(mut self) -> common::Result<(common::Response, DeviceSession)> {
3130 use std::borrow::Cow;
3131 use std::io::{Read, Seek};
3132
3133 use common::{url::Params, ToParts};
3134 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3135
3136 let mut dd = common::DefaultDelegate;
3137 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3138 dlg.begin(common::MethodInfo {
3139 id: "testing.projects.deviceSessions.create",
3140 http_method: hyper::Method::POST,
3141 });
3142
3143 for &field in ["alt", "parent"].iter() {
3144 if self._additional_params.contains_key(field) {
3145 dlg.finished(false);
3146 return Err(common::Error::FieldClash(field));
3147 }
3148 }
3149
3150 let mut params = Params::with_capacity(4 + self._additional_params.len());
3151 params.push("parent", self._parent);
3152
3153 params.extend(self._additional_params.iter());
3154
3155 params.push("alt", "json");
3156 let mut url = self.hub._base_url.clone() + "v1/{+parent}/deviceSessions";
3157 if self._scopes.is_empty() {
3158 self._scopes
3159 .insert(Scope::CloudPlatform.as_ref().to_string());
3160 }
3161
3162 #[allow(clippy::single_element_loop)]
3163 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3164 url = params.uri_replacement(url, param_name, find_this, true);
3165 }
3166 {
3167 let to_remove = ["parent"];
3168 params.remove_params(&to_remove);
3169 }
3170
3171 let url = params.parse_with_url(&url);
3172
3173 let mut json_mime_type = mime::APPLICATION_JSON;
3174 let mut request_value_reader = {
3175 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3176 common::remove_json_null_values(&mut value);
3177 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3178 serde_json::to_writer(&mut dst, &value).unwrap();
3179 dst
3180 };
3181 let request_size = request_value_reader
3182 .seek(std::io::SeekFrom::End(0))
3183 .unwrap();
3184 request_value_reader
3185 .seek(std::io::SeekFrom::Start(0))
3186 .unwrap();
3187
3188 loop {
3189 let token = match self
3190 .hub
3191 .auth
3192 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3193 .await
3194 {
3195 Ok(token) => token,
3196 Err(e) => match dlg.token(e) {
3197 Ok(token) => token,
3198 Err(e) => {
3199 dlg.finished(false);
3200 return Err(common::Error::MissingToken(e));
3201 }
3202 },
3203 };
3204 request_value_reader
3205 .seek(std::io::SeekFrom::Start(0))
3206 .unwrap();
3207 let mut req_result = {
3208 let client = &self.hub.client;
3209 dlg.pre_request();
3210 let mut req_builder = hyper::Request::builder()
3211 .method(hyper::Method::POST)
3212 .uri(url.as_str())
3213 .header(USER_AGENT, self.hub._user_agent.clone());
3214
3215 if let Some(token) = token.as_ref() {
3216 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3217 }
3218
3219 let request = req_builder
3220 .header(CONTENT_TYPE, json_mime_type.to_string())
3221 .header(CONTENT_LENGTH, request_size as u64)
3222 .body(common::to_body(
3223 request_value_reader.get_ref().clone().into(),
3224 ));
3225
3226 client.request(request.unwrap()).await
3227 };
3228
3229 match req_result {
3230 Err(err) => {
3231 if let common::Retry::After(d) = dlg.http_error(&err) {
3232 sleep(d).await;
3233 continue;
3234 }
3235 dlg.finished(false);
3236 return Err(common::Error::HttpError(err));
3237 }
3238 Ok(res) => {
3239 let (mut parts, body) = res.into_parts();
3240 let mut body = common::Body::new(body);
3241 if !parts.status.is_success() {
3242 let bytes = common::to_bytes(body).await.unwrap_or_default();
3243 let error = serde_json::from_str(&common::to_string(&bytes));
3244 let response = common::to_response(parts, bytes.into());
3245
3246 if let common::Retry::After(d) =
3247 dlg.http_failure(&response, error.as_ref().ok())
3248 {
3249 sleep(d).await;
3250 continue;
3251 }
3252
3253 dlg.finished(false);
3254
3255 return Err(match error {
3256 Ok(value) => common::Error::BadRequest(value),
3257 _ => common::Error::Failure(response),
3258 });
3259 }
3260 let response = {
3261 let bytes = common::to_bytes(body).await.unwrap_or_default();
3262 let encoded = common::to_string(&bytes);
3263 match serde_json::from_str(&encoded) {
3264 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3265 Err(error) => {
3266 dlg.response_json_decode_error(&encoded, &error);
3267 return Err(common::Error::JsonDecodeError(
3268 encoded.to_string(),
3269 error,
3270 ));
3271 }
3272 }
3273 };
3274
3275 dlg.finished(true);
3276 return Ok(response);
3277 }
3278 }
3279 }
3280 }
3281
3282 ///
3283 /// Sets the *request* property to the given value.
3284 ///
3285 /// Even though the property as already been set when instantiating this call,
3286 /// we provide this method for API completeness.
3287 pub fn request(mut self, new_value: DeviceSession) -> ProjectDeviceSessionCreateCall<'a, C> {
3288 self._request = new_value;
3289 self
3290 }
3291 /// Required. The Compute Engine project under which this device will be allocated. "projects/{project_id}"
3292 ///
3293 /// Sets the *parent* path property to the given value.
3294 ///
3295 /// Even though the property as already been set when instantiating this call,
3296 /// we provide this method for API completeness.
3297 pub fn parent(mut self, new_value: &str) -> ProjectDeviceSessionCreateCall<'a, C> {
3298 self._parent = new_value.to_string();
3299 self
3300 }
3301 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3302 /// while executing the actual API request.
3303 ///
3304 /// ````text
3305 /// It should be used to handle progress information, and to implement a certain level of resilience.
3306 /// ````
3307 ///
3308 /// Sets the *delegate* property to the given value.
3309 pub fn delegate(
3310 mut self,
3311 new_value: &'a mut dyn common::Delegate,
3312 ) -> ProjectDeviceSessionCreateCall<'a, C> {
3313 self._delegate = Some(new_value);
3314 self
3315 }
3316
3317 /// Set any additional parameter of the query string used in the request.
3318 /// It should be used to set parameters which are not yet available through their own
3319 /// setters.
3320 ///
3321 /// Please note that this method must not be used to set any of the known parameters
3322 /// which have their own setter method. If done anyway, the request will fail.
3323 ///
3324 /// # Additional Parameters
3325 ///
3326 /// * *$.xgafv* (query-string) - V1 error format.
3327 /// * *access_token* (query-string) - OAuth access token.
3328 /// * *alt* (query-string) - Data format for response.
3329 /// * *callback* (query-string) - JSONP
3330 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3331 /// * *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.
3332 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3333 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3334 /// * *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.
3335 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3336 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3337 pub fn param<T>(mut self, name: T, value: T) -> ProjectDeviceSessionCreateCall<'a, C>
3338 where
3339 T: AsRef<str>,
3340 {
3341 self._additional_params
3342 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3343 self
3344 }
3345
3346 /// Identifies the authorization scope for the method you are building.
3347 ///
3348 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3349 /// [`Scope::CloudPlatform`].
3350 ///
3351 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3352 /// tokens for more than one scope.
3353 ///
3354 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3355 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3356 /// sufficient, a read-write scope will do as well.
3357 pub fn add_scope<St>(mut self, scope: St) -> ProjectDeviceSessionCreateCall<'a, C>
3358 where
3359 St: AsRef<str>,
3360 {
3361 self._scopes.insert(String::from(scope.as_ref()));
3362 self
3363 }
3364 /// Identifies the authorization scope(s) for the method you are building.
3365 ///
3366 /// See [`Self::add_scope()`] for details.
3367 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectDeviceSessionCreateCall<'a, C>
3368 where
3369 I: IntoIterator<Item = St>,
3370 St: AsRef<str>,
3371 {
3372 self._scopes
3373 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3374 self
3375 }
3376
3377 /// Removes all scopes, and no default scope will be used either.
3378 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3379 /// for details).
3380 pub fn clear_scopes(mut self) -> ProjectDeviceSessionCreateCall<'a, C> {
3381 self._scopes.clear();
3382 self
3383 }
3384}
3385
3386/// GET /v1/projects/{project_id}/deviceSessions/{device_session_id} Return a DeviceSession, which documents the allocation status and whether the device is allocated. Clients making requests from this API must poll GetDeviceSession.
3387///
3388/// A builder for the *deviceSessions.get* method supported by a *project* resource.
3389/// It is not used directly, but through a [`ProjectMethods`] instance.
3390///
3391/// # Example
3392///
3393/// Instantiate a resource method builder
3394///
3395/// ```test_harness,no_run
3396/// # extern crate hyper;
3397/// # extern crate hyper_rustls;
3398/// # extern crate google_testing1 as testing1;
3399/// # async fn dox() {
3400/// # use testing1::{Testing, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3401///
3402/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3403/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3404/// # secret,
3405/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3406/// # ).build().await.unwrap();
3407///
3408/// # let client = hyper_util::client::legacy::Client::builder(
3409/// # hyper_util::rt::TokioExecutor::new()
3410/// # )
3411/// # .build(
3412/// # hyper_rustls::HttpsConnectorBuilder::new()
3413/// # .with_native_roots()
3414/// # .unwrap()
3415/// # .https_or_http()
3416/// # .enable_http1()
3417/// # .build()
3418/// # );
3419/// # let mut hub = Testing::new(client, auth);
3420/// // You can configure optional parameters by calling the respective setters at will, and
3421/// // execute the final call using `doit()`.
3422/// // Values shown here are possibly random and not representative !
3423/// let result = hub.projects().device_sessions_get("name")
3424/// .doit().await;
3425/// # }
3426/// ```
3427pub struct ProjectDeviceSessionGetCall<'a, C>
3428where
3429 C: 'a,
3430{
3431 hub: &'a Testing<C>,
3432 _name: String,
3433 _delegate: Option<&'a mut dyn common::Delegate>,
3434 _additional_params: HashMap<String, String>,
3435 _scopes: BTreeSet<String>,
3436}
3437
3438impl<'a, C> common::CallBuilder for ProjectDeviceSessionGetCall<'a, C> {}
3439
3440impl<'a, C> ProjectDeviceSessionGetCall<'a, C>
3441where
3442 C: common::Connector,
3443{
3444 /// Perform the operation you have build so far.
3445 pub async fn doit(mut self) -> common::Result<(common::Response, DeviceSession)> {
3446 use std::borrow::Cow;
3447 use std::io::{Read, Seek};
3448
3449 use common::{url::Params, ToParts};
3450 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3451
3452 let mut dd = common::DefaultDelegate;
3453 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3454 dlg.begin(common::MethodInfo {
3455 id: "testing.projects.deviceSessions.get",
3456 http_method: hyper::Method::GET,
3457 });
3458
3459 for &field in ["alt", "name"].iter() {
3460 if self._additional_params.contains_key(field) {
3461 dlg.finished(false);
3462 return Err(common::Error::FieldClash(field));
3463 }
3464 }
3465
3466 let mut params = Params::with_capacity(3 + self._additional_params.len());
3467 params.push("name", self._name);
3468
3469 params.extend(self._additional_params.iter());
3470
3471 params.push("alt", "json");
3472 let mut url = self.hub._base_url.clone() + "v1/{+name}";
3473 if self._scopes.is_empty() {
3474 self._scopes
3475 .insert(Scope::CloudPlatform.as_ref().to_string());
3476 }
3477
3478 #[allow(clippy::single_element_loop)]
3479 for &(find_this, param_name) in [("{+name}", "name")].iter() {
3480 url = params.uri_replacement(url, param_name, find_this, true);
3481 }
3482 {
3483 let to_remove = ["name"];
3484 params.remove_params(&to_remove);
3485 }
3486
3487 let url = params.parse_with_url(&url);
3488
3489 loop {
3490 let token = match self
3491 .hub
3492 .auth
3493 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3494 .await
3495 {
3496 Ok(token) => token,
3497 Err(e) => match dlg.token(e) {
3498 Ok(token) => token,
3499 Err(e) => {
3500 dlg.finished(false);
3501 return Err(common::Error::MissingToken(e));
3502 }
3503 },
3504 };
3505 let mut req_result = {
3506 let client = &self.hub.client;
3507 dlg.pre_request();
3508 let mut req_builder = hyper::Request::builder()
3509 .method(hyper::Method::GET)
3510 .uri(url.as_str())
3511 .header(USER_AGENT, self.hub._user_agent.clone());
3512
3513 if let Some(token) = token.as_ref() {
3514 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3515 }
3516
3517 let request = req_builder
3518 .header(CONTENT_LENGTH, 0_u64)
3519 .body(common::to_body::<String>(None));
3520
3521 client.request(request.unwrap()).await
3522 };
3523
3524 match req_result {
3525 Err(err) => {
3526 if let common::Retry::After(d) = dlg.http_error(&err) {
3527 sleep(d).await;
3528 continue;
3529 }
3530 dlg.finished(false);
3531 return Err(common::Error::HttpError(err));
3532 }
3533 Ok(res) => {
3534 let (mut parts, body) = res.into_parts();
3535 let mut body = common::Body::new(body);
3536 if !parts.status.is_success() {
3537 let bytes = common::to_bytes(body).await.unwrap_or_default();
3538 let error = serde_json::from_str(&common::to_string(&bytes));
3539 let response = common::to_response(parts, bytes.into());
3540
3541 if let common::Retry::After(d) =
3542 dlg.http_failure(&response, error.as_ref().ok())
3543 {
3544 sleep(d).await;
3545 continue;
3546 }
3547
3548 dlg.finished(false);
3549
3550 return Err(match error {
3551 Ok(value) => common::Error::BadRequest(value),
3552 _ => common::Error::Failure(response),
3553 });
3554 }
3555 let response = {
3556 let bytes = common::to_bytes(body).await.unwrap_or_default();
3557 let encoded = common::to_string(&bytes);
3558 match serde_json::from_str(&encoded) {
3559 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3560 Err(error) => {
3561 dlg.response_json_decode_error(&encoded, &error);
3562 return Err(common::Error::JsonDecodeError(
3563 encoded.to_string(),
3564 error,
3565 ));
3566 }
3567 }
3568 };
3569
3570 dlg.finished(true);
3571 return Ok(response);
3572 }
3573 }
3574 }
3575 }
3576
3577 /// Required. Name of the DeviceSession, e.g. "projects/{project_id}/deviceSessions/{session_id}"
3578 ///
3579 /// Sets the *name* path property to the given value.
3580 ///
3581 /// Even though the property as already been set when instantiating this call,
3582 /// we provide this method for API completeness.
3583 pub fn name(mut self, new_value: &str) -> ProjectDeviceSessionGetCall<'a, C> {
3584 self._name = new_value.to_string();
3585 self
3586 }
3587 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3588 /// while executing the actual API request.
3589 ///
3590 /// ````text
3591 /// It should be used to handle progress information, and to implement a certain level of resilience.
3592 /// ````
3593 ///
3594 /// Sets the *delegate* property to the given value.
3595 pub fn delegate(
3596 mut self,
3597 new_value: &'a mut dyn common::Delegate,
3598 ) -> ProjectDeviceSessionGetCall<'a, C> {
3599 self._delegate = Some(new_value);
3600 self
3601 }
3602
3603 /// Set any additional parameter of the query string used in the request.
3604 /// It should be used to set parameters which are not yet available through their own
3605 /// setters.
3606 ///
3607 /// Please note that this method must not be used to set any of the known parameters
3608 /// which have their own setter method. If done anyway, the request will fail.
3609 ///
3610 /// # Additional Parameters
3611 ///
3612 /// * *$.xgafv* (query-string) - V1 error format.
3613 /// * *access_token* (query-string) - OAuth access token.
3614 /// * *alt* (query-string) - Data format for response.
3615 /// * *callback* (query-string) - JSONP
3616 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3617 /// * *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.
3618 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3619 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3620 /// * *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.
3621 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3622 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3623 pub fn param<T>(mut self, name: T, value: T) -> ProjectDeviceSessionGetCall<'a, C>
3624 where
3625 T: AsRef<str>,
3626 {
3627 self._additional_params
3628 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3629 self
3630 }
3631
3632 /// Identifies the authorization scope for the method you are building.
3633 ///
3634 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3635 /// [`Scope::CloudPlatform`].
3636 ///
3637 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3638 /// tokens for more than one scope.
3639 ///
3640 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3641 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3642 /// sufficient, a read-write scope will do as well.
3643 pub fn add_scope<St>(mut self, scope: St) -> ProjectDeviceSessionGetCall<'a, C>
3644 where
3645 St: AsRef<str>,
3646 {
3647 self._scopes.insert(String::from(scope.as_ref()));
3648 self
3649 }
3650 /// Identifies the authorization scope(s) for the method you are building.
3651 ///
3652 /// See [`Self::add_scope()`] for details.
3653 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectDeviceSessionGetCall<'a, C>
3654 where
3655 I: IntoIterator<Item = St>,
3656 St: AsRef<str>,
3657 {
3658 self._scopes
3659 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3660 self
3661 }
3662
3663 /// Removes all scopes, and no default scope will be used either.
3664 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3665 /// for details).
3666 pub fn clear_scopes(mut self) -> ProjectDeviceSessionGetCall<'a, C> {
3667 self._scopes.clear();
3668 self
3669 }
3670}
3671
3672/// GET /v1/projects/{project_id}/deviceSessions Lists device Sessions owned by the project user.
3673///
3674/// A builder for the *deviceSessions.list* method supported by a *project* resource.
3675/// It is not used directly, but through a [`ProjectMethods`] instance.
3676///
3677/// # Example
3678///
3679/// Instantiate a resource method builder
3680///
3681/// ```test_harness,no_run
3682/// # extern crate hyper;
3683/// # extern crate hyper_rustls;
3684/// # extern crate google_testing1 as testing1;
3685/// # async fn dox() {
3686/// # use testing1::{Testing, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3687///
3688/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3689/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3690/// # secret,
3691/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3692/// # ).build().await.unwrap();
3693///
3694/// # let client = hyper_util::client::legacy::Client::builder(
3695/// # hyper_util::rt::TokioExecutor::new()
3696/// # )
3697/// # .build(
3698/// # hyper_rustls::HttpsConnectorBuilder::new()
3699/// # .with_native_roots()
3700/// # .unwrap()
3701/// # .https_or_http()
3702/// # .enable_http1()
3703/// # .build()
3704/// # );
3705/// # let mut hub = Testing::new(client, auth);
3706/// // You can configure optional parameters by calling the respective setters at will, and
3707/// // execute the final call using `doit()`.
3708/// // Values shown here are possibly random and not representative !
3709/// let result = hub.projects().device_sessions_list("parent")
3710/// .page_token("amet.")
3711/// .page_size(-59)
3712/// .filter("amet.")
3713/// .doit().await;
3714/// # }
3715/// ```
3716pub struct ProjectDeviceSessionListCall<'a, C>
3717where
3718 C: 'a,
3719{
3720 hub: &'a Testing<C>,
3721 _parent: String,
3722 _page_token: Option<String>,
3723 _page_size: Option<i32>,
3724 _filter: Option<String>,
3725 _delegate: Option<&'a mut dyn common::Delegate>,
3726 _additional_params: HashMap<String, String>,
3727 _scopes: BTreeSet<String>,
3728}
3729
3730impl<'a, C> common::CallBuilder for ProjectDeviceSessionListCall<'a, C> {}
3731
3732impl<'a, C> ProjectDeviceSessionListCall<'a, C>
3733where
3734 C: common::Connector,
3735{
3736 /// Perform the operation you have build so far.
3737 pub async fn doit(mut self) -> common::Result<(common::Response, ListDeviceSessionsResponse)> {
3738 use std::borrow::Cow;
3739 use std::io::{Read, Seek};
3740
3741 use common::{url::Params, ToParts};
3742 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3743
3744 let mut dd = common::DefaultDelegate;
3745 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3746 dlg.begin(common::MethodInfo {
3747 id: "testing.projects.deviceSessions.list",
3748 http_method: hyper::Method::GET,
3749 });
3750
3751 for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
3752 if self._additional_params.contains_key(field) {
3753 dlg.finished(false);
3754 return Err(common::Error::FieldClash(field));
3755 }
3756 }
3757
3758 let mut params = Params::with_capacity(6 + self._additional_params.len());
3759 params.push("parent", self._parent);
3760 if let Some(value) = self._page_token.as_ref() {
3761 params.push("pageToken", value);
3762 }
3763 if let Some(value) = self._page_size.as_ref() {
3764 params.push("pageSize", value.to_string());
3765 }
3766 if let Some(value) = self._filter.as_ref() {
3767 params.push("filter", value);
3768 }
3769
3770 params.extend(self._additional_params.iter());
3771
3772 params.push("alt", "json");
3773 let mut url = self.hub._base_url.clone() + "v1/{+parent}/deviceSessions";
3774 if self._scopes.is_empty() {
3775 self._scopes
3776 .insert(Scope::CloudPlatform.as_ref().to_string());
3777 }
3778
3779 #[allow(clippy::single_element_loop)]
3780 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3781 url = params.uri_replacement(url, param_name, find_this, true);
3782 }
3783 {
3784 let to_remove = ["parent"];
3785 params.remove_params(&to_remove);
3786 }
3787
3788 let url = params.parse_with_url(&url);
3789
3790 loop {
3791 let token = match self
3792 .hub
3793 .auth
3794 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3795 .await
3796 {
3797 Ok(token) => token,
3798 Err(e) => match dlg.token(e) {
3799 Ok(token) => token,
3800 Err(e) => {
3801 dlg.finished(false);
3802 return Err(common::Error::MissingToken(e));
3803 }
3804 },
3805 };
3806 let mut req_result = {
3807 let client = &self.hub.client;
3808 dlg.pre_request();
3809 let mut req_builder = hyper::Request::builder()
3810 .method(hyper::Method::GET)
3811 .uri(url.as_str())
3812 .header(USER_AGENT, self.hub._user_agent.clone());
3813
3814 if let Some(token) = token.as_ref() {
3815 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3816 }
3817
3818 let request = req_builder
3819 .header(CONTENT_LENGTH, 0_u64)
3820 .body(common::to_body::<String>(None));
3821
3822 client.request(request.unwrap()).await
3823 };
3824
3825 match req_result {
3826 Err(err) => {
3827 if let common::Retry::After(d) = dlg.http_error(&err) {
3828 sleep(d).await;
3829 continue;
3830 }
3831 dlg.finished(false);
3832 return Err(common::Error::HttpError(err));
3833 }
3834 Ok(res) => {
3835 let (mut parts, body) = res.into_parts();
3836 let mut body = common::Body::new(body);
3837 if !parts.status.is_success() {
3838 let bytes = common::to_bytes(body).await.unwrap_or_default();
3839 let error = serde_json::from_str(&common::to_string(&bytes));
3840 let response = common::to_response(parts, bytes.into());
3841
3842 if let common::Retry::After(d) =
3843 dlg.http_failure(&response, error.as_ref().ok())
3844 {
3845 sleep(d).await;
3846 continue;
3847 }
3848
3849 dlg.finished(false);
3850
3851 return Err(match error {
3852 Ok(value) => common::Error::BadRequest(value),
3853 _ => common::Error::Failure(response),
3854 });
3855 }
3856 let response = {
3857 let bytes = common::to_bytes(body).await.unwrap_or_default();
3858 let encoded = common::to_string(&bytes);
3859 match serde_json::from_str(&encoded) {
3860 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3861 Err(error) => {
3862 dlg.response_json_decode_error(&encoded, &error);
3863 return Err(common::Error::JsonDecodeError(
3864 encoded.to_string(),
3865 error,
3866 ));
3867 }
3868 }
3869 };
3870
3871 dlg.finished(true);
3872 return Ok(response);
3873 }
3874 }
3875 }
3876 }
3877
3878 /// Required. The name of the parent to request, e.g. "projects/{project_id}"
3879 ///
3880 /// Sets the *parent* path property to the given value.
3881 ///
3882 /// Even though the property as already been set when instantiating this call,
3883 /// we provide this method for API completeness.
3884 pub fn parent(mut self, new_value: &str) -> ProjectDeviceSessionListCall<'a, C> {
3885 self._parent = new_value.to_string();
3886 self
3887 }
3888 /// Optional. A continuation token for paging.
3889 ///
3890 /// Sets the *page token* query property to the given value.
3891 pub fn page_token(mut self, new_value: &str) -> ProjectDeviceSessionListCall<'a, C> {
3892 self._page_token = Some(new_value.to_string());
3893 self
3894 }
3895 /// Optional. The maximum number of DeviceSessions to return.
3896 ///
3897 /// Sets the *page size* query property to the given value.
3898 pub fn page_size(mut self, new_value: i32) -> ProjectDeviceSessionListCall<'a, C> {
3899 self._page_size = Some(new_value);
3900 self
3901 }
3902 /// Optional. If specified, responses will be filtered by the given filter. Allowed fields are: session_state.
3903 ///
3904 /// Sets the *filter* query property to the given value.
3905 pub fn filter(mut self, new_value: &str) -> ProjectDeviceSessionListCall<'a, C> {
3906 self._filter = Some(new_value.to_string());
3907 self
3908 }
3909 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3910 /// while executing the actual API request.
3911 ///
3912 /// ````text
3913 /// It should be used to handle progress information, and to implement a certain level of resilience.
3914 /// ````
3915 ///
3916 /// Sets the *delegate* property to the given value.
3917 pub fn delegate(
3918 mut self,
3919 new_value: &'a mut dyn common::Delegate,
3920 ) -> ProjectDeviceSessionListCall<'a, C> {
3921 self._delegate = Some(new_value);
3922 self
3923 }
3924
3925 /// Set any additional parameter of the query string used in the request.
3926 /// It should be used to set parameters which are not yet available through their own
3927 /// setters.
3928 ///
3929 /// Please note that this method must not be used to set any of the known parameters
3930 /// which have their own setter method. If done anyway, the request will fail.
3931 ///
3932 /// # Additional Parameters
3933 ///
3934 /// * *$.xgafv* (query-string) - V1 error format.
3935 /// * *access_token* (query-string) - OAuth access token.
3936 /// * *alt* (query-string) - Data format for response.
3937 /// * *callback* (query-string) - JSONP
3938 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3939 /// * *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.
3940 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3941 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3942 /// * *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.
3943 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3944 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3945 pub fn param<T>(mut self, name: T, value: T) -> ProjectDeviceSessionListCall<'a, C>
3946 where
3947 T: AsRef<str>,
3948 {
3949 self._additional_params
3950 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3951 self
3952 }
3953
3954 /// Identifies the authorization scope for the method you are building.
3955 ///
3956 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3957 /// [`Scope::CloudPlatform`].
3958 ///
3959 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3960 /// tokens for more than one scope.
3961 ///
3962 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3963 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3964 /// sufficient, a read-write scope will do as well.
3965 pub fn add_scope<St>(mut self, scope: St) -> ProjectDeviceSessionListCall<'a, C>
3966 where
3967 St: AsRef<str>,
3968 {
3969 self._scopes.insert(String::from(scope.as_ref()));
3970 self
3971 }
3972 /// Identifies the authorization scope(s) for the method you are building.
3973 ///
3974 /// See [`Self::add_scope()`] for details.
3975 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectDeviceSessionListCall<'a, C>
3976 where
3977 I: IntoIterator<Item = St>,
3978 St: AsRef<str>,
3979 {
3980 self._scopes
3981 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3982 self
3983 }
3984
3985 /// Removes all scopes, and no default scope will be used either.
3986 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3987 /// for details).
3988 pub fn clear_scopes(mut self) -> ProjectDeviceSessionListCall<'a, C> {
3989 self._scopes.clear();
3990 self
3991 }
3992}
3993
3994/// PATCH /v1/projects/{projectId}/deviceSessions/deviceSessionId}:updateDeviceSession Updates the current device session to the fields described by the update_mask.
3995///
3996/// A builder for the *deviceSessions.patch* method supported by a *project* resource.
3997/// It is not used directly, but through a [`ProjectMethods`] instance.
3998///
3999/// # Example
4000///
4001/// Instantiate a resource method builder
4002///
4003/// ```test_harness,no_run
4004/// # extern crate hyper;
4005/// # extern crate hyper_rustls;
4006/// # extern crate google_testing1 as testing1;
4007/// use testing1::api::DeviceSession;
4008/// # async fn dox() {
4009/// # use testing1::{Testing, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4010///
4011/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4012/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4013/// # secret,
4014/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4015/// # ).build().await.unwrap();
4016///
4017/// # let client = hyper_util::client::legacy::Client::builder(
4018/// # hyper_util::rt::TokioExecutor::new()
4019/// # )
4020/// # .build(
4021/// # hyper_rustls::HttpsConnectorBuilder::new()
4022/// # .with_native_roots()
4023/// # .unwrap()
4024/// # .https_or_http()
4025/// # .enable_http1()
4026/// # .build()
4027/// # );
4028/// # let mut hub = Testing::new(client, auth);
4029/// // As the method needs a request, you would usually fill it with the desired information
4030/// // into the respective structure. Some of the parts shown here might not be applicable !
4031/// // Values shown here are possibly random and not representative !
4032/// let mut req = DeviceSession::default();
4033///
4034/// // You can configure optional parameters by calling the respective setters at will, and
4035/// // execute the final call using `doit()`.
4036/// // Values shown here are possibly random and not representative !
4037/// let result = hub.projects().device_sessions_patch(req, "name")
4038/// .update_mask(FieldMask::new::<&str>(&[]))
4039/// .doit().await;
4040/// # }
4041/// ```
4042pub struct ProjectDeviceSessionPatchCall<'a, C>
4043where
4044 C: 'a,
4045{
4046 hub: &'a Testing<C>,
4047 _request: DeviceSession,
4048 _name: String,
4049 _update_mask: Option<common::FieldMask>,
4050 _delegate: Option<&'a mut dyn common::Delegate>,
4051 _additional_params: HashMap<String, String>,
4052 _scopes: BTreeSet<String>,
4053}
4054
4055impl<'a, C> common::CallBuilder for ProjectDeviceSessionPatchCall<'a, C> {}
4056
4057impl<'a, C> ProjectDeviceSessionPatchCall<'a, C>
4058where
4059 C: common::Connector,
4060{
4061 /// Perform the operation you have build so far.
4062 pub async fn doit(mut self) -> common::Result<(common::Response, DeviceSession)> {
4063 use std::borrow::Cow;
4064 use std::io::{Read, Seek};
4065
4066 use common::{url::Params, ToParts};
4067 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4068
4069 let mut dd = common::DefaultDelegate;
4070 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4071 dlg.begin(common::MethodInfo {
4072 id: "testing.projects.deviceSessions.patch",
4073 http_method: hyper::Method::PATCH,
4074 });
4075
4076 for &field in ["alt", "name", "updateMask"].iter() {
4077 if self._additional_params.contains_key(field) {
4078 dlg.finished(false);
4079 return Err(common::Error::FieldClash(field));
4080 }
4081 }
4082
4083 let mut params = Params::with_capacity(5 + self._additional_params.len());
4084 params.push("name", self._name);
4085 if let Some(value) = self._update_mask.as_ref() {
4086 params.push("updateMask", value.to_string());
4087 }
4088
4089 params.extend(self._additional_params.iter());
4090
4091 params.push("alt", "json");
4092 let mut url = self.hub._base_url.clone() + "v1/{+name}";
4093 if self._scopes.is_empty() {
4094 self._scopes
4095 .insert(Scope::CloudPlatform.as_ref().to_string());
4096 }
4097
4098 #[allow(clippy::single_element_loop)]
4099 for &(find_this, param_name) in [("{+name}", "name")].iter() {
4100 url = params.uri_replacement(url, param_name, find_this, true);
4101 }
4102 {
4103 let to_remove = ["name"];
4104 params.remove_params(&to_remove);
4105 }
4106
4107 let url = params.parse_with_url(&url);
4108
4109 let mut json_mime_type = mime::APPLICATION_JSON;
4110 let mut request_value_reader = {
4111 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4112 common::remove_json_null_values(&mut value);
4113 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4114 serde_json::to_writer(&mut dst, &value).unwrap();
4115 dst
4116 };
4117 let request_size = request_value_reader
4118 .seek(std::io::SeekFrom::End(0))
4119 .unwrap();
4120 request_value_reader
4121 .seek(std::io::SeekFrom::Start(0))
4122 .unwrap();
4123
4124 loop {
4125 let token = match self
4126 .hub
4127 .auth
4128 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4129 .await
4130 {
4131 Ok(token) => token,
4132 Err(e) => match dlg.token(e) {
4133 Ok(token) => token,
4134 Err(e) => {
4135 dlg.finished(false);
4136 return Err(common::Error::MissingToken(e));
4137 }
4138 },
4139 };
4140 request_value_reader
4141 .seek(std::io::SeekFrom::Start(0))
4142 .unwrap();
4143 let mut req_result = {
4144 let client = &self.hub.client;
4145 dlg.pre_request();
4146 let mut req_builder = hyper::Request::builder()
4147 .method(hyper::Method::PATCH)
4148 .uri(url.as_str())
4149 .header(USER_AGENT, self.hub._user_agent.clone());
4150
4151 if let Some(token) = token.as_ref() {
4152 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4153 }
4154
4155 let request = req_builder
4156 .header(CONTENT_TYPE, json_mime_type.to_string())
4157 .header(CONTENT_LENGTH, request_size as u64)
4158 .body(common::to_body(
4159 request_value_reader.get_ref().clone().into(),
4160 ));
4161
4162 client.request(request.unwrap()).await
4163 };
4164
4165 match req_result {
4166 Err(err) => {
4167 if let common::Retry::After(d) = dlg.http_error(&err) {
4168 sleep(d).await;
4169 continue;
4170 }
4171 dlg.finished(false);
4172 return Err(common::Error::HttpError(err));
4173 }
4174 Ok(res) => {
4175 let (mut parts, body) = res.into_parts();
4176 let mut body = common::Body::new(body);
4177 if !parts.status.is_success() {
4178 let bytes = common::to_bytes(body).await.unwrap_or_default();
4179 let error = serde_json::from_str(&common::to_string(&bytes));
4180 let response = common::to_response(parts, bytes.into());
4181
4182 if let common::Retry::After(d) =
4183 dlg.http_failure(&response, error.as_ref().ok())
4184 {
4185 sleep(d).await;
4186 continue;
4187 }
4188
4189 dlg.finished(false);
4190
4191 return Err(match error {
4192 Ok(value) => common::Error::BadRequest(value),
4193 _ => common::Error::Failure(response),
4194 });
4195 }
4196 let response = {
4197 let bytes = common::to_bytes(body).await.unwrap_or_default();
4198 let encoded = common::to_string(&bytes);
4199 match serde_json::from_str(&encoded) {
4200 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4201 Err(error) => {
4202 dlg.response_json_decode_error(&encoded, &error);
4203 return Err(common::Error::JsonDecodeError(
4204 encoded.to_string(),
4205 error,
4206 ));
4207 }
4208 }
4209 };
4210
4211 dlg.finished(true);
4212 return Ok(response);
4213 }
4214 }
4215 }
4216 }
4217
4218 ///
4219 /// Sets the *request* property to the given value.
4220 ///
4221 /// Even though the property as already been set when instantiating this call,
4222 /// we provide this method for API completeness.
4223 pub fn request(mut self, new_value: DeviceSession) -> ProjectDeviceSessionPatchCall<'a, C> {
4224 self._request = new_value;
4225 self
4226 }
4227 /// Optional. Name of the DeviceSession, e.g. "projects/{project_id}/deviceSessions/{session_id}"
4228 ///
4229 /// Sets the *name* path property to the given value.
4230 ///
4231 /// Even though the property as already been set when instantiating this call,
4232 /// we provide this method for API completeness.
4233 pub fn name(mut self, new_value: &str) -> ProjectDeviceSessionPatchCall<'a, C> {
4234 self._name = new_value.to_string();
4235 self
4236 }
4237 /// Required. The list of fields to update.
4238 ///
4239 /// Sets the *update mask* query property to the given value.
4240 pub fn update_mask(
4241 mut self,
4242 new_value: common::FieldMask,
4243 ) -> ProjectDeviceSessionPatchCall<'a, C> {
4244 self._update_mask = Some(new_value);
4245 self
4246 }
4247 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4248 /// while executing the actual API request.
4249 ///
4250 /// ````text
4251 /// It should be used to handle progress information, and to implement a certain level of resilience.
4252 /// ````
4253 ///
4254 /// Sets the *delegate* property to the given value.
4255 pub fn delegate(
4256 mut self,
4257 new_value: &'a mut dyn common::Delegate,
4258 ) -> ProjectDeviceSessionPatchCall<'a, C> {
4259 self._delegate = Some(new_value);
4260 self
4261 }
4262
4263 /// Set any additional parameter of the query string used in the request.
4264 /// It should be used to set parameters which are not yet available through their own
4265 /// setters.
4266 ///
4267 /// Please note that this method must not be used to set any of the known parameters
4268 /// which have their own setter method. If done anyway, the request will fail.
4269 ///
4270 /// # Additional Parameters
4271 ///
4272 /// * *$.xgafv* (query-string) - V1 error format.
4273 /// * *access_token* (query-string) - OAuth access token.
4274 /// * *alt* (query-string) - Data format for response.
4275 /// * *callback* (query-string) - JSONP
4276 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4277 /// * *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.
4278 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4279 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4280 /// * *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.
4281 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4282 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4283 pub fn param<T>(mut self, name: T, value: T) -> ProjectDeviceSessionPatchCall<'a, C>
4284 where
4285 T: AsRef<str>,
4286 {
4287 self._additional_params
4288 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4289 self
4290 }
4291
4292 /// Identifies the authorization scope for the method you are building.
4293 ///
4294 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4295 /// [`Scope::CloudPlatform`].
4296 ///
4297 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4298 /// tokens for more than one scope.
4299 ///
4300 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4301 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4302 /// sufficient, a read-write scope will do as well.
4303 pub fn add_scope<St>(mut self, scope: St) -> ProjectDeviceSessionPatchCall<'a, C>
4304 where
4305 St: AsRef<str>,
4306 {
4307 self._scopes.insert(String::from(scope.as_ref()));
4308 self
4309 }
4310 /// Identifies the authorization scope(s) for the method you are building.
4311 ///
4312 /// See [`Self::add_scope()`] for details.
4313 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectDeviceSessionPatchCall<'a, C>
4314 where
4315 I: IntoIterator<Item = St>,
4316 St: AsRef<str>,
4317 {
4318 self._scopes
4319 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4320 self
4321 }
4322
4323 /// Removes all scopes, and no default scope will be used either.
4324 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4325 /// for details).
4326 pub fn clear_scopes(mut self) -> ProjectDeviceSessionPatchCall<'a, C> {
4327 self._scopes.clear();
4328 self
4329 }
4330}
4331
4332/// Cancels unfinished test executions in a test matrix. This call returns immediately and cancellation proceeds asynchronously. If the matrix is already final, this operation will have no effect. May return any of the following canonical error codes: - PERMISSION_DENIED - if the user is not authorized to read project - INVALID_ARGUMENT - if the request is malformed - NOT_FOUND - if the Test Matrix does not exist
4333///
4334/// A builder for the *testMatrices.cancel* method supported by a *project* resource.
4335/// It is not used directly, but through a [`ProjectMethods`] instance.
4336///
4337/// # Example
4338///
4339/// Instantiate a resource method builder
4340///
4341/// ```test_harness,no_run
4342/// # extern crate hyper;
4343/// # extern crate hyper_rustls;
4344/// # extern crate google_testing1 as testing1;
4345/// # async fn dox() {
4346/// # use testing1::{Testing, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4347///
4348/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4349/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4350/// # secret,
4351/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4352/// # ).build().await.unwrap();
4353///
4354/// # let client = hyper_util::client::legacy::Client::builder(
4355/// # hyper_util::rt::TokioExecutor::new()
4356/// # )
4357/// # .build(
4358/// # hyper_rustls::HttpsConnectorBuilder::new()
4359/// # .with_native_roots()
4360/// # .unwrap()
4361/// # .https_or_http()
4362/// # .enable_http1()
4363/// # .build()
4364/// # );
4365/// # let mut hub = Testing::new(client, auth);
4366/// // You can configure optional parameters by calling the respective setters at will, and
4367/// // execute the final call using `doit()`.
4368/// // Values shown here are possibly random and not representative !
4369/// let result = hub.projects().test_matrices_cancel("projectId", "testMatrixId")
4370/// .doit().await;
4371/// # }
4372/// ```
4373pub struct ProjectTestMatriceCancelCall<'a, C>
4374where
4375 C: 'a,
4376{
4377 hub: &'a Testing<C>,
4378 _project_id: String,
4379 _test_matrix_id: String,
4380 _delegate: Option<&'a mut dyn common::Delegate>,
4381 _additional_params: HashMap<String, String>,
4382 _scopes: BTreeSet<String>,
4383}
4384
4385impl<'a, C> common::CallBuilder for ProjectTestMatriceCancelCall<'a, C> {}
4386
4387impl<'a, C> ProjectTestMatriceCancelCall<'a, C>
4388where
4389 C: common::Connector,
4390{
4391 /// Perform the operation you have build so far.
4392 pub async fn doit(mut self) -> common::Result<(common::Response, CancelTestMatrixResponse)> {
4393 use std::borrow::Cow;
4394 use std::io::{Read, Seek};
4395
4396 use common::{url::Params, ToParts};
4397 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4398
4399 let mut dd = common::DefaultDelegate;
4400 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4401 dlg.begin(common::MethodInfo {
4402 id: "testing.projects.testMatrices.cancel",
4403 http_method: hyper::Method::POST,
4404 });
4405
4406 for &field in ["alt", "projectId", "testMatrixId"].iter() {
4407 if self._additional_params.contains_key(field) {
4408 dlg.finished(false);
4409 return Err(common::Error::FieldClash(field));
4410 }
4411 }
4412
4413 let mut params = Params::with_capacity(4 + self._additional_params.len());
4414 params.push("projectId", self._project_id);
4415 params.push("testMatrixId", self._test_matrix_id);
4416
4417 params.extend(self._additional_params.iter());
4418
4419 params.push("alt", "json");
4420 let mut url = self.hub._base_url.clone()
4421 + "v1/projects/{projectId}/testMatrices/{testMatrixId}:cancel";
4422 if self._scopes.is_empty() {
4423 self._scopes
4424 .insert(Scope::CloudPlatform.as_ref().to_string());
4425 }
4426
4427 #[allow(clippy::single_element_loop)]
4428 for &(find_this, param_name) in [
4429 ("{projectId}", "projectId"),
4430 ("{testMatrixId}", "testMatrixId"),
4431 ]
4432 .iter()
4433 {
4434 url = params.uri_replacement(url, param_name, find_this, false);
4435 }
4436 {
4437 let to_remove = ["testMatrixId", "projectId"];
4438 params.remove_params(&to_remove);
4439 }
4440
4441 let url = params.parse_with_url(&url);
4442
4443 loop {
4444 let token = match self
4445 .hub
4446 .auth
4447 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4448 .await
4449 {
4450 Ok(token) => token,
4451 Err(e) => match dlg.token(e) {
4452 Ok(token) => token,
4453 Err(e) => {
4454 dlg.finished(false);
4455 return Err(common::Error::MissingToken(e));
4456 }
4457 },
4458 };
4459 let mut req_result = {
4460 let client = &self.hub.client;
4461 dlg.pre_request();
4462 let mut req_builder = hyper::Request::builder()
4463 .method(hyper::Method::POST)
4464 .uri(url.as_str())
4465 .header(USER_AGENT, self.hub._user_agent.clone());
4466
4467 if let Some(token) = token.as_ref() {
4468 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4469 }
4470
4471 let request = req_builder
4472 .header(CONTENT_LENGTH, 0_u64)
4473 .body(common::to_body::<String>(None));
4474
4475 client.request(request.unwrap()).await
4476 };
4477
4478 match req_result {
4479 Err(err) => {
4480 if let common::Retry::After(d) = dlg.http_error(&err) {
4481 sleep(d).await;
4482 continue;
4483 }
4484 dlg.finished(false);
4485 return Err(common::Error::HttpError(err));
4486 }
4487 Ok(res) => {
4488 let (mut parts, body) = res.into_parts();
4489 let mut body = common::Body::new(body);
4490 if !parts.status.is_success() {
4491 let bytes = common::to_bytes(body).await.unwrap_or_default();
4492 let error = serde_json::from_str(&common::to_string(&bytes));
4493 let response = common::to_response(parts, bytes.into());
4494
4495 if let common::Retry::After(d) =
4496 dlg.http_failure(&response, error.as_ref().ok())
4497 {
4498 sleep(d).await;
4499 continue;
4500 }
4501
4502 dlg.finished(false);
4503
4504 return Err(match error {
4505 Ok(value) => common::Error::BadRequest(value),
4506 _ => common::Error::Failure(response),
4507 });
4508 }
4509 let response = {
4510 let bytes = common::to_bytes(body).await.unwrap_or_default();
4511 let encoded = common::to_string(&bytes);
4512 match serde_json::from_str(&encoded) {
4513 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4514 Err(error) => {
4515 dlg.response_json_decode_error(&encoded, &error);
4516 return Err(common::Error::JsonDecodeError(
4517 encoded.to_string(),
4518 error,
4519 ));
4520 }
4521 }
4522 };
4523
4524 dlg.finished(true);
4525 return Ok(response);
4526 }
4527 }
4528 }
4529 }
4530
4531 /// Cloud project that owns the test.
4532 ///
4533 /// Sets the *project id* path property to the given value.
4534 ///
4535 /// Even though the property as already been set when instantiating this call,
4536 /// we provide this method for API completeness.
4537 pub fn project_id(mut self, new_value: &str) -> ProjectTestMatriceCancelCall<'a, C> {
4538 self._project_id = new_value.to_string();
4539 self
4540 }
4541 /// Test matrix that will be canceled.
4542 ///
4543 /// Sets the *test matrix id* path property to the given value.
4544 ///
4545 /// Even though the property as already been set when instantiating this call,
4546 /// we provide this method for API completeness.
4547 pub fn test_matrix_id(mut self, new_value: &str) -> ProjectTestMatriceCancelCall<'a, C> {
4548 self._test_matrix_id = new_value.to_string();
4549 self
4550 }
4551 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4552 /// while executing the actual API request.
4553 ///
4554 /// ````text
4555 /// It should be used to handle progress information, and to implement a certain level of resilience.
4556 /// ````
4557 ///
4558 /// Sets the *delegate* property to the given value.
4559 pub fn delegate(
4560 mut self,
4561 new_value: &'a mut dyn common::Delegate,
4562 ) -> ProjectTestMatriceCancelCall<'a, C> {
4563 self._delegate = Some(new_value);
4564 self
4565 }
4566
4567 /// Set any additional parameter of the query string used in the request.
4568 /// It should be used to set parameters which are not yet available through their own
4569 /// setters.
4570 ///
4571 /// Please note that this method must not be used to set any of the known parameters
4572 /// which have their own setter method. If done anyway, the request will fail.
4573 ///
4574 /// # Additional Parameters
4575 ///
4576 /// * *$.xgafv* (query-string) - V1 error format.
4577 /// * *access_token* (query-string) - OAuth access token.
4578 /// * *alt* (query-string) - Data format for response.
4579 /// * *callback* (query-string) - JSONP
4580 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4581 /// * *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.
4582 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4583 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4584 /// * *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.
4585 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4586 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4587 pub fn param<T>(mut self, name: T, value: T) -> ProjectTestMatriceCancelCall<'a, C>
4588 where
4589 T: AsRef<str>,
4590 {
4591 self._additional_params
4592 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4593 self
4594 }
4595
4596 /// Identifies the authorization scope for the method you are building.
4597 ///
4598 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4599 /// [`Scope::CloudPlatform`].
4600 ///
4601 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4602 /// tokens for more than one scope.
4603 ///
4604 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4605 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4606 /// sufficient, a read-write scope will do as well.
4607 pub fn add_scope<St>(mut self, scope: St) -> ProjectTestMatriceCancelCall<'a, C>
4608 where
4609 St: AsRef<str>,
4610 {
4611 self._scopes.insert(String::from(scope.as_ref()));
4612 self
4613 }
4614 /// Identifies the authorization scope(s) for the method you are building.
4615 ///
4616 /// See [`Self::add_scope()`] for details.
4617 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTestMatriceCancelCall<'a, C>
4618 where
4619 I: IntoIterator<Item = St>,
4620 St: AsRef<str>,
4621 {
4622 self._scopes
4623 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4624 self
4625 }
4626
4627 /// Removes all scopes, and no default scope will be used either.
4628 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4629 /// for details).
4630 pub fn clear_scopes(mut self) -> ProjectTestMatriceCancelCall<'a, C> {
4631 self._scopes.clear();
4632 self
4633 }
4634}
4635
4636/// Creates and runs a matrix of tests according to the given specifications. Unsupported environments will be returned in the state UNSUPPORTED. A test matrix is limited to use at most 2000 devices in parallel. The returned matrix will not yet contain the executions that will be created for this matrix. Execution creation happens later on and will require a call to GetTestMatrix. May return any of the following canonical error codes: - PERMISSION_DENIED - if the user is not authorized to write to project - INVALID_ARGUMENT - if the request is malformed or if the matrix tries to use too many simultaneous devices.
4637///
4638/// A builder for the *testMatrices.create* method supported by a *project* resource.
4639/// It is not used directly, but through a [`ProjectMethods`] instance.
4640///
4641/// # Example
4642///
4643/// Instantiate a resource method builder
4644///
4645/// ```test_harness,no_run
4646/// # extern crate hyper;
4647/// # extern crate hyper_rustls;
4648/// # extern crate google_testing1 as testing1;
4649/// use testing1::api::TestMatrix;
4650/// # async fn dox() {
4651/// # use testing1::{Testing, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4652///
4653/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4654/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4655/// # secret,
4656/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4657/// # ).build().await.unwrap();
4658///
4659/// # let client = hyper_util::client::legacy::Client::builder(
4660/// # hyper_util::rt::TokioExecutor::new()
4661/// # )
4662/// # .build(
4663/// # hyper_rustls::HttpsConnectorBuilder::new()
4664/// # .with_native_roots()
4665/// # .unwrap()
4666/// # .https_or_http()
4667/// # .enable_http1()
4668/// # .build()
4669/// # );
4670/// # let mut hub = Testing::new(client, auth);
4671/// // As the method needs a request, you would usually fill it with the desired information
4672/// // into the respective structure. Some of the parts shown here might not be applicable !
4673/// // Values shown here are possibly random and not representative !
4674/// let mut req = TestMatrix::default();
4675///
4676/// // You can configure optional parameters by calling the respective setters at will, and
4677/// // execute the final call using `doit()`.
4678/// // Values shown here are possibly random and not representative !
4679/// let result = hub.projects().test_matrices_create(req, "projectId")
4680/// .request_id("gubergren")
4681/// .doit().await;
4682/// # }
4683/// ```
4684pub struct ProjectTestMatriceCreateCall<'a, C>
4685where
4686 C: 'a,
4687{
4688 hub: &'a Testing<C>,
4689 _request: TestMatrix,
4690 _project_id: String,
4691 _request_id: Option<String>,
4692 _delegate: Option<&'a mut dyn common::Delegate>,
4693 _additional_params: HashMap<String, String>,
4694 _scopes: BTreeSet<String>,
4695}
4696
4697impl<'a, C> common::CallBuilder for ProjectTestMatriceCreateCall<'a, C> {}
4698
4699impl<'a, C> ProjectTestMatriceCreateCall<'a, C>
4700where
4701 C: common::Connector,
4702{
4703 /// Perform the operation you have build so far.
4704 pub async fn doit(mut self) -> common::Result<(common::Response, TestMatrix)> {
4705 use std::borrow::Cow;
4706 use std::io::{Read, Seek};
4707
4708 use common::{url::Params, ToParts};
4709 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4710
4711 let mut dd = common::DefaultDelegate;
4712 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4713 dlg.begin(common::MethodInfo {
4714 id: "testing.projects.testMatrices.create",
4715 http_method: hyper::Method::POST,
4716 });
4717
4718 for &field in ["alt", "projectId", "requestId"].iter() {
4719 if self._additional_params.contains_key(field) {
4720 dlg.finished(false);
4721 return Err(common::Error::FieldClash(field));
4722 }
4723 }
4724
4725 let mut params = Params::with_capacity(5 + self._additional_params.len());
4726 params.push("projectId", self._project_id);
4727 if let Some(value) = self._request_id.as_ref() {
4728 params.push("requestId", value);
4729 }
4730
4731 params.extend(self._additional_params.iter());
4732
4733 params.push("alt", "json");
4734 let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/testMatrices";
4735 if self._scopes.is_empty() {
4736 self._scopes
4737 .insert(Scope::CloudPlatform.as_ref().to_string());
4738 }
4739
4740 #[allow(clippy::single_element_loop)]
4741 for &(find_this, param_name) in [("{projectId}", "projectId")].iter() {
4742 url = params.uri_replacement(url, param_name, find_this, false);
4743 }
4744 {
4745 let to_remove = ["projectId"];
4746 params.remove_params(&to_remove);
4747 }
4748
4749 let url = params.parse_with_url(&url);
4750
4751 let mut json_mime_type = mime::APPLICATION_JSON;
4752 let mut request_value_reader = {
4753 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4754 common::remove_json_null_values(&mut value);
4755 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4756 serde_json::to_writer(&mut dst, &value).unwrap();
4757 dst
4758 };
4759 let request_size = request_value_reader
4760 .seek(std::io::SeekFrom::End(0))
4761 .unwrap();
4762 request_value_reader
4763 .seek(std::io::SeekFrom::Start(0))
4764 .unwrap();
4765
4766 loop {
4767 let token = match self
4768 .hub
4769 .auth
4770 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4771 .await
4772 {
4773 Ok(token) => token,
4774 Err(e) => match dlg.token(e) {
4775 Ok(token) => token,
4776 Err(e) => {
4777 dlg.finished(false);
4778 return Err(common::Error::MissingToken(e));
4779 }
4780 },
4781 };
4782 request_value_reader
4783 .seek(std::io::SeekFrom::Start(0))
4784 .unwrap();
4785 let mut req_result = {
4786 let client = &self.hub.client;
4787 dlg.pre_request();
4788 let mut req_builder = hyper::Request::builder()
4789 .method(hyper::Method::POST)
4790 .uri(url.as_str())
4791 .header(USER_AGENT, self.hub._user_agent.clone());
4792
4793 if let Some(token) = token.as_ref() {
4794 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4795 }
4796
4797 let request = req_builder
4798 .header(CONTENT_TYPE, json_mime_type.to_string())
4799 .header(CONTENT_LENGTH, request_size as u64)
4800 .body(common::to_body(
4801 request_value_reader.get_ref().clone().into(),
4802 ));
4803
4804 client.request(request.unwrap()).await
4805 };
4806
4807 match req_result {
4808 Err(err) => {
4809 if let common::Retry::After(d) = dlg.http_error(&err) {
4810 sleep(d).await;
4811 continue;
4812 }
4813 dlg.finished(false);
4814 return Err(common::Error::HttpError(err));
4815 }
4816 Ok(res) => {
4817 let (mut parts, body) = res.into_parts();
4818 let mut body = common::Body::new(body);
4819 if !parts.status.is_success() {
4820 let bytes = common::to_bytes(body).await.unwrap_or_default();
4821 let error = serde_json::from_str(&common::to_string(&bytes));
4822 let response = common::to_response(parts, bytes.into());
4823
4824 if let common::Retry::After(d) =
4825 dlg.http_failure(&response, error.as_ref().ok())
4826 {
4827 sleep(d).await;
4828 continue;
4829 }
4830
4831 dlg.finished(false);
4832
4833 return Err(match error {
4834 Ok(value) => common::Error::BadRequest(value),
4835 _ => common::Error::Failure(response),
4836 });
4837 }
4838 let response = {
4839 let bytes = common::to_bytes(body).await.unwrap_or_default();
4840 let encoded = common::to_string(&bytes);
4841 match serde_json::from_str(&encoded) {
4842 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4843 Err(error) => {
4844 dlg.response_json_decode_error(&encoded, &error);
4845 return Err(common::Error::JsonDecodeError(
4846 encoded.to_string(),
4847 error,
4848 ));
4849 }
4850 }
4851 };
4852
4853 dlg.finished(true);
4854 return Ok(response);
4855 }
4856 }
4857 }
4858 }
4859
4860 ///
4861 /// Sets the *request* property to the given value.
4862 ///
4863 /// Even though the property as already been set when instantiating this call,
4864 /// we provide this method for API completeness.
4865 pub fn request(mut self, new_value: TestMatrix) -> ProjectTestMatriceCreateCall<'a, C> {
4866 self._request = new_value;
4867 self
4868 }
4869 /// The GCE project under which this job will run.
4870 ///
4871 /// Sets the *project id* path property to the given value.
4872 ///
4873 /// Even though the property as already been set when instantiating this call,
4874 /// we provide this method for API completeness.
4875 pub fn project_id(mut self, new_value: &str) -> ProjectTestMatriceCreateCall<'a, C> {
4876 self._project_id = new_value.to_string();
4877 self
4878 }
4879 /// A string id used to detect duplicated requests. Ids are automatically scoped to a project, so users should ensure the ID is unique per-project. A UUID is recommended. Optional, but strongly recommended.
4880 ///
4881 /// Sets the *request id* query property to the given value.
4882 pub fn request_id(mut self, new_value: &str) -> ProjectTestMatriceCreateCall<'a, C> {
4883 self._request_id = Some(new_value.to_string());
4884 self
4885 }
4886 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4887 /// while executing the actual API request.
4888 ///
4889 /// ````text
4890 /// It should be used to handle progress information, and to implement a certain level of resilience.
4891 /// ````
4892 ///
4893 /// Sets the *delegate* property to the given value.
4894 pub fn delegate(
4895 mut self,
4896 new_value: &'a mut dyn common::Delegate,
4897 ) -> ProjectTestMatriceCreateCall<'a, C> {
4898 self._delegate = Some(new_value);
4899 self
4900 }
4901
4902 /// Set any additional parameter of the query string used in the request.
4903 /// It should be used to set parameters which are not yet available through their own
4904 /// setters.
4905 ///
4906 /// Please note that this method must not be used to set any of the known parameters
4907 /// which have their own setter method. If done anyway, the request will fail.
4908 ///
4909 /// # Additional Parameters
4910 ///
4911 /// * *$.xgafv* (query-string) - V1 error format.
4912 /// * *access_token* (query-string) - OAuth access token.
4913 /// * *alt* (query-string) - Data format for response.
4914 /// * *callback* (query-string) - JSONP
4915 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4916 /// * *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.
4917 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4918 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4919 /// * *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.
4920 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4921 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4922 pub fn param<T>(mut self, name: T, value: T) -> ProjectTestMatriceCreateCall<'a, C>
4923 where
4924 T: AsRef<str>,
4925 {
4926 self._additional_params
4927 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4928 self
4929 }
4930
4931 /// Identifies the authorization scope for the method you are building.
4932 ///
4933 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4934 /// [`Scope::CloudPlatform`].
4935 ///
4936 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4937 /// tokens for more than one scope.
4938 ///
4939 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4940 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4941 /// sufficient, a read-write scope will do as well.
4942 pub fn add_scope<St>(mut self, scope: St) -> ProjectTestMatriceCreateCall<'a, C>
4943 where
4944 St: AsRef<str>,
4945 {
4946 self._scopes.insert(String::from(scope.as_ref()));
4947 self
4948 }
4949 /// Identifies the authorization scope(s) for the method you are building.
4950 ///
4951 /// See [`Self::add_scope()`] for details.
4952 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTestMatriceCreateCall<'a, C>
4953 where
4954 I: IntoIterator<Item = St>,
4955 St: AsRef<str>,
4956 {
4957 self._scopes
4958 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4959 self
4960 }
4961
4962 /// Removes all scopes, and no default scope will be used either.
4963 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4964 /// for details).
4965 pub fn clear_scopes(mut self) -> ProjectTestMatriceCreateCall<'a, C> {
4966 self._scopes.clear();
4967 self
4968 }
4969}
4970
4971/// Checks the status of a test matrix and the executions once they are created. The test matrix will contain the list of test executions to run if and only if the resultStorage.toolResultsExecution fields have been populated. Note: Flaky test executions may be added to the matrix at a later stage. May return any of the following canonical error codes: - PERMISSION_DENIED - if the user is not authorized to read project - INVALID_ARGUMENT - if the request is malformed - NOT_FOUND - if the Test Matrix does not exist
4972///
4973/// A builder for the *testMatrices.get* method supported by a *project* resource.
4974/// It is not used directly, but through a [`ProjectMethods`] instance.
4975///
4976/// # Example
4977///
4978/// Instantiate a resource method builder
4979///
4980/// ```test_harness,no_run
4981/// # extern crate hyper;
4982/// # extern crate hyper_rustls;
4983/// # extern crate google_testing1 as testing1;
4984/// # async fn dox() {
4985/// # use testing1::{Testing, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4986///
4987/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4988/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4989/// # secret,
4990/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4991/// # ).build().await.unwrap();
4992///
4993/// # let client = hyper_util::client::legacy::Client::builder(
4994/// # hyper_util::rt::TokioExecutor::new()
4995/// # )
4996/// # .build(
4997/// # hyper_rustls::HttpsConnectorBuilder::new()
4998/// # .with_native_roots()
4999/// # .unwrap()
5000/// # .https_or_http()
5001/// # .enable_http1()
5002/// # .build()
5003/// # );
5004/// # let mut hub = Testing::new(client, auth);
5005/// // You can configure optional parameters by calling the respective setters at will, and
5006/// // execute the final call using `doit()`.
5007/// // Values shown here are possibly random and not representative !
5008/// let result = hub.projects().test_matrices_get("projectId", "testMatrixId")
5009/// .doit().await;
5010/// # }
5011/// ```
5012pub struct ProjectTestMatriceGetCall<'a, C>
5013where
5014 C: 'a,
5015{
5016 hub: &'a Testing<C>,
5017 _project_id: String,
5018 _test_matrix_id: String,
5019 _delegate: Option<&'a mut dyn common::Delegate>,
5020 _additional_params: HashMap<String, String>,
5021 _scopes: BTreeSet<String>,
5022}
5023
5024impl<'a, C> common::CallBuilder for ProjectTestMatriceGetCall<'a, C> {}
5025
5026impl<'a, C> ProjectTestMatriceGetCall<'a, C>
5027where
5028 C: common::Connector,
5029{
5030 /// Perform the operation you have build so far.
5031 pub async fn doit(mut self) -> common::Result<(common::Response, TestMatrix)> {
5032 use std::borrow::Cow;
5033 use std::io::{Read, Seek};
5034
5035 use common::{url::Params, ToParts};
5036 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5037
5038 let mut dd = common::DefaultDelegate;
5039 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5040 dlg.begin(common::MethodInfo {
5041 id: "testing.projects.testMatrices.get",
5042 http_method: hyper::Method::GET,
5043 });
5044
5045 for &field in ["alt", "projectId", "testMatrixId"].iter() {
5046 if self._additional_params.contains_key(field) {
5047 dlg.finished(false);
5048 return Err(common::Error::FieldClash(field));
5049 }
5050 }
5051
5052 let mut params = Params::with_capacity(4 + self._additional_params.len());
5053 params.push("projectId", self._project_id);
5054 params.push("testMatrixId", self._test_matrix_id);
5055
5056 params.extend(self._additional_params.iter());
5057
5058 params.push("alt", "json");
5059 let mut url =
5060 self.hub._base_url.clone() + "v1/projects/{projectId}/testMatrices/{testMatrixId}";
5061 if self._scopes.is_empty() {
5062 self._scopes
5063 .insert(Scope::CloudPlatform.as_ref().to_string());
5064 }
5065
5066 #[allow(clippy::single_element_loop)]
5067 for &(find_this, param_name) in [
5068 ("{projectId}", "projectId"),
5069 ("{testMatrixId}", "testMatrixId"),
5070 ]
5071 .iter()
5072 {
5073 url = params.uri_replacement(url, param_name, find_this, false);
5074 }
5075 {
5076 let to_remove = ["testMatrixId", "projectId"];
5077 params.remove_params(&to_remove);
5078 }
5079
5080 let url = params.parse_with_url(&url);
5081
5082 loop {
5083 let token = match self
5084 .hub
5085 .auth
5086 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5087 .await
5088 {
5089 Ok(token) => token,
5090 Err(e) => match dlg.token(e) {
5091 Ok(token) => token,
5092 Err(e) => {
5093 dlg.finished(false);
5094 return Err(common::Error::MissingToken(e));
5095 }
5096 },
5097 };
5098 let mut req_result = {
5099 let client = &self.hub.client;
5100 dlg.pre_request();
5101 let mut req_builder = hyper::Request::builder()
5102 .method(hyper::Method::GET)
5103 .uri(url.as_str())
5104 .header(USER_AGENT, self.hub._user_agent.clone());
5105
5106 if let Some(token) = token.as_ref() {
5107 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5108 }
5109
5110 let request = req_builder
5111 .header(CONTENT_LENGTH, 0_u64)
5112 .body(common::to_body::<String>(None));
5113
5114 client.request(request.unwrap()).await
5115 };
5116
5117 match req_result {
5118 Err(err) => {
5119 if let common::Retry::After(d) = dlg.http_error(&err) {
5120 sleep(d).await;
5121 continue;
5122 }
5123 dlg.finished(false);
5124 return Err(common::Error::HttpError(err));
5125 }
5126 Ok(res) => {
5127 let (mut parts, body) = res.into_parts();
5128 let mut body = common::Body::new(body);
5129 if !parts.status.is_success() {
5130 let bytes = common::to_bytes(body).await.unwrap_or_default();
5131 let error = serde_json::from_str(&common::to_string(&bytes));
5132 let response = common::to_response(parts, bytes.into());
5133
5134 if let common::Retry::After(d) =
5135 dlg.http_failure(&response, error.as_ref().ok())
5136 {
5137 sleep(d).await;
5138 continue;
5139 }
5140
5141 dlg.finished(false);
5142
5143 return Err(match error {
5144 Ok(value) => common::Error::BadRequest(value),
5145 _ => common::Error::Failure(response),
5146 });
5147 }
5148 let response = {
5149 let bytes = common::to_bytes(body).await.unwrap_or_default();
5150 let encoded = common::to_string(&bytes);
5151 match serde_json::from_str(&encoded) {
5152 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5153 Err(error) => {
5154 dlg.response_json_decode_error(&encoded, &error);
5155 return Err(common::Error::JsonDecodeError(
5156 encoded.to_string(),
5157 error,
5158 ));
5159 }
5160 }
5161 };
5162
5163 dlg.finished(true);
5164 return Ok(response);
5165 }
5166 }
5167 }
5168 }
5169
5170 /// Cloud project that owns the test matrix.
5171 ///
5172 /// Sets the *project id* path property to the given value.
5173 ///
5174 /// Even though the property as already been set when instantiating this call,
5175 /// we provide this method for API completeness.
5176 pub fn project_id(mut self, new_value: &str) -> ProjectTestMatriceGetCall<'a, C> {
5177 self._project_id = new_value.to_string();
5178 self
5179 }
5180 /// Unique test matrix id which was assigned by the service.
5181 ///
5182 /// Sets the *test matrix id* path property to the given value.
5183 ///
5184 /// Even though the property as already been set when instantiating this call,
5185 /// we provide this method for API completeness.
5186 pub fn test_matrix_id(mut self, new_value: &str) -> ProjectTestMatriceGetCall<'a, C> {
5187 self._test_matrix_id = new_value.to_string();
5188 self
5189 }
5190 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5191 /// while executing the actual API request.
5192 ///
5193 /// ````text
5194 /// It should be used to handle progress information, and to implement a certain level of resilience.
5195 /// ````
5196 ///
5197 /// Sets the *delegate* property to the given value.
5198 pub fn delegate(
5199 mut self,
5200 new_value: &'a mut dyn common::Delegate,
5201 ) -> ProjectTestMatriceGetCall<'a, C> {
5202 self._delegate = Some(new_value);
5203 self
5204 }
5205
5206 /// Set any additional parameter of the query string used in the request.
5207 /// It should be used to set parameters which are not yet available through their own
5208 /// setters.
5209 ///
5210 /// Please note that this method must not be used to set any of the known parameters
5211 /// which have their own setter method. If done anyway, the request will fail.
5212 ///
5213 /// # Additional Parameters
5214 ///
5215 /// * *$.xgafv* (query-string) - V1 error format.
5216 /// * *access_token* (query-string) - OAuth access token.
5217 /// * *alt* (query-string) - Data format for response.
5218 /// * *callback* (query-string) - JSONP
5219 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5220 /// * *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.
5221 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5222 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5223 /// * *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.
5224 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5225 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5226 pub fn param<T>(mut self, name: T, value: T) -> ProjectTestMatriceGetCall<'a, C>
5227 where
5228 T: AsRef<str>,
5229 {
5230 self._additional_params
5231 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5232 self
5233 }
5234
5235 /// Identifies the authorization scope for the method you are building.
5236 ///
5237 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5238 /// [`Scope::CloudPlatform`].
5239 ///
5240 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5241 /// tokens for more than one scope.
5242 ///
5243 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5244 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5245 /// sufficient, a read-write scope will do as well.
5246 pub fn add_scope<St>(mut self, scope: St) -> ProjectTestMatriceGetCall<'a, C>
5247 where
5248 St: AsRef<str>,
5249 {
5250 self._scopes.insert(String::from(scope.as_ref()));
5251 self
5252 }
5253 /// Identifies the authorization scope(s) for the method you are building.
5254 ///
5255 /// See [`Self::add_scope()`] for details.
5256 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTestMatriceGetCall<'a, C>
5257 where
5258 I: IntoIterator<Item = St>,
5259 St: AsRef<str>,
5260 {
5261 self._scopes
5262 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5263 self
5264 }
5265
5266 /// Removes all scopes, and no default scope will be used either.
5267 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5268 /// for details).
5269 pub fn clear_scopes(mut self) -> ProjectTestMatriceGetCall<'a, C> {
5270 self._scopes.clear();
5271 self
5272 }
5273}
5274
5275/// Gets the catalog of supported test environments. May return any of the following canonical error codes: - INVALID_ARGUMENT - if the request is malformed - NOT_FOUND - if the environment type does not exist - INTERNAL - if an internal error occurred
5276///
5277/// A builder for the *get* method supported by a *testEnvironmentCatalog* resource.
5278/// It is not used directly, but through a [`TestEnvironmentCatalogMethods`] instance.
5279///
5280/// # Example
5281///
5282/// Instantiate a resource method builder
5283///
5284/// ```test_harness,no_run
5285/// # extern crate hyper;
5286/// # extern crate hyper_rustls;
5287/// # extern crate google_testing1 as testing1;
5288/// # async fn dox() {
5289/// # use testing1::{Testing, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5290///
5291/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5292/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5293/// # secret,
5294/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5295/// # ).build().await.unwrap();
5296///
5297/// # let client = hyper_util::client::legacy::Client::builder(
5298/// # hyper_util::rt::TokioExecutor::new()
5299/// # )
5300/// # .build(
5301/// # hyper_rustls::HttpsConnectorBuilder::new()
5302/// # .with_native_roots()
5303/// # .unwrap()
5304/// # .https_or_http()
5305/// # .enable_http1()
5306/// # .build()
5307/// # );
5308/// # let mut hub = Testing::new(client, auth);
5309/// // You can configure optional parameters by calling the respective setters at will, and
5310/// // execute the final call using `doit()`.
5311/// // Values shown here are possibly random and not representative !
5312/// let result = hub.test_environment_catalog().get("environmentType")
5313/// .project_id("ipsum")
5314/// .doit().await;
5315/// # }
5316/// ```
5317pub struct TestEnvironmentCatalogGetCall<'a, C>
5318where
5319 C: 'a,
5320{
5321 hub: &'a Testing<C>,
5322 _environment_type: String,
5323 _project_id: Option<String>,
5324 _delegate: Option<&'a mut dyn common::Delegate>,
5325 _additional_params: HashMap<String, String>,
5326 _scopes: BTreeSet<String>,
5327}
5328
5329impl<'a, C> common::CallBuilder for TestEnvironmentCatalogGetCall<'a, C> {}
5330
5331impl<'a, C> TestEnvironmentCatalogGetCall<'a, C>
5332where
5333 C: common::Connector,
5334{
5335 /// Perform the operation you have build so far.
5336 pub async fn doit(mut self) -> common::Result<(common::Response, TestEnvironmentCatalog)> {
5337 use std::borrow::Cow;
5338 use std::io::{Read, Seek};
5339
5340 use common::{url::Params, ToParts};
5341 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5342
5343 let mut dd = common::DefaultDelegate;
5344 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5345 dlg.begin(common::MethodInfo {
5346 id: "testing.testEnvironmentCatalog.get",
5347 http_method: hyper::Method::GET,
5348 });
5349
5350 for &field in ["alt", "environmentType", "projectId"].iter() {
5351 if self._additional_params.contains_key(field) {
5352 dlg.finished(false);
5353 return Err(common::Error::FieldClash(field));
5354 }
5355 }
5356
5357 let mut params = Params::with_capacity(4 + self._additional_params.len());
5358 params.push("environmentType", self._environment_type);
5359 if let Some(value) = self._project_id.as_ref() {
5360 params.push("projectId", value);
5361 }
5362
5363 params.extend(self._additional_params.iter());
5364
5365 params.push("alt", "json");
5366 let mut url = self.hub._base_url.clone() + "v1/testEnvironmentCatalog/{environmentType}";
5367 if self._scopes.is_empty() {
5368 self._scopes
5369 .insert(Scope::CloudPlatform.as_ref().to_string());
5370 }
5371
5372 #[allow(clippy::single_element_loop)]
5373 for &(find_this, param_name) in [("{environmentType}", "environmentType")].iter() {
5374 url = params.uri_replacement(url, param_name, find_this, false);
5375 }
5376 {
5377 let to_remove = ["environmentType"];
5378 params.remove_params(&to_remove);
5379 }
5380
5381 let url = params.parse_with_url(&url);
5382
5383 loop {
5384 let token = match self
5385 .hub
5386 .auth
5387 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5388 .await
5389 {
5390 Ok(token) => token,
5391 Err(e) => match dlg.token(e) {
5392 Ok(token) => token,
5393 Err(e) => {
5394 dlg.finished(false);
5395 return Err(common::Error::MissingToken(e));
5396 }
5397 },
5398 };
5399 let mut req_result = {
5400 let client = &self.hub.client;
5401 dlg.pre_request();
5402 let mut req_builder = hyper::Request::builder()
5403 .method(hyper::Method::GET)
5404 .uri(url.as_str())
5405 .header(USER_AGENT, self.hub._user_agent.clone());
5406
5407 if let Some(token) = token.as_ref() {
5408 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5409 }
5410
5411 let request = req_builder
5412 .header(CONTENT_LENGTH, 0_u64)
5413 .body(common::to_body::<String>(None));
5414
5415 client.request(request.unwrap()).await
5416 };
5417
5418 match req_result {
5419 Err(err) => {
5420 if let common::Retry::After(d) = dlg.http_error(&err) {
5421 sleep(d).await;
5422 continue;
5423 }
5424 dlg.finished(false);
5425 return Err(common::Error::HttpError(err));
5426 }
5427 Ok(res) => {
5428 let (mut parts, body) = res.into_parts();
5429 let mut body = common::Body::new(body);
5430 if !parts.status.is_success() {
5431 let bytes = common::to_bytes(body).await.unwrap_or_default();
5432 let error = serde_json::from_str(&common::to_string(&bytes));
5433 let response = common::to_response(parts, bytes.into());
5434
5435 if let common::Retry::After(d) =
5436 dlg.http_failure(&response, error.as_ref().ok())
5437 {
5438 sleep(d).await;
5439 continue;
5440 }
5441
5442 dlg.finished(false);
5443
5444 return Err(match error {
5445 Ok(value) => common::Error::BadRequest(value),
5446 _ => common::Error::Failure(response),
5447 });
5448 }
5449 let response = {
5450 let bytes = common::to_bytes(body).await.unwrap_or_default();
5451 let encoded = common::to_string(&bytes);
5452 match serde_json::from_str(&encoded) {
5453 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5454 Err(error) => {
5455 dlg.response_json_decode_error(&encoded, &error);
5456 return Err(common::Error::JsonDecodeError(
5457 encoded.to_string(),
5458 error,
5459 ));
5460 }
5461 }
5462 };
5463
5464 dlg.finished(true);
5465 return Ok(response);
5466 }
5467 }
5468 }
5469 }
5470
5471 /// Required. The type of environment that should be listed.
5472 ///
5473 /// Sets the *environment type* path property to the given value.
5474 ///
5475 /// Even though the property as already been set when instantiating this call,
5476 /// we provide this method for API completeness.
5477 pub fn environment_type(mut self, new_value: &str) -> TestEnvironmentCatalogGetCall<'a, C> {
5478 self._environment_type = new_value.to_string();
5479 self
5480 }
5481 /// For authorization, the cloud project requesting the TestEnvironmentCatalog.
5482 ///
5483 /// Sets the *project id* query property to the given value.
5484 pub fn project_id(mut self, new_value: &str) -> TestEnvironmentCatalogGetCall<'a, C> {
5485 self._project_id = Some(new_value.to_string());
5486 self
5487 }
5488 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5489 /// while executing the actual API request.
5490 ///
5491 /// ````text
5492 /// It should be used to handle progress information, and to implement a certain level of resilience.
5493 /// ````
5494 ///
5495 /// Sets the *delegate* property to the given value.
5496 pub fn delegate(
5497 mut self,
5498 new_value: &'a mut dyn common::Delegate,
5499 ) -> TestEnvironmentCatalogGetCall<'a, C> {
5500 self._delegate = Some(new_value);
5501 self
5502 }
5503
5504 /// Set any additional parameter of the query string used in the request.
5505 /// It should be used to set parameters which are not yet available through their own
5506 /// setters.
5507 ///
5508 /// Please note that this method must not be used to set any of the known parameters
5509 /// which have their own setter method. If done anyway, the request will fail.
5510 ///
5511 /// # Additional Parameters
5512 ///
5513 /// * *$.xgafv* (query-string) - V1 error format.
5514 /// * *access_token* (query-string) - OAuth access token.
5515 /// * *alt* (query-string) - Data format for response.
5516 /// * *callback* (query-string) - JSONP
5517 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5518 /// * *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.
5519 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5520 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5521 /// * *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.
5522 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5523 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5524 pub fn param<T>(mut self, name: T, value: T) -> TestEnvironmentCatalogGetCall<'a, C>
5525 where
5526 T: AsRef<str>,
5527 {
5528 self._additional_params
5529 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5530 self
5531 }
5532
5533 /// Identifies the authorization scope for the method you are building.
5534 ///
5535 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5536 /// [`Scope::CloudPlatform`].
5537 ///
5538 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5539 /// tokens for more than one scope.
5540 ///
5541 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5542 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5543 /// sufficient, a read-write scope will do as well.
5544 pub fn add_scope<St>(mut self, scope: St) -> TestEnvironmentCatalogGetCall<'a, C>
5545 where
5546 St: AsRef<str>,
5547 {
5548 self._scopes.insert(String::from(scope.as_ref()));
5549 self
5550 }
5551 /// Identifies the authorization scope(s) for the method you are building.
5552 ///
5553 /// See [`Self::add_scope()`] for details.
5554 pub fn add_scopes<I, St>(mut self, scopes: I) -> TestEnvironmentCatalogGetCall<'a, C>
5555 where
5556 I: IntoIterator<Item = St>,
5557 St: AsRef<str>,
5558 {
5559 self._scopes
5560 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5561 self
5562 }
5563
5564 /// Removes all scopes, and no default scope will be used either.
5565 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5566 /// for details).
5567 pub fn clear_scopes(mut self) -> TestEnvironmentCatalogGetCall<'a, C> {
5568 self._scopes.clear();
5569 self
5570 }
5571}