google_androidmanagement1/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 /// Manage Android devices and apps for your customers
17 Full,
18}
19
20impl AsRef<str> for Scope {
21 fn as_ref(&self) -> &str {
22 match *self {
23 Scope::Full => "https://www.googleapis.com/auth/androidmanagement",
24 }
25 }
26}
27
28#[allow(clippy::derivable_impls)]
29impl Default for Scope {
30 fn default() -> Scope {
31 Scope::Full
32 }
33}
34
35// ########
36// HUB ###
37// ######
38
39/// Central instance to access all AndroidManagement related resource activities
40///
41/// # Examples
42///
43/// Instantiate a new hub
44///
45/// ```test_harness,no_run
46/// extern crate hyper;
47/// extern crate hyper_rustls;
48/// extern crate google_androidmanagement1 as androidmanagement1;
49/// use androidmanagement1::{Result, Error};
50/// # async fn dox() {
51/// use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
52///
53/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
54/// // `client_secret`, among other things.
55/// let secret: yup_oauth2::ApplicationSecret = Default::default();
56/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
57/// // unless you replace `None` with the desired Flow.
58/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
59/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
60/// // retrieve them from storage.
61/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
62/// .with_native_roots()
63/// .unwrap()
64/// .https_only()
65/// .enable_http2()
66/// .build();
67///
68/// let executor = hyper_util::rt::TokioExecutor::new();
69/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
70/// secret,
71/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
72/// yup_oauth2::client::CustomHyperClientBuilder::from(
73/// hyper_util::client::legacy::Client::builder(executor).build(connector),
74/// ),
75/// ).build().await.unwrap();
76///
77/// let client = hyper_util::client::legacy::Client::builder(
78/// hyper_util::rt::TokioExecutor::new()
79/// )
80/// .build(
81/// hyper_rustls::HttpsConnectorBuilder::new()
82/// .with_native_roots()
83/// .unwrap()
84/// .https_or_http()
85/// .enable_http2()
86/// .build()
87/// );
88/// let mut hub = AndroidManagement::new(client, auth);
89/// // You can configure optional parameters by calling the respective setters at will, and
90/// // execute the final call using `doit()`.
91/// // Values shown here are possibly random and not representative !
92/// let result = hub.enterprises().devices_operations_list("name")
93/// .return_partial_success(true)
94/// .page_token("gubergren")
95/// .page_size(-75)
96/// .filter("dolor")
97/// .doit().await;
98///
99/// match result {
100/// Err(e) => match e {
101/// // The Error enum provides details about what exactly happened.
102/// // You can also just use its `Debug`, `Display` or `Error` traits
103/// Error::HttpError(_)
104/// |Error::Io(_)
105/// |Error::MissingAPIKey
106/// |Error::MissingToken(_)
107/// |Error::Cancelled
108/// |Error::UploadSizeLimitExceeded(_, _)
109/// |Error::Failure(_)
110/// |Error::BadRequest(_)
111/// |Error::FieldClash(_)
112/// |Error::JsonDecodeError(_, _) => println!("{}", e),
113/// },
114/// Ok(res) => println!("Success: {:?}", res),
115/// }
116/// # }
117/// ```
118#[derive(Clone)]
119pub struct AndroidManagement<C> {
120 pub client: common::Client<C>,
121 pub auth: Box<dyn common::GetToken>,
122 _user_agent: String,
123 _base_url: String,
124 _root_url: String,
125}
126
127impl<C> common::Hub for AndroidManagement<C> {}
128
129impl<'a, C> AndroidManagement<C> {
130 pub fn new<A: 'static + common::GetToken>(
131 client: common::Client<C>,
132 auth: A,
133 ) -> AndroidManagement<C> {
134 AndroidManagement {
135 client,
136 auth: Box::new(auth),
137 _user_agent: "google-api-rust-client/7.0.0".to_string(),
138 _base_url: "https://androidmanagement.googleapis.com/".to_string(),
139 _root_url: "https://androidmanagement.googleapis.com/".to_string(),
140 }
141 }
142
143 pub fn enterprises(&'a self) -> EnterpriseMethods<'a, C> {
144 EnterpriseMethods { hub: self }
145 }
146 pub fn provisioning_info(&'a self) -> ProvisioningInfoMethods<'a, C> {
147 ProvisioningInfoMethods { hub: self }
148 }
149 pub fn signup_urls(&'a self) -> SignupUrlMethods<'a, C> {
150 SignupUrlMethods { hub: self }
151 }
152
153 /// Set the user-agent header field to use in all requests to the server.
154 /// It defaults to `google-api-rust-client/7.0.0`.
155 ///
156 /// Returns the previously set user-agent.
157 pub fn user_agent(&mut self, agent_name: String) -> String {
158 std::mem::replace(&mut self._user_agent, agent_name)
159 }
160
161 /// Set the base url to use in all requests to the server.
162 /// It defaults to `https://androidmanagement.googleapis.com/`.
163 ///
164 /// Returns the previously set base url.
165 pub fn base_url(&mut self, new_base_url: String) -> String {
166 std::mem::replace(&mut self._base_url, new_base_url)
167 }
168
169 /// Set the root url to use in all requests to the server.
170 /// It defaults to `https://androidmanagement.googleapis.com/`.
171 ///
172 /// Returns the previously set root url.
173 pub fn root_url(&mut self, new_root_url: String) -> String {
174 std::mem::replace(&mut self._root_url, new_root_url)
175 }
176}
177
178// ############
179// SCHEMAS ###
180// ##########
181/// Parameters associated with the ADD_ESIM command to add an eSIM profile to the device.
182///
183/// This type is not used in any activity, and only used as *part* of another schema.
184///
185#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
186#[serde_with::serde_as]
187#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
188pub struct AddEsimParams {
189 /// Required. The activation code for the eSIM profile.
190 #[serde(rename = "activationCode")]
191 pub activation_code: Option<String>,
192 /// Required. The activation state of the eSIM profile once it is downloaded.
193 #[serde(rename = "activationState")]
194 pub activation_state: Option<String>,
195}
196
197impl common::Part for AddEsimParams {}
198
199/// Advanced security settings. In most cases, setting these is not needed.
200///
201/// This type is not used in any activity, and only used as *part* of another schema.
202///
203#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
204#[serde_with::serde_as]
205#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
206pub struct AdvancedSecurityOverrides {
207 /// Controls Common Criteria Mode—security standards defined in the Common Criteria for Information Technology Security Evaluation (https://www.commoncriteriaportal.org/) (CC). Enabling Common Criteria Mode increases certain security components on a device, see CommonCriteriaMode for details.Warning: Common Criteria Mode enforces a strict security model typically only required for IT products used in national security systems and other highly sensitive organizations. Standard device use may be affected. Only enabled if required. If Common Criteria Mode is turned off after being enabled previously, all user-configured Wi-Fi networks may be lost and any enterprise-configured Wi-Fi networks that require user input may need to be reconfigured.
208 #[serde(rename = "commonCriteriaMode")]
209 pub common_criteria_mode: Option<String>,
210 /// Optional. Controls whether content protection, which scans for deceptive apps, is enabled. This is supported on Android 15 and above.
211 #[serde(rename = "contentProtectionPolicy")]
212 pub content_protection_policy: Option<String>,
213 /// Controls access to developer settings: developer options and safe boot. Replaces safeBootDisabled (deprecated) and debuggingFeaturesAllowed (deprecated). On personally-owned devices with a work profile, setting this policy will not disable safe boot. In this case, a NonComplianceDetail with MANAGEMENT_MODE is reported.
214 #[serde(rename = "developerSettings")]
215 pub developer_settings: Option<String>,
216 /// Whether Google Play Protect verification (https://support.google.com/accounts/answer/2812853) is enforced. Replaces ensureVerifyAppsEnabled (deprecated).
217 #[serde(rename = "googlePlayProtectVerifyApps")]
218 pub google_play_protect_verify_apps: Option<String>,
219 /// Optional. Controls Memory Tagging Extension (MTE) (https://source.android.com/docs/security/test/memory-safety/arm-mte) on the device. The device needs to be rebooted to apply changes to the MTE policy. On Android 15 and above, a NonComplianceDetail with PENDING is reported if the policy change is pending a device reboot.
220 #[serde(rename = "mtePolicy")]
221 pub mte_policy: Option<String>,
222 /// Personal apps that can read work profile notifications using a NotificationListenerService (https://developer.android.com/reference/android/service/notification/NotificationListenerService). By default, no personal apps (aside from system apps) can read work notifications. Each value in the list must be a package name.
223 #[serde(rename = "personalAppsThatCanReadWorkNotifications")]
224 pub personal_apps_that_can_read_work_notifications: Option<Vec<String>>,
225 /// The policy for untrusted apps (apps from unknown sources) enforced on the device. Replaces install_unknown_sources_allowed (deprecated).
226 #[serde(rename = "untrustedAppsPolicy")]
227 pub untrusted_apps_policy: Option<String>,
228}
229
230impl common::Part for AdvancedSecurityOverrides {}
231
232/// Configuration for an always-on VPN connection.
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 AlwaysOnVpnPackage {
240 /// Disallows networking when the VPN is not connected.
241 #[serde(rename = "lockdownEnabled")]
242 pub lockdown_enabled: Option<bool>,
243 /// The package name of the VPN app.
244 #[serde(rename = "packageName")]
245 pub package_name: Option<String>,
246}
247
248impl common::Part for AlwaysOnVpnPackage {}
249
250/// A compliance rule condition which is satisfied if the Android Framework API level on the device doesn't meet a minimum requirement. There can only be one rule with this type of condition per policy.
251///
252/// This type is not used in any activity, and only used as *part* of another schema.
253///
254#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
255#[serde_with::serde_as]
256#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
257pub struct ApiLevelCondition {
258 /// The minimum desired Android Framework API level. If the device doesn't meet the minimum requirement, this condition is satisfied. Must be greater than zero.
259 #[serde(rename = "minApiLevel")]
260 pub min_api_level: Option<i32>,
261}
262
263impl common::Part for ApiLevelCondition {}
264
265/// Access Point Name (APN) policy. Configuration for Access Point Names (APNs) which may override any other APNs on the device. See OVERRIDE_APNS_ENABLED and overrideApns for details.
266///
267/// This type is not used in any activity, and only used as *part* of another schema.
268///
269#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
270#[serde_with::serde_as]
271#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
272pub struct ApnPolicy {
273 /// Optional. APN settings for override APNs. There must not be any conflict between any of APN settings provided, otherwise the policy will be rejected. Two ApnSettings are considered to conflict when all of the following fields match on both: numericOperatorId, apn, proxyAddress, proxyPort, mmsProxyAddress, mmsProxyPort, mmsc, mvnoType, protocol, roamingProtocol. If some of the APN settings result in non-compliance of INVALID_VALUE , they will be ignored. This can be set on fully managed devices on Android 10 and above. This can also be set on work profiles on Android 13 and above and only with ApnSetting's with ENTERPRISE APN type. A NonComplianceDetail with API_LEVEL is reported if the Android version is less than 10. A NonComplianceDetail with MANAGEMENT_MODE is reported for work profiles on Android versions less than 13.
274 #[serde(rename = "apnSettings")]
275 pub apn_settings: Option<Vec<ApnSetting>>,
276 /// Optional. Whether override APNs are disabled or enabled. See DevicePolicyManager.setOverrideApnsEnabled (https://developer.android.com/reference/android/app/admin/DevicePolicyManager#setOverrideApnsEnabled) for more details.
277 #[serde(rename = "overrideApns")]
278 pub override_apns: Option<String>,
279}
280
281impl common::Part for ApnPolicy {}
282
283/// An Access Point Name (APN) configuration for a carrier data connection. The APN provides configuration to connect a cellular network device to an IP data network. A carrier uses this setting to decide which IP address to assign, any security methods to apply, and how the device might be connected to private networks.
284///
285/// This type is not used in any activity, and only used as *part* of another schema.
286///
287#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
288#[serde_with::serde_as]
289#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
290pub struct ApnSetting {
291 /// Optional. Whether User Plane resources have to be activated during every transition from CM-IDLE mode to CM-CONNECTED state for this APN. See 3GPP TS 23.501 section 5.6.13.
292 #[serde(rename = "alwaysOnSetting")]
293 pub always_on_setting: Option<String>,
294 /// Required. Name of the APN. Policy will be rejected if this field is empty.
295 pub apn: Option<String>,
296 /// Required. Usage categories for the APN. Policy will be rejected if this field is empty or contains APN_TYPE_UNSPECIFIED or duplicates. Multiple APN types can be set on fully managed devices. ENTERPRISE is the only allowed APN type on work profiles. A NonComplianceDetail with MANAGEMENT_MODE is reported for any other value on work profiles. APN types that are not supported on the device or management mode will be ignored. If this results in the empty list, the APN setting will be ignored, because apnTypes is a required field. A NonComplianceDetail with INVALID_VALUE is reported if none of the APN types are supported on the device or management mode.
297 #[serde(rename = "apnTypes")]
298 pub apn_types: Option<Vec<String>>,
299 /// Optional. Authentication type of the APN.
300 #[serde(rename = "authType")]
301 pub auth_type: Option<String>,
302 /// Optional. Carrier ID for the APN. A value of 0 (default) means not set and negative values are rejected.
303 #[serde(rename = "carrierId")]
304 pub carrier_id: Option<i32>,
305 /// Required. Human-readable name that describes the APN. Policy will be rejected if this field is empty.
306 #[serde(rename = "displayName")]
307 pub display_name: Option<String>,
308 /// Optional. MMS (Multimedia Messaging Service) proxy address of the APN which can be an IP address or hostname (not a URL).
309 #[serde(rename = "mmsProxyAddress")]
310 pub mms_proxy_address: Option<String>,
311 /// Optional. MMS (Multimedia Messaging Service) proxy port of the APN. A value of 0 (default) means not set and negative values are rejected.
312 #[serde(rename = "mmsProxyPort")]
313 pub mms_proxy_port: Option<i32>,
314 /// Optional. MMSC (Multimedia Messaging Service Center) URI of the APN.
315 pub mmsc: Option<String>,
316 /// Optional. The default MTU (Maximum Transmission Unit) size in bytes of the IPv4 routes brought up by this APN setting. A value of 0 (default) means not set and negative values are rejected. Supported on Android 13 and above. A NonComplianceDetail with API_LEVEL is reported if the Android version is less than 13.
317 #[serde(rename = "mtuV4")]
318 pub mtu_v4: Option<i32>,
319 /// Optional. The MTU (Maximum Transmission Unit) size of the IPv6 mobile interface to which the APN connected. A value of 0 (default) means not set and negative values are rejected. Supported on Android 13 and above. A NonComplianceDetail with API_LEVEL is reported if the Android version is less than 13.
320 #[serde(rename = "mtuV6")]
321 pub mtu_v6: Option<i32>,
322 /// Optional. MVNO match type for the APN.
323 #[serde(rename = "mvnoType")]
324 pub mvno_type: Option<String>,
325 /// Optional. Radio technologies (network types) the APN may use. Policy will be rejected if this field contains NETWORK_TYPE_UNSPECIFIED or duplicates.
326 #[serde(rename = "networkTypes")]
327 pub network_types: Option<Vec<String>>,
328 /// Optional. The numeric operator ID of the APN. Numeric operator ID is defined as MCC (Mobile Country Code) + MNC (Mobile Network Code).
329 #[serde(rename = "numericOperatorId")]
330 pub numeric_operator_id: Option<String>,
331 /// Optional. APN password of the APN.
332 pub password: Option<String>,
333 /// Optional. The protocol to use to connect to this APN.
334 pub protocol: Option<String>,
335 /// Optional. The proxy address of the APN.
336 #[serde(rename = "proxyAddress")]
337 pub proxy_address: Option<String>,
338 /// Optional. The proxy port of the APN. A value of 0 (default) means not set and negative values are rejected.
339 #[serde(rename = "proxyPort")]
340 pub proxy_port: Option<i32>,
341 /// Optional. The protocol to use to connect to this APN while the device is roaming.
342 #[serde(rename = "roamingProtocol")]
343 pub roaming_protocol: Option<String>,
344 /// Optional. APN username of the APN.
345 pub username: Option<String>,
346}
347
348impl common::Part for ApnSetting {}
349
350/// Id to name association of a app track.
351///
352/// This type is not used in any activity, and only used as *part* of another schema.
353///
354#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
355#[serde_with::serde_as]
356#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
357pub struct AppTrackInfo {
358 /// The track name associated with the trackId, set in the Play Console. The name is modifiable from Play Console.
359 #[serde(rename = "trackAlias")]
360 pub track_alias: Option<String>,
361 /// The unmodifiable unique track identifier, taken from the releaseTrackId in the URL of the Play Console page that displays the app’s track information.
362 #[serde(rename = "trackId")]
363 pub track_id: Option<String>,
364}
365
366impl common::Part for AppTrackInfo {}
367
368/// This represents a single version of the app.
369///
370/// This type is not used in any activity, and only used as *part* of another schema.
371///
372#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
373#[serde_with::serde_as]
374#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
375pub struct AppVersion {
376 /// If the value is True, it indicates that this version is a production track.
377 pub production: Option<bool>,
378 /// Track identifiers that the app version is published in. This does not include the production track (see production instead).
379 #[serde(rename = "trackIds")]
380 pub track_ids: Option<Vec<String>>,
381 /// Unique increasing identifier for the app version.
382 #[serde(rename = "versionCode")]
383 pub version_code: Option<i32>,
384 /// The string used in the Play store by the app developer to identify the version. The string is not necessarily unique or localized (for example, the string could be "1.4").
385 #[serde(rename = "versionString")]
386 pub version_string: Option<String>,
387}
388
389impl common::Part for AppVersion {}
390
391/// Information about an app.
392///
393/// # Activities
394///
395/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
396/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
397///
398/// * [applications get enterprises](EnterpriseApplicationGetCall) (response)
399#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
400#[serde_with::serde_as]
401#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
402pub struct Application {
403 /// Whether this app is free, free with in-app purchases, or paid. If the pricing is unspecified, this means the app is not generally available anymore (even though it might still be available to people who own it).
404 #[serde(rename = "appPricing")]
405 pub app_pricing: Option<String>,
406 /// Application tracks visible to the enterprise.
407 #[serde(rename = "appTracks")]
408 pub app_tracks: Option<Vec<AppTrackInfo>>,
409 /// Versions currently available for this app.
410 #[serde(rename = "appVersions")]
411 pub app_versions: Option<Vec<AppVersion>>,
412 /// The name of the author of the apps (for example, the app developer).
413 pub author: Option<String>,
414 /// The countries which this app is available in as per ISO 3166-1 alpha-2.
415 #[serde(rename = "availableCountries")]
416 pub available_countries: Option<Vec<String>>,
417 /// The app category (e.g. RACING, SOCIAL, etc.)
418 pub category: Option<String>,
419 /// The content rating for this app.
420 #[serde(rename = "contentRating")]
421 pub content_rating: Option<String>,
422 /// The localized promotional description, if available.
423 pub description: Option<String>,
424 /// How and to whom the package is made available.
425 #[serde(rename = "distributionChannel")]
426 pub distribution_channel: Option<String>,
427 /// Noteworthy features (if any) of this app.
428 pub features: Option<Vec<String>>,
429 /// Full app description, if available.
430 #[serde(rename = "fullDescription")]
431 pub full_description: Option<String>,
432 /// A link to an image that can be used as an icon for the app. This image is suitable for use up to a pixel size of 512 x 512.
433 #[serde(rename = "iconUrl")]
434 pub icon_url: Option<String>,
435 /// The set of managed properties available to be pre-configured for the app.
436 #[serde(rename = "managedProperties")]
437 pub managed_properties: Option<Vec<ManagedProperty>>,
438 /// The minimum Android SDK necessary to run the app.
439 #[serde(rename = "minAndroidSdkVersion")]
440 pub min_android_sdk_version: Option<i32>,
441 /// The name of the app in the form enterprises/{enterprise}/applications/{package_name}.
442 pub name: Option<String>,
443 /// The permissions required by the app.
444 pub permissions: Option<Vec<ApplicationPermission>>,
445 /// A link to the (consumer) Google Play details page for the app.
446 #[serde(rename = "playStoreUrl")]
447 pub play_store_url: Option<String>,
448 /// A localised description of the recent changes made to the app.
449 #[serde(rename = "recentChanges")]
450 pub recent_changes: Option<String>,
451 /// A list of screenshot links representing the app.
452 #[serde(rename = "screenshotUrls")]
453 pub screenshot_urls: Option<Vec<String>>,
454 /// A link to a smaller image that can be used as an icon for the app. This image is suitable for use up to a pixel size of 128 x 128.
455 #[serde(rename = "smallIconUrl")]
456 pub small_icon_url: Option<String>,
457 /// The title of the app. Localized.
458 pub title: Option<String>,
459 /// Output only. The approximate time (within 7 days) the app was last published.
460 #[serde(rename = "updateTime")]
461 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
462}
463
464impl common::ResponseResult for Application {}
465
466/// An app-related event.
467///
468/// This type is not used in any activity, and only used as *part* of another schema.
469///
470#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
471#[serde_with::serde_as]
472#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
473pub struct ApplicationEvent {
474 /// The creation time of the event.
475 #[serde(rename = "createTime")]
476 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
477 /// App event type.
478 #[serde(rename = "eventType")]
479 pub event_type: Option<String>,
480}
481
482impl common::Part for ApplicationEvent {}
483
484/// A permission required by the app.
485///
486/// This type is not used in any activity, and only used as *part* of another schema.
487///
488#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
489#[serde_with::serde_as]
490#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
491pub struct ApplicationPermission {
492 /// A longer description of the permission, providing more detail on what it affects. Localized.
493 pub description: Option<String>,
494 /// The name of the permission. Localized.
495 pub name: Option<String>,
496 /// An opaque string uniquely identifying the permission. Not localized.
497 #[serde(rename = "permissionId")]
498 pub permission_id: Option<String>,
499}
500
501impl common::Part for ApplicationPermission {}
502
503/// Policy for an individual app. Note: Application availability on a given device cannot be changed using this policy if installAppsDisabled is enabled. The maximum number of applications that you can specify per policy is 3,000.
504///
505/// This type is not used in any activity, and only used as *part* of another schema.
506///
507#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
508#[serde_with::serde_as]
509#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
510pub struct ApplicationPolicy {
511 /// List of the app’s track IDs that a device belonging to the enterprise can access. If the list contains multiple track IDs, devices receive the latest version among all accessible tracks. If the list contains no track IDs, devices only have access to the app’s production track. More details about each track are available in AppTrackInfo.
512 #[serde(rename = "accessibleTrackIds")]
513 pub accessible_track_ids: Option<Vec<String>>,
514 /// Specifies whether the app is allowed networking when the VPN is not connected and alwaysOnVpnPackage.lockdownEnabled is enabled. If set to VPN_LOCKDOWN_ENFORCED, the app is not allowed networking, and if set to VPN_LOCKDOWN_EXEMPTION, the app is allowed networking. Only supported on devices running Android 10 and above. If this is not supported by the device, the device will contain a NonComplianceDetail with non_compliance_reason set to API_LEVEL and a fieldPath. If this is not applicable to the app, the device will contain a NonComplianceDetail with non_compliance_reason set to UNSUPPORTED and a fieldPath. The fieldPath is set to applications[i].alwaysOnVpnLockdownExemption, where i is the index of the package in the applications policy.
515 #[serde(rename = "alwaysOnVpnLockdownExemption")]
516 pub always_on_vpn_lockdown_exemption: Option<String>,
517 /// Controls the auto-update mode for the app.
518 #[serde(rename = "autoUpdateMode")]
519 pub auto_update_mode: Option<String>,
520 /// Controls whether the app can communicate with itself across a device’s work and personal profiles, subject to user consent.
521 #[serde(rename = "connectedWorkAndPersonalApp")]
522 pub connected_work_and_personal_app: Option<String>,
523 /// Optional. Whether the app is allowed to act as a credential provider on Android 14 and above.
524 #[serde(rename = "credentialProviderPolicy")]
525 pub credential_provider_policy: Option<String>,
526 /// Optional. Configuration for this custom app.install_type must be set to CUSTOM for this to be set.
527 #[serde(rename = "customAppConfig")]
528 pub custom_app_config: Option<CustomAppConfig>,
529 /// The default policy for all permissions requested by the app. If specified, this overrides the policy-level default_permission_policy which applies to all apps. It does not override the permission_grants which applies to all apps.
530 #[serde(rename = "defaultPermissionPolicy")]
531 pub default_permission_policy: Option<String>,
532 /// The scopes delegated to the app from Android Device Policy. These provide additional privileges for the applications they are applied to.
533 #[serde(rename = "delegatedScopes")]
534 pub delegated_scopes: Option<Vec<String>>,
535 /// Whether the app is disabled. When disabled, the app data is still preserved.
536 pub disabled: Option<bool>,
537 /// Configuration to enable this app as an extension app, with the capability of interacting with Android Device Policy offline.This field can be set for at most one app. If there is any app with COMPANION_APP role, this field cannot be set.The signing key certificate fingerprint of the app on the device must match one of the entries in ApplicationPolicy.signingKeyCerts or ExtensionConfig.signingKeyFingerprintsSha256 (deprecated) or the signing key certificate fingerprints obtained from Play Store for the app to be able to communicate with Android Device Policy. If the app is not on Play Store and if ApplicationPolicy.signingKeyCerts and ExtensionConfig.signingKeyFingerprintsSha256 (deprecated) are not set, a NonComplianceDetail with INVALID_VALUE is reported.
538 #[serde(rename = "extensionConfig")]
539 pub extension_config: Option<ExtensionConfig>,
540 /// Optional. The constraints for installing the app. You can specify a maximum of one InstallConstraint. Multiple constraints are rejected.
541 #[serde(rename = "installConstraint")]
542 pub install_constraint: Option<Vec<InstallConstraint>>,
543 /// Optional. Amongst apps with installType set to: FORCE_INSTALLED PREINSTALLEDthis controls the relative priority of installation. A value of 0 (default) means this app has no priority over other apps. For values between 1 and 10,000, a lower value means a higher priority. Values outside of the range 0 to 10,000 inclusive are rejected.
544 #[serde(rename = "installPriority")]
545 pub install_priority: Option<i32>,
546 /// The type of installation to perform.
547 #[serde(rename = "installType")]
548 pub install_type: Option<String>,
549 /// Whether the app is allowed to lock itself in full-screen mode. DEPRECATED. Use InstallType KIOSK or kioskCustomLauncherEnabled to configure a dedicated device.
550 #[serde(rename = "lockTaskAllowed")]
551 pub lock_task_allowed: Option<bool>,
552 /// Managed configuration applied to the app. The format for the configuration is dictated by the ManagedProperty values supported by the app. Each field name in the managed configuration must match the key field of the ManagedProperty. The field value must be compatible with the type of the ManagedProperty: *type* *JSON value* BOOL true or false STRING string INTEGER number CHOICE string MULTISELECT array of strings HIDDEN string BUNDLE_ARRAY array of objects
553 #[serde(rename = "managedConfiguration")]
554 pub managed_configuration: Option<HashMap<String, serde_json::Value>>,
555 /// The managed configurations template for the app, saved from the managed configurations iframe. This field is ignored if managed_configuration is set.
556 #[serde(rename = "managedConfigurationTemplate")]
557 pub managed_configuration_template: Option<ManagedConfigurationTemplate>,
558 /// The minimum version of the app that runs on the device. If set, the device attempts to update the app to at least this version code. If the app is not up-to-date, the device will contain a NonComplianceDetail with non_compliance_reason set to APP_NOT_UPDATED. The app must already be published to Google Play with a version code greater than or equal to this value. At most 20 apps may specify a minimum version code per policy.
559 #[serde(rename = "minimumVersionCode")]
560 pub minimum_version_code: Option<i32>,
561 /// The package name of the app. For example, com.google.android.youtube for the YouTube app.
562 #[serde(rename = "packageName")]
563 pub package_name: Option<String>,
564 /// Explicit permission grants or denials for the app. These values override the default_permission_policy and permission_grants which apply to all apps.
565 #[serde(rename = "permissionGrants")]
566 pub permission_grants: Option<Vec<PermissionGrant>>,
567 /// Optional. ID of the preferential network the application uses. There must be a configuration for the specified network ID in preferentialNetworkServiceConfigs. If set to PREFERENTIAL_NETWORK_ID_UNSPECIFIED, the application will use the default network ID specified in defaultPreferentialNetworkId. See the documentation of defaultPreferentialNetworkId for the list of apps excluded from this defaulting. This applies on both work profiles and fully managed devices on Android 13 and above.
568 #[serde(rename = "preferentialNetworkId")]
569 pub preferential_network_id: Option<String>,
570 /// Optional. Roles the app has.Apps having certain roles can be exempted from power and background execution restrictions, suspension and hibernation on Android 14 and above. The user control can also be disallowed for apps with certain roles on Android 11 and above. Refer to the documentation of each RoleType for more details.The app is notified about the roles that are set for it if the app has a notification receiver service with . The app is notified whenever its roles are updated or after the app is installed when it has nonempty list of roles. The app can use this notification to bootstrap itself after the installation. See Integrate with the AMAPI SDK (https://developers.google.com/android/management/sdk-integration) and Manage app roles (https://developers.google.com/android/management/app-roles) guides for more details on the requirements for the service.For the exemptions to be applied and the app to be notified about the roles, the signing key certificate fingerprint of the app on the device must match one of the signing key certificate fingerprints obtained from Play Store or one of the entries in ApplicationPolicy.signingKeyCerts. Otherwise, a NonComplianceDetail with APP_SIGNING_CERT_MISMATCH is reported.There must not be duplicate roles with the same roleType. Multiple apps cannot hold a role with the same roleType. A role with type ROLE_TYPE_UNSPECIFIED is not allowed.
571 pub roles: Option<Vec<Role>>,
572 /// Optional. Signing key certificates of the app.This field is required in the following cases: The app has installType set to CUSTOM (i.e. a custom app). The app has roles set to a nonempty list and the app does not exist on the Play Store. The app has extensionConfig set (i.e. an extension app) but ExtensionConfig.signingKeyFingerprintsSha256 (deprecated) is not set and the app does not exist on the Play Store.If this field is not set for a custom app, the policy is rejected. If it is not set when required for a non-custom app, a NonComplianceDetail with INVALID_VALUE is reported.For other cases, this field is optional and the signing key certificates obtained from Play Store are used.See following policy settings to see how this field is used: choosePrivateKeyRules ApplicationPolicy.InstallType.CUSTOM ApplicationPolicy.extensionConfig ApplicationPolicy.roles
573 #[serde(rename = "signingKeyCerts")]
574 pub signing_key_certs: Option<Vec<ApplicationSigningKeyCert>>,
575 /// Optional. Specifies whether user control is permitted for the app. User control includes user actions like force-stopping and clearing app data. Certain types of apps have special treatment, see USER_CONTROL_SETTINGS_UNSPECIFIED and USER_CONTROL_ALLOWED for more details.
576 #[serde(rename = "userControlSettings")]
577 pub user_control_settings: Option<String>,
578 /// Specifies whether the app installed in the work profile is allowed to add widgets to the home screen.
579 #[serde(rename = "workProfileWidgets")]
580 pub work_profile_widgets: Option<String>,
581}
582
583impl common::Part for ApplicationPolicy {}
584
585/// A change to be made to a single ApplicationPolicy object.
586///
587/// This type is not used in any activity, and only used as *part* of another schema.
588///
589#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
590#[serde_with::serde_as]
591#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
592pub struct ApplicationPolicyChange {
593 /// If ApplicationPolicy.packageName matches an existing ApplicationPolicy object within the Policy being modified, then that object will be updated. Otherwise, it will be added to the end of the Policy.applications.
594 pub application: Option<ApplicationPolicy>,
595 /// The field mask indicating the fields to update. If omitted, all modifiable fields are updated.
596 #[serde(rename = "updateMask")]
597 pub update_mask: Option<common::FieldMask>,
598}
599
600impl common::Part for ApplicationPolicyChange {}
601
602/// Information reported about an installed app.
603///
604/// This type is not used in any activity, and only used as *part* of another schema.
605///
606#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
607#[serde_with::serde_as]
608#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
609pub struct ApplicationReport {
610 /// The source of the package.
611 #[serde(rename = "applicationSource")]
612 pub application_source: Option<String>,
613 /// The display name of the app.
614 #[serde(rename = "displayName")]
615 pub display_name: Option<String>,
616 /// The list of app events which have occurred in the last 30 hours.
617 pub events: Option<Vec<ApplicationEvent>>,
618 /// The package name of the app that installed this app.
619 #[serde(rename = "installerPackageName")]
620 pub installer_package_name: Option<String>,
621 /// List of keyed app states reported by the app.
622 #[serde(rename = "keyedAppStates")]
623 pub keyed_app_states: Option<Vec<KeyedAppState>>,
624 /// Package name of the app.
625 #[serde(rename = "packageName")]
626 pub package_name: Option<String>,
627 /// The SHA-256 hash of the app's APK file, which can be used to verify the app hasn't been modified. Each byte of the hash value is represented as a two-digit hexadecimal number.
628 #[serde(rename = "packageSha256Hash")]
629 pub package_sha256_hash: Option<String>,
630 /// The SHA-1 hash of each android.content.pm.Signature (https://developer.android.com/reference/android/content/pm/Signature.html) associated with the app package. Each byte of each hash value is represented as a two-digit hexadecimal number.
631 #[serde(rename = "signingKeyCertFingerprints")]
632 pub signing_key_cert_fingerprints: Option<Vec<String>>,
633 /// Application state.
634 pub state: Option<String>,
635 /// Whether the app is user facing.
636 #[serde(rename = "userFacingType")]
637 pub user_facing_type: Option<String>,
638 /// The app version code, which can be used to determine whether one version is more recent than another.
639 #[serde(rename = "versionCode")]
640 pub version_code: Option<i32>,
641 /// The app version as displayed to the user.
642 #[serde(rename = "versionName")]
643 pub version_name: Option<String>,
644}
645
646impl common::Part for ApplicationReport {}
647
648/// Settings controlling the behavior of application reports.
649///
650/// This type is not used in any activity, and only used as *part* of another schema.
651///
652#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
653#[serde_with::serde_as]
654#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
655pub struct ApplicationReportingSettings {
656 /// Whether removed apps are included in application reports.
657 #[serde(rename = "includeRemovedApps")]
658 pub include_removed_apps: Option<bool>,
659}
660
661impl common::Part for ApplicationReportingSettings {}
662
663/// The application signing key certificate.
664///
665/// This type is not used in any activity, and only used as *part* of another schema.
666///
667#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
668#[serde_with::serde_as]
669#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
670pub struct ApplicationSigningKeyCert {
671 /// Required. The SHA-256 hash value of the signing key certificate of the app. This must be a valid SHA-256 hash value, i.e. 32 bytes. Otherwise, the policy is rejected.
672 #[serde(rename = "signingKeyCertFingerprintSha256")]
673 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
674 pub signing_key_cert_fingerprint_sha256: Option<Vec<u8>>,
675}
676
677impl common::Part for ApplicationSigningKeyCert {}
678
679/// An action to block access to apps and data on a fully managed device or in a work profile. This action also triggers a device or work profile to displays a user-facing notification with information (where possible) on how to correct the compliance issue. Note: wipeAction must also be specified.
680///
681/// This type is not used in any activity, and only used as *part* of another schema.
682///
683#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
684#[serde_with::serde_as]
685#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
686pub struct BlockAction {
687 /// Number of days the policy is non-compliant before the device or work profile is blocked. To block access immediately, set to 0. blockAfterDays must be less than wipeAfterDays.
688 #[serde(rename = "blockAfterDays")]
689 pub block_after_days: Option<i32>,
690 /// Specifies the scope of this BlockAction. Only applicable to devices that are company-owned.
691 #[serde(rename = "blockScope")]
692 pub block_scope: Option<String>,
693}
694
695impl common::Part for BlockAction {}
696
697/// Controls apps' access to private keys. The rule determines which private key, if any, Android Device Policy grants to the specified app. Access is granted either when the app calls KeyChain.choosePrivateKeyAlias (https://developer.android.com/reference/android/security/KeyChain#choosePrivateKeyAlias%28android.app.Activity,%20android.security.KeyChainAliasCallback,%20java.lang.String[],%20java.security.Principal[],%20java.lang.String,%20int,%20java.lang.String%29) (or any overloads) to request a private key alias for a given URL, or for rules that are not URL-specific (that is, if urlPattern is not set, or set to the empty string or .*) on Android 11 and above, directly so that the app can call KeyChain.getPrivateKey (https://developer.android.com/reference/android/security/KeyChain#getPrivateKey%28android.content.Context,%20java.lang.String%29), without first having to call KeyChain.choosePrivateKeyAlias.When an app calls KeyChain.choosePrivateKeyAlias if more than one choosePrivateKeyRules matches, the last matching rule defines which key alias to return.
698///
699/// This type is not used in any activity, and only used as *part* of another schema.
700///
701#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
702#[serde_with::serde_as]
703#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
704pub struct ChoosePrivateKeyRule {
705 /// The package names to which this rule applies. The signing key certificate fingerprint of the app is verified against the signing key certificate fingerprints provided by Play Store and ApplicationPolicy.signingKeyCerts . If no package names are specified, then the alias is provided to all apps that call KeyChain.choosePrivateKeyAlias (https://developer.android.com/reference/android/security/KeyChain#choosePrivateKeyAlias%28android.app.Activity,%20android.security.KeyChainAliasCallback,%20java.lang.String[],%20java.security.Principal[],%20java.lang.String,%20int,%20java.lang.String%29) or any overloads (but not without calling KeyChain.choosePrivateKeyAlias, even on Android 11 and above). Any app with the same Android UID as a package specified here will have access when they call KeyChain.choosePrivateKeyAlias.
706 #[serde(rename = "packageNames")]
707 pub package_names: Option<Vec<String>>,
708 /// The alias of the private key to be used.
709 #[serde(rename = "privateKeyAlias")]
710 pub private_key_alias: Option<String>,
711 /// The URL pattern to match against the URL of the request. If not set or empty, it matches all URLs. This uses the regular expression syntax of java.util.regex.Pattern.
712 #[serde(rename = "urlPattern")]
713 pub url_pattern: Option<String>,
714}
715
716impl common::Part for ChoosePrivateKeyRule {}
717
718/// Parameters associated with the CLEAR_APP_DATA command to clear the data of specified apps from the device.
719///
720/// This type is not used in any activity, and only used as *part* of another schema.
721///
722#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
723#[serde_with::serde_as]
724#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
725pub struct ClearAppsDataParams {
726 /// The package names of the apps whose data will be cleared when the command is executed.
727 #[serde(rename = "packageNames")]
728 pub package_names: Option<Vec<String>>,
729}
730
731impl common::Part for ClearAppsDataParams {}
732
733/// Status of the CLEAR_APP_DATA command to clear the data of specified apps from the device.
734///
735/// This type is not used in any activity, and only used as *part* of another schema.
736///
737#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
738#[serde_with::serde_as]
739#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
740pub struct ClearAppsDataStatus {
741 /// The per-app results, a mapping from package names to the respective clearing result.
742 pub results: Option<HashMap<String, PerAppResult>>,
743}
744
745impl common::Part for ClearAppsDataStatus {}
746
747/// A command.
748///
749/// # Activities
750///
751/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
752/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
753///
754/// * [devices issue command enterprises](EnterpriseDeviceIssueCommandCall) (request)
755#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
756#[serde_with::serde_as]
757#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
758pub struct Command {
759 /// Optional. Parameters for the ADD_ESIM command to add an eSIM profile to the device. If this is set, then it is suggested that type should not be set. In this case, the server automatically sets it to ADD_ESIM. It is also acceptable to explicitly set type to ADD_ESIM.
760 #[serde(rename = "addEsimParams")]
761 pub add_esim_params: Option<AddEsimParams>,
762 /// Parameters for the CLEAR_APP_DATA command to clear the data of specified apps from the device. See ClearAppsDataParams. If this is set, then it is suggested that type should not be set. In this case, the server automatically sets it to CLEAR_APP_DATA. It is also acceptable to explicitly set type to CLEAR_APP_DATA.
763 #[serde(rename = "clearAppsDataParams")]
764 pub clear_apps_data_params: Option<ClearAppsDataParams>,
765 /// Output only. Status of the CLEAR_APP_DATA command to clear the data of specified apps from the device. See ClearAppsDataStatus.
766 #[serde(rename = "clearAppsDataStatus")]
767 pub clear_apps_data_status: Option<ClearAppsDataStatus>,
768 /// The timestamp at which the command was created. The timestamp is automatically generated by the server.
769 #[serde(rename = "createTime")]
770 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
771 /// The duration for which the command is valid. The command will expire if not executed by the device during this time. The default duration if unspecified is ten minutes. There is no maximum duration.
772 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
773 pub duration: Option<chrono::Duration>,
774 /// If the command failed, an error code explaining the failure. This is not set when the command is cancelled by the caller. For reasoning about command errors, prefer fields in the following order (most preferred first): 1. Command-specific fields like clearAppsDataStatus, startLostModeStatus, or similar, if they exist. 2. This field, if set. 3. The generic error field in the Operation that wraps the command.
775 #[serde(rename = "errorCode")]
776 pub error_code: Option<String>,
777 /// Output only. Status of an ADD_ESIM or REMOVE_ESIM command.
778 #[serde(rename = "esimStatus")]
779 pub esim_status: Option<EsimCommandStatus>,
780 /// For commands of type RESET_PASSWORD, optionally specifies the new password. Note: The new password must be at least 6 characters long if it is numeric in case of Android 14 devices. Else the command will fail with INVALID_VALUE.
781 #[serde(rename = "newPassword")]
782 pub new_password: Option<String>,
783 /// Optional. Parameters for the REMOVE_ESIM command to remove an eSIM profile from the device. If this is set, then it is suggested that type should not be set. In this case, the server automatically sets it to REMOVE_ESIM. It is also acceptable to explicitly set type to REMOVE_ESIM.
784 #[serde(rename = "removeEsimParams")]
785 pub remove_esim_params: Option<RemoveEsimParams>,
786 /// Optional. Parameters for the REQUEST_DEVICE_INFO command to get device related information. If this is set, then it is suggested that type should not be set. In this case, the server automatically sets it to REQUEST_DEVICE_INFO . It is also acceptable to explicitly set type to REQUEST_DEVICE_INFO.
787 #[serde(rename = "requestDeviceInfoParams")]
788 pub request_device_info_params: Option<RequestDeviceInfoParams>,
789 /// Output only. Status of the REQUEST_DEVICE_INFO command.
790 #[serde(rename = "requestDeviceInfoStatus")]
791 pub request_device_info_status: Option<RequestDeviceInfoStatus>,
792 /// For commands of type RESET_PASSWORD, optionally specifies flags.
793 #[serde(rename = "resetPasswordFlags")]
794 pub reset_password_flags: Option<Vec<String>>,
795 /// Parameters for the START_LOST_MODE command to put the device into lost mode. See StartLostModeParams. If this is set, then it is suggested that type should not be set. In this case, the server automatically sets it to START_LOST_MODE. It is also acceptable to explicitly set type to START_LOST_MODE.
796 #[serde(rename = "startLostModeParams")]
797 pub start_lost_mode_params: Option<StartLostModeParams>,
798 /// Output only. Status of the START_LOST_MODE command to put the device into lost mode. See StartLostModeStatus.
799 #[serde(rename = "startLostModeStatus")]
800 pub start_lost_mode_status: Option<StartLostModeStatus>,
801 /// Parameters for the STOP_LOST_MODE command to take the device out of lost mode. See StopLostModeParams. If this is set, then it is suggested that type should not be set. In this case, the server automatically sets it to STOP_LOST_MODE. It is also acceptable to explicitly set type to STOP_LOST_MODE.
802 #[serde(rename = "stopLostModeParams")]
803 pub stop_lost_mode_params: Option<StopLostModeParams>,
804 /// Output only. Status of the STOP_LOST_MODE command to take the device out of lost mode. See StopLostModeStatus.
805 #[serde(rename = "stopLostModeStatus")]
806 pub stop_lost_mode_status: Option<StopLostModeStatus>,
807 /// The type of the command.
808 #[serde(rename = "type")]
809 pub type_: Option<String>,
810 /// The resource name of the user that owns the device in the form enterprises/{enterpriseId}/users/{userId}. This is automatically generated by the server based on the device the command is sent to.
811 #[serde(rename = "userName")]
812 pub user_name: Option<String>,
813 /// Optional. Parameters for the WIPE command to wipe the device. If this is set, then it is suggested that type should not be set. In this case, the server automatically sets it to WIPE. It is also acceptable to explicitly set type to WIPE.
814 #[serde(rename = "wipeParams")]
815 pub wipe_params: Option<WipeParams>,
816}
817
818impl common::RequestValue for Command {}
819
820/// Information about Common Criteria Mode—security standards defined in the Common Criteria for Information Technology Security Evaluation (https://www.commoncriteriaportal.org/) (CC).This information is only available if statusReportingSettings.commonCriteriaModeEnabled is true in the device's policy.
821///
822/// This type is not used in any activity, and only used as *part* of another schema.
823///
824#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
825#[serde_with::serde_as]
826#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
827pub struct CommonCriteriaModeInfo {
828 /// Whether Common Criteria Mode is enabled.
829 #[serde(rename = "commonCriteriaModeStatus")]
830 pub common_criteria_mode_status: Option<String>,
831 /// Output only. The status of policy signature verification.
832 #[serde(rename = "policySignatureVerificationStatus")]
833 pub policy_signature_verification_status: Option<String>,
834}
835
836impl common::Part for CommonCriteriaModeInfo {}
837
838/// A rule declaring which mitigating actions to take when a device is not compliant with its policy. For every rule, there is always an implicit mitigating action to set policy_compliant to false for the Device resource, and display a message on the device indicating that the device is not compliant with its policy. Other mitigating actions may optionally be taken as well, depending on the field values in the rule.
839///
840/// This type is not used in any activity, and only used as *part* of another schema.
841///
842#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
843#[serde_with::serde_as]
844#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
845pub struct ComplianceRule {
846 /// A condition which is satisfied if the Android Framework API level on the device doesn't meet a minimum requirement.
847 #[serde(rename = "apiLevelCondition")]
848 pub api_level_condition: Option<ApiLevelCondition>,
849 /// If set to true, the rule includes a mitigating action to disable apps so that the device is effectively disabled, but app data is preserved. If the device is running an app in locked task mode, the app will be closed and a UI showing the reason for non-compliance will be displayed.
850 #[serde(rename = "disableApps")]
851 pub disable_apps: Option<bool>,
852 /// A condition which is satisfied if there exists any matching NonComplianceDetail for the device.
853 #[serde(rename = "nonComplianceDetailCondition")]
854 pub non_compliance_detail_condition: Option<NonComplianceDetailCondition>,
855 /// If set, the rule includes a mitigating action to disable apps specified in the list, but app data is preserved.
856 #[serde(rename = "packageNamesToDisable")]
857 pub package_names_to_disable: Option<Vec<String>>,
858}
859
860impl common::Part for ComplianceRule {}
861
862/// Contact details for managed Google Play enterprises.
863///
864/// This type is not used in any activity, and only used as *part* of another schema.
865///
866#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
867#[serde_with::serde_as]
868#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
869pub struct ContactInfo {
870 /// Email address for a point of contact, which will be used to send important announcements related to managed Google Play.
871 #[serde(rename = "contactEmail")]
872 pub contact_email: Option<String>,
873 /// The email of the data protection officer. The email is validated but not verified.
874 #[serde(rename = "dataProtectionOfficerEmail")]
875 pub data_protection_officer_email: Option<String>,
876 /// The name of the data protection officer.
877 #[serde(rename = "dataProtectionOfficerName")]
878 pub data_protection_officer_name: Option<String>,
879 /// The phone number of the data protection officer The phone number is validated but not verified.
880 #[serde(rename = "dataProtectionOfficerPhone")]
881 pub data_protection_officer_phone: Option<String>,
882 /// The email of the EU representative. The email is validated but not verified.
883 #[serde(rename = "euRepresentativeEmail")]
884 pub eu_representative_email: Option<String>,
885 /// The name of the EU representative.
886 #[serde(rename = "euRepresentativeName")]
887 pub eu_representative_name: Option<String>,
888 /// The phone number of the EU representative. The phone number is validated but not verified.
889 #[serde(rename = "euRepresentativePhone")]
890 pub eu_representative_phone: Option<String>,
891}
892
893impl common::Part for ContactInfo {}
894
895/// This feature is not generally available.
896///
897/// This type is not used in any activity, and only used as *part* of another schema.
898///
899#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
900#[serde_with::serde_as]
901#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
902pub struct ContentProviderEndpoint {
903 /// This feature is not generally available.
904 #[serde(rename = "packageName")]
905 pub package_name: Option<String>,
906 /// Required. This feature is not generally available.
907 #[serde(rename = "signingCertsSha256")]
908 pub signing_certs_sha256: Option<Vec<String>>,
909 /// This feature is not generally available.
910 pub uri: Option<String>,
911}
912
913impl common::Part for ContentProviderEndpoint {}
914
915/// Controls the data from the work profile that can be accessed from the personal profile and vice versa. A NonComplianceDetail with MANAGEMENT_MODE is reported if the device does not have a work profile.
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 CrossProfilePolicies {
923 /// Optional. Controls whether personal profile apps can invoke app functions exposed by apps in the work profile.
924 #[serde(rename = "crossProfileAppFunctions")]
925 pub cross_profile_app_functions: Option<String>,
926 /// Whether text copied from one profile (personal or work) can be pasted in the other profile.
927 #[serde(rename = "crossProfileCopyPaste")]
928 pub cross_profile_copy_paste: Option<String>,
929 /// Whether data from one profile (personal or work) can be shared with apps in the other profile. Specifically controls simple data sharing via intents. Management of other cross-profile communication channels, such as contact search, copy/paste, or connected work & personal apps, are configured separately.
930 #[serde(rename = "crossProfileDataSharing")]
931 pub cross_profile_data_sharing: Option<String>,
932 /// List of apps which are excluded from the ShowWorkContactsInPersonalProfile setting. For this to be set, ShowWorkContactsInPersonalProfile must be set to one of the following values: SHOW_WORK_CONTACTS_IN_PERSONAL_PROFILE_ALLOWED. In this case, these exemptions act as a blocklist. SHOW_WORK_CONTACTS_IN_PERSONAL_PROFILE_DISALLOWED. In this case, these exemptions act as an allowlist. SHOW_WORK_CONTACTS_IN_PERSONAL_PROFILE_DISALLOWED_EXCEPT_SYSTEM. In this case, these exemptions act as an allowlist, in addition to the already allowlisted system apps.Supported on Android 14 and above. A NonComplianceDetail with API_LEVEL is reported if the Android version is less than 14.
933 #[serde(rename = "exemptionsToShowWorkContactsInPersonalProfile")]
934 pub exemptions_to_show_work_contacts_in_personal_profile: Option<PackageNameList>,
935 /// Whether personal apps can access contacts stored in the work profile.See also exemptions_to_show_work_contacts_in_personal_profile.
936 #[serde(rename = "showWorkContactsInPersonalProfile")]
937 pub show_work_contacts_in_personal_profile: Option<String>,
938 /// Specifies the default behaviour for work profile widgets. If the policy does not specify work_profile_widgets for a specific application, it will behave according to the value specified here.
939 #[serde(rename = "workProfileWidgetsDefault")]
940 pub work_profile_widgets_default: Option<String>,
941}
942
943impl common::Part for CrossProfilePolicies {}
944
945/// Configuration for a custom app.
946///
947/// This type is not used in any activity, and only used as *part* of another schema.
948///
949#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
950#[serde_with::serde_as]
951#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
952pub struct CustomAppConfig {
953 /// Optional. User uninstall settings of the custom app.
954 #[serde(rename = "userUninstallSettings")]
955 pub user_uninstall_settings: Option<String>,
956}
957
958impl common::Part for CustomAppConfig {}
959
960/// 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
961///
962/// This type is not used in any activity, and only used as *part* of another schema.
963///
964#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
965#[serde_with::serde_as]
966#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
967pub struct Date {
968 /// 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.
969 pub day: Option<i32>,
970 /// Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
971 pub month: Option<i32>,
972 /// Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
973 pub year: Option<i32>,
974}
975
976impl common::Part for Date {}
977
978/// Information about the application to be set as the default.
979///
980/// This type is not used in any activity, and only used as *part* of another schema.
981///
982#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
983#[serde_with::serde_as]
984#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
985pub struct DefaultApplication {
986 /// Required. The package name that should be set as the default application. The policy is rejected if the package name is invalid.
987 #[serde(rename = "packageName")]
988 pub package_name: Option<String>,
989}
990
991impl common::Part for DefaultApplication {}
992
993/// Additional context for non-compliance related to default application settings.
994///
995/// This type is not used in any activity, and only used as *part* of another schema.
996///
997#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
998#[serde_with::serde_as]
999#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1000pub struct DefaultApplicationContext {
1001 /// Output only. The scope of non-compliant default application setting.
1002 #[serde(rename = "defaultApplicationScope")]
1003 pub default_application_scope: Option<String>,
1004}
1005
1006impl common::Part for DefaultApplicationContext {}
1007
1008/// The default application information for a specific DefaultApplicationType.
1009///
1010/// This type is not used in any activity, and only used as *part* of another schema.
1011///
1012#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1013#[serde_with::serde_as]
1014#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1015pub struct DefaultApplicationInfo {
1016 /// Output only. Details on the default application setting attempts, in the same order as listed in defaultApplications.
1017 #[serde(rename = "defaultApplicationSettingAttempts")]
1018 pub default_application_setting_attempts: Option<Vec<DefaultApplicationSettingAttempt>>,
1019 /// Output only. The default application type.
1020 #[serde(rename = "defaultApplicationType")]
1021 pub default_application_type: Option<String>,
1022 /// Output only. The package name of the current default application.
1023 #[serde(rename = "packageName")]
1024 pub package_name: Option<String>,
1025}
1026
1027impl common::Part for DefaultApplicationInfo {}
1028
1029/// The default application setting for a DefaultApplicationType.
1030///
1031/// This type is not used in any activity, and only used as *part* of another schema.
1032///
1033#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1034#[serde_with::serde_as]
1035#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1036pub struct DefaultApplicationSetting {
1037 /// Required. The scopes to which the policy should be applied. This list must not be empty or contain duplicates.A NonComplianceDetail with MANAGEMENT_MODE reason and DEFAULT_APPLICATION_SETTING_UNSUPPORTED_SCOPES specific reason is reported if none of the specified scopes can be applied to the management mode (e.g. a fully managed device receives a policy with only SCOPE_PERSONAL_PROFILE in the list).
1038 #[serde(rename = "defaultApplicationScopes")]
1039 pub default_application_scopes: Option<Vec<String>>,
1040 /// Required. The app type to set the default application.
1041 #[serde(rename = "defaultApplicationType")]
1042 pub default_application_type: Option<String>,
1043 /// Required. The list of applications that can be set as the default app for a given type. This list must not be empty or contain duplicates. The first app in the list that is installed and qualified for the defaultApplicationType (e.g. SMS app for DEFAULT_SMS) is set as the default app. The signing key certificate fingerprint of the app on the device must also match one of the signing key certificate fingerprints obtained from Play Store or one of the entries in ApplicationPolicy.signingKeyCerts in order to be set as the default.If the defaultApplicationScopes contains SCOPE_FULLY_MANAGED or SCOPE_WORK_PROFILE, the app must have an entry in applications with installType set to a value other than BLOCKED.A NonComplianceDetail with APP_NOT_INSTALLED reason and DEFAULT_APPLICATION_SETTING_FAILED_FOR_SCOPE specific reason is reported if none of the apps in the list are installed. A NonComplianceDetail with INVALID_VALUE reason and DEFAULT_APPLICATION_SETTING_FAILED_FOR_SCOPE specific reason is reported if at least one app is installed but the policy fails to apply due to other reasons (e.g. the app is not of the right type).When applying to SCOPE_PERSONAL_PROFILE on a company-owned device with a work profile, only pre-installed system apps can be set as the default. A NonComplianceDetail with INVALID_VALUE reason and DEFAULT_APPLICATION_SETTING_FAILED_FOR_SCOPE specific reason is reported if the policy fails to apply to the personal profile.
1044 #[serde(rename = "defaultApplications")]
1045 pub default_applications: Option<Vec<DefaultApplication>>,
1046}
1047
1048impl common::Part for DefaultApplicationSetting {}
1049
1050/// Details on a default application setting attempt.
1051///
1052/// This type is not used in any activity, and only used as *part* of another schema.
1053///
1054#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1055#[serde_with::serde_as]
1056#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1057pub struct DefaultApplicationSettingAttempt {
1058 /// Output only. The outcome of setting the app as the default.
1059 #[serde(rename = "attemptOutcome")]
1060 pub attempt_outcome: Option<String>,
1061 /// Output only. The package name of the attempted application.
1062 #[serde(rename = "packageName")]
1063 pub package_name: Option<String>,
1064}
1065
1066impl common::Part for DefaultApplicationSettingAttempt {}
1067
1068/// A device owned by an enterprise. Unless otherwise noted, all fields are read-only and can’t be modified by enterprises.devices.patch.
1069///
1070/// # Activities
1071///
1072/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1073/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1074///
1075/// * [devices get enterprises](EnterpriseDeviceGetCall) (response)
1076/// * [devices patch enterprises](EnterpriseDevicePatchCall) (request|response)
1077#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1078#[serde_with::serde_as]
1079#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1080pub struct Device {
1081 /// The API level of the Android platform version running on the device.
1082 #[serde(rename = "apiLevel")]
1083 pub api_level: Option<i32>,
1084 /// Reports for apps installed on the device. This information is only available when application_reports_enabled is true in the device's policy.
1085 #[serde(rename = "applicationReports")]
1086 pub application_reports: Option<Vec<ApplicationReport>>,
1087 /// The password requirements currently applied to the device. This field exists because the applied requirements may be slightly different from those specified in passwordPolicies in some cases. Note that this field does not provide information about password compliance. For non-compliance information, see nonComplianceDetails. NonComplianceDetail.fieldPath, is set based on passwordPolicies, not based on this field.
1088 #[serde(rename = "appliedPasswordPolicies")]
1089 pub applied_password_policies: Option<Vec<PasswordRequirements>>,
1090 /// The name of the policy currently applied to the device.
1091 #[serde(rename = "appliedPolicyName")]
1092 pub applied_policy_name: Option<String>,
1093 /// The version of the policy currently applied to the device.
1094 #[serde(rename = "appliedPolicyVersion")]
1095 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1096 pub applied_policy_version: Option<i64>,
1097 /// The state currently applied to the device.
1098 #[serde(rename = "appliedState")]
1099 pub applied_state: Option<String>,
1100 /// Information about Common Criteria Mode—security standards defined in the Common Criteria for Information Technology Security Evaluation (https://www.commoncriteriaportal.org/) (CC).This information is only available if statusReportingSettings.commonCriteriaModeEnabled is true in the device's policy the device is company-owned.
1101 #[serde(rename = "commonCriteriaModeInfo")]
1102 pub common_criteria_mode_info: Option<CommonCriteriaModeInfo>,
1103 /// Output only. The default application information for the DefaultApplicationType. This information is only available if defaultApplicationInfoReportingEnabled is true in the device's policy. Available on Android 16 and above.All app types are reported on fully managed devices. DEFAULT_BROWSER, DEFAULT_CALL_REDIRECTION, DEFAULT_CALL_SCREENING and DEFAULT_DIALER types are reported for the work profiles on company-owned devices with a work profile and personally-owned devices. DEFAULT_WALLET is also reported for company-owned devices with a work profile, but will only include work profile information.
1104 #[serde(rename = "defaultApplicationInfo")]
1105 pub default_application_info: Option<Vec<DefaultApplicationInfo>>,
1106 /// Device settings information. This information is only available if deviceSettingsEnabled is true in the device's policy.
1107 #[serde(rename = "deviceSettings")]
1108 pub device_settings: Option<DeviceSettings>,
1109 /// If the device state is DISABLED, an optional message that is displayed on the device indicating the reason the device is disabled. This field can be modified by a patch request.
1110 #[serde(rename = "disabledReason")]
1111 pub disabled_reason: Option<UserFacingMessage>,
1112 /// Detailed information about displays on the device. This information is only available if displayInfoEnabled is true in the device's policy.
1113 pub displays: Option<Vec<Display>>,
1114 /// Output only. Information related to whether this device was migrated from being managed by another Device Policy Controller (DPC).
1115 #[serde(rename = "dpcMigrationInfo")]
1116 pub dpc_migration_info: Option<DpcMigrationInfo>,
1117 /// The time of device enrollment.
1118 #[serde(rename = "enrollmentTime")]
1119 pub enrollment_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1120 /// If the device was enrolled with an enrollment token with additional data provided, this field contains that data.
1121 #[serde(rename = "enrollmentTokenData")]
1122 pub enrollment_token_data: Option<String>,
1123 /// If the device was enrolled with an enrollment token, this field contains the name of the token.
1124 #[serde(rename = "enrollmentTokenName")]
1125 pub enrollment_token_name: Option<String>,
1126 /// Detailed information about the device hardware.
1127 #[serde(rename = "hardwareInfo")]
1128 pub hardware_info: Option<HardwareInfo>,
1129 /// Hardware status samples in chronological order. This information is only available if hardwareStatusEnabled is true in the device's policy.
1130 #[serde(rename = "hardwareStatusSamples")]
1131 pub hardware_status_samples: Option<Vec<HardwareStatus>>,
1132 /// Deprecated.
1133 #[serde(rename = "lastPolicyComplianceReportTime")]
1134 pub last_policy_compliance_report_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1135 /// The last time the device fetched its policy.
1136 #[serde(rename = "lastPolicySyncTime")]
1137 pub last_policy_sync_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1138 /// The last time the device sent a status report.
1139 #[serde(rename = "lastStatusReportTime")]
1140 pub last_status_report_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1141 /// The type of management mode Android Device Policy takes on the device. This influences which policy settings are supported.
1142 #[serde(rename = "managementMode")]
1143 pub management_mode: Option<String>,
1144 /// Events related to memory and storage measurements in chronological order. This information is only available if memoryInfoEnabled is true in the device's policy.Events are retained for a certain period of time and old events are deleted.
1145 #[serde(rename = "memoryEvents")]
1146 pub memory_events: Option<Vec<MemoryEvent>>,
1147 /// Memory information: contains information about device memory and storage.
1148 #[serde(rename = "memoryInfo")]
1149 pub memory_info: Option<MemoryInfo>,
1150 /// The name of the device in the form enterprises/{enterpriseId}/devices/{deviceId}.
1151 pub name: Option<String>,
1152 /// Device network information. This information is only available if networkInfoEnabled is true in the device's policy.
1153 #[serde(rename = "networkInfo")]
1154 pub network_info: Option<NetworkInfo>,
1155 /// Details about policy settings that the device is not compliant with.
1156 #[serde(rename = "nonComplianceDetails")]
1157 pub non_compliance_details: Option<Vec<NonComplianceDetail>>,
1158 /// Ownership of the managed device.
1159 pub ownership: Option<String>,
1160 /// Whether the device is compliant with its policy.
1161 #[serde(rename = "policyCompliant")]
1162 pub policy_compliant: Option<bool>,
1163 /// The name of the policy applied to the device, in the form enterprises/{enterpriseId}/policies/{policyId}. If not specified, the policy_name for the device's user is applied. This field can be modified by a patch request. You can specify only the policyId when calling enterprises.devices.patch, as long as the policyId doesn’t contain any slashes. The rest of the policy name is inferred.
1164 #[serde(rename = "policyName")]
1165 pub policy_name: Option<String>,
1166 /// Power management events on the device in chronological order. This information is only available if powerManagementEventsEnabled is true in the device's policy.
1167 #[serde(rename = "powerManagementEvents")]
1168 pub power_management_events: Option<Vec<PowerManagementEvent>>,
1169 /// If the same physical device has been enrolled multiple times, this field contains its previous device names. The serial number is used as the unique identifier to determine if the same physical device has enrolled previously. The names are in chronological order.
1170 #[serde(rename = "previousDeviceNames")]
1171 pub previous_device_names: Option<Vec<String>>,
1172 /// Device's security posture value that reflects how secure the device is.
1173 #[serde(rename = "securityPosture")]
1174 pub security_posture: Option<SecurityPosture>,
1175 /// Detailed information about the device software. This information is only available if softwareInfoEnabled is true in the device's policy.
1176 #[serde(rename = "softwareInfo")]
1177 pub software_info: Option<SoftwareInfo>,
1178 /// The state to be applied to the device. This field can be modified by a patch request. Note that when calling enterprises.devices.patch, ACTIVE and DISABLED are the only allowable values. To enter the device into a DELETED state, call enterprises.devices.delete.
1179 pub state: Option<String>,
1180 /// Map of selected system properties name and value related to the device. This information is only available if systemPropertiesEnabled is true in the device's policy.
1181 #[serde(rename = "systemProperties")]
1182 pub system_properties: Option<HashMap<String, String>>,
1183 /// The user who owns the device.
1184 pub user: Option<User>,
1185 /// The resource name of the user that owns this device in the form enterprises/{enterpriseId}/users/{userId}.
1186 #[serde(rename = "userName")]
1187 pub user_name: Option<String>,
1188}
1189
1190impl common::RequestValue for Device {}
1191impl common::ResponseResult for Device {}
1192
1193/// Covers controls for device connectivity such as Wi-Fi, USB data access, keyboard/mouse connections, and more.
1194///
1195/// This type is not used in any activity, and only used as *part* of another schema.
1196///
1197#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1198#[serde_with::serde_as]
1199#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1200pub struct DeviceConnectivityManagement {
1201 /// Optional. Access Point Name (APN) policy. Configuration for Access Point Names (APNs) which may override any other APNs on the device. See OVERRIDE_APNS_ENABLED and overrideApns for details.
1202 #[serde(rename = "apnPolicy")]
1203 pub apn_policy: Option<ApnPolicy>,
1204 /// Optional. Controls whether Bluetooth sharing is allowed.
1205 #[serde(rename = "bluetoothSharing")]
1206 pub bluetooth_sharing: Option<String>,
1207 /// Controls Wi-Fi configuring privileges. Based on the option set, user will have either full or limited or no control in configuring Wi-Fi networks.
1208 #[serde(rename = "configureWifi")]
1209 pub configure_wifi: Option<String>,
1210 /// Optional. Preferential network service configuration. Setting this field will override preferentialNetworkService. This can be set on both work profiles and fully managed devices on Android 13 and above. See 5G network slicing (https://developers.google.com/android/management/5g-network-slicing) guide for more details.
1211 #[serde(rename = "preferentialNetworkServiceSettings")]
1212 pub preferential_network_service_settings: Option<PreferentialNetworkServiceSettings>,
1213 /// Controls tethering settings. Based on the value set, the user is partially or fully disallowed from using different forms of tethering.
1214 #[serde(rename = "tetheringSettings")]
1215 pub tethering_settings: Option<String>,
1216 /// Controls what files and/or data can be transferred via USB. Supported only on company-owned devices.
1217 #[serde(rename = "usbDataAccess")]
1218 pub usb_data_access: Option<String>,
1219 /// Controls configuring and using Wi-Fi direct settings. Supported on company-owned devices running Android 13 and above.
1220 #[serde(rename = "wifiDirectSettings")]
1221 pub wifi_direct_settings: Option<String>,
1222 /// Optional. Wi-Fi roaming policy.
1223 #[serde(rename = "wifiRoamingPolicy")]
1224 pub wifi_roaming_policy: Option<WifiRoamingPolicy>,
1225 /// Restrictions on which Wi-Fi SSIDs the device can connect to. Note that this does not affect which networks can be configured on the device. Supported on company-owned devices running Android 13 and above.
1226 #[serde(rename = "wifiSsidPolicy")]
1227 pub wifi_ssid_policy: Option<WifiSsidPolicy>,
1228}
1229
1230impl common::Part for DeviceConnectivityManagement {}
1231
1232/// Controls for device radio settings.
1233///
1234/// This type is not used in any activity, and only used as *part* of another schema.
1235///
1236#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1237#[serde_with::serde_as]
1238#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1239pub struct DeviceRadioState {
1240 /// Controls whether airplane mode can be toggled by the user or not.
1241 #[serde(rename = "airplaneModeState")]
1242 pub airplane_mode_state: Option<String>,
1243 /// Controls whether cellular 2G setting can be toggled by the user or not.
1244 #[serde(rename = "cellularTwoGState")]
1245 pub cellular_two_g_state: Option<String>,
1246 /// The minimum required security level of Wi-Fi networks that the device can connect to.
1247 #[serde(rename = "minimumWifiSecurityLevel")]
1248 pub minimum_wifi_security_level: Option<String>,
1249 /// Controls the state of the ultra wideband setting and whether the user can toggle it on or off.
1250 #[serde(rename = "ultraWidebandState")]
1251 pub ultra_wideband_state: Option<String>,
1252 /// Controls current state of Wi-Fi and if user can change its state.
1253 #[serde(rename = "wifiState")]
1254 pub wifi_state: Option<String>,
1255}
1256
1257impl common::Part for DeviceRadioState {}
1258
1259/// Information about security related device settings on device.
1260///
1261/// This type is not used in any activity, and only used as *part* of another schema.
1262///
1263#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1264#[serde_with::serde_as]
1265#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1266pub struct DeviceSettings {
1267 /// Whether ADB (https://developer.android.com/studio/command-line/adb.html) is enabled on the device.
1268 #[serde(rename = "adbEnabled")]
1269 pub adb_enabled: Option<bool>,
1270 /// Whether developer mode is enabled on the device.
1271 #[serde(rename = "developmentSettingsEnabled")]
1272 pub development_settings_enabled: Option<bool>,
1273 /// Encryption status from DevicePolicyManager.
1274 #[serde(rename = "encryptionStatus")]
1275 pub encryption_status: Option<String>,
1276 /// Whether the device is secured with PIN/password.
1277 #[serde(rename = "isDeviceSecure")]
1278 pub is_device_secure: Option<bool>,
1279 /// Whether the storage encryption is enabled.
1280 #[serde(rename = "isEncrypted")]
1281 pub is_encrypted: Option<bool>,
1282 /// Whether installing apps from unknown sources is enabled.
1283 #[serde(rename = "unknownSourcesEnabled")]
1284 pub unknown_sources_enabled: Option<bool>,
1285 /// Whether Google Play Protect verification (https://support.google.com/accounts/answer/2812853) is enforced on the device.
1286 #[serde(rename = "verifyAppsEnabled")]
1287 pub verify_apps_enabled: Option<bool>,
1288}
1289
1290impl common::Part for DeviceSettings {}
1291
1292/// Device display information.
1293///
1294/// This type is not used in any activity, and only used as *part* of another schema.
1295///
1296#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1297#[serde_with::serde_as]
1298#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1299pub struct Display {
1300 /// Display density expressed as dots-per-inch.
1301 pub density: Option<i32>,
1302 /// Unique display id.
1303 #[serde(rename = "displayId")]
1304 pub display_id: Option<i32>,
1305 /// Display height in pixels.
1306 pub height: Option<i32>,
1307 /// Name of the display.
1308 pub name: Option<String>,
1309 /// Refresh rate of the display in frames per second.
1310 #[serde(rename = "refreshRate")]
1311 pub refresh_rate: Option<i32>,
1312 /// State of the display.
1313 pub state: Option<String>,
1314 /// Display width in pixels.
1315 pub width: Option<i32>,
1316}
1317
1318impl common::Part for Display {}
1319
1320/// Controls for the display settings.
1321///
1322/// This type is not used in any activity, and only used as *part* of another schema.
1323///
1324#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1325#[serde_with::serde_as]
1326#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1327pub struct DisplaySettings {
1328 /// Optional. Controls the screen brightness settings.
1329 #[serde(rename = "screenBrightnessSettings")]
1330 pub screen_brightness_settings: Option<ScreenBrightnessSettings>,
1331 /// Optional. Controls the screen timeout settings.
1332 #[serde(rename = "screenTimeoutSettings")]
1333 pub screen_timeout_settings: Option<ScreenTimeoutSettings>,
1334}
1335
1336impl common::Part for DisplaySettings {}
1337
1338/// Information related to whether this device was migrated from being managed by another Device Policy Controller (DPC).
1339///
1340/// This type is not used in any activity, and only used as *part* of another schema.
1341///
1342#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1343#[serde_with::serde_as]
1344#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1345pub struct DpcMigrationInfo {
1346 /// Output only. If this device was migrated from another DPC, the additionalData field of the migration token is populated here.
1347 #[serde(rename = "additionalData")]
1348 pub additional_data: Option<String>,
1349 /// Output only. If this device was migrated from another DPC, this is its package name. Not populated otherwise.
1350 #[serde(rename = "previousDpc")]
1351 pub previous_dpc: Option<String>,
1352}
1353
1354impl common::Part for DpcMigrationInfo {}
1355
1356/// EID information for each eUICC chip.
1357///
1358/// This type is not used in any activity, and only used as *part* of another schema.
1359///
1360#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1361#[serde_with::serde_as]
1362#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1363pub struct Eid {
1364 /// Output only. The EID
1365 pub eid: Option<String>,
1366}
1367
1368impl common::Part for Eid {}
1369
1370/// Information related to the EIDs of the device.
1371///
1372/// This type is not used in any activity, and only used as *part* of another schema.
1373///
1374#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1375#[serde_with::serde_as]
1376#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1377pub struct EidInfo {
1378 /// Output only. EID information for each eUICC chip.
1379 pub eids: Option<Vec<Eid>>,
1380}
1381
1382impl common::Part for EidInfo {}
1383
1384/// 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); }
1385///
1386/// # Activities
1387///
1388/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1389/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1390///
1391/// * [devices operations cancel enterprises](EnterpriseDeviceOperationCancelCall) (response)
1392/// * [devices delete enterprises](EnterpriseDeviceDeleteCall) (response)
1393/// * [enrollment tokens delete enterprises](EnterpriseEnrollmentTokenDeleteCall) (response)
1394/// * [policies delete enterprises](EnterprisePolicyDeleteCall) (response)
1395/// * [web apps delete enterprises](EnterpriseWebAppDeleteCall) (response)
1396/// * [delete enterprises](EnterpriseDeleteCall) (response)
1397#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1398#[serde_with::serde_as]
1399#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1400pub struct Empty {
1401 _never_set: Option<bool>,
1402}
1403
1404impl common::ResponseResult for Empty {}
1405
1406/// An enrollment token.
1407///
1408/// # Activities
1409///
1410/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1411/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1412///
1413/// * [enrollment tokens create enterprises](EnterpriseEnrollmentTokenCreateCall) (request|response)
1414/// * [enrollment tokens get enterprises](EnterpriseEnrollmentTokenGetCall) (response)
1415#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1416#[serde_with::serde_as]
1417#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1418pub struct EnrollmentToken {
1419 /// Optional, arbitrary data associated with the enrollment token. This could contain, for example, the ID of an org unit the device is assigned to after enrollment. After a device enrolls with the token, this data will be exposed in the enrollment_token_data field of the Device resource. The data must be 1024 characters or less; otherwise, the creation request will fail.
1420 #[serde(rename = "additionalData")]
1421 pub additional_data: Option<String>,
1422 /// Controls whether personal usage is allowed on a device provisioned with this enrollment token.For company-owned devices: Enabling personal usage allows the user to set up a work profile on the device. Disabling personal usage requires the user provision the device as a fully managed device.For personally-owned devices: Enabling personal usage allows the user to set up a work profile on the device. Disabling personal usage will prevent the device from provisioning. Personal usage cannot be disabled on personally-owned device.
1423 #[serde(rename = "allowPersonalUsage")]
1424 pub allow_personal_usage: Option<String>,
1425 /// The length of time the enrollment token is valid, ranging from 1 minute to Durations.MAX_VALUE (https://developers.google.com/protocol-buffers/docs/reference/java/com/google/protobuf/util/Durations.html#MAX_VALUE), approximately 10,000 years. If not specified, the default duration is 1 hour. Please note that if requested duration causes the resulting expiration_timestamp to exceed Timestamps.MAX_VALUE (https://developers.google.com/protocol-buffers/docs/reference/java/com/google/protobuf/util/Timestamps.html#MAX_VALUE), then expiration_timestamp is coerced to Timestamps.MAX_VALUE.
1426 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1427 pub duration: Option<chrono::Duration>,
1428 /// The expiration time of the token. This is a read-only field generated by the server.
1429 #[serde(rename = "expirationTimestamp")]
1430 pub expiration_timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
1431 /// The name of the enrollment token, which is generated by the server during creation, in the form enterprises/{enterpriseId}/enrollmentTokens/{enrollmentTokenId}.
1432 pub name: Option<String>,
1433 /// Whether the enrollment token is for one time use only. If the flag is set to true, only one device can use it for registration.
1434 #[serde(rename = "oneTimeOnly")]
1435 pub one_time_only: Option<bool>,
1436 /// The name of the policy initially applied to the enrolled device, in the form enterprises/{enterpriseId}/policies/{policyId}. If not specified, the policy_name for the device’s user is applied. If user_name is also not specified, enterprises/{enterpriseId}/policies/default is applied by default. When updating this field, you can specify only the policyId as long as the policyId doesn’t contain any slashes. The rest of the policy name will be inferred.
1437 #[serde(rename = "policyName")]
1438 pub policy_name: Option<String>,
1439 /// A JSON string whose UTF-8 representation can be used to generate a QR code to enroll a device with this enrollment token. To enroll a device using NFC, the NFC record must contain a serialized java.util.Properties representation of the properties in the JSON.
1440 #[serde(rename = "qrCode")]
1441 pub qr_code: Option<String>,
1442 /// This field is deprecated and the value is ignored.
1443 pub user: Option<User>,
1444 /// The token value that's passed to the device and authorizes the device to enroll. This is a read-only field generated by the server.
1445 pub value: Option<String>,
1446}
1447
1448impl common::RequestValue for EnrollmentToken {}
1449impl common::ResponseResult for EnrollmentToken {}
1450
1451/// The configuration applied to an enterprise.
1452///
1453/// # Activities
1454///
1455/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1456/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1457///
1458/// * [applications get enterprises](EnterpriseApplicationGetCall) (none)
1459/// * [devices operations cancel enterprises](EnterpriseDeviceOperationCancelCall) (none)
1460/// * [devices operations get enterprises](EnterpriseDeviceOperationGetCall) (none)
1461/// * [devices operations list enterprises](EnterpriseDeviceOperationListCall) (none)
1462/// * [devices delete enterprises](EnterpriseDeviceDeleteCall) (none)
1463/// * [devices get enterprises](EnterpriseDeviceGetCall) (none)
1464/// * [devices issue command enterprises](EnterpriseDeviceIssueCommandCall) (none)
1465/// * [devices list enterprises](EnterpriseDeviceListCall) (none)
1466/// * [devices patch enterprises](EnterpriseDevicePatchCall) (none)
1467/// * [enrollment tokens create enterprises](EnterpriseEnrollmentTokenCreateCall) (none)
1468/// * [enrollment tokens delete enterprises](EnterpriseEnrollmentTokenDeleteCall) (none)
1469/// * [enrollment tokens get enterprises](EnterpriseEnrollmentTokenGetCall) (none)
1470/// * [enrollment tokens list enterprises](EnterpriseEnrollmentTokenListCall) (none)
1471/// * [migration tokens create enterprises](EnterpriseMigrationTokenCreateCall) (none)
1472/// * [migration tokens get enterprises](EnterpriseMigrationTokenGetCall) (none)
1473/// * [migration tokens list enterprises](EnterpriseMigrationTokenListCall) (none)
1474/// * [policies delete enterprises](EnterprisePolicyDeleteCall) (none)
1475/// * [policies get enterprises](EnterprisePolicyGetCall) (none)
1476/// * [policies list enterprises](EnterprisePolicyListCall) (none)
1477/// * [policies modify policy applications enterprises](EnterprisePolicyModifyPolicyApplicationCall) (none)
1478/// * [policies patch enterprises](EnterprisePolicyPatchCall) (none)
1479/// * [policies remove policy applications enterprises](EnterprisePolicyRemovePolicyApplicationCall) (none)
1480/// * [web apps create enterprises](EnterpriseWebAppCreateCall) (none)
1481/// * [web apps delete enterprises](EnterpriseWebAppDeleteCall) (none)
1482/// * [web apps get enterprises](EnterpriseWebAppGetCall) (none)
1483/// * [web apps list enterprises](EnterpriseWebAppListCall) (none)
1484/// * [web apps patch enterprises](EnterpriseWebAppPatchCall) (none)
1485/// * [web tokens create enterprises](EnterpriseWebTokenCreateCall) (none)
1486/// * [create enterprises](EnterpriseCreateCall) (request|response)
1487/// * [delete enterprises](EnterpriseDeleteCall) (none)
1488/// * [generate enterprise upgrade url enterprises](EnterpriseGenerateEnterpriseUpgradeUrlCall) (none)
1489/// * [get enterprises](EnterpriseGetCall) (response)
1490/// * [list enterprises](EnterpriseListCall) (none)
1491/// * [patch enterprises](EnterprisePatchCall) (request|response)
1492#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1493#[serde_with::serde_as]
1494#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1495pub struct Enterprise {
1496 /// Deprecated and unused.
1497 #[serde(rename = "appAutoApprovalEnabled")]
1498 pub app_auto_approval_enabled: Option<bool>,
1499 /// The enterprise contact info of an EMM-managed enterprise.
1500 #[serde(rename = "contactInfo")]
1501 pub contact_info: Option<ContactInfo>,
1502 /// The types of Google Pub/Sub notifications enabled for the enterprise.
1503 #[serde(rename = "enabledNotificationTypes")]
1504 pub enabled_notification_types: Option<Vec<String>>,
1505 /// The name of the enterprise displayed to users. This field has a maximum length of 100 characters.
1506 #[serde(rename = "enterpriseDisplayName")]
1507 pub enterprise_display_name: Option<String>,
1508 /// Output only. The type of the enterprise.
1509 #[serde(rename = "enterpriseType")]
1510 pub enterprise_type: Option<String>,
1511 /// Settings for Google-provided user authentication.
1512 #[serde(rename = "googleAuthenticationSettings")]
1513 pub google_authentication_settings: Option<GoogleAuthenticationSettings>,
1514 /// An image displayed as a logo during device provisioning. Supported types are: image/bmp, image/gif, image/x-ico, image/jpeg, image/png, image/webp, image/vnd.wap.wbmp, image/x-adobe-dng.
1515 pub logo: Option<ExternalData>,
1516 /// Output only. The type of managed Google domain.
1517 #[serde(rename = "managedGoogleDomainType")]
1518 pub managed_google_domain_type: Option<String>,
1519 /// Output only. The type of a managed Google Play Accounts enterprise.
1520 #[serde(rename = "managedGooglePlayAccountsEnterpriseType")]
1521 pub managed_google_play_accounts_enterprise_type: Option<String>,
1522 /// The name of the enterprise which is generated by the server during creation, in the form enterprises/{enterpriseId}.
1523 pub name: Option<String>,
1524 /// A color in RGB format that indicates the predominant color to display in the device management app UI. The color components are stored as follows: (red << 16) | (green << 8) | blue, where the value of each component is between 0 and 255, inclusive.
1525 #[serde(rename = "primaryColor")]
1526 pub primary_color: Option<i32>,
1527 /// The topic which Pub/Sub notifications are published to, in the form projects/{project}/topics/{topic}. This field is only required if Pub/Sub notifications are enabled.
1528 #[serde(rename = "pubsubTopic")]
1529 pub pubsub_topic: Option<String>,
1530 /// Sign-in details of the enterprise.
1531 #[serde(rename = "signinDetails")]
1532 pub signin_details: Option<Vec<SigninDetail>>,
1533 /// Terms and conditions that must be accepted when provisioning a device for this enterprise. A page of terms is generated for each value in this list.
1534 #[serde(rename = "termsAndConditions")]
1535 pub terms_and_conditions: Option<Vec<TermsAndConditions>>,
1536}
1537
1538impl common::RequestValue for Enterprise {}
1539impl common::Resource for Enterprise {}
1540impl common::ResponseResult for Enterprise {}
1541
1542/// Status and error details (if present) of an ADD_ESIM or REMOVE_ESIM command.
1543///
1544/// This type is not used in any activity, and only used as *part* of another schema.
1545///
1546#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1547#[serde_with::serde_as]
1548#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1549pub struct EsimCommandStatus {
1550 /// Output only. Information about the eSIM added or removed. This is populated only when the eSIM operation status is SUCCESS.
1551 #[serde(rename = "esimInfo")]
1552 pub esim_info: Option<EsimInfo>,
1553 /// Output only. Details of the error if the status is set to INTERNAL_ERROR.
1554 #[serde(rename = "internalErrorDetails")]
1555 pub internal_error_details: Option<InternalErrorDetails>,
1556 /// Output only. Status of an ADD_ESIM or REMOVE_ESIM command.
1557 pub status: Option<String>,
1558}
1559
1560impl common::Part for EsimCommandStatus {}
1561
1562/// Details of the eSIM added or removed.
1563///
1564/// This type is not used in any activity, and only used as *part* of another schema.
1565///
1566#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1567#[serde_with::serde_as]
1568#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1569pub struct EsimInfo {
1570 /// Output only. ICC ID of the eSIM.
1571 #[serde(rename = "iccId")]
1572 pub icc_id: Option<String>,
1573}
1574
1575impl common::Part for EsimInfo {}
1576
1577/// Information related to the eUICC chip.
1578///
1579/// This type is not used in any activity, and only used as *part* of another schema.
1580///
1581#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1582#[serde_with::serde_as]
1583#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1584pub struct EuiccChipInfo {
1585 /// Output only. The Embedded Identity Document (EID) that identifies the eUICC chip for each eUICC chip on the device. This is available on company owned devices running Android 13 and above.
1586 pub eid: Option<String>,
1587}
1588
1589impl common::Part for EuiccChipInfo {}
1590
1591/// Configuration to enable an app as an extension app, with the capability of interacting with Android Device Policy offline. For Android versions 11 and above, extension apps are exempt from battery restrictions so will not be placed into the restricted App Standby Bucket (https://developer.android.com/topic/performance/appstandby#restricted-bucket). Extensions apps are also protected against users clearing their data or force-closing the application, although admins can continue to use the clear app data command on extension apps if needed for Android 11 and above.
1592///
1593/// This type is not used in any activity, and only used as *part* of another schema.
1594///
1595#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1596#[serde_with::serde_as]
1597#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1598pub struct ExtensionConfig {
1599 /// Fully qualified class name of the receiver service class for Android Device Policy to notify the extension app of any local command status updates. The service must be exported in the extension app's AndroidManifest.xml and extend NotificationReceiverService (https://developers.google.com/android/management/reference/amapi/com/google/android/managementapi/notification/NotificationReceiverService) (see Integrate with the AMAPI SDK (https://developers.google.com/android/management/sdk-integration) guide for more details).
1600 #[serde(rename = "notificationReceiver")]
1601 pub notification_receiver: Option<String>,
1602 /// Hex-encoded SHA-256 hashes of the signing key certificates of the extension app. Only hexadecimal string representations of 64 characters are valid.The signing key certificate fingerprints are always obtained from the Play Store and this field is used to provide additional signing key certificate fingerprints. However, if the application is not available on the Play Store, this field needs to be set. A NonComplianceDetail with INVALID_VALUE is reported if this field is not set when the application is not available on the Play Store.The signing key certificate fingerprint of the extension app on the device must match one of the signing key certificate fingerprints obtained from the Play Store or the ones provided in this field for the app to be able to communicate with Android Device Policy.In production use cases, it is recommended to leave this empty.
1603 #[serde(rename = "signingKeyFingerprintsSha256")]
1604 pub signing_key_fingerprints_sha256: Option<Vec<String>>,
1605}
1606
1607impl common::Part for ExtensionConfig {}
1608
1609/// Data hosted at an external location. The data is to be downloaded by Android Device Policy and verified against the hash.
1610///
1611/// This type is not used in any activity, and only used as *part* of another schema.
1612///
1613#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1614#[serde_with::serde_as]
1615#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1616pub struct ExternalData {
1617 /// The base-64 encoded SHA-256 hash of the content hosted at url. If the content doesn't match this hash, Android Device Policy won't use the data.
1618 #[serde(rename = "sha256Hash")]
1619 pub sha256_hash: Option<String>,
1620 /// The absolute URL to the data, which must use either the http or https scheme. Android Device Policy doesn't provide any credentials in the GET request, so the URL must be publicly accessible. Including a long, random component in the URL may be used to prevent attackers from discovering the URL.
1621 pub url: Option<String>,
1622}
1623
1624impl common::Part for ExternalData {}
1625
1626/// A system freeze period. When a device’s clock is within the freeze period, all incoming system updates (including security patches) are blocked and won’t be installed.When the device is outside any set freeze periods, the normal policy behavior (automatic, windowed, or postponed) applies.Leap years are ignored in freeze period calculations, in particular: If Feb. 29th is set as the start or end date of a freeze period, the freeze period will start or end on Feb. 28th instead. When a device’s system clock reads Feb. 29th, it’s treated as Feb. 28th. When calculating the number of days in a freeze period or the time between two freeze periods, Feb. 29th is ignored and not counted as a day.Note: For Freeze Periods to take effect, SystemUpdateType cannot be specified as SYSTEM_UPDATE_TYPE_UNSPECIFIED, because freeze periods require a defined policy to be specified.
1627///
1628/// This type is not used in any activity, and only used as *part* of another schema.
1629///
1630#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1631#[serde_with::serde_as]
1632#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1633pub struct FreezePeriod {
1634 /// The end date (inclusive) of the freeze period. Must be no later than 90 days from the start date. If the end date is earlier than the start date, the freeze period is considered wrapping year-end. Note: day and month must be set. year should not be set as it is not used. For example, {"month": 1,"date": 30}.
1635 #[serde(rename = "endDate")]
1636 pub end_date: Option<Date>,
1637 /// The start date (inclusive) of the freeze period. Note: day and month must be set. year should not be set as it is not used. For example, {"month": 1,"date": 30}.
1638 #[serde(rename = "startDate")]
1639 pub start_date: Option<Date>,
1640}
1641
1642impl common::Part for FreezePeriod {}
1643
1644/// Request message for generating a URL to upgrade an existing managed Google Play Accounts enterprise to a managed Google domain.Note: This feature is not generally available.
1645///
1646/// # Activities
1647///
1648/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1649/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1650///
1651/// * [generate enterprise upgrade url enterprises](EnterpriseGenerateEnterpriseUpgradeUrlCall) (request)
1652#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1653#[serde_with::serde_as]
1654#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1655pub struct GenerateEnterpriseUpgradeUrlRequest {
1656 /// Optional. Email address used to prefill the admin field of the enterprise signup form as part of the upgrade process. This value is a hint only and can be altered by the user. Personal email addresses are not allowed. If allowedDomains is non-empty then this must belong to one of the allowedDomains.
1657 #[serde(rename = "adminEmail")]
1658 pub admin_email: Option<String>,
1659 /// Optional. A list of domains that are permitted for the admin email. The IT admin cannot enter an email address with a domain name that is not in this list. Subdomains of domains in this list are not allowed but can be allowed by adding a second entry which has *. prefixed to the domain name (e.g. *.example.com). If the field is not present or is an empty list then the IT admin is free to use any valid domain name. Personal email domains are not allowed.
1660 #[serde(rename = "allowedDomains")]
1661 pub allowed_domains: Option<Vec<String>>,
1662}
1663
1664impl common::RequestValue for GenerateEnterpriseUpgradeUrlRequest {}
1665
1666/// Response message for generating a URL to upgrade an existing managed Google Play Accounts enterprise to a managed Google domain.Note: This feature is not generally available.
1667///
1668/// # Activities
1669///
1670/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1671/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1672///
1673/// * [generate enterprise upgrade url enterprises](EnterpriseGenerateEnterpriseUpgradeUrlCall) (response)
1674#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1675#[serde_with::serde_as]
1676#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1677pub struct GenerateEnterpriseUpgradeUrlResponse {
1678 /// A URL for an enterprise admin to upgrade their enterprise. The page can't be rendered in an iframe.
1679 pub url: Option<String>,
1680}
1681
1682impl common::ResponseResult for GenerateEnterpriseUpgradeUrlResponse {}
1683
1684/// Contains settings for Google-provided user authentication.
1685///
1686/// This type is not used in any activity, and only used as *part* of another schema.
1687///
1688#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1689#[serde_with::serde_as]
1690#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1691pub struct GoogleAuthenticationSettings {
1692 /// Output only. Whether users need to be authenticated by Google during the enrollment process. IT admin can specify if Google authentication is enabled for the enterprise for knowledge worker devices. This value can be set only via the Google Admin Console. Google authentication can be used with signin_url In the case where Google authentication is required and a signin_url is specified, Google authentication will be launched before signin_url.
1693 #[serde(rename = "googleAuthenticationRequired")]
1694 pub google_authentication_required: Option<String>,
1695}
1696
1697impl common::Part for GoogleAuthenticationSettings {}
1698
1699/// Information about device hardware. The fields related to temperature thresholds are only available if hardwareStatusEnabled is true in the device's policy.
1700///
1701/// This type is not used in any activity, and only used as *part* of another schema.
1702///
1703#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1704#[serde_with::serde_as]
1705#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1706pub struct HardwareInfo {
1707 /// Battery shutdown temperature thresholds in Celsius for each battery on the device.
1708 #[serde(rename = "batteryShutdownTemperatures")]
1709 pub battery_shutdown_temperatures: Option<Vec<f32>>,
1710 /// Battery throttling temperature thresholds in Celsius for each battery on the device.
1711 #[serde(rename = "batteryThrottlingTemperatures")]
1712 pub battery_throttling_temperatures: Option<Vec<f32>>,
1713 /// Brand of the device. For example, Google.
1714 pub brand: Option<String>,
1715 /// CPU shutdown temperature thresholds in Celsius for each CPU on the device.
1716 #[serde(rename = "cpuShutdownTemperatures")]
1717 pub cpu_shutdown_temperatures: Option<Vec<f32>>,
1718 /// CPU throttling temperature thresholds in Celsius for each CPU on the device.
1719 #[serde(rename = "cpuThrottlingTemperatures")]
1720 pub cpu_throttling_temperatures: Option<Vec<f32>>,
1721 /// Baseband version. For example, MDM9625_104662.22.05.34p.
1722 #[serde(rename = "deviceBasebandVersion")]
1723 pub device_baseband_version: Option<String>,
1724 /// Output only. ID that uniquely identifies a personally-owned device in a particular organization. On the same physical device when enrolled with the same organization, this ID persists across setups and even factory resets. This ID is available on personally-owned devices with a work profile on devices running Android 12 and above.
1725 #[serde(rename = "enterpriseSpecificId")]
1726 pub enterprise_specific_id: Option<String>,
1727 /// Output only. Information related to the eUICC chip.
1728 #[serde(rename = "euiccChipInfo")]
1729 pub euicc_chip_info: Option<Vec<EuiccChipInfo>>,
1730 /// GPU shutdown temperature thresholds in Celsius for each GPU on the device.
1731 #[serde(rename = "gpuShutdownTemperatures")]
1732 pub gpu_shutdown_temperatures: Option<Vec<f32>>,
1733 /// GPU throttling temperature thresholds in Celsius for each GPU on the device.
1734 #[serde(rename = "gpuThrottlingTemperatures")]
1735 pub gpu_throttling_temperatures: Option<Vec<f32>>,
1736 /// Name of the hardware. For example, Angler.
1737 pub hardware: Option<String>,
1738 /// Manufacturer. For example, Motorola.
1739 pub manufacturer: Option<String>,
1740 /// The model of the device. For example, Asus Nexus 7.
1741 pub model: Option<String>,
1742 /// The device serial number. However, for personally-owned devices running Android 12 and above, this is the same as the enterpriseSpecificId.
1743 #[serde(rename = "serialNumber")]
1744 pub serial_number: Option<String>,
1745 /// Device skin shutdown temperature thresholds in Celsius.
1746 #[serde(rename = "skinShutdownTemperatures")]
1747 pub skin_shutdown_temperatures: Option<Vec<f32>>,
1748 /// Device skin throttling temperature thresholds in Celsius.
1749 #[serde(rename = "skinThrottlingTemperatures")]
1750 pub skin_throttling_temperatures: Option<Vec<f32>>,
1751}
1752
1753impl common::Part for HardwareInfo {}
1754
1755/// Hardware status. Temperatures may be compared to the temperature thresholds available in hardwareInfo to determine hardware health.
1756///
1757/// This type is not used in any activity, and only used as *part* of another schema.
1758///
1759#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1760#[serde_with::serde_as]
1761#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1762pub struct HardwareStatus {
1763 /// Current battery temperatures in Celsius for each battery on the device.
1764 #[serde(rename = "batteryTemperatures")]
1765 pub battery_temperatures: Option<Vec<f32>>,
1766 /// Current CPU temperatures in Celsius for each CPU on the device.
1767 #[serde(rename = "cpuTemperatures")]
1768 pub cpu_temperatures: Option<Vec<f32>>,
1769 /// CPU usages in percentage for each core available on the device. Usage is 0 for each unplugged core. Empty array implies that CPU usage is not supported in the system.
1770 #[serde(rename = "cpuUsages")]
1771 pub cpu_usages: Option<Vec<f32>>,
1772 /// The time the measurements were taken.
1773 #[serde(rename = "createTime")]
1774 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1775 /// Fan speeds in RPM for each fan on the device. Empty array means that there are no fans or fan speed is not supported on the system.
1776 #[serde(rename = "fanSpeeds")]
1777 pub fan_speeds: Option<Vec<f32>>,
1778 /// Current GPU temperatures in Celsius for each GPU on the device.
1779 #[serde(rename = "gpuTemperatures")]
1780 pub gpu_temperatures: Option<Vec<f32>>,
1781 /// Current device skin temperatures in Celsius.
1782 #[serde(rename = "skinTemperatures")]
1783 pub skin_temperatures: Option<Vec<f32>>,
1784}
1785
1786impl common::Part for HardwareStatus {}
1787
1788/// Amongst apps with InstallType set to: FORCE_INSTALLED PREINSTALLEDthis defines a set of restrictions for the app installation. At least one of the fields must be set. When multiple fields are set, then all the constraints need to be satisfied for the app to be installed.
1789///
1790/// This type is not used in any activity, and only used as *part* of another schema.
1791///
1792#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1793#[serde_with::serde_as]
1794#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1795pub struct InstallConstraint {
1796 /// Optional. Charging constraint.
1797 #[serde(rename = "chargingConstraint")]
1798 pub charging_constraint: Option<String>,
1799 /// Optional. Device idle constraint.
1800 #[serde(rename = "deviceIdleConstraint")]
1801 pub device_idle_constraint: Option<String>,
1802 /// Optional. Network type constraint.
1803 #[serde(rename = "networkTypeConstraint")]
1804 pub network_type_constraint: Option<String>,
1805}
1806
1807impl common::Part for InstallConstraint {}
1808
1809/// Internal error details if present for the ADD_ESIM or REMOVE_ESIM command.
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 InternalErrorDetails {
1817 /// Output only. Integer representation of the error code as specified here (https://developer.android.com/reference/android/telephony/euicc/EuiccManager#EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE). See also, OPERATION_SMDX_SUBJECT_REASON_CODE. See error_code_detail for more details.
1818 #[serde(rename = "errorCode")]
1819 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1820 pub error_code: Option<i64>,
1821 /// Output only. The error code detail corresponding to the error_code.
1822 #[serde(rename = "errorCodeDetail")]
1823 pub error_code_detail: Option<String>,
1824 /// Output only. Integer representation of the operation code as specified here (https://developer.android.com/reference/android/telephony/euicc/EuiccManager#EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE). See operation_code_detail for more details.
1825 #[serde(rename = "operationCode")]
1826 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1827 pub operation_code: Option<i64>,
1828 /// Output only. The operation code detail corresponding to the operation_code.
1829 #[serde(rename = "operationCodeDetail")]
1830 pub operation_code_detail: Option<String>,
1831}
1832
1833impl common::Part for InternalErrorDetails {}
1834
1835/// Keyed app state reported by the app.
1836///
1837/// This type is not used in any activity, and only used as *part* of another schema.
1838///
1839#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1840#[serde_with::serde_as]
1841#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1842pub struct KeyedAppState {
1843 /// The creation time of the app state on the device.
1844 #[serde(rename = "createTime")]
1845 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1846 /// Optionally, a machine-readable value to be read by the EMM. For example, setting values that the admin can choose to query against in the EMM console (e.g. “notify me if the battery_warning data < 10”).
1847 pub data: Option<String>,
1848 /// The key for the app state. Acts as a point of reference for what the app is providing state for. For example, when providing managed configuration feedback, this key could be the managed configuration key.
1849 pub key: Option<String>,
1850 /// The time the app state was most recently updated.
1851 #[serde(rename = "lastUpdateTime")]
1852 pub last_update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1853 /// Optionally, a free-form message string to explain the app state. If the state was triggered by a particular value (e.g. a managed configuration value), it should be included in the message.
1854 pub message: Option<String>,
1855 /// The severity of the app state.
1856 pub severity: Option<String>,
1857}
1858
1859impl common::Part for KeyedAppState {}
1860
1861/// Settings controlling the behavior of a device in kiosk mode. To enable kiosk mode, set kioskCustomLauncherEnabled to true or specify an app in the policy with installType KIOSK.
1862///
1863/// This type is not used in any activity, and only used as *part* of another schema.
1864///
1865#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1866#[serde_with::serde_as]
1867#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1868pub struct KioskCustomization {
1869 /// Specifies whether the Settings app is allowed in kiosk mode.
1870 #[serde(rename = "deviceSettings")]
1871 pub device_settings: Option<String>,
1872 /// Sets the behavior of a device in kiosk mode when a user presses and holds (long-presses) the Power button.
1873 #[serde(rename = "powerButtonActions")]
1874 pub power_button_actions: Option<String>,
1875 /// Specifies whether system info and notifications are disabled in kiosk mode.
1876 #[serde(rename = "statusBar")]
1877 pub status_bar: Option<String>,
1878 /// Specifies whether system error dialogs for crashed or unresponsive apps are blocked in kiosk mode. When blocked, the system will force-stop the app as if the user chooses the "close app" option on the UI.
1879 #[serde(rename = "systemErrorWarnings")]
1880 pub system_error_warnings: Option<String>,
1881 /// Specifies which navigation features are enabled (e.g. Home, Overview buttons) in kiosk mode.
1882 #[serde(rename = "systemNavigation")]
1883 pub system_navigation: Option<String>,
1884}
1885
1886impl common::Part for KioskCustomization {}
1887
1888/// An action to launch an app.
1889///
1890/// This type is not used in any activity, and only used as *part* of another schema.
1891///
1892#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1893#[serde_with::serde_as]
1894#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1895pub struct LaunchAppAction {
1896 /// Package name of app to be launched
1897 #[serde(rename = "packageName")]
1898 pub package_name: Option<String>,
1899}
1900
1901impl common::Part for LaunchAppAction {}
1902
1903/// Response to a request to list devices for a given enterprise.
1904///
1905/// # Activities
1906///
1907/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1908/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1909///
1910/// * [devices list enterprises](EnterpriseDeviceListCall) (response)
1911#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1912#[serde_with::serde_as]
1913#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1914pub struct ListDevicesResponse {
1915 /// The list of devices.
1916 pub devices: Option<Vec<Device>>,
1917 /// If there are more results, a token to retrieve next page of results.
1918 #[serde(rename = "nextPageToken")]
1919 pub next_page_token: Option<String>,
1920}
1921
1922impl common::ResponseResult for ListDevicesResponse {}
1923
1924/// Response to a request to list enrollment tokens for a given enterprise.
1925///
1926/// # Activities
1927///
1928/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1929/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1930///
1931/// * [enrollment tokens list enterprises](EnterpriseEnrollmentTokenListCall) (response)
1932#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1933#[serde_with::serde_as]
1934#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1935pub struct ListEnrollmentTokensResponse {
1936 /// The list of enrollment tokens.
1937 #[serde(rename = "enrollmentTokens")]
1938 pub enrollment_tokens: Option<Vec<EnrollmentToken>>,
1939 /// If there are more results, a token to retrieve next page of results.
1940 #[serde(rename = "nextPageToken")]
1941 pub next_page_token: Option<String>,
1942}
1943
1944impl common::ResponseResult for ListEnrollmentTokensResponse {}
1945
1946/// Response to a request to list enterprises.
1947///
1948/// # Activities
1949///
1950/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1951/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1952///
1953/// * [list enterprises](EnterpriseListCall) (response)
1954#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1955#[serde_with::serde_as]
1956#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1957pub struct ListEnterprisesResponse {
1958 /// The list of enterprises.
1959 pub enterprises: Option<Vec<Enterprise>>,
1960 /// If there are more results, a token to retrieve next page of results.
1961 #[serde(rename = "nextPageToken")]
1962 pub next_page_token: Option<String>,
1963}
1964
1965impl common::ResponseResult for ListEnterprisesResponse {}
1966
1967/// Response to a request to list migration tokens for a given enterprise.
1968///
1969/// # Activities
1970///
1971/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1972/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1973///
1974/// * [migration tokens list enterprises](EnterpriseMigrationTokenListCall) (response)
1975#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1976#[serde_with::serde_as]
1977#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1978pub struct ListMigrationTokensResponse {
1979 /// The migration tokens from the specified enterprise.
1980 #[serde(rename = "migrationTokens")]
1981 pub migration_tokens: Option<Vec<MigrationToken>>,
1982 /// A token, which can be sent as page_token to retrieve the next page. If this field is omitted, there are no subsequent pages.
1983 #[serde(rename = "nextPageToken")]
1984 pub next_page_token: Option<String>,
1985}
1986
1987impl common::ResponseResult for ListMigrationTokensResponse {}
1988
1989/// The response message for Operations.ListOperations.
1990///
1991/// # Activities
1992///
1993/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1994/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1995///
1996/// * [devices operations list enterprises](EnterpriseDeviceOperationListCall) (response)
1997#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1998#[serde_with::serde_as]
1999#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2000pub struct ListOperationsResponse {
2001 /// The standard List next-page token.
2002 #[serde(rename = "nextPageToken")]
2003 pub next_page_token: Option<String>,
2004 /// A list of operations that matches the specified filter in the request.
2005 pub operations: Option<Vec<Operation>>,
2006 /// Unordered list. Unreachable resources. Populated when the request sets ListOperationsRequest.return_partial_success and reads across collections. For example, when attempting to list all resources across all supported locations.
2007 pub unreachable: Option<Vec<String>>,
2008}
2009
2010impl common::ResponseResult for ListOperationsResponse {}
2011
2012/// Response to a request to list policies for a given enterprise.
2013///
2014/// # Activities
2015///
2016/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2017/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2018///
2019/// * [policies list enterprises](EnterprisePolicyListCall) (response)
2020#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2021#[serde_with::serde_as]
2022#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2023pub struct ListPoliciesResponse {
2024 /// If there are more results, a token to retrieve next page of results.
2025 #[serde(rename = "nextPageToken")]
2026 pub next_page_token: Option<String>,
2027 /// The list of policies.
2028 pub policies: Option<Vec<Policy>>,
2029}
2030
2031impl common::ResponseResult for ListPoliciesResponse {}
2032
2033/// Response to a request to list web apps for a given enterprise.
2034///
2035/// # Activities
2036///
2037/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2038/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2039///
2040/// * [web apps list enterprises](EnterpriseWebAppListCall) (response)
2041#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2042#[serde_with::serde_as]
2043#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2044pub struct ListWebAppsResponse {
2045 /// If there are more results, a token to retrieve next page of results.
2046 #[serde(rename = "nextPageToken")]
2047 pub next_page_token: Option<String>,
2048 /// The list of web apps.
2049 #[serde(rename = "webApps")]
2050 pub web_apps: Option<Vec<WebApp>>,
2051}
2052
2053impl common::ResponseResult for ListWebAppsResponse {}
2054
2055/// The managed configurations template for the app, saved from the managed configurations iframe.
2056///
2057/// This type is not used in any activity, and only used as *part* of another schema.
2058///
2059#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2060#[serde_with::serde_as]
2061#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2062pub struct ManagedConfigurationTemplate {
2063 /// Optional, a map containing configuration variables defined for the configuration.
2064 #[serde(rename = "configurationVariables")]
2065 pub configuration_variables: Option<HashMap<String, String>>,
2066 /// The ID of the managed configurations template.
2067 #[serde(rename = "templateId")]
2068 pub template_id: Option<String>,
2069}
2070
2071impl common::Part for ManagedConfigurationTemplate {}
2072
2073/// Managed property.
2074///
2075/// This type is not used in any activity, and only used as *part* of another schema.
2076///
2077#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2078#[serde_with::serde_as]
2079#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2080pub struct ManagedProperty {
2081 /// The default value of the property. BUNDLE_ARRAY properties don't have a default value.
2082 #[serde(rename = "defaultValue")]
2083 pub default_value: Option<serde_json::Value>,
2084 /// A longer description of the property, providing more detail of what it affects. Localized.
2085 pub description: Option<String>,
2086 /// For CHOICE or MULTISELECT properties, the list of possible entries.
2087 pub entries: Option<Vec<ManagedPropertyEntry>>,
2088 /// The unique key that the app uses to identify the property, e.g. "com.google.android.gm.fieldname".
2089 pub key: Option<String>,
2090 /// For BUNDLE_ARRAY properties, the list of nested properties. A BUNDLE_ARRAY property is at most two levels deep.
2091 #[serde(rename = "nestedProperties")]
2092 pub nested_properties: Option<Vec<ManagedProperty>>,
2093 /// The name of the property. Localized.
2094 pub title: Option<String>,
2095 /// The type of the property.
2096 #[serde(rename = "type")]
2097 pub type_: Option<String>,
2098}
2099
2100impl common::Part for ManagedProperty {}
2101
2102/// An entry of a managed property.
2103///
2104/// This type is not used in any activity, and only used as *part* of another schema.
2105///
2106#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2107#[serde_with::serde_as]
2108#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2109pub struct ManagedPropertyEntry {
2110 /// The human-readable name of the value. Localized.
2111 pub name: Option<String>,
2112 /// The machine-readable value of the entry, which should be used in the configuration. Not localized.
2113 pub value: Option<String>,
2114}
2115
2116impl common::Part for ManagedPropertyEntry {}
2117
2118/// An event related to memory and storage measurements.To distinguish between new and old events, we recommend using the createTime field.
2119///
2120/// This type is not used in any activity, and only used as *part* of another schema.
2121///
2122#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2123#[serde_with::serde_as]
2124#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2125pub struct MemoryEvent {
2126 /// The number of free bytes in the medium, or for EXTERNAL_STORAGE_DETECTED, the total capacity in bytes of the storage medium.
2127 #[serde(rename = "byteCount")]
2128 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2129 pub byte_count: Option<i64>,
2130 /// The creation time of the event.
2131 #[serde(rename = "createTime")]
2132 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2133 /// Event type.
2134 #[serde(rename = "eventType")]
2135 pub event_type: Option<String>,
2136}
2137
2138impl common::Part for MemoryEvent {}
2139
2140/// Information about device memory and storage.
2141///
2142/// This type is not used in any activity, and only used as *part* of another schema.
2143///
2144#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2145#[serde_with::serde_as]
2146#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2147pub struct MemoryInfo {
2148 /// Total internal storage on device in bytes.
2149 #[serde(rename = "totalInternalStorage")]
2150 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2151 pub total_internal_storage: Option<i64>,
2152 /// Total RAM on device in bytes.
2153 #[serde(rename = "totalRam")]
2154 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2155 pub total_ram: Option<i64>,
2156}
2157
2158impl common::Part for MemoryInfo {}
2159
2160/// A token to initiate the migration of a device from being managed by a third-party DPC to being managed by Android Management API. A migration token is valid only for a single device. See the guide (https://developers.google.com/android/management/dpc-migration) for more details.
2161///
2162/// # Activities
2163///
2164/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2165/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2166///
2167/// * [migration tokens create enterprises](EnterpriseMigrationTokenCreateCall) (request|response)
2168/// * [migration tokens get enterprises](EnterpriseMigrationTokenGetCall) (response)
2169#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2170#[serde_with::serde_as]
2171#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2172pub struct MigrationToken {
2173 /// Immutable. Optional EMM-specified additional data. Once the device is migrated this will be populated in the migrationAdditionalData field of the Device resource. This must be at most 1024 characters.
2174 #[serde(rename = "additionalData")]
2175 pub additional_data: Option<String>,
2176 /// Output only. Time when this migration token was created.
2177 #[serde(rename = "createTime")]
2178 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2179 /// Output only. Once this migration token is used to migrate a device, the name of the resulting Device resource will be populated here, in the form enterprises/{enterprise}/devices/{device}.
2180 pub device: Option<String>,
2181 /// Required. Immutable. The id of the device, as in the Play EMM API. This corresponds to the deviceId parameter in Play EMM API's Devices.get (https://developers.google.com/android/work/play/emm-api/v1/devices/get#parameters) call.
2182 #[serde(rename = "deviceId")]
2183 pub device_id: Option<String>,
2184 /// Immutable. The time when this migration token expires. This can be at most seven days from the time of creation. The migration token is deleted seven days after it expires.
2185 #[serde(rename = "expireTime")]
2186 pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2187 /// Required. Immutable. The management mode of the device or profile being migrated.
2188 #[serde(rename = "managementMode")]
2189 pub management_mode: Option<String>,
2190 /// Output only. The name of the migration token, which is generated by the server during creation, in the form enterprises/{enterprise}/migrationTokens/{migration_token}.
2191 pub name: Option<String>,
2192 /// Required. Immutable. The name of the policy initially applied to the enrolled device, in the form enterprises/{enterprise}/policies/{policy}.
2193 pub policy: Option<String>,
2194 /// Input only. The time that this migration token is valid for. This is input-only, and for returning a migration token the server will populate the expireTime field. This can be at most seven days. The default is seven days.
2195 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
2196 pub ttl: Option<chrono::Duration>,
2197 /// Required. Immutable. The user id of the Managed Google Play account on the device, as in the Play EMM API. This corresponds to the userId parameter in Play EMM API's Devices.get (https://developers.google.com/android/work/play/emm-api/v1/devices/get#parameters) call.
2198 #[serde(rename = "userId")]
2199 pub user_id: Option<String>,
2200 /// Output only. The value of the migration token.
2201 pub value: Option<String>,
2202}
2203
2204impl common::RequestValue for MigrationToken {}
2205impl common::ResponseResult for MigrationToken {}
2206
2207/// Request to update or create ApplicationPolicy objects in the given Policy.
2208///
2209/// # Activities
2210///
2211/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2212/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2213///
2214/// * [policies modify policy applications enterprises](EnterprisePolicyModifyPolicyApplicationCall) (request)
2215#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2216#[serde_with::serde_as]
2217#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2218pub struct ModifyPolicyApplicationsRequest {
2219 /// Required. The changes to be made to the ApplicationPolicy objects. There must be at least one ApplicationPolicyChange.
2220 pub changes: Option<Vec<ApplicationPolicyChange>>,
2221}
2222
2223impl common::RequestValue for ModifyPolicyApplicationsRequest {}
2224
2225/// Response to a request to update or create ApplicationPolicy objects in the given policy.
2226///
2227/// # Activities
2228///
2229/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2230/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2231///
2232/// * [policies modify policy applications enterprises](EnterprisePolicyModifyPolicyApplicationCall) (response)
2233#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2234#[serde_with::serde_as]
2235#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2236pub struct ModifyPolicyApplicationsResponse {
2237 /// The updated policy.
2238 pub policy: Option<Policy>,
2239}
2240
2241impl common::ResponseResult for ModifyPolicyApplicationsResponse {}
2242
2243/// Device network info.
2244///
2245/// This type is not used in any activity, and only used as *part* of another schema.
2246///
2247#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2248#[serde_with::serde_as]
2249#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2250pub struct NetworkInfo {
2251 /// IMEI number of the GSM device. For example, A1000031212.
2252 pub imei: Option<String>,
2253 /// MEID number of the CDMA device. For example, A00000292788E1.
2254 pub meid: Option<String>,
2255 /// Alphabetic name of current registered operator. For example, Vodafone.
2256 #[serde(rename = "networkOperatorName")]
2257 pub network_operator_name: Option<String>,
2258 /// Provides telephony information associated with each SIM card on the device. Only supported on fully managed devices starting from Android API level 23.
2259 #[serde(rename = "telephonyInfos")]
2260 pub telephony_infos: Option<Vec<TelephonyInfo>>,
2261 /// Wi-Fi MAC address of the device. For example, 7c:11:11:11:11:11.
2262 #[serde(rename = "wifiMacAddress")]
2263 pub wifi_mac_address: Option<String>,
2264}
2265
2266impl common::Part for NetworkInfo {}
2267
2268/// Provides detail about non-compliance with a policy setting.
2269///
2270/// This type is not used in any activity, and only used as *part* of another schema.
2271///
2272#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2273#[serde_with::serde_as]
2274#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2275pub struct NonComplianceDetail {
2276 /// If the policy setting could not be applied, the current value of the setting on the device.
2277 #[serde(rename = "currentValue")]
2278 pub current_value: Option<serde_json::Value>,
2279 /// For settings with nested fields, if a particular nested field is out of compliance, this specifies the full path to the offending field. The path is formatted in the same way the policy JSON field would be referenced in JavaScript, that is: 1) For object-typed fields, the field name is followed by a dot then by a subfield name. 2) For array-typed fields, the field name is followed by the array index enclosed in brackets. For example, to indicate a problem with the url field in the externalData field in the 3rd application, the path would be applications[2].externalData.url
2280 #[serde(rename = "fieldPath")]
2281 pub field_path: Option<String>,
2282 /// If package_name is set and the non-compliance reason is APP_NOT_INSTALLED or APP_NOT_UPDATED, the detailed reason the app can't be installed or updated.
2283 #[serde(rename = "installationFailureReason")]
2284 pub installation_failure_reason: Option<String>,
2285 /// The reason the device is not in compliance with the setting.
2286 #[serde(rename = "nonComplianceReason")]
2287 pub non_compliance_reason: Option<String>,
2288 /// The package name indicating which app is out of compliance, if applicable.
2289 #[serde(rename = "packageName")]
2290 pub package_name: Option<String>,
2291 /// The name of the policy setting. This is the JSON field name of a top-level Policy field.
2292 #[serde(rename = "settingName")]
2293 pub setting_name: Option<String>,
2294 /// Additional context for specific_non_compliance_reason.
2295 #[serde(rename = "specificNonComplianceContext")]
2296 pub specific_non_compliance_context: Option<SpecificNonComplianceContext>,
2297 /// The policy-specific reason the device is not in compliance with the setting.
2298 #[serde(rename = "specificNonComplianceReason")]
2299 pub specific_non_compliance_reason: Option<String>,
2300}
2301
2302impl common::Part for NonComplianceDetail {}
2303
2304/// A compliance rule condition which is satisfied if there exists any matching NonComplianceDetail for the device. A NonComplianceDetail matches a NonComplianceDetailCondition if all the fields which are set within the NonComplianceDetailCondition match the corresponding NonComplianceDetail fields.
2305///
2306/// This type is not used in any activity, and only used as *part* of another schema.
2307///
2308#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2309#[serde_with::serde_as]
2310#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2311pub struct NonComplianceDetailCondition {
2312 /// The reason the device is not in compliance with the setting. If not set, then this condition matches any reason.
2313 #[serde(rename = "nonComplianceReason")]
2314 pub non_compliance_reason: Option<String>,
2315 /// The package name of the app that's out of compliance. If not set, then this condition matches any package name.
2316 #[serde(rename = "packageName")]
2317 pub package_name: Option<String>,
2318 /// The name of the policy setting. This is the JSON field name of a top-level Policy field. If not set, then this condition matches any setting name.
2319 #[serde(rename = "settingName")]
2320 pub setting_name: Option<String>,
2321}
2322
2323impl common::Part for NonComplianceDetailCondition {}
2324
2325/// This feature is not generally available.
2326///
2327/// This type is not used in any activity, and only used as *part* of another schema.
2328///
2329#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2330#[serde_with::serde_as]
2331#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2332pub struct OncCertificateProvider {
2333 /// This feature is not generally available.
2334 #[serde(rename = "certificateReferences")]
2335 pub certificate_references: Option<Vec<String>>,
2336 /// This feature is not generally available.
2337 #[serde(rename = "contentProviderEndpoint")]
2338 pub content_provider_endpoint: Option<ContentProviderEndpoint>,
2339}
2340
2341impl common::Part for OncCertificateProvider {}
2342
2343/// Additional context for non-compliance related to Wi-Fi configuration.
2344///
2345/// This type is not used in any activity, and only used as *part* of another schema.
2346///
2347#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2348#[serde_with::serde_as]
2349#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2350pub struct OncWifiContext {
2351 /// The GUID of non-compliant Wi-Fi configuration.
2352 #[serde(rename = "wifiGuid")]
2353 pub wifi_guid: Option<String>,
2354}
2355
2356impl common::Part for OncWifiContext {}
2357
2358/// This resource represents a long-running operation that is the result of a network API call.
2359///
2360/// # Activities
2361///
2362/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2363/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2364///
2365/// * [devices operations get enterprises](EnterpriseDeviceOperationGetCall) (response)
2366/// * [devices issue command enterprises](EnterpriseDeviceIssueCommandCall) (response)
2367#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2368#[serde_with::serde_as]
2369#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2370pub struct Operation {
2371 /// If the value is false, it means the operation is still in progress. If true, the operation is completed, and either error or response is available.
2372 pub done: Option<bool>,
2373 /// The error result of the operation in case of failure or cancellation.
2374 pub error: Option<Status>,
2375 /// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.
2376 pub metadata: Option<HashMap<String, serde_json::Value>>,
2377 /// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the name should be a resource name ending with operations/{unique_id}.
2378 pub name: Option<String>,
2379 /// The normal, successful response of the operation. If the original method returns no data on success, such as Delete, the response is google.protobuf.Empty. If the original method is standard Get/Create/Update, the response should be the resource. For other methods, the response should have the type XxxResponse, where Xxx is the original method name. For example, if the original method name is TakeSnapshot(), the inferred response type is TakeSnapshotResponse.
2380 pub response: Option<HashMap<String, serde_json::Value>>,
2381}
2382
2383impl common::ResponseResult for Operation {}
2384
2385/// A list of package names.
2386///
2387/// This type is not used in any activity, and only used as *part* of another schema.
2388///
2389#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2390#[serde_with::serde_as]
2391#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2392pub struct PackageNameList {
2393 /// A list of package names.
2394 #[serde(rename = "packageNames")]
2395 pub package_names: Option<Vec<String>>,
2396}
2397
2398impl common::Part for PackageNameList {}
2399
2400/// Additional context for non-compliance related to password policies.
2401///
2402/// This type is not used in any activity, and only used as *part* of another schema.
2403///
2404#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2405#[serde_with::serde_as]
2406#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2407pub struct PasswordPoliciesContext {
2408 /// The scope of non-compliant password.
2409 #[serde(rename = "passwordPolicyScope")]
2410 pub password_policy_scope: Option<String>,
2411}
2412
2413impl common::Part for PasswordPoliciesContext {}
2414
2415/// Requirements for the password used to unlock a device.
2416///
2417/// This type is not used in any activity, and only used as *part* of another schema.
2418///
2419#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2420#[serde_with::serde_as]
2421#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2422pub struct PasswordRequirements {
2423 /// Number of incorrect device-unlock passwords that can be entered before a device is wiped. A value of 0 means there is no restriction.
2424 #[serde(rename = "maximumFailedPasswordsForWipe")]
2425 pub maximum_failed_passwords_for_wipe: Option<i32>,
2426 /// Password expiration timeout.
2427 #[serde(rename = "passwordExpirationTimeout")]
2428 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
2429 pub password_expiration_timeout: Option<chrono::Duration>,
2430 /// The length of the password history. After setting this field, the user won't be able to enter a new password that is the same as any password in the history. A value of 0 means there is no restriction.
2431 #[serde(rename = "passwordHistoryLength")]
2432 pub password_history_length: Option<i32>,
2433 /// The minimum allowed password length. A value of 0 means there is no restriction. Only enforced when password_quality is NUMERIC, NUMERIC_COMPLEX, ALPHABETIC, ALPHANUMERIC, or COMPLEX.
2434 #[serde(rename = "passwordMinimumLength")]
2435 pub password_minimum_length: Option<i32>,
2436 /// Minimum number of letters required in the password. Only enforced when password_quality is COMPLEX.
2437 #[serde(rename = "passwordMinimumLetters")]
2438 pub password_minimum_letters: Option<i32>,
2439 /// Minimum number of lower case letters required in the password. Only enforced when password_quality is COMPLEX.
2440 #[serde(rename = "passwordMinimumLowerCase")]
2441 pub password_minimum_lower_case: Option<i32>,
2442 /// Minimum number of non-letter characters (numerical digits or symbols) required in the password. Only enforced when password_quality is COMPLEX.
2443 #[serde(rename = "passwordMinimumNonLetter")]
2444 pub password_minimum_non_letter: Option<i32>,
2445 /// Minimum number of numerical digits required in the password. Only enforced when password_quality is COMPLEX.
2446 #[serde(rename = "passwordMinimumNumeric")]
2447 pub password_minimum_numeric: Option<i32>,
2448 /// Minimum number of symbols required in the password. Only enforced when password_quality is COMPLEX.
2449 #[serde(rename = "passwordMinimumSymbols")]
2450 pub password_minimum_symbols: Option<i32>,
2451 /// Minimum number of upper case letters required in the password. Only enforced when password_quality is COMPLEX.
2452 #[serde(rename = "passwordMinimumUpperCase")]
2453 pub password_minimum_upper_case: Option<i32>,
2454 /// The required password quality.
2455 #[serde(rename = "passwordQuality")]
2456 pub password_quality: Option<String>,
2457 /// The scope that the password requirement applies to.
2458 #[serde(rename = "passwordScope")]
2459 pub password_scope: Option<String>,
2460 /// The length of time after a device or work profile is unlocked using a strong form of authentication (password, PIN, pattern) that it can be unlocked using any other authentication method (e.g. fingerprint, trust agents, face). After the specified time period elapses, only strong forms of authentication can be used to unlock the device or work profile.
2461 #[serde(rename = "requirePasswordUnlock")]
2462 pub require_password_unlock: Option<String>,
2463 /// Controls whether a unified lock is allowed for the device and the work profile, on devices running Android 9 and above with a work profile. This can be set only if password_scope is set to SCOPE_PROFILE, the policy will be rejected otherwise. If user has not set a separate work lock and this field is set to REQUIRE_SEPARATE_WORK_LOCK, a NonComplianceDetail is reported with nonComplianceReason set to USER_ACTION.
2464 #[serde(rename = "unifiedLockSettings")]
2465 pub unified_lock_settings: Option<String>,
2466}
2467
2468impl common::Part for PasswordRequirements {}
2469
2470/// The result of an attempt to clear the data of a single app.
2471///
2472/// This type is not used in any activity, and only used as *part* of another schema.
2473///
2474#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2475#[serde_with::serde_as]
2476#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2477pub struct PerAppResult {
2478 /// The result of an attempt to clear the data of a single app.
2479 #[serde(rename = "clearingResult")]
2480 pub clearing_result: Option<String>,
2481}
2482
2483impl common::Part for PerAppResult {}
2484
2485/// Configuration for an Android permission and its grant state.
2486///
2487/// This type is not used in any activity, and only used as *part* of another schema.
2488///
2489#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2490#[serde_with::serde_as]
2491#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2492pub struct PermissionGrant {
2493 /// The Android permission or group, e.g. android.permission.READ_CALENDAR or android.permission_group.CALENDAR.
2494 pub permission: Option<String>,
2495 /// The policy for granting the permission.
2496 pub policy: Option<String>,
2497}
2498
2499impl common::Part for PermissionGrant {}
2500
2501/// A default activity for handling intents that match a particular intent filter. Note: To set up a kiosk, use InstallType to KIOSK rather than use persistent preferred activities.
2502///
2503/// This type is not used in any activity, and only used as *part* of another schema.
2504///
2505#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2506#[serde_with::serde_as]
2507#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2508pub struct PersistentPreferredActivity {
2509 /// The intent actions to match in the filter. If any actions are included in the filter, then an intent's action must be one of those values for it to match. If no actions are included, the intent action is ignored.
2510 pub actions: Option<Vec<String>>,
2511 /// The intent categories to match in the filter. An intent includes the categories that it requires, all of which must be included in the filter in order to match. In other words, adding a category to the filter has no impact on matching unless that category is specified in the intent.
2512 pub categories: Option<Vec<String>>,
2513 /// The activity that should be the default intent handler. This should be an Android component name, e.g. com.android.enterprise.app/.MainActivity. Alternatively, the value may be the package name of an app, which causes Android Device Policy to choose an appropriate activity from the app to handle the intent.
2514 #[serde(rename = "receiverActivity")]
2515 pub receiver_activity: Option<String>,
2516}
2517
2518impl common::Part for PersistentPreferredActivity {}
2519
2520/// Policies for apps in the personal profile of a company-owned device with a work profile.
2521///
2522/// This type is not used in any activity, and only used as *part* of another schema.
2523///
2524#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2525#[serde_with::serde_as]
2526#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2527pub struct PersonalApplicationPolicy {
2528 /// The type of installation to perform.
2529 #[serde(rename = "installType")]
2530 pub install_type: Option<String>,
2531 /// The package name of the application.
2532 #[serde(rename = "packageName")]
2533 pub package_name: Option<String>,
2534}
2535
2536impl common::Part for PersonalApplicationPolicy {}
2537
2538/// Policies controlling personal usage on a company-owned device with a work profile.
2539///
2540/// This type is not used in any activity, and only used as *part* of another schema.
2541///
2542#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2543#[serde_with::serde_as]
2544#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2545pub struct PersonalUsagePolicies {
2546 /// Account types that can't be managed by the user.
2547 #[serde(rename = "accountTypesWithManagementDisabled")]
2548 pub account_types_with_management_disabled: Option<Vec<String>>,
2549 /// Optional. Whether bluetooth sharing is allowed.
2550 #[serde(rename = "bluetoothSharing")]
2551 pub bluetooth_sharing: Option<String>,
2552 /// If true, the camera is disabled on the personal profile.
2553 #[serde(rename = "cameraDisabled")]
2554 pub camera_disabled: Option<bool>,
2555 /// Controls how long the work profile can stay off. The minimum duration must be at least 3 days. Other details are as follows: - If the duration is set to 0, the feature is turned off. - If the duration is set to a value smaller than the minimum duration, the feature returns an error. *Note:* If you want to avoid personal profiles being suspended during long periods of off-time, you can temporarily set a large value for this parameter.
2556 #[serde(rename = "maxDaysWithWorkOff")]
2557 pub max_days_with_work_off: Option<i32>,
2558 /// Policy applied to applications in the personal profile.
2559 #[serde(rename = "personalApplications")]
2560 pub personal_applications: Option<Vec<PersonalApplicationPolicy>>,
2561 /// Used together with personalApplications to control how apps in the personal profile are allowed or blocked.
2562 #[serde(rename = "personalPlayStoreMode")]
2563 pub personal_play_store_mode: Option<String>,
2564 /// Optional. Controls whether a private space is allowed on the device.
2565 #[serde(rename = "privateSpacePolicy")]
2566 pub private_space_policy: Option<String>,
2567 /// If true, screen capture is disabled for all users.
2568 #[serde(rename = "screenCaptureDisabled")]
2569 pub screen_capture_disabled: Option<bool>,
2570}
2571
2572impl common::Part for PersonalUsagePolicies {}
2573
2574/// A policy resource represents a group of settings that govern the behavior of a managed device and the apps installed on it.
2575///
2576/// # Activities
2577///
2578/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2579/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2580///
2581/// * [policies get enterprises](EnterprisePolicyGetCall) (response)
2582/// * [policies patch enterprises](EnterprisePolicyPatchCall) (request|response)
2583#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2584#[serde_with::serde_as]
2585#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2586pub struct Policy {
2587 /// Account types that can't be managed by the user.
2588 #[serde(rename = "accountTypesWithManagementDisabled")]
2589 pub account_types_with_management_disabled: Option<Vec<String>>,
2590 /// Whether adding new users and profiles is disabled. For devices where managementMode is DEVICE_OWNER this field is ignored and the user is never allowed to add or remove users.
2591 #[serde(rename = "addUserDisabled")]
2592 pub add_user_disabled: Option<bool>,
2593 /// Whether adjusting the master volume is disabled. Also mutes the device. The setting has effect only on fully managed devices.
2594 #[serde(rename = "adjustVolumeDisabled")]
2595 pub adjust_volume_disabled: Option<bool>,
2596 /// Advanced security settings. In most cases, setting these is not needed.
2597 #[serde(rename = "advancedSecurityOverrides")]
2598 pub advanced_security_overrides: Option<AdvancedSecurityOverrides>,
2599 /// Configuration for an always-on VPN connection. Use with vpn_config_disabled to prevent modification of this setting.
2600 #[serde(rename = "alwaysOnVpnPackage")]
2601 pub always_on_vpn_package: Option<AlwaysOnVpnPackage>,
2602 /// This setting is not supported. Any value is ignored.
2603 #[serde(rename = "androidDevicePolicyTracks")]
2604 pub android_device_policy_tracks: Option<Vec<String>>,
2605 /// Recommended alternative: autoUpdateMode which is set per app, provides greater flexibility around update frequency.When autoUpdateMode is set to AUTO_UPDATE_POSTPONED or AUTO_UPDATE_HIGH_PRIORITY, this field has no effect.The app auto update policy, which controls when automatic app updates can be applied.
2606 #[serde(rename = "appAutoUpdatePolicy")]
2607 pub app_auto_update_policy: Option<String>,
2608 /// Optional. Controls whether apps on the device for fully managed devices or in the work profile for devices with work profiles are allowed to expose app functions.
2609 #[serde(rename = "appFunctions")]
2610 pub app_functions: Option<String>,
2611 /// Policy applied to apps. This can have at most 3,000 elements.
2612 pub applications: Option<Vec<ApplicationPolicy>>,
2613 /// Optional. Controls whether AssistContent (https://developer.android.com/reference/android/app/assist/AssistContent) is allowed to be sent to a privileged app such as an assistant app. AssistContent includes screenshots and information about an app, such as package name. This is supported on Android 15 and above.
2614 #[serde(rename = "assistContentPolicy")]
2615 pub assist_content_policy: Option<String>,
2616 /// Whether auto date, time, and time zone are enabled on a company-owned device. If this is set, then autoTimeRequired is ignored.
2617 #[serde(rename = "autoDateAndTimeZone")]
2618 pub auto_date_and_time_zone: Option<String>,
2619 /// Whether auto time is required, which prevents the user from manually setting the date and time. If autoDateAndTimeZone is set, this field is ignored.
2620 #[serde(rename = "autoTimeRequired")]
2621 pub auto_time_required: Option<bool>,
2622 /// Whether applications other than the ones configured in applications are blocked from being installed. When set, applications that were installed under a previous policy but no longer appear in the policy are automatically uninstalled.
2623 #[serde(rename = "blockApplicationsEnabled")]
2624 pub block_applications_enabled: Option<bool>,
2625 /// Whether configuring bluetooth is disabled.
2626 #[serde(rename = "bluetoothConfigDisabled")]
2627 pub bluetooth_config_disabled: Option<bool>,
2628 /// Whether bluetooth contact sharing is disabled.
2629 #[serde(rename = "bluetoothContactSharingDisabled")]
2630 pub bluetooth_contact_sharing_disabled: Option<bool>,
2631 /// Whether bluetooth is disabled. Prefer this setting over bluetooth_config_disabled because bluetooth_config_disabled can be bypassed by the user.
2632 #[serde(rename = "bluetoothDisabled")]
2633 pub bluetooth_disabled: Option<bool>,
2634 /// Controls the use of the camera and whether the user has access to the camera access toggle.
2635 #[serde(rename = "cameraAccess")]
2636 pub camera_access: Option<String>,
2637 /// If camera_access is set to any value other than CAMERA_ACCESS_UNSPECIFIED, this has no effect. Otherwise this field controls whether cameras are disabled: If true, all cameras are disabled, otherwise they are available. For fully managed devices this field applies for all apps on the device. For work profiles, this field applies only to apps in the work profile, and the camera access of apps outside the work profile is unaffected.
2638 #[serde(rename = "cameraDisabled")]
2639 pub camera_disabled: Option<bool>,
2640 /// Whether configuring cell broadcast is disabled.
2641 #[serde(rename = "cellBroadcastsConfigDisabled")]
2642 pub cell_broadcasts_config_disabled: Option<bool>,
2643 /// Rules for determining apps' access to private keys. See ChoosePrivateKeyRule for details. This must be empty if any application has CERT_SELECTION delegation scope.
2644 #[serde(rename = "choosePrivateKeyRules")]
2645 pub choose_private_key_rules: Option<Vec<ChoosePrivateKeyRule>>,
2646 /// Rules declaring which mitigating actions to take when a device is not compliant with its policy. When the conditions for multiple rules are satisfied, all of the mitigating actions for the rules are taken. There is a maximum limit of 100 rules. Use policy enforcement rules instead.
2647 #[serde(rename = "complianceRules")]
2648 pub compliance_rules: Option<Vec<ComplianceRule>>,
2649 /// Whether creating windows besides app windows is disabled.
2650 #[serde(rename = "createWindowsDisabled")]
2651 pub create_windows_disabled: Option<bool>,
2652 /// Controls which apps are allowed to act as credential providers on Android 14 and above. These apps store credentials, see this (https://developer.android.com/training/sign-in/passkeys) and this (https://developer.android.com/reference/androidx/credentials/CredentialManager) for details. See also credentialProviderPolicy.
2653 #[serde(rename = "credentialProviderPolicyDefault")]
2654 pub credential_provider_policy_default: Option<String>,
2655 /// Whether configuring user credentials is disabled.
2656 #[serde(rename = "credentialsConfigDisabled")]
2657 pub credentials_config_disabled: Option<bool>,
2658 /// Cross-profile policies applied on the device.
2659 #[serde(rename = "crossProfilePolicies")]
2660 pub cross_profile_policies: Option<CrossProfilePolicies>,
2661 /// Whether roaming data services are disabled.
2662 #[serde(rename = "dataRoamingDisabled")]
2663 pub data_roaming_disabled: Option<bool>,
2664 /// Whether the user is allowed to enable debugging features.
2665 #[serde(rename = "debuggingFeaturesAllowed")]
2666 pub debugging_features_allowed: Option<bool>,
2667 /// Optional. The default application setting for supported types. If the default application is successfully set for at least one app type on a profile, users are prevented from changing any default applications on that profile.Only one DefaultApplicationSetting is allowed for each DefaultApplicationType.See Default application settings (https://developers.google.com/android/management/default-application-settings) guide for more details.
2668 #[serde(rename = "defaultApplicationSettings")]
2669 pub default_application_settings: Option<Vec<DefaultApplicationSetting>>,
2670 /// The default permission policy for runtime permission requests.
2671 #[serde(rename = "defaultPermissionPolicy")]
2672 pub default_permission_policy: Option<String>,
2673 /// Covers controls for device connectivity such as Wi-Fi, USB data access, keyboard/mouse connections, and more.
2674 #[serde(rename = "deviceConnectivityManagement")]
2675 pub device_connectivity_management: Option<DeviceConnectivityManagement>,
2676 /// The device owner information to be shown on the lock screen.
2677 #[serde(rename = "deviceOwnerLockScreenInfo")]
2678 pub device_owner_lock_screen_info: Option<UserFacingMessage>,
2679 /// Covers controls for radio state such as Wi-Fi, bluetooth, and more.
2680 #[serde(rename = "deviceRadioState")]
2681 pub device_radio_state: Option<DeviceRadioState>,
2682 /// Optional. Controls for the display settings.
2683 #[serde(rename = "displaySettings")]
2684 pub display_settings: Option<DisplaySettings>,
2685 /// Whether encryption is enabled
2686 #[serde(rename = "encryptionPolicy")]
2687 pub encryption_policy: Option<String>,
2688 /// Whether app verification is force-enabled.
2689 #[serde(rename = "ensureVerifyAppsEnabled")]
2690 pub ensure_verify_apps_enabled: Option<bool>,
2691 /// Optional. Controls whether the enterpriseDisplayName is visible on the device (e.g. lock screen message on company-owned devices).
2692 #[serde(rename = "enterpriseDisplayNameVisibility")]
2693 pub enterprise_display_name_visibility: Option<String>,
2694 /// Whether factory resetting from settings is disabled.
2695 #[serde(rename = "factoryResetDisabled")]
2696 pub factory_reset_disabled: Option<bool>,
2697 /// Email addresses of device administrators for factory reset protection. When the device is factory reset, it will require one of these admins to log in with the Google account email and password to unlock the device. If no admins are specified, the device won't provide factory reset protection.
2698 #[serde(rename = "frpAdminEmails")]
2699 pub frp_admin_emails: Option<Vec<String>>,
2700 /// Whether the user is allowed to have fun. Controls whether the Easter egg game in Settings is disabled.
2701 #[serde(rename = "funDisabled")]
2702 pub fun_disabled: Option<bool>,
2703 /// Whether user installation of apps is disabled.
2704 #[serde(rename = "installAppsDisabled")]
2705 pub install_apps_disabled: Option<bool>,
2706 /// This field has no effect.
2707 #[serde(rename = "installUnknownSourcesAllowed")]
2708 pub install_unknown_sources_allowed: Option<bool>,
2709 /// If true, this disables the Lock Screen (https://source.android.com/docs/core/display/multi_display/lock-screen) for primary and/or secondary displays. This policy is supported only in dedicated device management mode.
2710 #[serde(rename = "keyguardDisabled")]
2711 pub keyguard_disabled: Option<bool>,
2712 /// Disabled keyguard customizations, such as widgets.
2713 #[serde(rename = "keyguardDisabledFeatures")]
2714 pub keyguard_disabled_features: Option<Vec<String>>,
2715 /// Whether the kiosk custom launcher is enabled. This replaces the home screen with a launcher that locks down the device to the apps installed via the applications setting. Apps appear on a single page in alphabetical order. Use kioskCustomization to further configure the kiosk device behavior.
2716 #[serde(rename = "kioskCustomLauncherEnabled")]
2717 pub kiosk_custom_launcher_enabled: Option<bool>,
2718 /// Settings controlling the behavior of a device in kiosk mode. To enable kiosk mode, set kioskCustomLauncherEnabled to true or specify an app in the policy with installType KIOSK.
2719 #[serde(rename = "kioskCustomization")]
2720 pub kiosk_customization: Option<KioskCustomization>,
2721 /// The degree of location detection enabled.
2722 #[serde(rename = "locationMode")]
2723 pub location_mode: Option<String>,
2724 /// A message displayed to the user in the device administators settings screen.
2725 #[serde(rename = "longSupportMessage")]
2726 pub long_support_message: Option<UserFacingMessage>,
2727 /// Maximum time in milliseconds for user activity until the device locks. A value of 0 means there is no restriction.
2728 #[serde(rename = "maximumTimeToLock")]
2729 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2730 pub maximum_time_to_lock: Option<i64>,
2731 /// Controls the use of the microphone and whether the user has access to the microphone access toggle. This applies only on fully managed devices.
2732 #[serde(rename = "microphoneAccess")]
2733 pub microphone_access: Option<String>,
2734 /// The minimum allowed Android API level.
2735 #[serde(rename = "minimumApiLevel")]
2736 pub minimum_api_level: Option<i32>,
2737 /// Whether configuring mobile networks is disabled.
2738 #[serde(rename = "mobileNetworksConfigDisabled")]
2739 pub mobile_networks_config_disabled: Option<bool>,
2740 /// Whether adding or removing accounts is disabled.
2741 #[serde(rename = "modifyAccountsDisabled")]
2742 pub modify_accounts_disabled: Option<bool>,
2743 /// Whether the user mounting physical external media is disabled.
2744 #[serde(rename = "mountPhysicalMediaDisabled")]
2745 pub mount_physical_media_disabled: Option<bool>,
2746 /// The name of the policy in the form enterprises/{enterpriseId}/policies/{policyId}.
2747 pub name: Option<String>,
2748 /// Whether the network escape hatch is enabled. If a network connection can't be made at boot time, the escape hatch prompts the user to temporarily connect to a network in order to refresh the device policy. After applying policy, the temporary network will be forgotten and the device will continue booting. This prevents being unable to connect to a network if there is no suitable network in the last policy and the device boots into an app in lock task mode, or the user is otherwise unable to reach device settings.Note: Setting wifiConfigDisabled to true will override this setting under specific circumstances. Please see wifiConfigDisabled for further details. Setting configureWifi to DISALLOW_CONFIGURING_WIFI will override this setting under specific circumstances. Please see DISALLOW_CONFIGURING_WIFI for further details.
2749 #[serde(rename = "networkEscapeHatchEnabled")]
2750 pub network_escape_hatch_enabled: Option<bool>,
2751 /// Whether resetting network settings is disabled.
2752 #[serde(rename = "networkResetDisabled")]
2753 pub network_reset_disabled: Option<bool>,
2754 /// This feature is not generally available.
2755 #[serde(rename = "oncCertificateProviders")]
2756 pub onc_certificate_providers: Option<Vec<OncCertificateProvider>>,
2757 /// Network configuration for the device. See configure networks for more information.
2758 #[serde(rename = "openNetworkConfiguration")]
2759 pub open_network_configuration: Option<HashMap<String, serde_json::Value>>,
2760 /// Whether using NFC to beam data from apps is disabled.
2761 #[serde(rename = "outgoingBeamDisabled")]
2762 pub outgoing_beam_disabled: Option<bool>,
2763 /// Whether outgoing calls are disabled.
2764 #[serde(rename = "outgoingCallsDisabled")]
2765 pub outgoing_calls_disabled: Option<bool>,
2766 /// Password requirement policies. Different policies can be set for work profile or fully managed devices by setting the password_scope field in the policy.
2767 #[serde(rename = "passwordPolicies")]
2768 pub password_policies: Option<Vec<PasswordRequirements>>,
2769 /// Password requirements. The field password_requirements.require_password_unlock must not be set. DEPRECATED - Use passwordPolicies.Note:Complexity-based values of PasswordQuality, that is, COMPLEXITY_LOW, COMPLEXITY_MEDIUM, and COMPLEXITY_HIGH, cannot be used here. unified_lock_settings cannot be used here.
2770 #[serde(rename = "passwordRequirements")]
2771 pub password_requirements: Option<PasswordRequirements>,
2772 /// Explicit permission or group grants or denials for all apps. These values override the default_permission_policy.
2773 #[serde(rename = "permissionGrants")]
2774 pub permission_grants: Option<Vec<PermissionGrant>>,
2775 /// Specifies permitted accessibility services. If the field is not set, any accessibility service can be used. If the field is set, only the accessibility services in this list and the system's built-in accessibility service can be used. In particular, if the field is set to empty, only the system's built-in accessibility servicess can be used. This can be set on fully managed devices and on work profiles. When applied to a work profile, this affects both the personal profile and the work profile.
2776 #[serde(rename = "permittedAccessibilityServices")]
2777 pub permitted_accessibility_services: Option<PackageNameList>,
2778 /// If present, only the input methods provided by packages in this list are permitted. If this field is present, but the list is empty, then only system input methods are permitted.
2779 #[serde(rename = "permittedInputMethods")]
2780 pub permitted_input_methods: Option<PackageNameList>,
2781 /// Default intent handler activities.
2782 #[serde(rename = "persistentPreferredActivities")]
2783 pub persistent_preferred_activities: Option<Vec<PersistentPreferredActivity>>,
2784 /// Policies managing personal usage on a company-owned device.
2785 #[serde(rename = "personalUsagePolicies")]
2786 pub personal_usage_policies: Option<PersonalUsagePolicies>,
2787 /// This mode controls which apps are available to the user in the Play Store and the behavior on the device when apps are removed from the policy.
2788 #[serde(rename = "playStoreMode")]
2789 pub play_store_mode: Option<String>,
2790 /// Rules that define the behavior when a particular policy can not be applied on device
2791 #[serde(rename = "policyEnforcementRules")]
2792 pub policy_enforcement_rules: Option<Vec<PolicyEnforcementRule>>,
2793 /// Controls whether preferential network service is enabled on the work profile or on fully managed devices. For example, an organization may have an agreement with a carrier that all of the work data from its employees' devices will be sent via a network service dedicated for enterprise use. An example of a supported preferential network service is the enterprise slice on 5G networks. This policy has no effect if preferentialNetworkServiceSettings or ApplicationPolicy.preferentialNetworkId is set on devices running Android 13 or above.
2794 #[serde(rename = "preferentialNetworkService")]
2795 pub preferential_network_service: Option<String>,
2796 /// Optional. Controls whether printing is allowed. This is supported on devices running Android 9 and above. .
2797 #[serde(rename = "printingPolicy")]
2798 pub printing_policy: Option<String>,
2799 /// Allows showing UI on a device for a user to choose a private key alias if there are no matching rules in ChoosePrivateKeyRules. For devices below Android P, setting this may leave enterprise keys vulnerable. This value will have no effect if any application has CERT_SELECTION delegation scope.
2800 #[serde(rename = "privateKeySelectionEnabled")]
2801 pub private_key_selection_enabled: Option<bool>,
2802 /// The network-independent global HTTP proxy. Typically proxies should be configured per-network in open_network_configuration. However for unusual configurations like general internal filtering a global HTTP proxy may be useful. If the proxy is not accessible, network access may break. The global proxy is only a recommendation and some apps may ignore it.
2803 #[serde(rename = "recommendedGlobalProxy")]
2804 pub recommended_global_proxy: Option<ProxyInfo>,
2805 /// Whether removing other users is disabled.
2806 #[serde(rename = "removeUserDisabled")]
2807 pub remove_user_disabled: Option<bool>,
2808 /// Whether rebooting the device into safe boot is disabled.
2809 #[serde(rename = "safeBootDisabled")]
2810 pub safe_boot_disabled: Option<bool>,
2811 /// Whether screen capture is disabled.
2812 #[serde(rename = "screenCaptureDisabled")]
2813 pub screen_capture_disabled: Option<bool>,
2814 /// Whether changing the user icon is disabled. This applies only on devices running Android 7 and above.
2815 #[serde(rename = "setUserIconDisabled")]
2816 pub set_user_icon_disabled: Option<bool>,
2817 /// Whether changing the wallpaper is disabled.
2818 #[serde(rename = "setWallpaperDisabled")]
2819 pub set_wallpaper_disabled: Option<bool>,
2820 /// Action to take during the setup process. At most one action may be specified.
2821 #[serde(rename = "setupActions")]
2822 pub setup_actions: Option<Vec<SetupAction>>,
2823 /// Whether location sharing is disabled.
2824 #[serde(rename = "shareLocationDisabled")]
2825 pub share_location_disabled: Option<bool>,
2826 /// A message displayed to the user in the settings screen wherever functionality has been disabled by the admin. If the message is longer than 200 characters it may be truncated.
2827 #[serde(rename = "shortSupportMessage")]
2828 pub short_support_message: Option<UserFacingMessage>,
2829 /// Flag to skip hints on the first use. Enterprise admin can enable the system recommendation for apps to skip their user tutorial and other introductory hints on first start-up.
2830 #[serde(rename = "skipFirstUseHintsEnabled")]
2831 pub skip_first_use_hints_enabled: Option<bool>,
2832 /// Whether sending and receiving SMS messages is disabled.
2833 #[serde(rename = "smsDisabled")]
2834 pub sms_disabled: Option<bool>,
2835 /// Whether the status bar is disabled. This disables notifications, quick settings, and other screen overlays that allow escape from full-screen mode. DEPRECATED. To disable the status bar on a kiosk device, use InstallType KIOSK or kioskCustomLauncherEnabled.
2836 #[serde(rename = "statusBarDisabled")]
2837 pub status_bar_disabled: Option<bool>,
2838 /// Status reporting settings
2839 #[serde(rename = "statusReportingSettings")]
2840 pub status_reporting_settings: Option<StatusReportingSettings>,
2841 /// The battery plugged in modes for which the device stays on. When using this setting, it is recommended to clear maximum_time_to_lock so that the device doesn't lock itself while it stays on.
2842 #[serde(rename = "stayOnPluggedModes")]
2843 pub stay_on_plugged_modes: Option<Vec<String>>,
2844 /// The system update policy, which controls how OS updates are applied. If the update type is WINDOWED, the update window will automatically apply to Play app updates as well.Note: Google Play system updates (https://source.android.com/docs/core/ota/modular-system) (also called Mainline updates) are automatically downloaded and require a device reboot to be installed. Refer to the mainline section in Manage system updates (https://developer.android.com/work/dpc/system-updates#mainline) for further details.
2845 #[serde(rename = "systemUpdate")]
2846 pub system_update: Option<SystemUpdate>,
2847 /// Whether configuring tethering and portable hotspots is disabled. If tetheringSettings is set to anything other than TETHERING_SETTINGS_UNSPECIFIED, this setting is ignored.
2848 #[serde(rename = "tetheringConfigDisabled")]
2849 pub tethering_config_disabled: Option<bool>,
2850 /// Whether user uninstallation of applications is disabled. This prevents apps from being uninstalled, even those removed using applications
2851 #[serde(rename = "uninstallAppsDisabled")]
2852 pub uninstall_apps_disabled: Option<bool>,
2853 /// If microphone_access is set to any value other than MICROPHONE_ACCESS_UNSPECIFIED, this has no effect. Otherwise this field controls whether microphones are disabled: If true, all microphones are disabled, otherwise they are available. This is available only on fully managed devices.
2854 #[serde(rename = "unmuteMicrophoneDisabled")]
2855 pub unmute_microphone_disabled: Option<bool>,
2856 /// Configuration of device activity logging.
2857 #[serde(rename = "usageLog")]
2858 pub usage_log: Option<UsageLog>,
2859 /// Whether transferring files over USB is disabled. This is supported only on company-owned devices.
2860 #[serde(rename = "usbFileTransferDisabled")]
2861 pub usb_file_transfer_disabled: Option<bool>,
2862 /// Whether USB storage is enabled. Deprecated.
2863 #[serde(rename = "usbMassStorageEnabled")]
2864 pub usb_mass_storage_enabled: Option<bool>,
2865 /// The version of the policy. This is a read-only field. The version is incremented each time the policy is updated.
2866 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2867 pub version: Option<i64>,
2868 /// Whether configuring VPN is disabled.
2869 #[serde(rename = "vpnConfigDisabled")]
2870 pub vpn_config_disabled: Option<bool>,
2871 /// Whether configuring Wi-Fi networks is disabled. Supported on fully managed devices and work profiles on company-owned devices. For fully managed devices, setting this to true removes all configured networks and retains only the networks configured using openNetworkConfiguration. For work profiles on company-owned devices, existing configured networks are not affected and the user is not allowed to add, remove, or modify Wi-Fi networks. If configureWifi is set to anything other than CONFIGURE_WIFI_UNSPECIFIED, this setting is ignored. Note: If a network connection can't be made at boot time and configuring Wi-Fi is disabled then network escape hatch will be shown in order to refresh the device policy (see networkEscapeHatchEnabled).
2872 #[serde(rename = "wifiConfigDisabled")]
2873 pub wifi_config_disabled: Option<bool>,
2874 /// This is deprecated.
2875 #[serde(rename = "wifiConfigsLockdownEnabled")]
2876 pub wifi_configs_lockdown_enabled: Option<bool>,
2877 /// Optional. Wipe flags to indicate what data is wiped when a device or profile wipe is triggered due to any reason (for example, non-compliance). This does not apply to the enterprises.devices.delete method. . This list must not have duplicates.
2878 #[serde(rename = "wipeDataFlags")]
2879 pub wipe_data_flags: Option<Vec<String>>,
2880 /// Optional. Controls the work account setup configuration, such as details of whether a Google authenticated account is required.
2881 #[serde(rename = "workAccountSetupConfig")]
2882 pub work_account_setup_config: Option<WorkAccountSetupConfig>,
2883}
2884
2885impl common::RequestValue for Policy {}
2886impl common::ResponseResult for Policy {}
2887
2888/// A rule that defines the actions to take if a device or work profile is not compliant with the policy specified in settingName. In the case of multiple matching or multiple triggered enforcement rules, a merge will occur with the most severe action being taken. However, all triggered rules are still kept track of: this includes initial trigger time and all associated non-compliance details. In the situation where the most severe enforcement rule is satisfied, the next most appropriate action is applied.
2889///
2890/// This type is not used in any activity, and only used as *part* of another schema.
2891///
2892#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2893#[serde_with::serde_as]
2894#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2895pub struct PolicyEnforcementRule {
2896 /// An action to block access to apps and data on a company owned device or in a work profile. This action also triggers a user-facing notification with information (where possible) on how to correct the compliance issue. Note: wipeAction must also be specified.
2897 #[serde(rename = "blockAction")]
2898 pub block_action: Option<BlockAction>,
2899 /// The top-level policy to enforce. For example, applications or passwordPolicies.
2900 #[serde(rename = "settingName")]
2901 pub setting_name: Option<String>,
2902 /// An action to reset a company owned device or delete a work profile. Note: blockAction must also be specified.
2903 #[serde(rename = "wipeAction")]
2904 pub wipe_action: Option<WipeAction>,
2905}
2906
2907impl common::Part for PolicyEnforcementRule {}
2908
2909/// Additional details regarding the security posture of the device.
2910///
2911/// This type is not used in any activity, and only used as *part* of another schema.
2912///
2913#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2914#[serde_with::serde_as]
2915#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2916pub struct PostureDetail {
2917 /// Corresponding admin-facing advice to mitigate this security risk and improve the security posture of the device.
2918 pub advice: Option<Vec<UserFacingMessage>>,
2919 /// A specific security risk that negatively affects the security posture of the device.
2920 #[serde(rename = "securityRisk")]
2921 pub security_risk: Option<String>,
2922}
2923
2924impl common::Part for PostureDetail {}
2925
2926/// A power management event.
2927///
2928/// This type is not used in any activity, and only used as *part* of another schema.
2929///
2930#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2931#[serde_with::serde_as]
2932#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2933pub struct PowerManagementEvent {
2934 /// For BATTERY_LEVEL_COLLECTED events, the battery level as a percentage.
2935 #[serde(rename = "batteryLevel")]
2936 pub battery_level: Option<f32>,
2937 /// The creation time of the event.
2938 #[serde(rename = "createTime")]
2939 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2940 /// Event type.
2941 #[serde(rename = "eventType")]
2942 pub event_type: Option<String>,
2943}
2944
2945impl common::Part for PowerManagementEvent {}
2946
2947/// Individual preferential network service configuration.
2948///
2949/// This type is not used in any activity, and only used as *part* of another schema.
2950///
2951#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2952#[serde_with::serde_as]
2953#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2954pub struct PreferentialNetworkServiceConfig {
2955 /// Optional. Whether fallback to the device-wide default network is allowed. If this is set to FALLBACK_TO_DEFAULT_CONNECTION_ALLOWED, then nonMatchingNetworks must not be set to NON_MATCHING_NETWORKS_DISALLOWED, the policy will be rejected otherwise. Note: If this is set to FALLBACK_TO_DEFAULT_CONNECTION_DISALLOWED, applications are not able to access the internet if the 5G slice is not available.
2956 #[serde(rename = "fallbackToDefaultConnection")]
2957 pub fallback_to_default_connection: Option<String>,
2958 /// Optional. Whether apps this configuration applies to are blocked from using networks other than the preferential service. If this is set to NON_MATCHING_NETWORKS_DISALLOWED, then fallbackToDefaultConnection must be set to FALLBACK_TO_DEFAULT_CONNECTION_DISALLOWED.
2959 #[serde(rename = "nonMatchingNetworks")]
2960 pub non_matching_networks: Option<String>,
2961 /// Required. Preferential network identifier. This must not be set to NO_PREFERENTIAL_NETWORK or PREFERENTIAL_NETWORK_ID_UNSPECIFIED, the policy will be rejected otherwise.
2962 #[serde(rename = "preferentialNetworkId")]
2963 pub preferential_network_id: Option<String>,
2964}
2965
2966impl common::Part for PreferentialNetworkServiceConfig {}
2967
2968/// Preferential network service settings.
2969///
2970/// This type is not used in any activity, and only used as *part* of another schema.
2971///
2972#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2973#[serde_with::serde_as]
2974#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2975pub struct PreferentialNetworkServiceSettings {
2976 /// Required. Default preferential network ID for the applications that are not in applications or if ApplicationPolicy.preferentialNetworkId is set to PREFERENTIAL_NETWORK_ID_UNSPECIFIED. There must be a configuration for the specified network ID in preferentialNetworkServiceConfigs, unless this is set to NO_PREFERENTIAL_NETWORK. If set to PREFERENTIAL_NETWORK_ID_UNSPECIFIED or unset, this defaults to NO_PREFERENTIAL_NETWORK. Note: If the default preferential network is misconfigured, applications with no ApplicationPolicy.preferentialNetworkId set are not able to access the internet. This setting does not apply to the following critical apps: com.google.android.apps.work.clouddpc com.google.android.gmsApplicationPolicy.preferentialNetworkId can still be used to configure the preferential network for them.
2977 #[serde(rename = "defaultPreferentialNetworkId")]
2978 pub default_preferential_network_id: Option<String>,
2979 /// Required. Preferential network service configurations which enables having multiple enterprise slices. There must not be multiple configurations with the same preferentialNetworkId. If a configuration is not referenced by any application by setting ApplicationPolicy.preferentialNetworkId or by setting defaultPreferentialNetworkId, it will be ignored. For devices on 4G networks, enterprise APN needs to be configured additionally to set up data call for preferential network service. These APNs can be added using apnPolicy.
2980 #[serde(rename = "preferentialNetworkServiceConfigs")]
2981 pub preferential_network_service_configs: Option<Vec<PreferentialNetworkServiceConfig>>,
2982}
2983
2984impl common::Part for PreferentialNetworkServiceSettings {}
2985
2986/// Information about a device that is available during setup.
2987///
2988/// # Activities
2989///
2990/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2991/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2992///
2993/// * [get provisioning info](ProvisioningInfoGetCall) (response)
2994#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2995#[serde_with::serde_as]
2996#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2997pub struct ProvisioningInfo {
2998 /// The API level of the Android platform version running on the device.
2999 #[serde(rename = "apiLevel")]
3000 pub api_level: Option<i32>,
3001 /// The email address of the authenticated user (only present for Google Account provisioning method).
3002 #[serde(rename = "authenticatedUserEmail")]
3003 pub authenticated_user_email: Option<String>,
3004 /// The brand of the device. For example, Google.
3005 pub brand: Option<String>,
3006 /// The name of the enterprise in the form enterprises/{enterprise}.
3007 pub enterprise: Option<String>,
3008 /// For corporate-owned devices, IMEI number of the GSM device. For example, A1000031212.
3009 pub imei: Option<String>,
3010 /// The management mode of the device or profile.
3011 #[serde(rename = "managementMode")]
3012 pub management_mode: Option<String>,
3013 /// For corporate-owned devices, MEID number of the CDMA device. For example, A00000292788E1.
3014 pub meid: Option<String>,
3015 /// The model of the device. For example, Asus Nexus 7.
3016 pub model: Option<String>,
3017 /// The name of this resource in the form provisioningInfo/{provisioning_info}.
3018 pub name: Option<String>,
3019 /// Ownership of the managed device.
3020 pub ownership: Option<String>,
3021 /// For corporate-owned devices, The device serial number.
3022 #[serde(rename = "serialNumber")]
3023 pub serial_number: Option<String>,
3024}
3025
3026impl common::ResponseResult for ProvisioningInfo {}
3027
3028/// Configuration info for an HTTP proxy. For a direct proxy, set the host, port, and excluded_hosts fields. For a PAC script proxy, set the pac_uri field.
3029///
3030/// This type is not used in any activity, and only used as *part* of another schema.
3031///
3032#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3033#[serde_with::serde_as]
3034#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3035pub struct ProxyInfo {
3036 /// For a direct proxy, the hosts for which the proxy is bypassed. The host names may contain wildcards such as *.example.com.
3037 #[serde(rename = "excludedHosts")]
3038 pub excluded_hosts: Option<Vec<String>>,
3039 /// The host of the direct proxy.
3040 pub host: Option<String>,
3041 /// The URI of the PAC script used to configure the proxy.
3042 #[serde(rename = "pacUri")]
3043 pub pac_uri: Option<String>,
3044 /// The port of the direct proxy.
3045 pub port: Option<i32>,
3046}
3047
3048impl common::Part for ProxyInfo {}
3049
3050/// Parameters associated with the REMOVE_ESIM command to remove an eSIM profile from the device.
3051///
3052/// This type is not used in any activity, and only used as *part* of another schema.
3053///
3054#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3055#[serde_with::serde_as]
3056#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3057pub struct RemoveEsimParams {
3058 /// Required. ICC ID of the eSIM profile to be deleted.
3059 #[serde(rename = "iccId")]
3060 pub icc_id: Option<String>,
3061}
3062
3063impl common::Part for RemoveEsimParams {}
3064
3065/// Request to remove ApplicationPolicy objects in the given policy.
3066///
3067/// # Activities
3068///
3069/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3070/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3071///
3072/// * [policies remove policy applications enterprises](EnterprisePolicyRemovePolicyApplicationCall) (request)
3073#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3074#[serde_with::serde_as]
3075#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3076pub struct RemovePolicyApplicationsRequest {
3077 /// Required. Package names to be removed. Entries that are not found are ignored. There must be at least one entry in package_names.
3078 #[serde(rename = "packageNames")]
3079 pub package_names: Option<Vec<String>>,
3080}
3081
3082impl common::RequestValue for RemovePolicyApplicationsRequest {}
3083
3084/// Response to a request to remove ApplicationPolicy objects in the given policy.
3085///
3086/// # Activities
3087///
3088/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3089/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3090///
3091/// * [policies remove policy applications enterprises](EnterprisePolicyRemovePolicyApplicationCall) (response)
3092#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3093#[serde_with::serde_as]
3094#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3095pub struct RemovePolicyApplicationsResponse {
3096 /// The updated policy after ApplicationPolicy objects have been removed.
3097 pub policy: Option<Policy>,
3098}
3099
3100impl common::ResponseResult for RemovePolicyApplicationsResponse {}
3101
3102/// Parameters associated with the REQUEST_DEVICE_INFO command to get device related information.
3103///
3104/// This type is not used in any activity, and only used as *part* of another schema.
3105///
3106#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3107#[serde_with::serde_as]
3108#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3109pub struct RequestDeviceInfoParams {
3110 /// Required. Type of device information to be requested.
3111 #[serde(rename = "deviceInfo")]
3112 pub device_info: Option<String>,
3113}
3114
3115impl common::Part for RequestDeviceInfoParams {}
3116
3117/// Status of the REQUEST_DEVICE_INFO command.
3118///
3119/// This type is not used in any activity, and only used as *part* of another schema.
3120///
3121#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3122#[serde_with::serde_as]
3123#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3124pub struct RequestDeviceInfoStatus {
3125 /// Information related to the EIDs of the device.
3126 #[serde(rename = "eidInfo")]
3127 pub eid_info: Option<EidInfo>,
3128 /// Output only. Status of a REQUEST_DEVICE_INFO command.
3129 pub status: Option<String>,
3130}
3131
3132impl common::Part for RequestDeviceInfoStatus {}
3133
3134/// Role an app can have.
3135///
3136/// This type is not used in any activity, and only used as *part* of another schema.
3137///
3138#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3139#[serde_with::serde_as]
3140#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3141pub struct Role {
3142 /// Required. The type of the role an app can have.
3143 #[serde(rename = "roleType")]
3144 pub role_type: Option<String>,
3145}
3146
3147impl common::Part for Role {}
3148
3149/// Controls for the screen brightness settings.
3150///
3151/// This type is not used in any activity, and only used as *part* of another schema.
3152///
3153#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3154#[serde_with::serde_as]
3155#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3156pub struct ScreenBrightnessSettings {
3157 /// Optional. The screen brightness between 1 and 255 where 1 is the lowest and 255 is the highest brightness. A value of 0 (default) means no screen brightness set. Any other value is rejected. screenBrightnessMode must be either BRIGHTNESS_AUTOMATIC or BRIGHTNESS_FIXED to set this. Supported on Android 9 and above on fully managed devices. A NonComplianceDetail with API_LEVEL is reported if the Android version is less than 9. Supported on work profiles on company-owned devices on Android 15 and above.
3158 #[serde(rename = "screenBrightness")]
3159 pub screen_brightness: Option<i32>,
3160 /// Optional. Controls the screen brightness mode.
3161 #[serde(rename = "screenBrightnessMode")]
3162 pub screen_brightness_mode: Option<String>,
3163}
3164
3165impl common::Part for ScreenBrightnessSettings {}
3166
3167/// Controls the screen timeout settings.
3168///
3169/// This type is not used in any activity, and only used as *part* of another schema.
3170///
3171#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3172#[serde_with::serde_as]
3173#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3174pub struct ScreenTimeoutSettings {
3175 /// Optional. Controls the screen timeout duration. The screen timeout duration must be greater than 0, otherwise it is rejected. Additionally, it should not be greater than maximumTimeToLock, otherwise the screen timeout is set to maximumTimeToLock and a NonComplianceDetail with INVALID_VALUE reason and SCREEN_TIMEOUT_GREATER_THAN_MAXIMUM_TIME_TO_LOCK specific reason is reported. If the screen timeout is less than a certain lower bound, it is set to the lower bound. The lower bound may vary across devices. If this is set, screenTimeoutMode must be SCREEN_TIMEOUT_ENFORCED. Supported on Android 9 and above on fully managed devices. A NonComplianceDetail with API_LEVEL is reported if the Android version is less than 9. Supported on work profiles on company-owned devices on Android 15 and above.
3176 #[serde(rename = "screenTimeout")]
3177 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
3178 pub screen_timeout: Option<chrono::Duration>,
3179 /// Optional. Controls whether the user is allowed to configure the screen timeout.
3180 #[serde(rename = "screenTimeoutMode")]
3181 pub screen_timeout_mode: Option<String>,
3182}
3183
3184impl common::Part for ScreenTimeoutSettings {}
3185
3186/// The security posture of the device, as determined by the current device state and the policies applied.
3187///
3188/// This type is not used in any activity, and only used as *part* of another schema.
3189///
3190#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3191#[serde_with::serde_as]
3192#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3193pub struct SecurityPosture {
3194 /// Device's security posture value.
3195 #[serde(rename = "devicePosture")]
3196 pub device_posture: Option<String>,
3197 /// Additional details regarding the security posture of the device.
3198 #[serde(rename = "postureDetails")]
3199 pub posture_details: Option<Vec<PostureDetail>>,
3200}
3201
3202impl common::Part for SecurityPosture {}
3203
3204/// An action executed during setup.
3205///
3206/// This type is not used in any activity, and only used as *part* of another schema.
3207///
3208#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3209#[serde_with::serde_as]
3210#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3211pub struct SetupAction {
3212 /// Description of this action.
3213 pub description: Option<UserFacingMessage>,
3214 /// An action to launch an app. The app will be launched with an intent containing an extra with key com.google.android.apps.work.clouddpc.EXTRA_LAUNCHED_AS_SETUP_ACTION set to the boolean value true to indicate that this is a setup action flow. If SetupAction references an app, the corresponding installType in the application policy must be set as REQUIRED_FOR_SETUP or said setup will fail.
3215 #[serde(rename = "launchApp")]
3216 pub launch_app: Option<LaunchAppAction>,
3217 /// Title of this action.
3218 pub title: Option<UserFacingMessage>,
3219}
3220
3221impl common::Part for SetupAction {}
3222
3223/// A resource containing sign in details for an enterprise. Use enterprises to manage SigninDetails for a given enterprise.For an enterprise, we can have any number of SigninDetails that is uniquely identified by combination of the following three fields (signin_url, allow_personal_usage, token_tag). One cannot create two SigninDetails with the same (signin_url, allow_personal_usage, token_tag). (token_tag is an optional field).Patch: The operation updates the current list of SigninDetails with the new list of SigninDetails. If the stored SigninDetail configuration is passed, it returns the same signin_enrollment_token and qr_code. If we pass multiple identical SigninDetail configurations that are not stored, it will store the first one amongst those SigninDetail configurations. if the configuration already exists we cannot request it more than once in a particular patch API call, otherwise it will give a duplicate key error and the whole operation will fail. If we remove certain SigninDetail configuration from the request then it will get removed from the storage. We can then request another signin_enrollment_token and qr_code for the same SigninDetail configuration.
3224///
3225/// This type is not used in any activity, and only used as *part* of another schema.
3226///
3227#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3228#[serde_with::serde_as]
3229#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3230pub struct SigninDetail {
3231 /// Controls whether personal usage is allowed on a device provisioned with this enrollment token.For company-owned devices: Enabling personal usage allows the user to set up a work profile on the device. Disabling personal usage requires the user provision the device as a fully managed device.For personally-owned devices: Enabling personal usage allows the user to set up a work profile on the device. Disabling personal usage will prevent the device from provisioning. Personal usage cannot be disabled on personally-owned device.
3232 #[serde(rename = "allowPersonalUsage")]
3233 pub allow_personal_usage: Option<String>,
3234 /// Optional. Whether the sign-in URL should be used by default for the enterprise. The SigninDetail with defaultStatus set to SIGNIN_DETAIL_IS_DEFAULT is used for Google account enrollment method. Only one of an enterprise's signinDetails can have defaultStatus set to SIGNIN_DETAIL_IS_DEFAULT. If an Enterprise has at least one signinDetails and none of them have defaultStatus set to SIGNIN_DETAIL_IS_DEFAULT then the first one from the list is selected and has set defaultStatus to SIGNIN_DETAIL_IS_DEFAULT. If no signinDetails specified for the Enterprise then the Google Account device enrollment will fail.
3235 #[serde(rename = "defaultStatus")]
3236 pub default_status: Option<String>,
3237 /// A JSON string whose UTF-8 representation can be used to generate a QR code to enroll a device with this enrollment token. To enroll a device using NFC, the NFC record must contain a serialized java.util.Properties representation of the properties in the JSON. This is a read-only field generated by the server.
3238 #[serde(rename = "qrCode")]
3239 pub qr_code: Option<String>,
3240 /// An enterprise wide enrollment token used to trigger custom sign-in flow. This is a read-only field generated by the server.
3241 #[serde(rename = "signinEnrollmentToken")]
3242 pub signin_enrollment_token: Option<String>,
3243 /// Sign-in URL for authentication when device is provisioned with a sign-in enrollment token. The sign-in endpoint should finish authentication flow with a URL in the form of https://enterprise.google.com/android/enroll?et= for a successful login, or https://enterprise.google.com/android/enroll/invalid for a failed login.
3244 #[serde(rename = "signinUrl")]
3245 pub signin_url: Option<String>,
3246 /// An EMM-specified metadata to distinguish between instances of SigninDetail.
3247 #[serde(rename = "tokenTag")]
3248 pub token_tag: Option<String>,
3249}
3250
3251impl common::Part for SigninDetail {}
3252
3253/// An enterprise signup URL.
3254///
3255/// # Activities
3256///
3257/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3258/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3259///
3260/// * [create signup urls](SignupUrlCreateCall) (response)
3261#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3262#[serde_with::serde_as]
3263#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3264pub struct SignupUrl {
3265 /// The name of the resource. Use this value in the signupUrl field when calling enterprises.create to complete the enterprise signup flow.
3266 pub name: Option<String>,
3267 /// A URL where an enterprise admin can register their enterprise. The page can't be rendered in an iframe.
3268 pub url: Option<String>,
3269}
3270
3271impl common::Resource for SignupUrl {}
3272impl common::ResponseResult for SignupUrl {}
3273
3274/// Information about device software.
3275///
3276/// This type is not used in any activity, and only used as *part* of another schema.
3277///
3278#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3279#[serde_with::serde_as]
3280#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3281pub struct SoftwareInfo {
3282 /// Android build ID string meant for displaying to the user. For example, shamu-userdebug 6.0.1 MOB30I 2756745 dev-keys.
3283 #[serde(rename = "androidBuildNumber")]
3284 pub android_build_number: Option<String>,
3285 /// Build time.
3286 #[serde(rename = "androidBuildTime")]
3287 pub android_build_time: Option<chrono::DateTime<chrono::offset::Utc>>,
3288 /// The Android Device Policy app version code.
3289 #[serde(rename = "androidDevicePolicyVersionCode")]
3290 pub android_device_policy_version_code: Option<i32>,
3291 /// The Android Device Policy app version as displayed to the user.
3292 #[serde(rename = "androidDevicePolicyVersionName")]
3293 pub android_device_policy_version_name: Option<String>,
3294 /// The user-visible Android version string. For example, 6.0.1.
3295 #[serde(rename = "androidVersion")]
3296 pub android_version: Option<String>,
3297 /// The system bootloader version number, e.g. 0.6.7.
3298 #[serde(rename = "bootloaderVersion")]
3299 pub bootloader_version: Option<String>,
3300 /// SHA-256 hash of android.content.pm.Signature (https://developer.android.com/reference/android/content/pm/Signature.html) associated with the system package, which can be used to verify that the system build hasn't been modified.
3301 #[serde(rename = "deviceBuildSignature")]
3302 pub device_build_signature: Option<String>,
3303 /// Kernel version, for example, 2.6.32.9-g103d848.
3304 #[serde(rename = "deviceKernelVersion")]
3305 pub device_kernel_version: Option<String>,
3306 /// An IETF BCP 47 language code for the primary locale on the device.
3307 #[serde(rename = "primaryLanguageCode")]
3308 pub primary_language_code: Option<String>,
3309 /// Security patch level, e.g. 2016-05-01.
3310 #[serde(rename = "securityPatchLevel")]
3311 pub security_patch_level: Option<String>,
3312 /// Information about a potential pending system update.
3313 #[serde(rename = "systemUpdateInfo")]
3314 pub system_update_info: Option<SystemUpdateInfo>,
3315}
3316
3317impl common::Part for SoftwareInfo {}
3318
3319/// Additional context for SpecificNonComplianceReason.
3320///
3321/// This type is not used in any activity, and only used as *part* of another schema.
3322///
3323#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3324#[serde_with::serde_as]
3325#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3326pub struct SpecificNonComplianceContext {
3327 /// Output only. Additional context for non-compliance related to default application settings. See DEFAULT_APPLICATION_SETTING_FAILED_FOR_SCOPE.
3328 #[serde(rename = "defaultApplicationContext")]
3329 pub default_application_context: Option<DefaultApplicationContext>,
3330 /// Additional context for non-compliance related to Wi-Fi configuration. See ONC_WIFI_INVALID_VALUE and ONC_WIFI_API_LEVEL
3331 #[serde(rename = "oncWifiContext")]
3332 pub onc_wifi_context: Option<OncWifiContext>,
3333 /// Additional context for non-compliance related to password policies. See PASSWORD_POLICIES_PASSWORD_EXPIRED and PASSWORD_POLICIES_PASSWORD_NOT_SUFFICIENT.
3334 #[serde(rename = "passwordPoliciesContext")]
3335 pub password_policies_context: Option<PasswordPoliciesContext>,
3336}
3337
3338impl common::Part for SpecificNonComplianceContext {}
3339
3340/// Parameters associated with the START_LOST_MODE command to put the device into lost mode. At least one of the parameters, not including the organization name, must be provided in order for the device to be put into lost mode.
3341///
3342/// This type is not used in any activity, and only used as *part* of another schema.
3343///
3344#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3345#[serde_with::serde_as]
3346#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3347pub struct StartLostModeParams {
3348 /// The email address displayed to the user when the device is in lost mode.
3349 #[serde(rename = "lostEmailAddress")]
3350 pub lost_email_address: Option<String>,
3351 /// The message displayed to the user when the device is in lost mode.
3352 #[serde(rename = "lostMessage")]
3353 pub lost_message: Option<UserFacingMessage>,
3354 /// The organization name displayed to the user when the device is in lost mode.
3355 #[serde(rename = "lostOrganization")]
3356 pub lost_organization: Option<UserFacingMessage>,
3357 /// The phone number that will be called when the device is in lost mode and the call owner button is tapped.
3358 #[serde(rename = "lostPhoneNumber")]
3359 pub lost_phone_number: Option<UserFacingMessage>,
3360 /// The street address displayed to the user when the device is in lost mode.
3361 #[serde(rename = "lostStreetAddress")]
3362 pub lost_street_address: Option<UserFacingMessage>,
3363}
3364
3365impl common::Part for StartLostModeParams {}
3366
3367/// Status of the START_LOST_MODE command to put the device into lost mode.
3368///
3369/// This type is not used in any activity, and only used as *part* of another schema.
3370///
3371#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3372#[serde_with::serde_as]
3373#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3374pub struct StartLostModeStatus {
3375 /// The status. See StartLostModeStatus.
3376 pub status: Option<String>,
3377}
3378
3379impl common::Part for StartLostModeStatus {}
3380
3381/// The Status type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by gRPC (https://github.com/grpc). Each Status message contains three pieces of data: error code, error message, and error details.You can find out more about this error model and how to work with it in the API Design Guide (https://cloud.google.com/apis/design/errors).
3382///
3383/// This type is not used in any activity, and only used as *part* of another schema.
3384///
3385#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3386#[serde_with::serde_as]
3387#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3388pub struct Status {
3389 /// The status code, which should be an enum value of google.rpc.Code.
3390 pub code: Option<i32>,
3391 /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
3392 pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
3393 /// A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
3394 pub message: Option<String>,
3395}
3396
3397impl common::Part for Status {}
3398
3399/// Settings controlling the behavior of status reports.
3400///
3401/// This type is not used in any activity, and only used as *part* of another schema.
3402///
3403#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3404#[serde_with::serde_as]
3405#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3406pub struct StatusReportingSettings {
3407 /// Application reporting settings. Only applicable if application_reports_enabled is true.
3408 #[serde(rename = "applicationReportingSettings")]
3409 pub application_reporting_settings: Option<ApplicationReportingSettings>,
3410 /// Whether app reports are enabled.
3411 #[serde(rename = "applicationReportsEnabled")]
3412 pub application_reports_enabled: Option<bool>,
3413 /// Whether Common Criteria Mode reporting is enabled. This is supported only on company-owned devices.
3414 #[serde(rename = "commonCriteriaModeEnabled")]
3415 pub common_criteria_mode_enabled: Option<bool>,
3416 /// Optional. Whether defaultApplicationInfo reporting is enabled.
3417 #[serde(rename = "defaultApplicationInfoReportingEnabled")]
3418 pub default_application_info_reporting_enabled: Option<bool>,
3419 /// Whether device settings reporting is enabled.
3420 #[serde(rename = "deviceSettingsEnabled")]
3421 pub device_settings_enabled: Option<bool>,
3422 /// Whether displays reporting is enabled. Report data is not available for personally owned devices with work profiles.
3423 #[serde(rename = "displayInfoEnabled")]
3424 pub display_info_enabled: Option<bool>,
3425 /// Whether hardware status reporting is enabled. Report data is not available for personally owned devices with work profiles.
3426 #[serde(rename = "hardwareStatusEnabled")]
3427 pub hardware_status_enabled: Option<bool>,
3428 /// Whether memory event reporting is enabled.
3429 #[serde(rename = "memoryInfoEnabled")]
3430 pub memory_info_enabled: Option<bool>,
3431 /// Whether network info reporting is enabled.
3432 #[serde(rename = "networkInfoEnabled")]
3433 pub network_info_enabled: Option<bool>,
3434 /// Whether power management event reporting is enabled. Report data is not available for personally owned devices with work profiles.
3435 #[serde(rename = "powerManagementEventsEnabled")]
3436 pub power_management_events_enabled: Option<bool>,
3437 /// Whether software info reporting is enabled.
3438 #[serde(rename = "softwareInfoEnabled")]
3439 pub software_info_enabled: Option<bool>,
3440 /// Whether system properties reporting is enabled.
3441 #[serde(rename = "systemPropertiesEnabled")]
3442 pub system_properties_enabled: Option<bool>,
3443}
3444
3445impl common::Part for StatusReportingSettings {}
3446
3447/// Parameters associated with the STOP_LOST_MODE command to take the device out of lost mode.
3448///
3449/// This type is not used in any activity, and only used as *part* of another schema.
3450///
3451#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3452#[serde_with::serde_as]
3453#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3454pub struct StopLostModeParams {
3455 _never_set: Option<bool>,
3456}
3457
3458impl common::Part for StopLostModeParams {}
3459
3460/// Status of the STOP_LOST_MODE command to take the device out of lost mode.
3461///
3462/// This type is not used in any activity, and only used as *part* of another schema.
3463///
3464#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3465#[serde_with::serde_as]
3466#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3467pub struct StopLostModeStatus {
3468 /// The status. See StopLostModeStatus.
3469 pub status: Option<String>,
3470}
3471
3472impl common::Part for StopLostModeStatus {}
3473
3474/// Configuration for managing system updatesNote: Google Play system updates (https://source.android.com/docs/core/ota/modular-system) (also called Mainline updates) are automatically downloaded but require a device reboot to be installed. Refer to the mainline section in Manage system updates (https://developer.android.com/work/dpc/system-updates#mainline) for further details.
3475///
3476/// This type is not used in any activity, and only used as *part* of another schema.
3477///
3478#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3479#[serde_with::serde_as]
3480#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3481pub struct SystemUpdate {
3482 /// If the type is WINDOWED, the end of the maintenance window, measured as the number of minutes after midnight in device's local time. This value must be between 0 and 1439, inclusive. If this value is less than start_minutes, then the maintenance window spans midnight. If the maintenance window specified is smaller than 30 minutes, the actual window is extended to 30 minutes beyond the start time.
3483 #[serde(rename = "endMinutes")]
3484 pub end_minutes: Option<i32>,
3485 /// An annually repeating time period in which over-the-air (OTA) system updates are postponed to freeze the OS version running on a device. To prevent freezing the device indefinitely, each freeze period must be separated by at least 60 days.
3486 #[serde(rename = "freezePeriods")]
3487 pub freeze_periods: Option<Vec<FreezePeriod>>,
3488 /// If the type is WINDOWED, the start of the maintenance window, measured as the number of minutes after midnight in the device's local time. This value must be between 0 and 1439, inclusive.
3489 #[serde(rename = "startMinutes")]
3490 pub start_minutes: Option<i32>,
3491 /// The type of system update to configure.
3492 #[serde(rename = "type")]
3493 pub type_: Option<String>,
3494}
3495
3496impl common::Part for SystemUpdate {}
3497
3498/// Information about a potential pending system update.
3499///
3500/// This type is not used in any activity, and only used as *part* of another schema.
3501///
3502#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3503#[serde_with::serde_as]
3504#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3505pub struct SystemUpdateInfo {
3506 /// The time when the update was first available. A zero value indicates that this field is not set. This field is set only if an update is available (that is, updateStatus is neither UPDATE_STATUS_UNKNOWN nor UP_TO_DATE).
3507 #[serde(rename = "updateReceivedTime")]
3508 pub update_received_time: Option<chrono::DateTime<chrono::offset::Utc>>,
3509 /// The status of an update: whether an update exists and what type it is.
3510 #[serde(rename = "updateStatus")]
3511 pub update_status: Option<String>,
3512}
3513
3514impl common::Part for SystemUpdateInfo {}
3515
3516/// Telephony information associated with a given SIM card on the device. Only supported on fully managed devices starting from Android API level 23.
3517///
3518/// This type is not used in any activity, and only used as *part* of another schema.
3519///
3520#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3521#[serde_with::serde_as]
3522#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3523pub struct TelephonyInfo {
3524 /// Output only. Activation state of the SIM card on the device. This is applicable for eSIMs only. This is supported on all devices for API level 35 and above. This is always ACTIVATION_STATE_UNSPECIFIED for physical SIMs and for devices below API level 35.
3525 #[serde(rename = "activationState")]
3526 pub activation_state: Option<String>,
3527 /// The carrier name associated with this SIM card.
3528 #[serde(rename = "carrierName")]
3529 pub carrier_name: Option<String>,
3530 /// Output only. The configuration mode of the SIM card on the device. This is applicable for eSIMs only. This is supported on all devices for API level 35 and above. This is always CONFIG_MODE_UNSPECIFIED for physical SIMs and for devices below API level 35.
3531 #[serde(rename = "configMode")]
3532 pub config_mode: Option<String>,
3533 /// Output only. The ICCID associated with this SIM card.
3534 #[serde(rename = "iccId")]
3535 pub icc_id: Option<String>,
3536 /// The phone number associated with this SIM card.
3537 #[serde(rename = "phoneNumber")]
3538 pub phone_number: Option<String>,
3539}
3540
3541impl common::Part for TelephonyInfo {}
3542
3543/// A terms and conditions page to be accepted during provisioning.
3544///
3545/// This type is not used in any activity, and only used as *part* of another schema.
3546///
3547#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3548#[serde_with::serde_as]
3549#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3550pub struct TermsAndConditions {
3551 /// A well-formatted HTML string. It will be parsed on the client with android.text.Html#fromHtml.
3552 pub content: Option<UserFacingMessage>,
3553 /// A short header which appears above the HTML content.
3554 pub header: Option<UserFacingMessage>,
3555}
3556
3557impl common::Part for TermsAndConditions {}
3558
3559/// Controls types of device activity logs collected from the device and reported via Pub/Sub notification (https://developers.google.com/android/management/notifications).
3560///
3561/// This type is not used in any activity, and only used as *part* of another schema.
3562///
3563#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3564#[serde_with::serde_as]
3565#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3566pub struct UsageLog {
3567 /// Specifies which log types are enabled. Note that users will receive on-device messaging when usage logging is enabled.
3568 #[serde(rename = "enabledLogTypes")]
3569 pub enabled_log_types: Option<Vec<String>>,
3570 /// Specifies which of the enabled log types can be uploaded over mobile data. By default logs are queued for upload when the device connects to WiFi.
3571 #[serde(rename = "uploadOnCellularAllowed")]
3572 pub upload_on_cellular_allowed: Option<Vec<String>>,
3573}
3574
3575impl common::Part for UsageLog {}
3576
3577/// A user belonging to an enterprise.
3578///
3579/// This type is not used in any activity, and only used as *part* of another schema.
3580///
3581#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3582#[serde_with::serde_as]
3583#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3584pub struct User {
3585 /// A unique identifier you create for this user, such as user342 or asset#44418. This field must be set when the user is created and can't be updated. This field must not contain personally identifiable information (PII). This identifier must be 1024 characters or less; otherwise, the update policy request will fail.
3586 #[serde(rename = "accountIdentifier")]
3587 pub account_identifier: Option<String>,
3588}
3589
3590impl common::Part for User {}
3591
3592/// Provides a user-facing message with locale info. The maximum message length is 4096 characters.
3593///
3594/// This type is not used in any activity, and only used as *part* of another schema.
3595///
3596#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3597#[serde_with::serde_as]
3598#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3599pub struct UserFacingMessage {
3600 /// The default message displayed if no localized message is specified or the user's locale doesn't match with any of the localized messages. A default message must be provided if any localized messages are provided.
3601 #[serde(rename = "defaultMessage")]
3602 pub default_message: Option<String>,
3603 /// A map containing pairs, where locale is a well-formed BCP 47 language (https://www.w3.org/International/articles/language-tags/) code, such as en-US, es-ES, or fr.
3604 #[serde(rename = "localizedMessages")]
3605 pub localized_messages: Option<HashMap<String, String>>,
3606}
3607
3608impl common::Part for UserFacingMessage {}
3609
3610/// A web app.
3611///
3612/// # Activities
3613///
3614/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3615/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3616///
3617/// * [web apps create enterprises](EnterpriseWebAppCreateCall) (request|response)
3618/// * [web apps get enterprises](EnterpriseWebAppGetCall) (response)
3619/// * [web apps patch enterprises](EnterpriseWebAppPatchCall) (request|response)
3620#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3621#[serde_with::serde_as]
3622#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3623pub struct WebApp {
3624 /// The display mode of the web app.
3625 #[serde(rename = "displayMode")]
3626 pub display_mode: Option<String>,
3627 /// A list of icons for the web app. Must have at least one element.
3628 pub icons: Option<Vec<WebAppIcon>>,
3629 /// The name of the web app, which is generated by the server during creation in the form enterprises/{enterpriseId}/webApps/{packageName}.
3630 pub name: Option<String>,
3631 /// The start URL, i.e. the URL that should load when the user opens the application.
3632 #[serde(rename = "startUrl")]
3633 pub start_url: Option<String>,
3634 /// The title of the web app as displayed to the user (e.g., amongst a list of other applications, or as a label for an icon).
3635 pub title: Option<String>,
3636 /// The current version of the app.Note that the version can automatically increase during the lifetime of the web app, while Google does internal housekeeping to keep the web app up-to-date.
3637 #[serde(rename = "versionCode")]
3638 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3639 pub version_code: Option<i64>,
3640}
3641
3642impl common::RequestValue for WebApp {}
3643impl common::ResponseResult for WebApp {}
3644
3645/// An icon for a web app. Supported formats are: png, jpg and webp.
3646///
3647/// This type is not used in any activity, and only used as *part* of another schema.
3648///
3649#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3650#[serde_with::serde_as]
3651#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3652pub struct WebAppIcon {
3653 /// The actual bytes of the image in a base64url encoded string (c.f. RFC4648, section 5 "Base 64 Encoding with URL and Filename Safe Alphabet"). - The image type can be png or jpg. - The image should ideally be square. - The image should ideally have a size of 512x512.
3654 #[serde(rename = "imageData")]
3655 pub image_data: Option<String>,
3656}
3657
3658impl common::Part for WebAppIcon {}
3659
3660/// A web token used to access the managed Google Play iframe.
3661///
3662/// # Activities
3663///
3664/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3665/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3666///
3667/// * [web tokens create enterprises](EnterpriseWebTokenCreateCall) (request|response)
3668#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3669#[serde_with::serde_as]
3670#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3671pub struct WebToken {
3672 /// The features to enable. Use this if you want to control exactly which feature(s) will be activated; leave empty to allow all features.Restrictions / things to note: - If no features are listed here, all features are enabled — this is the default behavior where you give access to all features to your admins. - This must not contain any FEATURE_UNSPECIFIED values. - Repeated values are ignored
3673 #[serde(rename = "enabledFeatures")]
3674 pub enabled_features: Option<Vec<String>>,
3675 /// The name of the web token, which is generated by the server during creation in the form enterprises/{enterpriseId}/webTokens/{webTokenId}.
3676 pub name: Option<String>,
3677 /// The URL of the parent frame hosting the iframe with the embedded UI. To prevent XSS, the iframe may not be hosted at other URLs. The URL must use the https scheme.
3678 #[serde(rename = "parentFrameUrl")]
3679 pub parent_frame_url: Option<String>,
3680 /// Permissions available to an admin in the embedded UI. An admin must have all of these permissions in order to view the UI. This field is deprecated.
3681 pub permissions: Option<Vec<String>>,
3682 /// The token value which is used in the hosting page to generate the iframe with the embedded UI. This is a read-only field generated by the server.
3683 pub value: Option<String>,
3684}
3685
3686impl common::RequestValue for WebToken {}
3687impl common::ResponseResult for WebToken {}
3688
3689/// Wi-Fi roaming policy.
3690///
3691/// This type is not used in any activity, and only used as *part* of another schema.
3692///
3693#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3694#[serde_with::serde_as]
3695#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3696pub struct WifiRoamingPolicy {
3697 /// Optional. Wi-Fi roaming settings. SSIDs provided in this list must be unique, the policy will be rejected otherwise.
3698 #[serde(rename = "wifiRoamingSettings")]
3699 pub wifi_roaming_settings: Option<Vec<WifiRoamingSetting>>,
3700}
3701
3702impl common::Part for WifiRoamingPolicy {}
3703
3704/// Wi-Fi roaming setting.
3705///
3706/// This type is not used in any activity, and only used as *part* of another schema.
3707///
3708#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3709#[serde_with::serde_as]
3710#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3711pub struct WifiRoamingSetting {
3712 /// Required. Wi-Fi roaming mode for the specified SSID.
3713 #[serde(rename = "wifiRoamingMode")]
3714 pub wifi_roaming_mode: Option<String>,
3715 /// Required. SSID of the Wi-Fi network.
3716 #[serde(rename = "wifiSsid")]
3717 pub wifi_ssid: Option<String>,
3718}
3719
3720impl common::Part for WifiRoamingSetting {}
3721
3722/// Represents a Wi-Fi SSID.
3723///
3724/// This type is not used in any activity, and only used as *part* of another schema.
3725///
3726#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3727#[serde_with::serde_as]
3728#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3729pub struct WifiSsid {
3730 /// Required. Wi-Fi SSID represented as a string.
3731 #[serde(rename = "wifiSsid")]
3732 pub wifi_ssid: Option<String>,
3733}
3734
3735impl common::Part for WifiSsid {}
3736
3737/// Restrictions on which Wi-Fi SSIDs the device can connect to. Note that this does not affect which networks can be configured on the device. Supported on company-owned devices running Android 13 and above.
3738///
3739/// This type is not used in any activity, and only used as *part* of another schema.
3740///
3741#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3742#[serde_with::serde_as]
3743#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3744pub struct WifiSsidPolicy {
3745 /// Type of the Wi-Fi SSID policy to be applied.
3746 #[serde(rename = "wifiSsidPolicyType")]
3747 pub wifi_ssid_policy_type: Option<String>,
3748 /// Optional. List of Wi-Fi SSIDs that should be applied in the policy. This field must be non-empty when WifiSsidPolicyType is set to WIFI_SSID_ALLOWLIST. If this is set to a non-empty list, then a NonComplianceDetail detail with API_LEVEL is reported if the Android version is less than 13 and a NonComplianceDetail with MANAGEMENT_MODE is reported for non-company-owned devices.
3749 #[serde(rename = "wifiSsids")]
3750 pub wifi_ssids: Option<Vec<WifiSsid>>,
3751}
3752
3753impl common::Part for WifiSsidPolicy {}
3754
3755/// An action to reset a company owned device or delete a work profile. Note: blockAction must also be specified.
3756///
3757/// This type is not used in any activity, and only used as *part* of another schema.
3758///
3759#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3760#[serde_with::serde_as]
3761#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3762pub struct WipeAction {
3763 /// Whether the factory-reset protection data is preserved on the device. This setting doesn’t apply to work profiles.
3764 #[serde(rename = "preserveFrp")]
3765 pub preserve_frp: Option<bool>,
3766 /// Number of days the policy is non-compliant before the device or work profile is wiped. wipeAfterDays must be greater than blockAfterDays.
3767 #[serde(rename = "wipeAfterDays")]
3768 pub wipe_after_days: Option<i32>,
3769}
3770
3771impl common::Part for WipeAction {}
3772
3773/// Parameters associated with the WIPE command to wipe the device.
3774///
3775/// This type is not used in any activity, and only used as *part* of another schema.
3776///
3777#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3778#[serde_with::serde_as]
3779#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3780pub struct WipeParams {
3781 /// Optional. Flags to determine what data to wipe.
3782 #[serde(rename = "wipeDataFlags")]
3783 pub wipe_data_flags: Option<Vec<String>>,
3784 /// Optional. A short message displayed to the user before wiping the work profile on personal devices. This has no effect on company owned devices. The maximum message length is 200 characters.
3785 #[serde(rename = "wipeReason")]
3786 pub wipe_reason: Option<UserFacingMessage>,
3787}
3788
3789impl common::Part for WipeParams {}
3790
3791/// Controls the work account setup configuration, such as details of whether a Google authenticated account is required.
3792///
3793/// This type is not used in any activity, and only used as *part* of another schema.
3794///
3795#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3796#[serde_with::serde_as]
3797#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3798pub struct WorkAccountSetupConfig {
3799 /// Optional. The authentication type of the user on the device.
3800 #[serde(rename = "authenticationType")]
3801 pub authentication_type: Option<String>,
3802 /// Optional. The specific google work account email address to be added. This field is only relevant if authenticationType is GOOGLE_AUTHENTICATED. This must be an enterprise account and not a consumer account. Once set and a Google authenticated account is added to the device, changing this field will have no effect, and thus recommended to be set only once.
3803 #[serde(rename = "requiredAccountEmail")]
3804 pub required_account_email: Option<String>,
3805}
3806
3807impl common::Part for WorkAccountSetupConfig {}
3808
3809// ###################
3810// MethodBuilders ###
3811// #################
3812
3813/// A builder providing access to all methods supported on *enterprise* resources.
3814/// It is not used directly, but through the [`AndroidManagement`] hub.
3815///
3816/// # Example
3817///
3818/// Instantiate a resource builder
3819///
3820/// ```test_harness,no_run
3821/// extern crate hyper;
3822/// extern crate hyper_rustls;
3823/// extern crate google_androidmanagement1 as androidmanagement1;
3824///
3825/// # async fn dox() {
3826/// use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3827///
3828/// let secret: yup_oauth2::ApplicationSecret = Default::default();
3829/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
3830/// .with_native_roots()
3831/// .unwrap()
3832/// .https_only()
3833/// .enable_http2()
3834/// .build();
3835///
3836/// let executor = hyper_util::rt::TokioExecutor::new();
3837/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3838/// secret,
3839/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3840/// yup_oauth2::client::CustomHyperClientBuilder::from(
3841/// hyper_util::client::legacy::Client::builder(executor).build(connector),
3842/// ),
3843/// ).build().await.unwrap();
3844///
3845/// let client = hyper_util::client::legacy::Client::builder(
3846/// hyper_util::rt::TokioExecutor::new()
3847/// )
3848/// .build(
3849/// hyper_rustls::HttpsConnectorBuilder::new()
3850/// .with_native_roots()
3851/// .unwrap()
3852/// .https_or_http()
3853/// .enable_http2()
3854/// .build()
3855/// );
3856/// let mut hub = AndroidManagement::new(client, auth);
3857/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
3858/// // like `applications_get(...)`, `create(...)`, `delete(...)`, `devices_delete(...)`, `devices_get(...)`, `devices_issue_command(...)`, `devices_list(...)`, `devices_operations_cancel(...)`, `devices_operations_get(...)`, `devices_operations_list(...)`, `devices_patch(...)`, `enrollment_tokens_create(...)`, `enrollment_tokens_delete(...)`, `enrollment_tokens_get(...)`, `enrollment_tokens_list(...)`, `generate_enterprise_upgrade_url(...)`, `get(...)`, `list(...)`, `migration_tokens_create(...)`, `migration_tokens_get(...)`, `migration_tokens_list(...)`, `patch(...)`, `policies_delete(...)`, `policies_get(...)`, `policies_list(...)`, `policies_modify_policy_applications(...)`, `policies_patch(...)`, `policies_remove_policy_applications(...)`, `web_apps_create(...)`, `web_apps_delete(...)`, `web_apps_get(...)`, `web_apps_list(...)`, `web_apps_patch(...)` and `web_tokens_create(...)`
3859/// // to build up your call.
3860/// let rb = hub.enterprises();
3861/// # }
3862/// ```
3863pub struct EnterpriseMethods<'a, C>
3864where
3865 C: 'a,
3866{
3867 hub: &'a AndroidManagement<C>,
3868}
3869
3870impl<'a, C> common::MethodsBuilder for EnterpriseMethods<'a, C> {}
3871
3872impl<'a, C> EnterpriseMethods<'a, C> {
3873 /// Create a builder to help you perform the following task:
3874 ///
3875 /// Gets info about an application.
3876 ///
3877 /// # Arguments
3878 ///
3879 /// * `name` - The name of the application in the form enterprises/{enterpriseId}/applications/{package_name}.
3880 pub fn applications_get(&self, name: &str) -> EnterpriseApplicationGetCall<'a, C> {
3881 EnterpriseApplicationGetCall {
3882 hub: self.hub,
3883 _name: name.to_string(),
3884 _language_code: Default::default(),
3885 _delegate: Default::default(),
3886 _additional_params: Default::default(),
3887 _scopes: Default::default(),
3888 }
3889 }
3890
3891 /// Create a builder to help you perform the following task:
3892 ///
3893 /// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to Code.CANCELLED.
3894 ///
3895 /// # Arguments
3896 ///
3897 /// * `name` - The name of the operation resource to be cancelled.
3898 pub fn devices_operations_cancel(
3899 &self,
3900 name: &str,
3901 ) -> EnterpriseDeviceOperationCancelCall<'a, C> {
3902 EnterpriseDeviceOperationCancelCall {
3903 hub: self.hub,
3904 _name: name.to_string(),
3905 _delegate: Default::default(),
3906 _additional_params: Default::default(),
3907 _scopes: Default::default(),
3908 }
3909 }
3910
3911 /// Create a builder to help you perform the following task:
3912 ///
3913 /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
3914 ///
3915 /// # Arguments
3916 ///
3917 /// * `name` - The name of the operation resource.
3918 pub fn devices_operations_get(&self, name: &str) -> EnterpriseDeviceOperationGetCall<'a, C> {
3919 EnterpriseDeviceOperationGetCall {
3920 hub: self.hub,
3921 _name: name.to_string(),
3922 _delegate: Default::default(),
3923 _additional_params: Default::default(),
3924 _scopes: Default::default(),
3925 }
3926 }
3927
3928 /// Create a builder to help you perform the following task:
3929 ///
3930 /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED.
3931 ///
3932 /// # Arguments
3933 ///
3934 /// * `name` - The name of the operation's parent resource.
3935 pub fn devices_operations_list(&self, name: &str) -> EnterpriseDeviceOperationListCall<'a, C> {
3936 EnterpriseDeviceOperationListCall {
3937 hub: self.hub,
3938 _name: name.to_string(),
3939 _return_partial_success: Default::default(),
3940 _page_token: Default::default(),
3941 _page_size: Default::default(),
3942 _filter: Default::default(),
3943 _delegate: Default::default(),
3944 _additional_params: Default::default(),
3945 _scopes: Default::default(),
3946 }
3947 }
3948
3949 /// Create a builder to help you perform the following task:
3950 ///
3951 /// Deletes a device. This operation attempts to wipe the device but this is not guaranteed to succeed if the device is offline for an extended period. Deleted devices do not show up in enterprises.devices.list calls and a 404 is returned from enterprises.devices.get.
3952 ///
3953 /// # Arguments
3954 ///
3955 /// * `name` - The name of the device in the form enterprises/{enterpriseId}/devices/{deviceId}.
3956 pub fn devices_delete(&self, name: &str) -> EnterpriseDeviceDeleteCall<'a, C> {
3957 EnterpriseDeviceDeleteCall {
3958 hub: self.hub,
3959 _name: name.to_string(),
3960 _wipe_reason_message: Default::default(),
3961 _wipe_data_flags: Default::default(),
3962 _delegate: Default::default(),
3963 _additional_params: Default::default(),
3964 _scopes: Default::default(),
3965 }
3966 }
3967
3968 /// Create a builder to help you perform the following task:
3969 ///
3970 /// Gets a device. Deleted devices will respond with a 404 error.
3971 ///
3972 /// # Arguments
3973 ///
3974 /// * `name` - The name of the device in the form enterprises/{enterpriseId}/devices/{deviceId}.
3975 pub fn devices_get(&self, name: &str) -> EnterpriseDeviceGetCall<'a, C> {
3976 EnterpriseDeviceGetCall {
3977 hub: self.hub,
3978 _name: name.to_string(),
3979 _delegate: Default::default(),
3980 _additional_params: Default::default(),
3981 _scopes: Default::default(),
3982 }
3983 }
3984
3985 /// Create a builder to help you perform the following task:
3986 ///
3987 /// Issues a command to a device. The Operation resource returned contains a Command in its metadata field. Use the get operation method to get the status of the command.
3988 ///
3989 /// # Arguments
3990 ///
3991 /// * `request` - No description provided.
3992 /// * `name` - The name of the device in the form enterprises/{enterpriseId}/devices/{deviceId}.
3993 pub fn devices_issue_command(
3994 &self,
3995 request: Command,
3996 name: &str,
3997 ) -> EnterpriseDeviceIssueCommandCall<'a, C> {
3998 EnterpriseDeviceIssueCommandCall {
3999 hub: self.hub,
4000 _request: request,
4001 _name: name.to_string(),
4002 _delegate: Default::default(),
4003 _additional_params: Default::default(),
4004 _scopes: Default::default(),
4005 }
4006 }
4007
4008 /// Create a builder to help you perform the following task:
4009 ///
4010 /// Lists devices for a given enterprise. Deleted devices are not returned in the response.
4011 ///
4012 /// # Arguments
4013 ///
4014 /// * `parent` - The name of the enterprise in the form enterprises/{enterpriseId}.
4015 pub fn devices_list(&self, parent: &str) -> EnterpriseDeviceListCall<'a, C> {
4016 EnterpriseDeviceListCall {
4017 hub: self.hub,
4018 _parent: parent.to_string(),
4019 _page_token: Default::default(),
4020 _page_size: Default::default(),
4021 _delegate: Default::default(),
4022 _additional_params: Default::default(),
4023 _scopes: Default::default(),
4024 }
4025 }
4026
4027 /// Create a builder to help you perform the following task:
4028 ///
4029 /// Updates a device.
4030 ///
4031 /// # Arguments
4032 ///
4033 /// * `request` - No description provided.
4034 /// * `name` - The name of the device in the form enterprises/{enterpriseId}/devices/{deviceId}.
4035 pub fn devices_patch(&self, request: Device, name: &str) -> EnterpriseDevicePatchCall<'a, C> {
4036 EnterpriseDevicePatchCall {
4037 hub: self.hub,
4038 _request: request,
4039 _name: name.to_string(),
4040 _update_mask: Default::default(),
4041 _delegate: Default::default(),
4042 _additional_params: Default::default(),
4043 _scopes: Default::default(),
4044 }
4045 }
4046
4047 /// Create a builder to help you perform the following task:
4048 ///
4049 /// Creates an enrollment token for a given enterprise. It's up to the caller's responsibility to manage the lifecycle of newly created tokens and deleting them when they're not intended to be used anymore.
4050 ///
4051 /// # Arguments
4052 ///
4053 /// * `request` - No description provided.
4054 /// * `parent` - The name of the enterprise in the form enterprises/{enterpriseId}.
4055 pub fn enrollment_tokens_create(
4056 &self,
4057 request: EnrollmentToken,
4058 parent: &str,
4059 ) -> EnterpriseEnrollmentTokenCreateCall<'a, C> {
4060 EnterpriseEnrollmentTokenCreateCall {
4061 hub: self.hub,
4062 _request: request,
4063 _parent: parent.to_string(),
4064 _delegate: Default::default(),
4065 _additional_params: Default::default(),
4066 _scopes: Default::default(),
4067 }
4068 }
4069
4070 /// Create a builder to help you perform the following task:
4071 ///
4072 /// Deletes an enrollment token. This operation invalidates the token, preventing its future use.
4073 ///
4074 /// # Arguments
4075 ///
4076 /// * `name` - The name of the enrollment token in the form enterprises/{enterpriseId}/enrollmentTokens/{enrollmentTokenId}.
4077 pub fn enrollment_tokens_delete(
4078 &self,
4079 name: &str,
4080 ) -> EnterpriseEnrollmentTokenDeleteCall<'a, C> {
4081 EnterpriseEnrollmentTokenDeleteCall {
4082 hub: self.hub,
4083 _name: name.to_string(),
4084 _delegate: Default::default(),
4085 _additional_params: Default::default(),
4086 _scopes: Default::default(),
4087 }
4088 }
4089
4090 /// Create a builder to help you perform the following task:
4091 ///
4092 /// Gets an active, unexpired enrollment token. A partial view of the enrollment token is returned. Only the following fields are populated: name, expirationTimestamp, allowPersonalUsage, value, qrCode. This method is meant to help manage active enrollment tokens lifecycle. For security reasons, it's recommended to delete active enrollment tokens as soon as they're not intended to be used anymore.
4093 ///
4094 /// # Arguments
4095 ///
4096 /// * `name` - Required. The name of the enrollment token in the form enterprises/{enterpriseId}/enrollmentTokens/{enrollmentTokenId}.
4097 pub fn enrollment_tokens_get(&self, name: &str) -> EnterpriseEnrollmentTokenGetCall<'a, C> {
4098 EnterpriseEnrollmentTokenGetCall {
4099 hub: self.hub,
4100 _name: name.to_string(),
4101 _delegate: Default::default(),
4102 _additional_params: Default::default(),
4103 _scopes: Default::default(),
4104 }
4105 }
4106
4107 /// Create a builder to help you perform the following task:
4108 ///
4109 /// Lists active, unexpired enrollment tokens for a given enterprise. The list items contain only a partial view of EnrollmentToken object. Only the following fields are populated: name, expirationTimestamp, allowPersonalUsage, value, qrCode. This method is meant to help manage active enrollment tokens lifecycle. For security reasons, it's recommended to delete active enrollment tokens as soon as they're not intended to be used anymore.
4110 ///
4111 /// # Arguments
4112 ///
4113 /// * `parent` - Required. The name of the enterprise in the form enterprises/{enterpriseId}.
4114 pub fn enrollment_tokens_list(&self, parent: &str) -> EnterpriseEnrollmentTokenListCall<'a, C> {
4115 EnterpriseEnrollmentTokenListCall {
4116 hub: self.hub,
4117 _parent: parent.to_string(),
4118 _page_token: Default::default(),
4119 _page_size: Default::default(),
4120 _delegate: Default::default(),
4121 _additional_params: Default::default(),
4122 _scopes: Default::default(),
4123 }
4124 }
4125
4126 /// Create a builder to help you perform the following task:
4127 ///
4128 /// Creates a migration token, to migrate an existing device from being managed by the EMM's Device Policy Controller (DPC) to being managed by the Android Management API. See the guide (https://developers.google.com/android/management/dpc-migration) for more details.
4129 ///
4130 /// # Arguments
4131 ///
4132 /// * `request` - No description provided.
4133 /// * `parent` - Required. The enterprise in which this migration token is created. This must be the same enterprise which already manages the device in the Play EMM API. Format: enterprises/{enterprise}
4134 pub fn migration_tokens_create(
4135 &self,
4136 request: MigrationToken,
4137 parent: &str,
4138 ) -> EnterpriseMigrationTokenCreateCall<'a, C> {
4139 EnterpriseMigrationTokenCreateCall {
4140 hub: self.hub,
4141 _request: request,
4142 _parent: parent.to_string(),
4143 _delegate: Default::default(),
4144 _additional_params: Default::default(),
4145 _scopes: Default::default(),
4146 }
4147 }
4148
4149 /// Create a builder to help you perform the following task:
4150 ///
4151 /// Gets a migration token.
4152 ///
4153 /// # Arguments
4154 ///
4155 /// * `name` - Required. The name of the migration token to retrieve. Format: enterprises/{enterprise}/migrationTokens/{migration_token}
4156 pub fn migration_tokens_get(&self, name: &str) -> EnterpriseMigrationTokenGetCall<'a, C> {
4157 EnterpriseMigrationTokenGetCall {
4158 hub: self.hub,
4159 _name: name.to_string(),
4160 _delegate: Default::default(),
4161 _additional_params: Default::default(),
4162 _scopes: Default::default(),
4163 }
4164 }
4165
4166 /// Create a builder to help you perform the following task:
4167 ///
4168 /// Lists migration tokens.
4169 ///
4170 /// # Arguments
4171 ///
4172 /// * `parent` - Required. The enterprise which the migration tokens belong to. Format: enterprises/{enterprise}
4173 pub fn migration_tokens_list(&self, parent: &str) -> EnterpriseMigrationTokenListCall<'a, C> {
4174 EnterpriseMigrationTokenListCall {
4175 hub: self.hub,
4176 _parent: parent.to_string(),
4177 _page_token: Default::default(),
4178 _page_size: Default::default(),
4179 _delegate: Default::default(),
4180 _additional_params: Default::default(),
4181 _scopes: Default::default(),
4182 }
4183 }
4184
4185 /// Create a builder to help you perform the following task:
4186 ///
4187 /// Deletes a policy. This operation is only permitted if no devices are currently referencing the policy.
4188 ///
4189 /// # Arguments
4190 ///
4191 /// * `name` - The name of the policy in the form enterprises/{enterpriseId}/policies/{policyId}.
4192 pub fn policies_delete(&self, name: &str) -> EnterprisePolicyDeleteCall<'a, C> {
4193 EnterprisePolicyDeleteCall {
4194 hub: self.hub,
4195 _name: name.to_string(),
4196 _delegate: Default::default(),
4197 _additional_params: Default::default(),
4198 _scopes: Default::default(),
4199 }
4200 }
4201
4202 /// Create a builder to help you perform the following task:
4203 ///
4204 /// Gets a policy.
4205 ///
4206 /// # Arguments
4207 ///
4208 /// * `name` - The name of the policy in the form enterprises/{enterpriseId}/policies/{policyId}.
4209 pub fn policies_get(&self, name: &str) -> EnterprisePolicyGetCall<'a, C> {
4210 EnterprisePolicyGetCall {
4211 hub: self.hub,
4212 _name: name.to_string(),
4213 _delegate: Default::default(),
4214 _additional_params: Default::default(),
4215 _scopes: Default::default(),
4216 }
4217 }
4218
4219 /// Create a builder to help you perform the following task:
4220 ///
4221 /// Lists policies for a given enterprise.
4222 ///
4223 /// # Arguments
4224 ///
4225 /// * `parent` - The name of the enterprise in the form enterprises/{enterpriseId}.
4226 pub fn policies_list(&self, parent: &str) -> EnterprisePolicyListCall<'a, C> {
4227 EnterprisePolicyListCall {
4228 hub: self.hub,
4229 _parent: parent.to_string(),
4230 _page_token: Default::default(),
4231 _page_size: Default::default(),
4232 _delegate: Default::default(),
4233 _additional_params: Default::default(),
4234 _scopes: Default::default(),
4235 }
4236 }
4237
4238 /// Create a builder to help you perform the following task:
4239 ///
4240 /// Updates or creates applications in a policy.
4241 ///
4242 /// # Arguments
4243 ///
4244 /// * `request` - No description provided.
4245 /// * `name` - Required. The name of the Policy containing the ApplicationPolicy objects to be updated, in the form enterprises/{enterpriseId}/policies/{policyId}.
4246 pub fn policies_modify_policy_applications(
4247 &self,
4248 request: ModifyPolicyApplicationsRequest,
4249 name: &str,
4250 ) -> EnterprisePolicyModifyPolicyApplicationCall<'a, C> {
4251 EnterprisePolicyModifyPolicyApplicationCall {
4252 hub: self.hub,
4253 _request: request,
4254 _name: name.to_string(),
4255 _delegate: Default::default(),
4256 _additional_params: Default::default(),
4257 _scopes: Default::default(),
4258 }
4259 }
4260
4261 /// Create a builder to help you perform the following task:
4262 ///
4263 /// Updates or creates a policy.
4264 ///
4265 /// # Arguments
4266 ///
4267 /// * `request` - No description provided.
4268 /// * `name` - The name of the policy in the form enterprises/{enterpriseId}/policies/{policyId}.
4269 pub fn policies_patch(&self, request: Policy, name: &str) -> EnterprisePolicyPatchCall<'a, C> {
4270 EnterprisePolicyPatchCall {
4271 hub: self.hub,
4272 _request: request,
4273 _name: name.to_string(),
4274 _update_mask: Default::default(),
4275 _delegate: Default::default(),
4276 _additional_params: Default::default(),
4277 _scopes: Default::default(),
4278 }
4279 }
4280
4281 /// Create a builder to help you perform the following task:
4282 ///
4283 /// Removes applications in a policy.
4284 ///
4285 /// # Arguments
4286 ///
4287 /// * `request` - No description provided.
4288 /// * `name` - Required. The name of the policy containing the ApplicationPolicy objects to be removed, in the form enterprises/{enterpriseId}/policies/{policyId}.
4289 pub fn policies_remove_policy_applications(
4290 &self,
4291 request: RemovePolicyApplicationsRequest,
4292 name: &str,
4293 ) -> EnterprisePolicyRemovePolicyApplicationCall<'a, C> {
4294 EnterprisePolicyRemovePolicyApplicationCall {
4295 hub: self.hub,
4296 _request: request,
4297 _name: name.to_string(),
4298 _delegate: Default::default(),
4299 _additional_params: Default::default(),
4300 _scopes: Default::default(),
4301 }
4302 }
4303
4304 /// Create a builder to help you perform the following task:
4305 ///
4306 /// Creates a web app.
4307 ///
4308 /// # Arguments
4309 ///
4310 /// * `request` - No description provided.
4311 /// * `parent` - The name of the enterprise in the form enterprises/{enterpriseId}.
4312 pub fn web_apps_create(
4313 &self,
4314 request: WebApp,
4315 parent: &str,
4316 ) -> EnterpriseWebAppCreateCall<'a, C> {
4317 EnterpriseWebAppCreateCall {
4318 hub: self.hub,
4319 _request: request,
4320 _parent: parent.to_string(),
4321 _delegate: Default::default(),
4322 _additional_params: Default::default(),
4323 _scopes: Default::default(),
4324 }
4325 }
4326
4327 /// Create a builder to help you perform the following task:
4328 ///
4329 /// Deletes a web app.
4330 ///
4331 /// # Arguments
4332 ///
4333 /// * `name` - The name of the web app in the form enterprises/{enterpriseId}/webApps/{packageName}.
4334 pub fn web_apps_delete(&self, name: &str) -> EnterpriseWebAppDeleteCall<'a, C> {
4335 EnterpriseWebAppDeleteCall {
4336 hub: self.hub,
4337 _name: name.to_string(),
4338 _delegate: Default::default(),
4339 _additional_params: Default::default(),
4340 _scopes: Default::default(),
4341 }
4342 }
4343
4344 /// Create a builder to help you perform the following task:
4345 ///
4346 /// Gets a web app.
4347 ///
4348 /// # Arguments
4349 ///
4350 /// * `name` - The name of the web app in the form enterprises/{enterpriseId}/webApps/{packageName}.
4351 pub fn web_apps_get(&self, name: &str) -> EnterpriseWebAppGetCall<'a, C> {
4352 EnterpriseWebAppGetCall {
4353 hub: self.hub,
4354 _name: name.to_string(),
4355 _delegate: Default::default(),
4356 _additional_params: Default::default(),
4357 _scopes: Default::default(),
4358 }
4359 }
4360
4361 /// Create a builder to help you perform the following task:
4362 ///
4363 /// Lists web apps for a given enterprise.
4364 ///
4365 /// # Arguments
4366 ///
4367 /// * `parent` - The name of the enterprise in the form enterprises/{enterpriseId}.
4368 pub fn web_apps_list(&self, parent: &str) -> EnterpriseWebAppListCall<'a, C> {
4369 EnterpriseWebAppListCall {
4370 hub: self.hub,
4371 _parent: parent.to_string(),
4372 _page_token: Default::default(),
4373 _page_size: Default::default(),
4374 _delegate: Default::default(),
4375 _additional_params: Default::default(),
4376 _scopes: Default::default(),
4377 }
4378 }
4379
4380 /// Create a builder to help you perform the following task:
4381 ///
4382 /// Updates a web app.
4383 ///
4384 /// # Arguments
4385 ///
4386 /// * `request` - No description provided.
4387 /// * `name` - The name of the web app in the form enterprises/{enterpriseId}/webApps/{packageName}.
4388 pub fn web_apps_patch(&self, request: WebApp, name: &str) -> EnterpriseWebAppPatchCall<'a, C> {
4389 EnterpriseWebAppPatchCall {
4390 hub: self.hub,
4391 _request: request,
4392 _name: name.to_string(),
4393 _update_mask: Default::default(),
4394 _delegate: Default::default(),
4395 _additional_params: Default::default(),
4396 _scopes: Default::default(),
4397 }
4398 }
4399
4400 /// Create a builder to help you perform the following task:
4401 ///
4402 /// Creates a web token to access an embeddable managed Google Play web UI for a given enterprise.
4403 ///
4404 /// # Arguments
4405 ///
4406 /// * `request` - No description provided.
4407 /// * `parent` - The name of the enterprise in the form enterprises/{enterpriseId}.
4408 pub fn web_tokens_create(
4409 &self,
4410 request: WebToken,
4411 parent: &str,
4412 ) -> EnterpriseWebTokenCreateCall<'a, C> {
4413 EnterpriseWebTokenCreateCall {
4414 hub: self.hub,
4415 _request: request,
4416 _parent: parent.to_string(),
4417 _delegate: Default::default(),
4418 _additional_params: Default::default(),
4419 _scopes: Default::default(),
4420 }
4421 }
4422
4423 /// Create a builder to help you perform the following task:
4424 ///
4425 /// Creates an enterprise. This is the last step in the enterprise signup flow. See also: SigninDetail
4426 ///
4427 /// # Arguments
4428 ///
4429 /// * `request` - No description provided.
4430 pub fn create(&self, request: Enterprise) -> EnterpriseCreateCall<'a, C> {
4431 EnterpriseCreateCall {
4432 hub: self.hub,
4433 _request: request,
4434 _signup_url_name: Default::default(),
4435 _project_id: Default::default(),
4436 _enterprise_token: Default::default(),
4437 _agreement_accepted: Default::default(),
4438 _delegate: Default::default(),
4439 _additional_params: Default::default(),
4440 _scopes: Default::default(),
4441 }
4442 }
4443
4444 /// Create a builder to help you perform the following task:
4445 ///
4446 /// Permanently deletes an enterprise and all accounts and data associated with it. Warning: this will result in a cascaded deletion of all AM API devices associated with the deleted enterprise. Only available for EMM-managed enterprises.
4447 ///
4448 /// # Arguments
4449 ///
4450 /// * `name` - The name of the enterprise in the form enterprises/{enterpriseId}.
4451 pub fn delete(&self, name: &str) -> EnterpriseDeleteCall<'a, C> {
4452 EnterpriseDeleteCall {
4453 hub: self.hub,
4454 _name: name.to_string(),
4455 _delegate: Default::default(),
4456 _additional_params: Default::default(),
4457 _scopes: Default::default(),
4458 }
4459 }
4460
4461 /// Create a builder to help you perform the following task:
4462 ///
4463 /// Generates an enterprise upgrade URL to upgrade an existing managed Google Play Accounts enterprise to a managed Google domain. See the guide (https://developers.google.com/android/management/upgrade-an-enterprise) for more details.
4464 ///
4465 /// # Arguments
4466 ///
4467 /// * `request` - No description provided.
4468 /// * `name` - Required. The name of the enterprise to be upgraded in the form enterprises/{enterpriseId}.
4469 pub fn generate_enterprise_upgrade_url(
4470 &self,
4471 request: GenerateEnterpriseUpgradeUrlRequest,
4472 name: &str,
4473 ) -> EnterpriseGenerateEnterpriseUpgradeUrlCall<'a, C> {
4474 EnterpriseGenerateEnterpriseUpgradeUrlCall {
4475 hub: self.hub,
4476 _request: request,
4477 _name: name.to_string(),
4478 _delegate: Default::default(),
4479 _additional_params: Default::default(),
4480 _scopes: Default::default(),
4481 }
4482 }
4483
4484 /// Create a builder to help you perform the following task:
4485 ///
4486 /// Gets an enterprise.
4487 ///
4488 /// # Arguments
4489 ///
4490 /// * `name` - The name of the enterprise in the form enterprises/{enterpriseId}.
4491 pub fn get(&self, name: &str) -> EnterpriseGetCall<'a, C> {
4492 EnterpriseGetCall {
4493 hub: self.hub,
4494 _name: name.to_string(),
4495 _delegate: Default::default(),
4496 _additional_params: Default::default(),
4497 _scopes: Default::default(),
4498 }
4499 }
4500
4501 /// Create a builder to help you perform the following task:
4502 ///
4503 /// Lists EMM-managed enterprises. Only BASIC fields are returned.
4504 pub fn list(&self) -> EnterpriseListCall<'a, C> {
4505 EnterpriseListCall {
4506 hub: self.hub,
4507 _view: Default::default(),
4508 _project_id: Default::default(),
4509 _page_token: Default::default(),
4510 _page_size: Default::default(),
4511 _delegate: Default::default(),
4512 _additional_params: Default::default(),
4513 _scopes: Default::default(),
4514 }
4515 }
4516
4517 /// Create a builder to help you perform the following task:
4518 ///
4519 /// Updates an enterprise. See also: SigninDetail
4520 ///
4521 /// # Arguments
4522 ///
4523 /// * `request` - No description provided.
4524 /// * `name` - The name of the enterprise in the form enterprises/{enterpriseId}.
4525 pub fn patch(&self, request: Enterprise, name: &str) -> EnterprisePatchCall<'a, C> {
4526 EnterprisePatchCall {
4527 hub: self.hub,
4528 _request: request,
4529 _name: name.to_string(),
4530 _update_mask: Default::default(),
4531 _delegate: Default::default(),
4532 _additional_params: Default::default(),
4533 _scopes: Default::default(),
4534 }
4535 }
4536}
4537
4538/// A builder providing access to all methods supported on *provisioningInfo* resources.
4539/// It is not used directly, but through the [`AndroidManagement`] hub.
4540///
4541/// # Example
4542///
4543/// Instantiate a resource builder
4544///
4545/// ```test_harness,no_run
4546/// extern crate hyper;
4547/// extern crate hyper_rustls;
4548/// extern crate google_androidmanagement1 as androidmanagement1;
4549///
4550/// # async fn dox() {
4551/// use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4552///
4553/// let secret: yup_oauth2::ApplicationSecret = Default::default();
4554/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
4555/// .with_native_roots()
4556/// .unwrap()
4557/// .https_only()
4558/// .enable_http2()
4559/// .build();
4560///
4561/// let executor = hyper_util::rt::TokioExecutor::new();
4562/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4563/// secret,
4564/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4565/// yup_oauth2::client::CustomHyperClientBuilder::from(
4566/// hyper_util::client::legacy::Client::builder(executor).build(connector),
4567/// ),
4568/// ).build().await.unwrap();
4569///
4570/// let client = hyper_util::client::legacy::Client::builder(
4571/// hyper_util::rt::TokioExecutor::new()
4572/// )
4573/// .build(
4574/// hyper_rustls::HttpsConnectorBuilder::new()
4575/// .with_native_roots()
4576/// .unwrap()
4577/// .https_or_http()
4578/// .enable_http2()
4579/// .build()
4580/// );
4581/// let mut hub = AndroidManagement::new(client, auth);
4582/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
4583/// // like `get(...)`
4584/// // to build up your call.
4585/// let rb = hub.provisioning_info();
4586/// # }
4587/// ```
4588pub struct ProvisioningInfoMethods<'a, C>
4589where
4590 C: 'a,
4591{
4592 hub: &'a AndroidManagement<C>,
4593}
4594
4595impl<'a, C> common::MethodsBuilder for ProvisioningInfoMethods<'a, C> {}
4596
4597impl<'a, C> ProvisioningInfoMethods<'a, C> {
4598 /// Create a builder to help you perform the following task:
4599 ///
4600 /// Get the device provisioning information by the identifier provided in the sign-in url.
4601 ///
4602 /// # Arguments
4603 ///
4604 /// * `name` - Required. The identifier that Android Device Policy passes to the 3P sign-in page in the form of provisioningInfo/{provisioning_info}.
4605 pub fn get(&self, name: &str) -> ProvisioningInfoGetCall<'a, C> {
4606 ProvisioningInfoGetCall {
4607 hub: self.hub,
4608 _name: name.to_string(),
4609 _delegate: Default::default(),
4610 _additional_params: Default::default(),
4611 _scopes: Default::default(),
4612 }
4613 }
4614}
4615
4616/// A builder providing access to all methods supported on *signupUrl* resources.
4617/// It is not used directly, but through the [`AndroidManagement`] hub.
4618///
4619/// # Example
4620///
4621/// Instantiate a resource builder
4622///
4623/// ```test_harness,no_run
4624/// extern crate hyper;
4625/// extern crate hyper_rustls;
4626/// extern crate google_androidmanagement1 as androidmanagement1;
4627///
4628/// # async fn dox() {
4629/// use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4630///
4631/// let secret: yup_oauth2::ApplicationSecret = Default::default();
4632/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
4633/// .with_native_roots()
4634/// .unwrap()
4635/// .https_only()
4636/// .enable_http2()
4637/// .build();
4638///
4639/// let executor = hyper_util::rt::TokioExecutor::new();
4640/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4641/// secret,
4642/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4643/// yup_oauth2::client::CustomHyperClientBuilder::from(
4644/// hyper_util::client::legacy::Client::builder(executor).build(connector),
4645/// ),
4646/// ).build().await.unwrap();
4647///
4648/// let client = hyper_util::client::legacy::Client::builder(
4649/// hyper_util::rt::TokioExecutor::new()
4650/// )
4651/// .build(
4652/// hyper_rustls::HttpsConnectorBuilder::new()
4653/// .with_native_roots()
4654/// .unwrap()
4655/// .https_or_http()
4656/// .enable_http2()
4657/// .build()
4658/// );
4659/// let mut hub = AndroidManagement::new(client, auth);
4660/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
4661/// // like `create(...)`
4662/// // to build up your call.
4663/// let rb = hub.signup_urls();
4664/// # }
4665/// ```
4666pub struct SignupUrlMethods<'a, C>
4667where
4668 C: 'a,
4669{
4670 hub: &'a AndroidManagement<C>,
4671}
4672
4673impl<'a, C> common::MethodsBuilder for SignupUrlMethods<'a, C> {}
4674
4675impl<'a, C> SignupUrlMethods<'a, C> {
4676 /// Create a builder to help you perform the following task:
4677 ///
4678 /// Creates an enterprise signup URL.
4679 pub fn create(&self) -> SignupUrlCreateCall<'a, C> {
4680 SignupUrlCreateCall {
4681 hub: self.hub,
4682 _project_id: Default::default(),
4683 _callback_url: Default::default(),
4684 _allowed_domains: Default::default(),
4685 _admin_email: Default::default(),
4686 _delegate: Default::default(),
4687 _additional_params: Default::default(),
4688 _scopes: Default::default(),
4689 }
4690 }
4691}
4692
4693// ###################
4694// CallBuilders ###
4695// #################
4696
4697/// Gets info about an application.
4698///
4699/// A builder for the *applications.get* method supported by a *enterprise* resource.
4700/// It is not used directly, but through a [`EnterpriseMethods`] instance.
4701///
4702/// # Example
4703///
4704/// Instantiate a resource method builder
4705///
4706/// ```test_harness,no_run
4707/// # extern crate hyper;
4708/// # extern crate hyper_rustls;
4709/// # extern crate google_androidmanagement1 as androidmanagement1;
4710/// # async fn dox() {
4711/// # use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4712///
4713/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4714/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4715/// # .with_native_roots()
4716/// # .unwrap()
4717/// # .https_only()
4718/// # .enable_http2()
4719/// # .build();
4720///
4721/// # let executor = hyper_util::rt::TokioExecutor::new();
4722/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4723/// # secret,
4724/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4725/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4726/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4727/// # ),
4728/// # ).build().await.unwrap();
4729///
4730/// # let client = hyper_util::client::legacy::Client::builder(
4731/// # hyper_util::rt::TokioExecutor::new()
4732/// # )
4733/// # .build(
4734/// # hyper_rustls::HttpsConnectorBuilder::new()
4735/// # .with_native_roots()
4736/// # .unwrap()
4737/// # .https_or_http()
4738/// # .enable_http2()
4739/// # .build()
4740/// # );
4741/// # let mut hub = AndroidManagement::new(client, auth);
4742/// // You can configure optional parameters by calling the respective setters at will, and
4743/// // execute the final call using `doit()`.
4744/// // Values shown here are possibly random and not representative !
4745/// let result = hub.enterprises().applications_get("name")
4746/// .language_code("ipsum")
4747/// .doit().await;
4748/// # }
4749/// ```
4750pub struct EnterpriseApplicationGetCall<'a, C>
4751where
4752 C: 'a,
4753{
4754 hub: &'a AndroidManagement<C>,
4755 _name: String,
4756 _language_code: Option<String>,
4757 _delegate: Option<&'a mut dyn common::Delegate>,
4758 _additional_params: HashMap<String, String>,
4759 _scopes: BTreeSet<String>,
4760}
4761
4762impl<'a, C> common::CallBuilder for EnterpriseApplicationGetCall<'a, C> {}
4763
4764impl<'a, C> EnterpriseApplicationGetCall<'a, C>
4765where
4766 C: common::Connector,
4767{
4768 /// Perform the operation you have build so far.
4769 pub async fn doit(mut self) -> common::Result<(common::Response, Application)> {
4770 use std::borrow::Cow;
4771 use std::io::{Read, Seek};
4772
4773 use common::{url::Params, ToParts};
4774 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4775
4776 let mut dd = common::DefaultDelegate;
4777 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4778 dlg.begin(common::MethodInfo {
4779 id: "androidmanagement.enterprises.applications.get",
4780 http_method: hyper::Method::GET,
4781 });
4782
4783 for &field in ["alt", "name", "languageCode"].iter() {
4784 if self._additional_params.contains_key(field) {
4785 dlg.finished(false);
4786 return Err(common::Error::FieldClash(field));
4787 }
4788 }
4789
4790 let mut params = Params::with_capacity(4 + self._additional_params.len());
4791 params.push("name", self._name);
4792 if let Some(value) = self._language_code.as_ref() {
4793 params.push("languageCode", value);
4794 }
4795
4796 params.extend(self._additional_params.iter());
4797
4798 params.push("alt", "json");
4799 let mut url = self.hub._base_url.clone() + "v1/{+name}";
4800 if self._scopes.is_empty() {
4801 self._scopes.insert(Scope::Full.as_ref().to_string());
4802 }
4803
4804 #[allow(clippy::single_element_loop)]
4805 for &(find_this, param_name) in [("{+name}", "name")].iter() {
4806 url = params.uri_replacement(url, param_name, find_this, true);
4807 }
4808 {
4809 let to_remove = ["name"];
4810 params.remove_params(&to_remove);
4811 }
4812
4813 let url = params.parse_with_url(&url);
4814
4815 loop {
4816 let token = match self
4817 .hub
4818 .auth
4819 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4820 .await
4821 {
4822 Ok(token) => token,
4823 Err(e) => match dlg.token(e) {
4824 Ok(token) => token,
4825 Err(e) => {
4826 dlg.finished(false);
4827 return Err(common::Error::MissingToken(e));
4828 }
4829 },
4830 };
4831 let mut req_result = {
4832 let client = &self.hub.client;
4833 dlg.pre_request();
4834 let mut req_builder = hyper::Request::builder()
4835 .method(hyper::Method::GET)
4836 .uri(url.as_str())
4837 .header(USER_AGENT, self.hub._user_agent.clone());
4838
4839 if let Some(token) = token.as_ref() {
4840 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4841 }
4842
4843 let request = req_builder
4844 .header(CONTENT_LENGTH, 0_u64)
4845 .body(common::to_body::<String>(None));
4846
4847 client.request(request.unwrap()).await
4848 };
4849
4850 match req_result {
4851 Err(err) => {
4852 if let common::Retry::After(d) = dlg.http_error(&err) {
4853 sleep(d).await;
4854 continue;
4855 }
4856 dlg.finished(false);
4857 return Err(common::Error::HttpError(err));
4858 }
4859 Ok(res) => {
4860 let (mut parts, body) = res.into_parts();
4861 let mut body = common::Body::new(body);
4862 if !parts.status.is_success() {
4863 let bytes = common::to_bytes(body).await.unwrap_or_default();
4864 let error = serde_json::from_str(&common::to_string(&bytes));
4865 let response = common::to_response(parts, bytes.into());
4866
4867 if let common::Retry::After(d) =
4868 dlg.http_failure(&response, error.as_ref().ok())
4869 {
4870 sleep(d).await;
4871 continue;
4872 }
4873
4874 dlg.finished(false);
4875
4876 return Err(match error {
4877 Ok(value) => common::Error::BadRequest(value),
4878 _ => common::Error::Failure(response),
4879 });
4880 }
4881 let response = {
4882 let bytes = common::to_bytes(body).await.unwrap_or_default();
4883 let encoded = common::to_string(&bytes);
4884 match serde_json::from_str(&encoded) {
4885 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4886 Err(error) => {
4887 dlg.response_json_decode_error(&encoded, &error);
4888 return Err(common::Error::JsonDecodeError(
4889 encoded.to_string(),
4890 error,
4891 ));
4892 }
4893 }
4894 };
4895
4896 dlg.finished(true);
4897 return Ok(response);
4898 }
4899 }
4900 }
4901 }
4902
4903 /// The name of the application in the form enterprises/{enterpriseId}/applications/{package_name}.
4904 ///
4905 /// Sets the *name* path property to the given value.
4906 ///
4907 /// Even though the property as already been set when instantiating this call,
4908 /// we provide this method for API completeness.
4909 pub fn name(mut self, new_value: &str) -> EnterpriseApplicationGetCall<'a, C> {
4910 self._name = new_value.to_string();
4911 self
4912 }
4913 /// The preferred language for localized application info, as a BCP47 tag (e.g. "en-US", "de"). If not specified the default language of the application will be used.
4914 ///
4915 /// Sets the *language code* query property to the given value.
4916 pub fn language_code(mut self, new_value: &str) -> EnterpriseApplicationGetCall<'a, C> {
4917 self._language_code = Some(new_value.to_string());
4918 self
4919 }
4920 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4921 /// while executing the actual API request.
4922 ///
4923 /// ````text
4924 /// It should be used to handle progress information, and to implement a certain level of resilience.
4925 /// ````
4926 ///
4927 /// Sets the *delegate* property to the given value.
4928 pub fn delegate(
4929 mut self,
4930 new_value: &'a mut dyn common::Delegate,
4931 ) -> EnterpriseApplicationGetCall<'a, C> {
4932 self._delegate = Some(new_value);
4933 self
4934 }
4935
4936 /// Set any additional parameter of the query string used in the request.
4937 /// It should be used to set parameters which are not yet available through their own
4938 /// setters.
4939 ///
4940 /// Please note that this method must not be used to set any of the known parameters
4941 /// which have their own setter method. If done anyway, the request will fail.
4942 ///
4943 /// # Additional Parameters
4944 ///
4945 /// * *$.xgafv* (query-string) - V1 error format.
4946 /// * *access_token* (query-string) - OAuth access token.
4947 /// * *alt* (query-string) - Data format for response.
4948 /// * *callback* (query-string) - JSONP
4949 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4950 /// * *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.
4951 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4952 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4953 /// * *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.
4954 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4955 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4956 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseApplicationGetCall<'a, C>
4957 where
4958 T: AsRef<str>,
4959 {
4960 self._additional_params
4961 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4962 self
4963 }
4964
4965 /// Identifies the authorization scope for the method you are building.
4966 ///
4967 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4968 /// [`Scope::Full`].
4969 ///
4970 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4971 /// tokens for more than one scope.
4972 ///
4973 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4974 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4975 /// sufficient, a read-write scope will do as well.
4976 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseApplicationGetCall<'a, C>
4977 where
4978 St: AsRef<str>,
4979 {
4980 self._scopes.insert(String::from(scope.as_ref()));
4981 self
4982 }
4983 /// Identifies the authorization scope(s) for the method you are building.
4984 ///
4985 /// See [`Self::add_scope()`] for details.
4986 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseApplicationGetCall<'a, C>
4987 where
4988 I: IntoIterator<Item = St>,
4989 St: AsRef<str>,
4990 {
4991 self._scopes
4992 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4993 self
4994 }
4995
4996 /// Removes all scopes, and no default scope will be used either.
4997 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4998 /// for details).
4999 pub fn clear_scopes(mut self) -> EnterpriseApplicationGetCall<'a, C> {
5000 self._scopes.clear();
5001 self
5002 }
5003}
5004
5005/// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to Code.CANCELLED.
5006///
5007/// A builder for the *devices.operations.cancel* method supported by a *enterprise* resource.
5008/// It is not used directly, but through a [`EnterpriseMethods`] instance.
5009///
5010/// # Example
5011///
5012/// Instantiate a resource method builder
5013///
5014/// ```test_harness,no_run
5015/// # extern crate hyper;
5016/// # extern crate hyper_rustls;
5017/// # extern crate google_androidmanagement1 as androidmanagement1;
5018/// # async fn dox() {
5019/// # use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5020///
5021/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5022/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5023/// # .with_native_roots()
5024/// # .unwrap()
5025/// # .https_only()
5026/// # .enable_http2()
5027/// # .build();
5028///
5029/// # let executor = hyper_util::rt::TokioExecutor::new();
5030/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5031/// # secret,
5032/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5033/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5034/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5035/// # ),
5036/// # ).build().await.unwrap();
5037///
5038/// # let client = hyper_util::client::legacy::Client::builder(
5039/// # hyper_util::rt::TokioExecutor::new()
5040/// # )
5041/// # .build(
5042/// # hyper_rustls::HttpsConnectorBuilder::new()
5043/// # .with_native_roots()
5044/// # .unwrap()
5045/// # .https_or_http()
5046/// # .enable_http2()
5047/// # .build()
5048/// # );
5049/// # let mut hub = AndroidManagement::new(client, auth);
5050/// // You can configure optional parameters by calling the respective setters at will, and
5051/// // execute the final call using `doit()`.
5052/// // Values shown here are possibly random and not representative !
5053/// let result = hub.enterprises().devices_operations_cancel("name")
5054/// .doit().await;
5055/// # }
5056/// ```
5057pub struct EnterpriseDeviceOperationCancelCall<'a, C>
5058where
5059 C: 'a,
5060{
5061 hub: &'a AndroidManagement<C>,
5062 _name: String,
5063 _delegate: Option<&'a mut dyn common::Delegate>,
5064 _additional_params: HashMap<String, String>,
5065 _scopes: BTreeSet<String>,
5066}
5067
5068impl<'a, C> common::CallBuilder for EnterpriseDeviceOperationCancelCall<'a, C> {}
5069
5070impl<'a, C> EnterpriseDeviceOperationCancelCall<'a, C>
5071where
5072 C: common::Connector,
5073{
5074 /// Perform the operation you have build so far.
5075 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
5076 use std::borrow::Cow;
5077 use std::io::{Read, Seek};
5078
5079 use common::{url::Params, ToParts};
5080 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5081
5082 let mut dd = common::DefaultDelegate;
5083 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5084 dlg.begin(common::MethodInfo {
5085 id: "androidmanagement.enterprises.devices.operations.cancel",
5086 http_method: hyper::Method::POST,
5087 });
5088
5089 for &field in ["alt", "name"].iter() {
5090 if self._additional_params.contains_key(field) {
5091 dlg.finished(false);
5092 return Err(common::Error::FieldClash(field));
5093 }
5094 }
5095
5096 let mut params = Params::with_capacity(3 + self._additional_params.len());
5097 params.push("name", self._name);
5098
5099 params.extend(self._additional_params.iter());
5100
5101 params.push("alt", "json");
5102 let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
5103 if self._scopes.is_empty() {
5104 self._scopes.insert(Scope::Full.as_ref().to_string());
5105 }
5106
5107 #[allow(clippy::single_element_loop)]
5108 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5109 url = params.uri_replacement(url, param_name, find_this, true);
5110 }
5111 {
5112 let to_remove = ["name"];
5113 params.remove_params(&to_remove);
5114 }
5115
5116 let url = params.parse_with_url(&url);
5117
5118 loop {
5119 let token = match self
5120 .hub
5121 .auth
5122 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5123 .await
5124 {
5125 Ok(token) => token,
5126 Err(e) => match dlg.token(e) {
5127 Ok(token) => token,
5128 Err(e) => {
5129 dlg.finished(false);
5130 return Err(common::Error::MissingToken(e));
5131 }
5132 },
5133 };
5134 let mut req_result = {
5135 let client = &self.hub.client;
5136 dlg.pre_request();
5137 let mut req_builder = hyper::Request::builder()
5138 .method(hyper::Method::POST)
5139 .uri(url.as_str())
5140 .header(USER_AGENT, self.hub._user_agent.clone());
5141
5142 if let Some(token) = token.as_ref() {
5143 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5144 }
5145
5146 let request = req_builder
5147 .header(CONTENT_LENGTH, 0_u64)
5148 .body(common::to_body::<String>(None));
5149
5150 client.request(request.unwrap()).await
5151 };
5152
5153 match req_result {
5154 Err(err) => {
5155 if let common::Retry::After(d) = dlg.http_error(&err) {
5156 sleep(d).await;
5157 continue;
5158 }
5159 dlg.finished(false);
5160 return Err(common::Error::HttpError(err));
5161 }
5162 Ok(res) => {
5163 let (mut parts, body) = res.into_parts();
5164 let mut body = common::Body::new(body);
5165 if !parts.status.is_success() {
5166 let bytes = common::to_bytes(body).await.unwrap_or_default();
5167 let error = serde_json::from_str(&common::to_string(&bytes));
5168 let response = common::to_response(parts, bytes.into());
5169
5170 if let common::Retry::After(d) =
5171 dlg.http_failure(&response, error.as_ref().ok())
5172 {
5173 sleep(d).await;
5174 continue;
5175 }
5176
5177 dlg.finished(false);
5178
5179 return Err(match error {
5180 Ok(value) => common::Error::BadRequest(value),
5181 _ => common::Error::Failure(response),
5182 });
5183 }
5184 let response = {
5185 let bytes = common::to_bytes(body).await.unwrap_or_default();
5186 let encoded = common::to_string(&bytes);
5187 match serde_json::from_str(&encoded) {
5188 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5189 Err(error) => {
5190 dlg.response_json_decode_error(&encoded, &error);
5191 return Err(common::Error::JsonDecodeError(
5192 encoded.to_string(),
5193 error,
5194 ));
5195 }
5196 }
5197 };
5198
5199 dlg.finished(true);
5200 return Ok(response);
5201 }
5202 }
5203 }
5204 }
5205
5206 /// The name of the operation resource to be cancelled.
5207 ///
5208 /// Sets the *name* path property to the given value.
5209 ///
5210 /// Even though the property as already been set when instantiating this call,
5211 /// we provide this method for API completeness.
5212 pub fn name(mut self, new_value: &str) -> EnterpriseDeviceOperationCancelCall<'a, C> {
5213 self._name = new_value.to_string();
5214 self
5215 }
5216 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5217 /// while executing the actual API request.
5218 ///
5219 /// ````text
5220 /// It should be used to handle progress information, and to implement a certain level of resilience.
5221 /// ````
5222 ///
5223 /// Sets the *delegate* property to the given value.
5224 pub fn delegate(
5225 mut self,
5226 new_value: &'a mut dyn common::Delegate,
5227 ) -> EnterpriseDeviceOperationCancelCall<'a, C> {
5228 self._delegate = Some(new_value);
5229 self
5230 }
5231
5232 /// Set any additional parameter of the query string used in the request.
5233 /// It should be used to set parameters which are not yet available through their own
5234 /// setters.
5235 ///
5236 /// Please note that this method must not be used to set any of the known parameters
5237 /// which have their own setter method. If done anyway, the request will fail.
5238 ///
5239 /// # Additional Parameters
5240 ///
5241 /// * *$.xgafv* (query-string) - V1 error format.
5242 /// * *access_token* (query-string) - OAuth access token.
5243 /// * *alt* (query-string) - Data format for response.
5244 /// * *callback* (query-string) - JSONP
5245 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5246 /// * *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.
5247 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5248 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5249 /// * *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.
5250 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5251 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5252 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseDeviceOperationCancelCall<'a, C>
5253 where
5254 T: AsRef<str>,
5255 {
5256 self._additional_params
5257 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5258 self
5259 }
5260
5261 /// Identifies the authorization scope for the method you are building.
5262 ///
5263 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5264 /// [`Scope::Full`].
5265 ///
5266 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5267 /// tokens for more than one scope.
5268 ///
5269 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5270 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5271 /// sufficient, a read-write scope will do as well.
5272 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseDeviceOperationCancelCall<'a, C>
5273 where
5274 St: AsRef<str>,
5275 {
5276 self._scopes.insert(String::from(scope.as_ref()));
5277 self
5278 }
5279 /// Identifies the authorization scope(s) for the method you are building.
5280 ///
5281 /// See [`Self::add_scope()`] for details.
5282 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseDeviceOperationCancelCall<'a, C>
5283 where
5284 I: IntoIterator<Item = St>,
5285 St: AsRef<str>,
5286 {
5287 self._scopes
5288 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5289 self
5290 }
5291
5292 /// Removes all scopes, and no default scope will be used either.
5293 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5294 /// for details).
5295 pub fn clear_scopes(mut self) -> EnterpriseDeviceOperationCancelCall<'a, C> {
5296 self._scopes.clear();
5297 self
5298 }
5299}
5300
5301/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
5302///
5303/// A builder for the *devices.operations.get* method supported by a *enterprise* resource.
5304/// It is not used directly, but through a [`EnterpriseMethods`] instance.
5305///
5306/// # Example
5307///
5308/// Instantiate a resource method builder
5309///
5310/// ```test_harness,no_run
5311/// # extern crate hyper;
5312/// # extern crate hyper_rustls;
5313/// # extern crate google_androidmanagement1 as androidmanagement1;
5314/// # async fn dox() {
5315/// # use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5316///
5317/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5318/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5319/// # .with_native_roots()
5320/// # .unwrap()
5321/// # .https_only()
5322/// # .enable_http2()
5323/// # .build();
5324///
5325/// # let executor = hyper_util::rt::TokioExecutor::new();
5326/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5327/// # secret,
5328/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5329/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5330/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5331/// # ),
5332/// # ).build().await.unwrap();
5333///
5334/// # let client = hyper_util::client::legacy::Client::builder(
5335/// # hyper_util::rt::TokioExecutor::new()
5336/// # )
5337/// # .build(
5338/// # hyper_rustls::HttpsConnectorBuilder::new()
5339/// # .with_native_roots()
5340/// # .unwrap()
5341/// # .https_or_http()
5342/// # .enable_http2()
5343/// # .build()
5344/// # );
5345/// # let mut hub = AndroidManagement::new(client, auth);
5346/// // You can configure optional parameters by calling the respective setters at will, and
5347/// // execute the final call using `doit()`.
5348/// // Values shown here are possibly random and not representative !
5349/// let result = hub.enterprises().devices_operations_get("name")
5350/// .doit().await;
5351/// # }
5352/// ```
5353pub struct EnterpriseDeviceOperationGetCall<'a, C>
5354where
5355 C: 'a,
5356{
5357 hub: &'a AndroidManagement<C>,
5358 _name: String,
5359 _delegate: Option<&'a mut dyn common::Delegate>,
5360 _additional_params: HashMap<String, String>,
5361 _scopes: BTreeSet<String>,
5362}
5363
5364impl<'a, C> common::CallBuilder for EnterpriseDeviceOperationGetCall<'a, C> {}
5365
5366impl<'a, C> EnterpriseDeviceOperationGetCall<'a, C>
5367where
5368 C: common::Connector,
5369{
5370 /// Perform the operation you have build so far.
5371 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5372 use std::borrow::Cow;
5373 use std::io::{Read, Seek};
5374
5375 use common::{url::Params, ToParts};
5376 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5377
5378 let mut dd = common::DefaultDelegate;
5379 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5380 dlg.begin(common::MethodInfo {
5381 id: "androidmanagement.enterprises.devices.operations.get",
5382 http_method: hyper::Method::GET,
5383 });
5384
5385 for &field in ["alt", "name"].iter() {
5386 if self._additional_params.contains_key(field) {
5387 dlg.finished(false);
5388 return Err(common::Error::FieldClash(field));
5389 }
5390 }
5391
5392 let mut params = Params::with_capacity(3 + self._additional_params.len());
5393 params.push("name", self._name);
5394
5395 params.extend(self._additional_params.iter());
5396
5397 params.push("alt", "json");
5398 let mut url = self.hub._base_url.clone() + "v1/{+name}";
5399 if self._scopes.is_empty() {
5400 self._scopes.insert(Scope::Full.as_ref().to_string());
5401 }
5402
5403 #[allow(clippy::single_element_loop)]
5404 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5405 url = params.uri_replacement(url, param_name, find_this, true);
5406 }
5407 {
5408 let to_remove = ["name"];
5409 params.remove_params(&to_remove);
5410 }
5411
5412 let url = params.parse_with_url(&url);
5413
5414 loop {
5415 let token = match self
5416 .hub
5417 .auth
5418 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5419 .await
5420 {
5421 Ok(token) => token,
5422 Err(e) => match dlg.token(e) {
5423 Ok(token) => token,
5424 Err(e) => {
5425 dlg.finished(false);
5426 return Err(common::Error::MissingToken(e));
5427 }
5428 },
5429 };
5430 let mut req_result = {
5431 let client = &self.hub.client;
5432 dlg.pre_request();
5433 let mut req_builder = hyper::Request::builder()
5434 .method(hyper::Method::GET)
5435 .uri(url.as_str())
5436 .header(USER_AGENT, self.hub._user_agent.clone());
5437
5438 if let Some(token) = token.as_ref() {
5439 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5440 }
5441
5442 let request = req_builder
5443 .header(CONTENT_LENGTH, 0_u64)
5444 .body(common::to_body::<String>(None));
5445
5446 client.request(request.unwrap()).await
5447 };
5448
5449 match req_result {
5450 Err(err) => {
5451 if let common::Retry::After(d) = dlg.http_error(&err) {
5452 sleep(d).await;
5453 continue;
5454 }
5455 dlg.finished(false);
5456 return Err(common::Error::HttpError(err));
5457 }
5458 Ok(res) => {
5459 let (mut parts, body) = res.into_parts();
5460 let mut body = common::Body::new(body);
5461 if !parts.status.is_success() {
5462 let bytes = common::to_bytes(body).await.unwrap_or_default();
5463 let error = serde_json::from_str(&common::to_string(&bytes));
5464 let response = common::to_response(parts, bytes.into());
5465
5466 if let common::Retry::After(d) =
5467 dlg.http_failure(&response, error.as_ref().ok())
5468 {
5469 sleep(d).await;
5470 continue;
5471 }
5472
5473 dlg.finished(false);
5474
5475 return Err(match error {
5476 Ok(value) => common::Error::BadRequest(value),
5477 _ => common::Error::Failure(response),
5478 });
5479 }
5480 let response = {
5481 let bytes = common::to_bytes(body).await.unwrap_or_default();
5482 let encoded = common::to_string(&bytes);
5483 match serde_json::from_str(&encoded) {
5484 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5485 Err(error) => {
5486 dlg.response_json_decode_error(&encoded, &error);
5487 return Err(common::Error::JsonDecodeError(
5488 encoded.to_string(),
5489 error,
5490 ));
5491 }
5492 }
5493 };
5494
5495 dlg.finished(true);
5496 return Ok(response);
5497 }
5498 }
5499 }
5500 }
5501
5502 /// The name of the operation resource.
5503 ///
5504 /// Sets the *name* path property to the given value.
5505 ///
5506 /// Even though the property as already been set when instantiating this call,
5507 /// we provide this method for API completeness.
5508 pub fn name(mut self, new_value: &str) -> EnterpriseDeviceOperationGetCall<'a, C> {
5509 self._name = new_value.to_string();
5510 self
5511 }
5512 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5513 /// while executing the actual API request.
5514 ///
5515 /// ````text
5516 /// It should be used to handle progress information, and to implement a certain level of resilience.
5517 /// ````
5518 ///
5519 /// Sets the *delegate* property to the given value.
5520 pub fn delegate(
5521 mut self,
5522 new_value: &'a mut dyn common::Delegate,
5523 ) -> EnterpriseDeviceOperationGetCall<'a, C> {
5524 self._delegate = Some(new_value);
5525 self
5526 }
5527
5528 /// Set any additional parameter of the query string used in the request.
5529 /// It should be used to set parameters which are not yet available through their own
5530 /// setters.
5531 ///
5532 /// Please note that this method must not be used to set any of the known parameters
5533 /// which have their own setter method. If done anyway, the request will fail.
5534 ///
5535 /// # Additional Parameters
5536 ///
5537 /// * *$.xgafv* (query-string) - V1 error format.
5538 /// * *access_token* (query-string) - OAuth access token.
5539 /// * *alt* (query-string) - Data format for response.
5540 /// * *callback* (query-string) - JSONP
5541 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5542 /// * *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.
5543 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5544 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5545 /// * *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.
5546 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5547 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5548 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseDeviceOperationGetCall<'a, C>
5549 where
5550 T: AsRef<str>,
5551 {
5552 self._additional_params
5553 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5554 self
5555 }
5556
5557 /// Identifies the authorization scope for the method you are building.
5558 ///
5559 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5560 /// [`Scope::Full`].
5561 ///
5562 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5563 /// tokens for more than one scope.
5564 ///
5565 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5566 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5567 /// sufficient, a read-write scope will do as well.
5568 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseDeviceOperationGetCall<'a, C>
5569 where
5570 St: AsRef<str>,
5571 {
5572 self._scopes.insert(String::from(scope.as_ref()));
5573 self
5574 }
5575 /// Identifies the authorization scope(s) for the method you are building.
5576 ///
5577 /// See [`Self::add_scope()`] for details.
5578 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseDeviceOperationGetCall<'a, C>
5579 where
5580 I: IntoIterator<Item = St>,
5581 St: AsRef<str>,
5582 {
5583 self._scopes
5584 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5585 self
5586 }
5587
5588 /// Removes all scopes, and no default scope will be used either.
5589 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5590 /// for details).
5591 pub fn clear_scopes(mut self) -> EnterpriseDeviceOperationGetCall<'a, C> {
5592 self._scopes.clear();
5593 self
5594 }
5595}
5596
5597/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED.
5598///
5599/// A builder for the *devices.operations.list* method supported by a *enterprise* resource.
5600/// It is not used directly, but through a [`EnterpriseMethods`] instance.
5601///
5602/// # Example
5603///
5604/// Instantiate a resource method builder
5605///
5606/// ```test_harness,no_run
5607/// # extern crate hyper;
5608/// # extern crate hyper_rustls;
5609/// # extern crate google_androidmanagement1 as androidmanagement1;
5610/// # async fn dox() {
5611/// # use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5612///
5613/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5614/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5615/// # .with_native_roots()
5616/// # .unwrap()
5617/// # .https_only()
5618/// # .enable_http2()
5619/// # .build();
5620///
5621/// # let executor = hyper_util::rt::TokioExecutor::new();
5622/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5623/// # secret,
5624/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5625/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5626/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5627/// # ),
5628/// # ).build().await.unwrap();
5629///
5630/// # let client = hyper_util::client::legacy::Client::builder(
5631/// # hyper_util::rt::TokioExecutor::new()
5632/// # )
5633/// # .build(
5634/// # hyper_rustls::HttpsConnectorBuilder::new()
5635/// # .with_native_roots()
5636/// # .unwrap()
5637/// # .https_or_http()
5638/// # .enable_http2()
5639/// # .build()
5640/// # );
5641/// # let mut hub = AndroidManagement::new(client, auth);
5642/// // You can configure optional parameters by calling the respective setters at will, and
5643/// // execute the final call using `doit()`.
5644/// // Values shown here are possibly random and not representative !
5645/// let result = hub.enterprises().devices_operations_list("name")
5646/// .return_partial_success(true)
5647/// .page_token("sed")
5648/// .page_size(-37)
5649/// .filter("gubergren")
5650/// .doit().await;
5651/// # }
5652/// ```
5653pub struct EnterpriseDeviceOperationListCall<'a, C>
5654where
5655 C: 'a,
5656{
5657 hub: &'a AndroidManagement<C>,
5658 _name: String,
5659 _return_partial_success: Option<bool>,
5660 _page_token: Option<String>,
5661 _page_size: Option<i32>,
5662 _filter: Option<String>,
5663 _delegate: Option<&'a mut dyn common::Delegate>,
5664 _additional_params: HashMap<String, String>,
5665 _scopes: BTreeSet<String>,
5666}
5667
5668impl<'a, C> common::CallBuilder for EnterpriseDeviceOperationListCall<'a, C> {}
5669
5670impl<'a, C> EnterpriseDeviceOperationListCall<'a, C>
5671where
5672 C: common::Connector,
5673{
5674 /// Perform the operation you have build so far.
5675 pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
5676 use std::borrow::Cow;
5677 use std::io::{Read, Seek};
5678
5679 use common::{url::Params, ToParts};
5680 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5681
5682 let mut dd = common::DefaultDelegate;
5683 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5684 dlg.begin(common::MethodInfo {
5685 id: "androidmanagement.enterprises.devices.operations.list",
5686 http_method: hyper::Method::GET,
5687 });
5688
5689 for &field in [
5690 "alt",
5691 "name",
5692 "returnPartialSuccess",
5693 "pageToken",
5694 "pageSize",
5695 "filter",
5696 ]
5697 .iter()
5698 {
5699 if self._additional_params.contains_key(field) {
5700 dlg.finished(false);
5701 return Err(common::Error::FieldClash(field));
5702 }
5703 }
5704
5705 let mut params = Params::with_capacity(7 + self._additional_params.len());
5706 params.push("name", self._name);
5707 if let Some(value) = self._return_partial_success.as_ref() {
5708 params.push("returnPartialSuccess", value.to_string());
5709 }
5710 if let Some(value) = self._page_token.as_ref() {
5711 params.push("pageToken", value);
5712 }
5713 if let Some(value) = self._page_size.as_ref() {
5714 params.push("pageSize", value.to_string());
5715 }
5716 if let Some(value) = self._filter.as_ref() {
5717 params.push("filter", value);
5718 }
5719
5720 params.extend(self._additional_params.iter());
5721
5722 params.push("alt", "json");
5723 let mut url = self.hub._base_url.clone() + "v1/{+name}";
5724 if self._scopes.is_empty() {
5725 self._scopes.insert(Scope::Full.as_ref().to_string());
5726 }
5727
5728 #[allow(clippy::single_element_loop)]
5729 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5730 url = params.uri_replacement(url, param_name, find_this, true);
5731 }
5732 {
5733 let to_remove = ["name"];
5734 params.remove_params(&to_remove);
5735 }
5736
5737 let url = params.parse_with_url(&url);
5738
5739 loop {
5740 let token = match self
5741 .hub
5742 .auth
5743 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5744 .await
5745 {
5746 Ok(token) => token,
5747 Err(e) => match dlg.token(e) {
5748 Ok(token) => token,
5749 Err(e) => {
5750 dlg.finished(false);
5751 return Err(common::Error::MissingToken(e));
5752 }
5753 },
5754 };
5755 let mut req_result = {
5756 let client = &self.hub.client;
5757 dlg.pre_request();
5758 let mut req_builder = hyper::Request::builder()
5759 .method(hyper::Method::GET)
5760 .uri(url.as_str())
5761 .header(USER_AGENT, self.hub._user_agent.clone());
5762
5763 if let Some(token) = token.as_ref() {
5764 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5765 }
5766
5767 let request = req_builder
5768 .header(CONTENT_LENGTH, 0_u64)
5769 .body(common::to_body::<String>(None));
5770
5771 client.request(request.unwrap()).await
5772 };
5773
5774 match req_result {
5775 Err(err) => {
5776 if let common::Retry::After(d) = dlg.http_error(&err) {
5777 sleep(d).await;
5778 continue;
5779 }
5780 dlg.finished(false);
5781 return Err(common::Error::HttpError(err));
5782 }
5783 Ok(res) => {
5784 let (mut parts, body) = res.into_parts();
5785 let mut body = common::Body::new(body);
5786 if !parts.status.is_success() {
5787 let bytes = common::to_bytes(body).await.unwrap_or_default();
5788 let error = serde_json::from_str(&common::to_string(&bytes));
5789 let response = common::to_response(parts, bytes.into());
5790
5791 if let common::Retry::After(d) =
5792 dlg.http_failure(&response, error.as_ref().ok())
5793 {
5794 sleep(d).await;
5795 continue;
5796 }
5797
5798 dlg.finished(false);
5799
5800 return Err(match error {
5801 Ok(value) => common::Error::BadRequest(value),
5802 _ => common::Error::Failure(response),
5803 });
5804 }
5805 let response = {
5806 let bytes = common::to_bytes(body).await.unwrap_or_default();
5807 let encoded = common::to_string(&bytes);
5808 match serde_json::from_str(&encoded) {
5809 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5810 Err(error) => {
5811 dlg.response_json_decode_error(&encoded, &error);
5812 return Err(common::Error::JsonDecodeError(
5813 encoded.to_string(),
5814 error,
5815 ));
5816 }
5817 }
5818 };
5819
5820 dlg.finished(true);
5821 return Ok(response);
5822 }
5823 }
5824 }
5825 }
5826
5827 /// The name of the operation's parent resource.
5828 ///
5829 /// Sets the *name* path property to the given value.
5830 ///
5831 /// Even though the property as already been set when instantiating this call,
5832 /// we provide this method for API completeness.
5833 pub fn name(mut self, new_value: &str) -> EnterpriseDeviceOperationListCall<'a, C> {
5834 self._name = new_value.to_string();
5835 self
5836 }
5837 /// When set to true, operations that are reachable are returned as normal, and those that are unreachable are returned in the ListOperationsResponse.unreachable field.This can only be true when reading across collections. For example, when parent is set to "projects/example/locations/-".This field is not supported by default and will result in an UNIMPLEMENTED error if set unless explicitly documented otherwise in service or product specific documentation.
5838 ///
5839 /// Sets the *return partial success* query property to the given value.
5840 pub fn return_partial_success(
5841 mut self,
5842 new_value: bool,
5843 ) -> EnterpriseDeviceOperationListCall<'a, C> {
5844 self._return_partial_success = Some(new_value);
5845 self
5846 }
5847 /// The standard list page token.
5848 ///
5849 /// Sets the *page token* query property to the given value.
5850 pub fn page_token(mut self, new_value: &str) -> EnterpriseDeviceOperationListCall<'a, C> {
5851 self._page_token = Some(new_value.to_string());
5852 self
5853 }
5854 /// The standard list page size.
5855 ///
5856 /// Sets the *page size* query property to the given value.
5857 pub fn page_size(mut self, new_value: i32) -> EnterpriseDeviceOperationListCall<'a, C> {
5858 self._page_size = Some(new_value);
5859 self
5860 }
5861 /// The standard list filter.
5862 ///
5863 /// Sets the *filter* query property to the given value.
5864 pub fn filter(mut self, new_value: &str) -> EnterpriseDeviceOperationListCall<'a, C> {
5865 self._filter = Some(new_value.to_string());
5866 self
5867 }
5868 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5869 /// while executing the actual API request.
5870 ///
5871 /// ````text
5872 /// It should be used to handle progress information, and to implement a certain level of resilience.
5873 /// ````
5874 ///
5875 /// Sets the *delegate* property to the given value.
5876 pub fn delegate(
5877 mut self,
5878 new_value: &'a mut dyn common::Delegate,
5879 ) -> EnterpriseDeviceOperationListCall<'a, C> {
5880 self._delegate = Some(new_value);
5881 self
5882 }
5883
5884 /// Set any additional parameter of the query string used in the request.
5885 /// It should be used to set parameters which are not yet available through their own
5886 /// setters.
5887 ///
5888 /// Please note that this method must not be used to set any of the known parameters
5889 /// which have their own setter method. If done anyway, the request will fail.
5890 ///
5891 /// # Additional Parameters
5892 ///
5893 /// * *$.xgafv* (query-string) - V1 error format.
5894 /// * *access_token* (query-string) - OAuth access token.
5895 /// * *alt* (query-string) - Data format for response.
5896 /// * *callback* (query-string) - JSONP
5897 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5898 /// * *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.
5899 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5900 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5901 /// * *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.
5902 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5903 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5904 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseDeviceOperationListCall<'a, C>
5905 where
5906 T: AsRef<str>,
5907 {
5908 self._additional_params
5909 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5910 self
5911 }
5912
5913 /// Identifies the authorization scope for the method you are building.
5914 ///
5915 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5916 /// [`Scope::Full`].
5917 ///
5918 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5919 /// tokens for more than one scope.
5920 ///
5921 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5922 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5923 /// sufficient, a read-write scope will do as well.
5924 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseDeviceOperationListCall<'a, C>
5925 where
5926 St: AsRef<str>,
5927 {
5928 self._scopes.insert(String::from(scope.as_ref()));
5929 self
5930 }
5931 /// Identifies the authorization scope(s) for the method you are building.
5932 ///
5933 /// See [`Self::add_scope()`] for details.
5934 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseDeviceOperationListCall<'a, C>
5935 where
5936 I: IntoIterator<Item = St>,
5937 St: AsRef<str>,
5938 {
5939 self._scopes
5940 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5941 self
5942 }
5943
5944 /// Removes all scopes, and no default scope will be used either.
5945 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5946 /// for details).
5947 pub fn clear_scopes(mut self) -> EnterpriseDeviceOperationListCall<'a, C> {
5948 self._scopes.clear();
5949 self
5950 }
5951}
5952
5953/// Deletes a device. This operation attempts to wipe the device but this is not guaranteed to succeed if the device is offline for an extended period. Deleted devices do not show up in enterprises.devices.list calls and a 404 is returned from enterprises.devices.get.
5954///
5955/// A builder for the *devices.delete* method supported by a *enterprise* resource.
5956/// It is not used directly, but through a [`EnterpriseMethods`] instance.
5957///
5958/// # Example
5959///
5960/// Instantiate a resource method builder
5961///
5962/// ```test_harness,no_run
5963/// # extern crate hyper;
5964/// # extern crate hyper_rustls;
5965/// # extern crate google_androidmanagement1 as androidmanagement1;
5966/// # async fn dox() {
5967/// # use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5968///
5969/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5970/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5971/// # .with_native_roots()
5972/// # .unwrap()
5973/// # .https_only()
5974/// # .enable_http2()
5975/// # .build();
5976///
5977/// # let executor = hyper_util::rt::TokioExecutor::new();
5978/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5979/// # secret,
5980/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5981/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5982/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5983/// # ),
5984/// # ).build().await.unwrap();
5985///
5986/// # let client = hyper_util::client::legacy::Client::builder(
5987/// # hyper_util::rt::TokioExecutor::new()
5988/// # )
5989/// # .build(
5990/// # hyper_rustls::HttpsConnectorBuilder::new()
5991/// # .with_native_roots()
5992/// # .unwrap()
5993/// # .https_or_http()
5994/// # .enable_http2()
5995/// # .build()
5996/// # );
5997/// # let mut hub = AndroidManagement::new(client, auth);
5998/// // You can configure optional parameters by calling the respective setters at will, and
5999/// // execute the final call using `doit()`.
6000/// // Values shown here are possibly random and not representative !
6001/// let result = hub.enterprises().devices_delete("name")
6002/// .wipe_reason_message("est")
6003/// .add_wipe_data_flags("ipsum")
6004/// .doit().await;
6005/// # }
6006/// ```
6007pub struct EnterpriseDeviceDeleteCall<'a, C>
6008where
6009 C: 'a,
6010{
6011 hub: &'a AndroidManagement<C>,
6012 _name: String,
6013 _wipe_reason_message: Option<String>,
6014 _wipe_data_flags: Vec<String>,
6015 _delegate: Option<&'a mut dyn common::Delegate>,
6016 _additional_params: HashMap<String, String>,
6017 _scopes: BTreeSet<String>,
6018}
6019
6020impl<'a, C> common::CallBuilder for EnterpriseDeviceDeleteCall<'a, C> {}
6021
6022impl<'a, C> EnterpriseDeviceDeleteCall<'a, C>
6023where
6024 C: common::Connector,
6025{
6026 /// Perform the operation you have build so far.
6027 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
6028 use std::borrow::Cow;
6029 use std::io::{Read, Seek};
6030
6031 use common::{url::Params, ToParts};
6032 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6033
6034 let mut dd = common::DefaultDelegate;
6035 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6036 dlg.begin(common::MethodInfo {
6037 id: "androidmanagement.enterprises.devices.delete",
6038 http_method: hyper::Method::DELETE,
6039 });
6040
6041 for &field in ["alt", "name", "wipeReasonMessage", "wipeDataFlags"].iter() {
6042 if self._additional_params.contains_key(field) {
6043 dlg.finished(false);
6044 return Err(common::Error::FieldClash(field));
6045 }
6046 }
6047
6048 let mut params = Params::with_capacity(5 + self._additional_params.len());
6049 params.push("name", self._name);
6050 if let Some(value) = self._wipe_reason_message.as_ref() {
6051 params.push("wipeReasonMessage", value);
6052 }
6053 if !self._wipe_data_flags.is_empty() {
6054 for f in self._wipe_data_flags.iter() {
6055 params.push("wipeDataFlags", f);
6056 }
6057 }
6058
6059 params.extend(self._additional_params.iter());
6060
6061 params.push("alt", "json");
6062 let mut url = self.hub._base_url.clone() + "v1/{+name}";
6063 if self._scopes.is_empty() {
6064 self._scopes.insert(Scope::Full.as_ref().to_string());
6065 }
6066
6067 #[allow(clippy::single_element_loop)]
6068 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6069 url = params.uri_replacement(url, param_name, find_this, true);
6070 }
6071 {
6072 let to_remove = ["name"];
6073 params.remove_params(&to_remove);
6074 }
6075
6076 let url = params.parse_with_url(&url);
6077
6078 loop {
6079 let token = match self
6080 .hub
6081 .auth
6082 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6083 .await
6084 {
6085 Ok(token) => token,
6086 Err(e) => match dlg.token(e) {
6087 Ok(token) => token,
6088 Err(e) => {
6089 dlg.finished(false);
6090 return Err(common::Error::MissingToken(e));
6091 }
6092 },
6093 };
6094 let mut req_result = {
6095 let client = &self.hub.client;
6096 dlg.pre_request();
6097 let mut req_builder = hyper::Request::builder()
6098 .method(hyper::Method::DELETE)
6099 .uri(url.as_str())
6100 .header(USER_AGENT, self.hub._user_agent.clone());
6101
6102 if let Some(token) = token.as_ref() {
6103 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6104 }
6105
6106 let request = req_builder
6107 .header(CONTENT_LENGTH, 0_u64)
6108 .body(common::to_body::<String>(None));
6109
6110 client.request(request.unwrap()).await
6111 };
6112
6113 match req_result {
6114 Err(err) => {
6115 if let common::Retry::After(d) = dlg.http_error(&err) {
6116 sleep(d).await;
6117 continue;
6118 }
6119 dlg.finished(false);
6120 return Err(common::Error::HttpError(err));
6121 }
6122 Ok(res) => {
6123 let (mut parts, body) = res.into_parts();
6124 let mut body = common::Body::new(body);
6125 if !parts.status.is_success() {
6126 let bytes = common::to_bytes(body).await.unwrap_or_default();
6127 let error = serde_json::from_str(&common::to_string(&bytes));
6128 let response = common::to_response(parts, bytes.into());
6129
6130 if let common::Retry::After(d) =
6131 dlg.http_failure(&response, error.as_ref().ok())
6132 {
6133 sleep(d).await;
6134 continue;
6135 }
6136
6137 dlg.finished(false);
6138
6139 return Err(match error {
6140 Ok(value) => common::Error::BadRequest(value),
6141 _ => common::Error::Failure(response),
6142 });
6143 }
6144 let response = {
6145 let bytes = common::to_bytes(body).await.unwrap_or_default();
6146 let encoded = common::to_string(&bytes);
6147 match serde_json::from_str(&encoded) {
6148 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6149 Err(error) => {
6150 dlg.response_json_decode_error(&encoded, &error);
6151 return Err(common::Error::JsonDecodeError(
6152 encoded.to_string(),
6153 error,
6154 ));
6155 }
6156 }
6157 };
6158
6159 dlg.finished(true);
6160 return Ok(response);
6161 }
6162 }
6163 }
6164 }
6165
6166 /// The name of the device in the form enterprises/{enterpriseId}/devices/{deviceId}.
6167 ///
6168 /// Sets the *name* path property to the given value.
6169 ///
6170 /// Even though the property as already been set when instantiating this call,
6171 /// we provide this method for API completeness.
6172 pub fn name(mut self, new_value: &str) -> EnterpriseDeviceDeleteCall<'a, C> {
6173 self._name = new_value.to_string();
6174 self
6175 }
6176 /// Optional. A short message displayed to the user before wiping the work profile on personal devices. This has no effect on company owned devices. The maximum message length is 200 characters.
6177 ///
6178 /// Sets the *wipe reason message* query property to the given value.
6179 pub fn wipe_reason_message(mut self, new_value: &str) -> EnterpriseDeviceDeleteCall<'a, C> {
6180 self._wipe_reason_message = Some(new_value.to_string());
6181 self
6182 }
6183 /// Optional flags that control the device wiping behavior.
6184 ///
6185 /// Append the given value to the *wipe data flags* query property.
6186 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
6187 pub fn add_wipe_data_flags(mut self, new_value: &str) -> EnterpriseDeviceDeleteCall<'a, C> {
6188 self._wipe_data_flags.push(new_value.to_string());
6189 self
6190 }
6191 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6192 /// while executing the actual API request.
6193 ///
6194 /// ````text
6195 /// It should be used to handle progress information, and to implement a certain level of resilience.
6196 /// ````
6197 ///
6198 /// Sets the *delegate* property to the given value.
6199 pub fn delegate(
6200 mut self,
6201 new_value: &'a mut dyn common::Delegate,
6202 ) -> EnterpriseDeviceDeleteCall<'a, C> {
6203 self._delegate = Some(new_value);
6204 self
6205 }
6206
6207 /// Set any additional parameter of the query string used in the request.
6208 /// It should be used to set parameters which are not yet available through their own
6209 /// setters.
6210 ///
6211 /// Please note that this method must not be used to set any of the known parameters
6212 /// which have their own setter method. If done anyway, the request will fail.
6213 ///
6214 /// # Additional Parameters
6215 ///
6216 /// * *$.xgafv* (query-string) - V1 error format.
6217 /// * *access_token* (query-string) - OAuth access token.
6218 /// * *alt* (query-string) - Data format for response.
6219 /// * *callback* (query-string) - JSONP
6220 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6221 /// * *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.
6222 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6223 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6224 /// * *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.
6225 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6226 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6227 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseDeviceDeleteCall<'a, C>
6228 where
6229 T: AsRef<str>,
6230 {
6231 self._additional_params
6232 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6233 self
6234 }
6235
6236 /// Identifies the authorization scope for the method you are building.
6237 ///
6238 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6239 /// [`Scope::Full`].
6240 ///
6241 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6242 /// tokens for more than one scope.
6243 ///
6244 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6245 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6246 /// sufficient, a read-write scope will do as well.
6247 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseDeviceDeleteCall<'a, C>
6248 where
6249 St: AsRef<str>,
6250 {
6251 self._scopes.insert(String::from(scope.as_ref()));
6252 self
6253 }
6254 /// Identifies the authorization scope(s) for the method you are building.
6255 ///
6256 /// See [`Self::add_scope()`] for details.
6257 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseDeviceDeleteCall<'a, C>
6258 where
6259 I: IntoIterator<Item = St>,
6260 St: AsRef<str>,
6261 {
6262 self._scopes
6263 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6264 self
6265 }
6266
6267 /// Removes all scopes, and no default scope will be used either.
6268 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6269 /// for details).
6270 pub fn clear_scopes(mut self) -> EnterpriseDeviceDeleteCall<'a, C> {
6271 self._scopes.clear();
6272 self
6273 }
6274}
6275
6276/// Gets a device. Deleted devices will respond with a 404 error.
6277///
6278/// A builder for the *devices.get* method supported by a *enterprise* resource.
6279/// It is not used directly, but through a [`EnterpriseMethods`] instance.
6280///
6281/// # Example
6282///
6283/// Instantiate a resource method builder
6284///
6285/// ```test_harness,no_run
6286/// # extern crate hyper;
6287/// # extern crate hyper_rustls;
6288/// # extern crate google_androidmanagement1 as androidmanagement1;
6289/// # async fn dox() {
6290/// # use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6291///
6292/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6293/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6294/// # .with_native_roots()
6295/// # .unwrap()
6296/// # .https_only()
6297/// # .enable_http2()
6298/// # .build();
6299///
6300/// # let executor = hyper_util::rt::TokioExecutor::new();
6301/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6302/// # secret,
6303/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6304/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6305/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6306/// # ),
6307/// # ).build().await.unwrap();
6308///
6309/// # let client = hyper_util::client::legacy::Client::builder(
6310/// # hyper_util::rt::TokioExecutor::new()
6311/// # )
6312/// # .build(
6313/// # hyper_rustls::HttpsConnectorBuilder::new()
6314/// # .with_native_roots()
6315/// # .unwrap()
6316/// # .https_or_http()
6317/// # .enable_http2()
6318/// # .build()
6319/// # );
6320/// # let mut hub = AndroidManagement::new(client, auth);
6321/// // You can configure optional parameters by calling the respective setters at will, and
6322/// // execute the final call using `doit()`.
6323/// // Values shown here are possibly random and not representative !
6324/// let result = hub.enterprises().devices_get("name")
6325/// .doit().await;
6326/// # }
6327/// ```
6328pub struct EnterpriseDeviceGetCall<'a, C>
6329where
6330 C: 'a,
6331{
6332 hub: &'a AndroidManagement<C>,
6333 _name: String,
6334 _delegate: Option<&'a mut dyn common::Delegate>,
6335 _additional_params: HashMap<String, String>,
6336 _scopes: BTreeSet<String>,
6337}
6338
6339impl<'a, C> common::CallBuilder for EnterpriseDeviceGetCall<'a, C> {}
6340
6341impl<'a, C> EnterpriseDeviceGetCall<'a, C>
6342where
6343 C: common::Connector,
6344{
6345 /// Perform the operation you have build so far.
6346 pub async fn doit(mut self) -> common::Result<(common::Response, Device)> {
6347 use std::borrow::Cow;
6348 use std::io::{Read, Seek};
6349
6350 use common::{url::Params, ToParts};
6351 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6352
6353 let mut dd = common::DefaultDelegate;
6354 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6355 dlg.begin(common::MethodInfo {
6356 id: "androidmanagement.enterprises.devices.get",
6357 http_method: hyper::Method::GET,
6358 });
6359
6360 for &field in ["alt", "name"].iter() {
6361 if self._additional_params.contains_key(field) {
6362 dlg.finished(false);
6363 return Err(common::Error::FieldClash(field));
6364 }
6365 }
6366
6367 let mut params = Params::with_capacity(3 + self._additional_params.len());
6368 params.push("name", self._name);
6369
6370 params.extend(self._additional_params.iter());
6371
6372 params.push("alt", "json");
6373 let mut url = self.hub._base_url.clone() + "v1/{+name}";
6374 if self._scopes.is_empty() {
6375 self._scopes.insert(Scope::Full.as_ref().to_string());
6376 }
6377
6378 #[allow(clippy::single_element_loop)]
6379 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6380 url = params.uri_replacement(url, param_name, find_this, true);
6381 }
6382 {
6383 let to_remove = ["name"];
6384 params.remove_params(&to_remove);
6385 }
6386
6387 let url = params.parse_with_url(&url);
6388
6389 loop {
6390 let token = match self
6391 .hub
6392 .auth
6393 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6394 .await
6395 {
6396 Ok(token) => token,
6397 Err(e) => match dlg.token(e) {
6398 Ok(token) => token,
6399 Err(e) => {
6400 dlg.finished(false);
6401 return Err(common::Error::MissingToken(e));
6402 }
6403 },
6404 };
6405 let mut req_result = {
6406 let client = &self.hub.client;
6407 dlg.pre_request();
6408 let mut req_builder = hyper::Request::builder()
6409 .method(hyper::Method::GET)
6410 .uri(url.as_str())
6411 .header(USER_AGENT, self.hub._user_agent.clone());
6412
6413 if let Some(token) = token.as_ref() {
6414 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6415 }
6416
6417 let request = req_builder
6418 .header(CONTENT_LENGTH, 0_u64)
6419 .body(common::to_body::<String>(None));
6420
6421 client.request(request.unwrap()).await
6422 };
6423
6424 match req_result {
6425 Err(err) => {
6426 if let common::Retry::After(d) = dlg.http_error(&err) {
6427 sleep(d).await;
6428 continue;
6429 }
6430 dlg.finished(false);
6431 return Err(common::Error::HttpError(err));
6432 }
6433 Ok(res) => {
6434 let (mut parts, body) = res.into_parts();
6435 let mut body = common::Body::new(body);
6436 if !parts.status.is_success() {
6437 let bytes = common::to_bytes(body).await.unwrap_or_default();
6438 let error = serde_json::from_str(&common::to_string(&bytes));
6439 let response = common::to_response(parts, bytes.into());
6440
6441 if let common::Retry::After(d) =
6442 dlg.http_failure(&response, error.as_ref().ok())
6443 {
6444 sleep(d).await;
6445 continue;
6446 }
6447
6448 dlg.finished(false);
6449
6450 return Err(match error {
6451 Ok(value) => common::Error::BadRequest(value),
6452 _ => common::Error::Failure(response),
6453 });
6454 }
6455 let response = {
6456 let bytes = common::to_bytes(body).await.unwrap_or_default();
6457 let encoded = common::to_string(&bytes);
6458 match serde_json::from_str(&encoded) {
6459 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6460 Err(error) => {
6461 dlg.response_json_decode_error(&encoded, &error);
6462 return Err(common::Error::JsonDecodeError(
6463 encoded.to_string(),
6464 error,
6465 ));
6466 }
6467 }
6468 };
6469
6470 dlg.finished(true);
6471 return Ok(response);
6472 }
6473 }
6474 }
6475 }
6476
6477 /// The name of the device in the form enterprises/{enterpriseId}/devices/{deviceId}.
6478 ///
6479 /// Sets the *name* path property to the given value.
6480 ///
6481 /// Even though the property as already been set when instantiating this call,
6482 /// we provide this method for API completeness.
6483 pub fn name(mut self, new_value: &str) -> EnterpriseDeviceGetCall<'a, C> {
6484 self._name = new_value.to_string();
6485 self
6486 }
6487 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6488 /// while executing the actual API request.
6489 ///
6490 /// ````text
6491 /// It should be used to handle progress information, and to implement a certain level of resilience.
6492 /// ````
6493 ///
6494 /// Sets the *delegate* property to the given value.
6495 pub fn delegate(
6496 mut self,
6497 new_value: &'a mut dyn common::Delegate,
6498 ) -> EnterpriseDeviceGetCall<'a, C> {
6499 self._delegate = Some(new_value);
6500 self
6501 }
6502
6503 /// Set any additional parameter of the query string used in the request.
6504 /// It should be used to set parameters which are not yet available through their own
6505 /// setters.
6506 ///
6507 /// Please note that this method must not be used to set any of the known parameters
6508 /// which have their own setter method. If done anyway, the request will fail.
6509 ///
6510 /// # Additional Parameters
6511 ///
6512 /// * *$.xgafv* (query-string) - V1 error format.
6513 /// * *access_token* (query-string) - OAuth access token.
6514 /// * *alt* (query-string) - Data format for response.
6515 /// * *callback* (query-string) - JSONP
6516 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6517 /// * *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.
6518 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6519 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6520 /// * *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.
6521 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6522 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6523 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseDeviceGetCall<'a, C>
6524 where
6525 T: AsRef<str>,
6526 {
6527 self._additional_params
6528 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6529 self
6530 }
6531
6532 /// Identifies the authorization scope for the method you are building.
6533 ///
6534 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6535 /// [`Scope::Full`].
6536 ///
6537 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6538 /// tokens for more than one scope.
6539 ///
6540 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6541 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6542 /// sufficient, a read-write scope will do as well.
6543 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseDeviceGetCall<'a, C>
6544 where
6545 St: AsRef<str>,
6546 {
6547 self._scopes.insert(String::from(scope.as_ref()));
6548 self
6549 }
6550 /// Identifies the authorization scope(s) for the method you are building.
6551 ///
6552 /// See [`Self::add_scope()`] for details.
6553 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseDeviceGetCall<'a, C>
6554 where
6555 I: IntoIterator<Item = St>,
6556 St: AsRef<str>,
6557 {
6558 self._scopes
6559 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6560 self
6561 }
6562
6563 /// Removes all scopes, and no default scope will be used either.
6564 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6565 /// for details).
6566 pub fn clear_scopes(mut self) -> EnterpriseDeviceGetCall<'a, C> {
6567 self._scopes.clear();
6568 self
6569 }
6570}
6571
6572/// Issues a command to a device. The Operation resource returned contains a Command in its metadata field. Use the get operation method to get the status of the command.
6573///
6574/// A builder for the *devices.issueCommand* method supported by a *enterprise* resource.
6575/// It is not used directly, but through a [`EnterpriseMethods`] instance.
6576///
6577/// # Example
6578///
6579/// Instantiate a resource method builder
6580///
6581/// ```test_harness,no_run
6582/// # extern crate hyper;
6583/// # extern crate hyper_rustls;
6584/// # extern crate google_androidmanagement1 as androidmanagement1;
6585/// use androidmanagement1::api::Command;
6586/// # async fn dox() {
6587/// # use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6588///
6589/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6590/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6591/// # .with_native_roots()
6592/// # .unwrap()
6593/// # .https_only()
6594/// # .enable_http2()
6595/// # .build();
6596///
6597/// # let executor = hyper_util::rt::TokioExecutor::new();
6598/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6599/// # secret,
6600/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6601/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6602/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6603/// # ),
6604/// # ).build().await.unwrap();
6605///
6606/// # let client = hyper_util::client::legacy::Client::builder(
6607/// # hyper_util::rt::TokioExecutor::new()
6608/// # )
6609/// # .build(
6610/// # hyper_rustls::HttpsConnectorBuilder::new()
6611/// # .with_native_roots()
6612/// # .unwrap()
6613/// # .https_or_http()
6614/// # .enable_http2()
6615/// # .build()
6616/// # );
6617/// # let mut hub = AndroidManagement::new(client, auth);
6618/// // As the method needs a request, you would usually fill it with the desired information
6619/// // into the respective structure. Some of the parts shown here might not be applicable !
6620/// // Values shown here are possibly random and not representative !
6621/// let mut req = Command::default();
6622///
6623/// // You can configure optional parameters by calling the respective setters at will, and
6624/// // execute the final call using `doit()`.
6625/// // Values shown here are possibly random and not representative !
6626/// let result = hub.enterprises().devices_issue_command(req, "name")
6627/// .doit().await;
6628/// # }
6629/// ```
6630pub struct EnterpriseDeviceIssueCommandCall<'a, C>
6631where
6632 C: 'a,
6633{
6634 hub: &'a AndroidManagement<C>,
6635 _request: Command,
6636 _name: String,
6637 _delegate: Option<&'a mut dyn common::Delegate>,
6638 _additional_params: HashMap<String, String>,
6639 _scopes: BTreeSet<String>,
6640}
6641
6642impl<'a, C> common::CallBuilder for EnterpriseDeviceIssueCommandCall<'a, C> {}
6643
6644impl<'a, C> EnterpriseDeviceIssueCommandCall<'a, C>
6645where
6646 C: common::Connector,
6647{
6648 /// Perform the operation you have build so far.
6649 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6650 use std::borrow::Cow;
6651 use std::io::{Read, Seek};
6652
6653 use common::{url::Params, ToParts};
6654 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6655
6656 let mut dd = common::DefaultDelegate;
6657 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6658 dlg.begin(common::MethodInfo {
6659 id: "androidmanagement.enterprises.devices.issueCommand",
6660 http_method: hyper::Method::POST,
6661 });
6662
6663 for &field in ["alt", "name"].iter() {
6664 if self._additional_params.contains_key(field) {
6665 dlg.finished(false);
6666 return Err(common::Error::FieldClash(field));
6667 }
6668 }
6669
6670 let mut params = Params::with_capacity(4 + self._additional_params.len());
6671 params.push("name", self._name);
6672
6673 params.extend(self._additional_params.iter());
6674
6675 params.push("alt", "json");
6676 let mut url = self.hub._base_url.clone() + "v1/{+name}:issueCommand";
6677 if self._scopes.is_empty() {
6678 self._scopes.insert(Scope::Full.as_ref().to_string());
6679 }
6680
6681 #[allow(clippy::single_element_loop)]
6682 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6683 url = params.uri_replacement(url, param_name, find_this, true);
6684 }
6685 {
6686 let to_remove = ["name"];
6687 params.remove_params(&to_remove);
6688 }
6689
6690 let url = params.parse_with_url(&url);
6691
6692 let mut json_mime_type = mime::APPLICATION_JSON;
6693 let mut request_value_reader = {
6694 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6695 common::remove_json_null_values(&mut value);
6696 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6697 serde_json::to_writer(&mut dst, &value).unwrap();
6698 dst
6699 };
6700 let request_size = request_value_reader
6701 .seek(std::io::SeekFrom::End(0))
6702 .unwrap();
6703 request_value_reader
6704 .seek(std::io::SeekFrom::Start(0))
6705 .unwrap();
6706
6707 loop {
6708 let token = match self
6709 .hub
6710 .auth
6711 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6712 .await
6713 {
6714 Ok(token) => token,
6715 Err(e) => match dlg.token(e) {
6716 Ok(token) => token,
6717 Err(e) => {
6718 dlg.finished(false);
6719 return Err(common::Error::MissingToken(e));
6720 }
6721 },
6722 };
6723 request_value_reader
6724 .seek(std::io::SeekFrom::Start(0))
6725 .unwrap();
6726 let mut req_result = {
6727 let client = &self.hub.client;
6728 dlg.pre_request();
6729 let mut req_builder = hyper::Request::builder()
6730 .method(hyper::Method::POST)
6731 .uri(url.as_str())
6732 .header(USER_AGENT, self.hub._user_agent.clone());
6733
6734 if let Some(token) = token.as_ref() {
6735 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6736 }
6737
6738 let request = req_builder
6739 .header(CONTENT_TYPE, json_mime_type.to_string())
6740 .header(CONTENT_LENGTH, request_size as u64)
6741 .body(common::to_body(
6742 request_value_reader.get_ref().clone().into(),
6743 ));
6744
6745 client.request(request.unwrap()).await
6746 };
6747
6748 match req_result {
6749 Err(err) => {
6750 if let common::Retry::After(d) = dlg.http_error(&err) {
6751 sleep(d).await;
6752 continue;
6753 }
6754 dlg.finished(false);
6755 return Err(common::Error::HttpError(err));
6756 }
6757 Ok(res) => {
6758 let (mut parts, body) = res.into_parts();
6759 let mut body = common::Body::new(body);
6760 if !parts.status.is_success() {
6761 let bytes = common::to_bytes(body).await.unwrap_or_default();
6762 let error = serde_json::from_str(&common::to_string(&bytes));
6763 let response = common::to_response(parts, bytes.into());
6764
6765 if let common::Retry::After(d) =
6766 dlg.http_failure(&response, error.as_ref().ok())
6767 {
6768 sleep(d).await;
6769 continue;
6770 }
6771
6772 dlg.finished(false);
6773
6774 return Err(match error {
6775 Ok(value) => common::Error::BadRequest(value),
6776 _ => common::Error::Failure(response),
6777 });
6778 }
6779 let response = {
6780 let bytes = common::to_bytes(body).await.unwrap_or_default();
6781 let encoded = common::to_string(&bytes);
6782 match serde_json::from_str(&encoded) {
6783 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6784 Err(error) => {
6785 dlg.response_json_decode_error(&encoded, &error);
6786 return Err(common::Error::JsonDecodeError(
6787 encoded.to_string(),
6788 error,
6789 ));
6790 }
6791 }
6792 };
6793
6794 dlg.finished(true);
6795 return Ok(response);
6796 }
6797 }
6798 }
6799 }
6800
6801 ///
6802 /// Sets the *request* property to the given value.
6803 ///
6804 /// Even though the property as already been set when instantiating this call,
6805 /// we provide this method for API completeness.
6806 pub fn request(mut self, new_value: Command) -> EnterpriseDeviceIssueCommandCall<'a, C> {
6807 self._request = new_value;
6808 self
6809 }
6810 /// The name of the device in the form enterprises/{enterpriseId}/devices/{deviceId}.
6811 ///
6812 /// Sets the *name* path property to the given value.
6813 ///
6814 /// Even though the property as already been set when instantiating this call,
6815 /// we provide this method for API completeness.
6816 pub fn name(mut self, new_value: &str) -> EnterpriseDeviceIssueCommandCall<'a, C> {
6817 self._name = new_value.to_string();
6818 self
6819 }
6820 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6821 /// while executing the actual API request.
6822 ///
6823 /// ````text
6824 /// It should be used to handle progress information, and to implement a certain level of resilience.
6825 /// ````
6826 ///
6827 /// Sets the *delegate* property to the given value.
6828 pub fn delegate(
6829 mut self,
6830 new_value: &'a mut dyn common::Delegate,
6831 ) -> EnterpriseDeviceIssueCommandCall<'a, C> {
6832 self._delegate = Some(new_value);
6833 self
6834 }
6835
6836 /// Set any additional parameter of the query string used in the request.
6837 /// It should be used to set parameters which are not yet available through their own
6838 /// setters.
6839 ///
6840 /// Please note that this method must not be used to set any of the known parameters
6841 /// which have their own setter method. If done anyway, the request will fail.
6842 ///
6843 /// # Additional Parameters
6844 ///
6845 /// * *$.xgafv* (query-string) - V1 error format.
6846 /// * *access_token* (query-string) - OAuth access token.
6847 /// * *alt* (query-string) - Data format for response.
6848 /// * *callback* (query-string) - JSONP
6849 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6850 /// * *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.
6851 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6852 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6853 /// * *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.
6854 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6855 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6856 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseDeviceIssueCommandCall<'a, C>
6857 where
6858 T: AsRef<str>,
6859 {
6860 self._additional_params
6861 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6862 self
6863 }
6864
6865 /// Identifies the authorization scope for the method you are building.
6866 ///
6867 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6868 /// [`Scope::Full`].
6869 ///
6870 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6871 /// tokens for more than one scope.
6872 ///
6873 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6874 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6875 /// sufficient, a read-write scope will do as well.
6876 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseDeviceIssueCommandCall<'a, C>
6877 where
6878 St: AsRef<str>,
6879 {
6880 self._scopes.insert(String::from(scope.as_ref()));
6881 self
6882 }
6883 /// Identifies the authorization scope(s) for the method you are building.
6884 ///
6885 /// See [`Self::add_scope()`] for details.
6886 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseDeviceIssueCommandCall<'a, C>
6887 where
6888 I: IntoIterator<Item = St>,
6889 St: AsRef<str>,
6890 {
6891 self._scopes
6892 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6893 self
6894 }
6895
6896 /// Removes all scopes, and no default scope will be used either.
6897 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6898 /// for details).
6899 pub fn clear_scopes(mut self) -> EnterpriseDeviceIssueCommandCall<'a, C> {
6900 self._scopes.clear();
6901 self
6902 }
6903}
6904
6905/// Lists devices for a given enterprise. Deleted devices are not returned in the response.
6906///
6907/// A builder for the *devices.list* method supported by a *enterprise* resource.
6908/// It is not used directly, but through a [`EnterpriseMethods`] instance.
6909///
6910/// # Example
6911///
6912/// Instantiate a resource method builder
6913///
6914/// ```test_harness,no_run
6915/// # extern crate hyper;
6916/// # extern crate hyper_rustls;
6917/// # extern crate google_androidmanagement1 as androidmanagement1;
6918/// # async fn dox() {
6919/// # use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6920///
6921/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6922/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6923/// # .with_native_roots()
6924/// # .unwrap()
6925/// # .https_only()
6926/// # .enable_http2()
6927/// # .build();
6928///
6929/// # let executor = hyper_util::rt::TokioExecutor::new();
6930/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6931/// # secret,
6932/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6933/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6934/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6935/// # ),
6936/// # ).build().await.unwrap();
6937///
6938/// # let client = hyper_util::client::legacy::Client::builder(
6939/// # hyper_util::rt::TokioExecutor::new()
6940/// # )
6941/// # .build(
6942/// # hyper_rustls::HttpsConnectorBuilder::new()
6943/// # .with_native_roots()
6944/// # .unwrap()
6945/// # .https_or_http()
6946/// # .enable_http2()
6947/// # .build()
6948/// # );
6949/// # let mut hub = AndroidManagement::new(client, auth);
6950/// // You can configure optional parameters by calling the respective setters at will, and
6951/// // execute the final call using `doit()`.
6952/// // Values shown here are possibly random and not representative !
6953/// let result = hub.enterprises().devices_list("parent")
6954/// .page_token("ea")
6955/// .page_size(-99)
6956/// .doit().await;
6957/// # }
6958/// ```
6959pub struct EnterpriseDeviceListCall<'a, C>
6960where
6961 C: 'a,
6962{
6963 hub: &'a AndroidManagement<C>,
6964 _parent: String,
6965 _page_token: Option<String>,
6966 _page_size: Option<i32>,
6967 _delegate: Option<&'a mut dyn common::Delegate>,
6968 _additional_params: HashMap<String, String>,
6969 _scopes: BTreeSet<String>,
6970}
6971
6972impl<'a, C> common::CallBuilder for EnterpriseDeviceListCall<'a, C> {}
6973
6974impl<'a, C> EnterpriseDeviceListCall<'a, C>
6975where
6976 C: common::Connector,
6977{
6978 /// Perform the operation you have build so far.
6979 pub async fn doit(mut self) -> common::Result<(common::Response, ListDevicesResponse)> {
6980 use std::borrow::Cow;
6981 use std::io::{Read, Seek};
6982
6983 use common::{url::Params, ToParts};
6984 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6985
6986 let mut dd = common::DefaultDelegate;
6987 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6988 dlg.begin(common::MethodInfo {
6989 id: "androidmanagement.enterprises.devices.list",
6990 http_method: hyper::Method::GET,
6991 });
6992
6993 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
6994 if self._additional_params.contains_key(field) {
6995 dlg.finished(false);
6996 return Err(common::Error::FieldClash(field));
6997 }
6998 }
6999
7000 let mut params = Params::with_capacity(5 + self._additional_params.len());
7001 params.push("parent", self._parent);
7002 if let Some(value) = self._page_token.as_ref() {
7003 params.push("pageToken", value);
7004 }
7005 if let Some(value) = self._page_size.as_ref() {
7006 params.push("pageSize", value.to_string());
7007 }
7008
7009 params.extend(self._additional_params.iter());
7010
7011 params.push("alt", "json");
7012 let mut url = self.hub._base_url.clone() + "v1/{+parent}/devices";
7013 if self._scopes.is_empty() {
7014 self._scopes.insert(Scope::Full.as_ref().to_string());
7015 }
7016
7017 #[allow(clippy::single_element_loop)]
7018 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7019 url = params.uri_replacement(url, param_name, find_this, true);
7020 }
7021 {
7022 let to_remove = ["parent"];
7023 params.remove_params(&to_remove);
7024 }
7025
7026 let url = params.parse_with_url(&url);
7027
7028 loop {
7029 let token = match self
7030 .hub
7031 .auth
7032 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7033 .await
7034 {
7035 Ok(token) => token,
7036 Err(e) => match dlg.token(e) {
7037 Ok(token) => token,
7038 Err(e) => {
7039 dlg.finished(false);
7040 return Err(common::Error::MissingToken(e));
7041 }
7042 },
7043 };
7044 let mut req_result = {
7045 let client = &self.hub.client;
7046 dlg.pre_request();
7047 let mut req_builder = hyper::Request::builder()
7048 .method(hyper::Method::GET)
7049 .uri(url.as_str())
7050 .header(USER_AGENT, self.hub._user_agent.clone());
7051
7052 if let Some(token) = token.as_ref() {
7053 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7054 }
7055
7056 let request = req_builder
7057 .header(CONTENT_LENGTH, 0_u64)
7058 .body(common::to_body::<String>(None));
7059
7060 client.request(request.unwrap()).await
7061 };
7062
7063 match req_result {
7064 Err(err) => {
7065 if let common::Retry::After(d) = dlg.http_error(&err) {
7066 sleep(d).await;
7067 continue;
7068 }
7069 dlg.finished(false);
7070 return Err(common::Error::HttpError(err));
7071 }
7072 Ok(res) => {
7073 let (mut parts, body) = res.into_parts();
7074 let mut body = common::Body::new(body);
7075 if !parts.status.is_success() {
7076 let bytes = common::to_bytes(body).await.unwrap_or_default();
7077 let error = serde_json::from_str(&common::to_string(&bytes));
7078 let response = common::to_response(parts, bytes.into());
7079
7080 if let common::Retry::After(d) =
7081 dlg.http_failure(&response, error.as_ref().ok())
7082 {
7083 sleep(d).await;
7084 continue;
7085 }
7086
7087 dlg.finished(false);
7088
7089 return Err(match error {
7090 Ok(value) => common::Error::BadRequest(value),
7091 _ => common::Error::Failure(response),
7092 });
7093 }
7094 let response = {
7095 let bytes = common::to_bytes(body).await.unwrap_or_default();
7096 let encoded = common::to_string(&bytes);
7097 match serde_json::from_str(&encoded) {
7098 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7099 Err(error) => {
7100 dlg.response_json_decode_error(&encoded, &error);
7101 return Err(common::Error::JsonDecodeError(
7102 encoded.to_string(),
7103 error,
7104 ));
7105 }
7106 }
7107 };
7108
7109 dlg.finished(true);
7110 return Ok(response);
7111 }
7112 }
7113 }
7114 }
7115
7116 /// The name of the enterprise in the form enterprises/{enterpriseId}.
7117 ///
7118 /// Sets the *parent* path property to the given value.
7119 ///
7120 /// Even though the property as already been set when instantiating this call,
7121 /// we provide this method for API completeness.
7122 pub fn parent(mut self, new_value: &str) -> EnterpriseDeviceListCall<'a, C> {
7123 self._parent = new_value.to_string();
7124 self
7125 }
7126 /// A token identifying a page of results returned by the server.
7127 ///
7128 /// Sets the *page token* query property to the given value.
7129 pub fn page_token(mut self, new_value: &str) -> EnterpriseDeviceListCall<'a, C> {
7130 self._page_token = Some(new_value.to_string());
7131 self
7132 }
7133 /// The requested page size. If unspecified, at most 10 devices will be returned. The maximum value is 100; values above 100 will be coerced to 100. The limits can change over time.
7134 ///
7135 /// Sets the *page size* query property to the given value.
7136 pub fn page_size(mut self, new_value: i32) -> EnterpriseDeviceListCall<'a, C> {
7137 self._page_size = Some(new_value);
7138 self
7139 }
7140 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7141 /// while executing the actual API request.
7142 ///
7143 /// ````text
7144 /// It should be used to handle progress information, and to implement a certain level of resilience.
7145 /// ````
7146 ///
7147 /// Sets the *delegate* property to the given value.
7148 pub fn delegate(
7149 mut self,
7150 new_value: &'a mut dyn common::Delegate,
7151 ) -> EnterpriseDeviceListCall<'a, C> {
7152 self._delegate = Some(new_value);
7153 self
7154 }
7155
7156 /// Set any additional parameter of the query string used in the request.
7157 /// It should be used to set parameters which are not yet available through their own
7158 /// setters.
7159 ///
7160 /// Please note that this method must not be used to set any of the known parameters
7161 /// which have their own setter method. If done anyway, the request will fail.
7162 ///
7163 /// # Additional Parameters
7164 ///
7165 /// * *$.xgafv* (query-string) - V1 error format.
7166 /// * *access_token* (query-string) - OAuth access token.
7167 /// * *alt* (query-string) - Data format for response.
7168 /// * *callback* (query-string) - JSONP
7169 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7170 /// * *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.
7171 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7172 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7173 /// * *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.
7174 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7175 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7176 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseDeviceListCall<'a, C>
7177 where
7178 T: AsRef<str>,
7179 {
7180 self._additional_params
7181 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7182 self
7183 }
7184
7185 /// Identifies the authorization scope for the method you are building.
7186 ///
7187 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7188 /// [`Scope::Full`].
7189 ///
7190 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7191 /// tokens for more than one scope.
7192 ///
7193 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7194 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7195 /// sufficient, a read-write scope will do as well.
7196 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseDeviceListCall<'a, C>
7197 where
7198 St: AsRef<str>,
7199 {
7200 self._scopes.insert(String::from(scope.as_ref()));
7201 self
7202 }
7203 /// Identifies the authorization scope(s) for the method you are building.
7204 ///
7205 /// See [`Self::add_scope()`] for details.
7206 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseDeviceListCall<'a, C>
7207 where
7208 I: IntoIterator<Item = St>,
7209 St: AsRef<str>,
7210 {
7211 self._scopes
7212 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7213 self
7214 }
7215
7216 /// Removes all scopes, and no default scope will be used either.
7217 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7218 /// for details).
7219 pub fn clear_scopes(mut self) -> EnterpriseDeviceListCall<'a, C> {
7220 self._scopes.clear();
7221 self
7222 }
7223}
7224
7225/// Updates a device.
7226///
7227/// A builder for the *devices.patch* method supported by a *enterprise* resource.
7228/// It is not used directly, but through a [`EnterpriseMethods`] instance.
7229///
7230/// # Example
7231///
7232/// Instantiate a resource method builder
7233///
7234/// ```test_harness,no_run
7235/// # extern crate hyper;
7236/// # extern crate hyper_rustls;
7237/// # extern crate google_androidmanagement1 as androidmanagement1;
7238/// use androidmanagement1::api::Device;
7239/// # async fn dox() {
7240/// # use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7241///
7242/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7243/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7244/// # .with_native_roots()
7245/// # .unwrap()
7246/// # .https_only()
7247/// # .enable_http2()
7248/// # .build();
7249///
7250/// # let executor = hyper_util::rt::TokioExecutor::new();
7251/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7252/// # secret,
7253/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7254/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7255/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7256/// # ),
7257/// # ).build().await.unwrap();
7258///
7259/// # let client = hyper_util::client::legacy::Client::builder(
7260/// # hyper_util::rt::TokioExecutor::new()
7261/// # )
7262/// # .build(
7263/// # hyper_rustls::HttpsConnectorBuilder::new()
7264/// # .with_native_roots()
7265/// # .unwrap()
7266/// # .https_or_http()
7267/// # .enable_http2()
7268/// # .build()
7269/// # );
7270/// # let mut hub = AndroidManagement::new(client, auth);
7271/// // As the method needs a request, you would usually fill it with the desired information
7272/// // into the respective structure. Some of the parts shown here might not be applicable !
7273/// // Values shown here are possibly random and not representative !
7274/// let mut req = Device::default();
7275///
7276/// // You can configure optional parameters by calling the respective setters at will, and
7277/// // execute the final call using `doit()`.
7278/// // Values shown here are possibly random and not representative !
7279/// let result = hub.enterprises().devices_patch(req, "name")
7280/// .update_mask(FieldMask::new::<&str>(&[]))
7281/// .doit().await;
7282/// # }
7283/// ```
7284pub struct EnterpriseDevicePatchCall<'a, C>
7285where
7286 C: 'a,
7287{
7288 hub: &'a AndroidManagement<C>,
7289 _request: Device,
7290 _name: String,
7291 _update_mask: Option<common::FieldMask>,
7292 _delegate: Option<&'a mut dyn common::Delegate>,
7293 _additional_params: HashMap<String, String>,
7294 _scopes: BTreeSet<String>,
7295}
7296
7297impl<'a, C> common::CallBuilder for EnterpriseDevicePatchCall<'a, C> {}
7298
7299impl<'a, C> EnterpriseDevicePatchCall<'a, C>
7300where
7301 C: common::Connector,
7302{
7303 /// Perform the operation you have build so far.
7304 pub async fn doit(mut self) -> common::Result<(common::Response, Device)> {
7305 use std::borrow::Cow;
7306 use std::io::{Read, Seek};
7307
7308 use common::{url::Params, ToParts};
7309 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7310
7311 let mut dd = common::DefaultDelegate;
7312 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7313 dlg.begin(common::MethodInfo {
7314 id: "androidmanagement.enterprises.devices.patch",
7315 http_method: hyper::Method::PATCH,
7316 });
7317
7318 for &field in ["alt", "name", "updateMask"].iter() {
7319 if self._additional_params.contains_key(field) {
7320 dlg.finished(false);
7321 return Err(common::Error::FieldClash(field));
7322 }
7323 }
7324
7325 let mut params = Params::with_capacity(5 + self._additional_params.len());
7326 params.push("name", self._name);
7327 if let Some(value) = self._update_mask.as_ref() {
7328 params.push("updateMask", value.to_string());
7329 }
7330
7331 params.extend(self._additional_params.iter());
7332
7333 params.push("alt", "json");
7334 let mut url = self.hub._base_url.clone() + "v1/{+name}";
7335 if self._scopes.is_empty() {
7336 self._scopes.insert(Scope::Full.as_ref().to_string());
7337 }
7338
7339 #[allow(clippy::single_element_loop)]
7340 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7341 url = params.uri_replacement(url, param_name, find_this, true);
7342 }
7343 {
7344 let to_remove = ["name"];
7345 params.remove_params(&to_remove);
7346 }
7347
7348 let url = params.parse_with_url(&url);
7349
7350 let mut json_mime_type = mime::APPLICATION_JSON;
7351 let mut request_value_reader = {
7352 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7353 common::remove_json_null_values(&mut value);
7354 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7355 serde_json::to_writer(&mut dst, &value).unwrap();
7356 dst
7357 };
7358 let request_size = request_value_reader
7359 .seek(std::io::SeekFrom::End(0))
7360 .unwrap();
7361 request_value_reader
7362 .seek(std::io::SeekFrom::Start(0))
7363 .unwrap();
7364
7365 loop {
7366 let token = match self
7367 .hub
7368 .auth
7369 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7370 .await
7371 {
7372 Ok(token) => token,
7373 Err(e) => match dlg.token(e) {
7374 Ok(token) => token,
7375 Err(e) => {
7376 dlg.finished(false);
7377 return Err(common::Error::MissingToken(e));
7378 }
7379 },
7380 };
7381 request_value_reader
7382 .seek(std::io::SeekFrom::Start(0))
7383 .unwrap();
7384 let mut req_result = {
7385 let client = &self.hub.client;
7386 dlg.pre_request();
7387 let mut req_builder = hyper::Request::builder()
7388 .method(hyper::Method::PATCH)
7389 .uri(url.as_str())
7390 .header(USER_AGENT, self.hub._user_agent.clone());
7391
7392 if let Some(token) = token.as_ref() {
7393 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7394 }
7395
7396 let request = req_builder
7397 .header(CONTENT_TYPE, json_mime_type.to_string())
7398 .header(CONTENT_LENGTH, request_size as u64)
7399 .body(common::to_body(
7400 request_value_reader.get_ref().clone().into(),
7401 ));
7402
7403 client.request(request.unwrap()).await
7404 };
7405
7406 match req_result {
7407 Err(err) => {
7408 if let common::Retry::After(d) = dlg.http_error(&err) {
7409 sleep(d).await;
7410 continue;
7411 }
7412 dlg.finished(false);
7413 return Err(common::Error::HttpError(err));
7414 }
7415 Ok(res) => {
7416 let (mut parts, body) = res.into_parts();
7417 let mut body = common::Body::new(body);
7418 if !parts.status.is_success() {
7419 let bytes = common::to_bytes(body).await.unwrap_or_default();
7420 let error = serde_json::from_str(&common::to_string(&bytes));
7421 let response = common::to_response(parts, bytes.into());
7422
7423 if let common::Retry::After(d) =
7424 dlg.http_failure(&response, error.as_ref().ok())
7425 {
7426 sleep(d).await;
7427 continue;
7428 }
7429
7430 dlg.finished(false);
7431
7432 return Err(match error {
7433 Ok(value) => common::Error::BadRequest(value),
7434 _ => common::Error::Failure(response),
7435 });
7436 }
7437 let response = {
7438 let bytes = common::to_bytes(body).await.unwrap_or_default();
7439 let encoded = common::to_string(&bytes);
7440 match serde_json::from_str(&encoded) {
7441 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7442 Err(error) => {
7443 dlg.response_json_decode_error(&encoded, &error);
7444 return Err(common::Error::JsonDecodeError(
7445 encoded.to_string(),
7446 error,
7447 ));
7448 }
7449 }
7450 };
7451
7452 dlg.finished(true);
7453 return Ok(response);
7454 }
7455 }
7456 }
7457 }
7458
7459 ///
7460 /// Sets the *request* property to the given value.
7461 ///
7462 /// Even though the property as already been set when instantiating this call,
7463 /// we provide this method for API completeness.
7464 pub fn request(mut self, new_value: Device) -> EnterpriseDevicePatchCall<'a, C> {
7465 self._request = new_value;
7466 self
7467 }
7468 /// The name of the device in the form enterprises/{enterpriseId}/devices/{deviceId}.
7469 ///
7470 /// Sets the *name* path property to the given value.
7471 ///
7472 /// Even though the property as already been set when instantiating this call,
7473 /// we provide this method for API completeness.
7474 pub fn name(mut self, new_value: &str) -> EnterpriseDevicePatchCall<'a, C> {
7475 self._name = new_value.to_string();
7476 self
7477 }
7478 /// The field mask indicating the fields to update. If not set, all modifiable fields will be modified.
7479 ///
7480 /// Sets the *update mask* query property to the given value.
7481 pub fn update_mask(mut self, new_value: common::FieldMask) -> EnterpriseDevicePatchCall<'a, C> {
7482 self._update_mask = Some(new_value);
7483 self
7484 }
7485 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7486 /// while executing the actual API request.
7487 ///
7488 /// ````text
7489 /// It should be used to handle progress information, and to implement a certain level of resilience.
7490 /// ````
7491 ///
7492 /// Sets the *delegate* property to the given value.
7493 pub fn delegate(
7494 mut self,
7495 new_value: &'a mut dyn common::Delegate,
7496 ) -> EnterpriseDevicePatchCall<'a, C> {
7497 self._delegate = Some(new_value);
7498 self
7499 }
7500
7501 /// Set any additional parameter of the query string used in the request.
7502 /// It should be used to set parameters which are not yet available through their own
7503 /// setters.
7504 ///
7505 /// Please note that this method must not be used to set any of the known parameters
7506 /// which have their own setter method. If done anyway, the request will fail.
7507 ///
7508 /// # Additional Parameters
7509 ///
7510 /// * *$.xgafv* (query-string) - V1 error format.
7511 /// * *access_token* (query-string) - OAuth access token.
7512 /// * *alt* (query-string) - Data format for response.
7513 /// * *callback* (query-string) - JSONP
7514 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7515 /// * *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.
7516 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7517 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7518 /// * *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.
7519 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7520 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7521 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseDevicePatchCall<'a, C>
7522 where
7523 T: AsRef<str>,
7524 {
7525 self._additional_params
7526 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7527 self
7528 }
7529
7530 /// Identifies the authorization scope for the method you are building.
7531 ///
7532 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7533 /// [`Scope::Full`].
7534 ///
7535 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7536 /// tokens for more than one scope.
7537 ///
7538 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7539 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7540 /// sufficient, a read-write scope will do as well.
7541 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseDevicePatchCall<'a, C>
7542 where
7543 St: AsRef<str>,
7544 {
7545 self._scopes.insert(String::from(scope.as_ref()));
7546 self
7547 }
7548 /// Identifies the authorization scope(s) for the method you are building.
7549 ///
7550 /// See [`Self::add_scope()`] for details.
7551 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseDevicePatchCall<'a, C>
7552 where
7553 I: IntoIterator<Item = St>,
7554 St: AsRef<str>,
7555 {
7556 self._scopes
7557 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7558 self
7559 }
7560
7561 /// Removes all scopes, and no default scope will be used either.
7562 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7563 /// for details).
7564 pub fn clear_scopes(mut self) -> EnterpriseDevicePatchCall<'a, C> {
7565 self._scopes.clear();
7566 self
7567 }
7568}
7569
7570/// Creates an enrollment token for a given enterprise. It's up to the caller's responsibility to manage the lifecycle of newly created tokens and deleting them when they're not intended to be used anymore.
7571///
7572/// A builder for the *enrollmentTokens.create* method supported by a *enterprise* resource.
7573/// It is not used directly, but through a [`EnterpriseMethods`] instance.
7574///
7575/// # Example
7576///
7577/// Instantiate a resource method builder
7578///
7579/// ```test_harness,no_run
7580/// # extern crate hyper;
7581/// # extern crate hyper_rustls;
7582/// # extern crate google_androidmanagement1 as androidmanagement1;
7583/// use androidmanagement1::api::EnrollmentToken;
7584/// # async fn dox() {
7585/// # use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7586///
7587/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7588/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7589/// # .with_native_roots()
7590/// # .unwrap()
7591/// # .https_only()
7592/// # .enable_http2()
7593/// # .build();
7594///
7595/// # let executor = hyper_util::rt::TokioExecutor::new();
7596/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7597/// # secret,
7598/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7599/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7600/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7601/// # ),
7602/// # ).build().await.unwrap();
7603///
7604/// # let client = hyper_util::client::legacy::Client::builder(
7605/// # hyper_util::rt::TokioExecutor::new()
7606/// # )
7607/// # .build(
7608/// # hyper_rustls::HttpsConnectorBuilder::new()
7609/// # .with_native_roots()
7610/// # .unwrap()
7611/// # .https_or_http()
7612/// # .enable_http2()
7613/// # .build()
7614/// # );
7615/// # let mut hub = AndroidManagement::new(client, auth);
7616/// // As the method needs a request, you would usually fill it with the desired information
7617/// // into the respective structure. Some of the parts shown here might not be applicable !
7618/// // Values shown here are possibly random and not representative !
7619/// let mut req = EnrollmentToken::default();
7620///
7621/// // You can configure optional parameters by calling the respective setters at will, and
7622/// // execute the final call using `doit()`.
7623/// // Values shown here are possibly random and not representative !
7624/// let result = hub.enterprises().enrollment_tokens_create(req, "parent")
7625/// .doit().await;
7626/// # }
7627/// ```
7628pub struct EnterpriseEnrollmentTokenCreateCall<'a, C>
7629where
7630 C: 'a,
7631{
7632 hub: &'a AndroidManagement<C>,
7633 _request: EnrollmentToken,
7634 _parent: String,
7635 _delegate: Option<&'a mut dyn common::Delegate>,
7636 _additional_params: HashMap<String, String>,
7637 _scopes: BTreeSet<String>,
7638}
7639
7640impl<'a, C> common::CallBuilder for EnterpriseEnrollmentTokenCreateCall<'a, C> {}
7641
7642impl<'a, C> EnterpriseEnrollmentTokenCreateCall<'a, C>
7643where
7644 C: common::Connector,
7645{
7646 /// Perform the operation you have build so far.
7647 pub async fn doit(mut self) -> common::Result<(common::Response, EnrollmentToken)> {
7648 use std::borrow::Cow;
7649 use std::io::{Read, Seek};
7650
7651 use common::{url::Params, ToParts};
7652 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7653
7654 let mut dd = common::DefaultDelegate;
7655 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7656 dlg.begin(common::MethodInfo {
7657 id: "androidmanagement.enterprises.enrollmentTokens.create",
7658 http_method: hyper::Method::POST,
7659 });
7660
7661 for &field in ["alt", "parent"].iter() {
7662 if self._additional_params.contains_key(field) {
7663 dlg.finished(false);
7664 return Err(common::Error::FieldClash(field));
7665 }
7666 }
7667
7668 let mut params = Params::with_capacity(4 + self._additional_params.len());
7669 params.push("parent", self._parent);
7670
7671 params.extend(self._additional_params.iter());
7672
7673 params.push("alt", "json");
7674 let mut url = self.hub._base_url.clone() + "v1/{+parent}/enrollmentTokens";
7675 if self._scopes.is_empty() {
7676 self._scopes.insert(Scope::Full.as_ref().to_string());
7677 }
7678
7679 #[allow(clippy::single_element_loop)]
7680 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7681 url = params.uri_replacement(url, param_name, find_this, true);
7682 }
7683 {
7684 let to_remove = ["parent"];
7685 params.remove_params(&to_remove);
7686 }
7687
7688 let url = params.parse_with_url(&url);
7689
7690 let mut json_mime_type = mime::APPLICATION_JSON;
7691 let mut request_value_reader = {
7692 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7693 common::remove_json_null_values(&mut value);
7694 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7695 serde_json::to_writer(&mut dst, &value).unwrap();
7696 dst
7697 };
7698 let request_size = request_value_reader
7699 .seek(std::io::SeekFrom::End(0))
7700 .unwrap();
7701 request_value_reader
7702 .seek(std::io::SeekFrom::Start(0))
7703 .unwrap();
7704
7705 loop {
7706 let token = match self
7707 .hub
7708 .auth
7709 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7710 .await
7711 {
7712 Ok(token) => token,
7713 Err(e) => match dlg.token(e) {
7714 Ok(token) => token,
7715 Err(e) => {
7716 dlg.finished(false);
7717 return Err(common::Error::MissingToken(e));
7718 }
7719 },
7720 };
7721 request_value_reader
7722 .seek(std::io::SeekFrom::Start(0))
7723 .unwrap();
7724 let mut req_result = {
7725 let client = &self.hub.client;
7726 dlg.pre_request();
7727 let mut req_builder = hyper::Request::builder()
7728 .method(hyper::Method::POST)
7729 .uri(url.as_str())
7730 .header(USER_AGENT, self.hub._user_agent.clone());
7731
7732 if let Some(token) = token.as_ref() {
7733 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7734 }
7735
7736 let request = req_builder
7737 .header(CONTENT_TYPE, json_mime_type.to_string())
7738 .header(CONTENT_LENGTH, request_size as u64)
7739 .body(common::to_body(
7740 request_value_reader.get_ref().clone().into(),
7741 ));
7742
7743 client.request(request.unwrap()).await
7744 };
7745
7746 match req_result {
7747 Err(err) => {
7748 if let common::Retry::After(d) = dlg.http_error(&err) {
7749 sleep(d).await;
7750 continue;
7751 }
7752 dlg.finished(false);
7753 return Err(common::Error::HttpError(err));
7754 }
7755 Ok(res) => {
7756 let (mut parts, body) = res.into_parts();
7757 let mut body = common::Body::new(body);
7758 if !parts.status.is_success() {
7759 let bytes = common::to_bytes(body).await.unwrap_or_default();
7760 let error = serde_json::from_str(&common::to_string(&bytes));
7761 let response = common::to_response(parts, bytes.into());
7762
7763 if let common::Retry::After(d) =
7764 dlg.http_failure(&response, error.as_ref().ok())
7765 {
7766 sleep(d).await;
7767 continue;
7768 }
7769
7770 dlg.finished(false);
7771
7772 return Err(match error {
7773 Ok(value) => common::Error::BadRequest(value),
7774 _ => common::Error::Failure(response),
7775 });
7776 }
7777 let response = {
7778 let bytes = common::to_bytes(body).await.unwrap_or_default();
7779 let encoded = common::to_string(&bytes);
7780 match serde_json::from_str(&encoded) {
7781 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7782 Err(error) => {
7783 dlg.response_json_decode_error(&encoded, &error);
7784 return Err(common::Error::JsonDecodeError(
7785 encoded.to_string(),
7786 error,
7787 ));
7788 }
7789 }
7790 };
7791
7792 dlg.finished(true);
7793 return Ok(response);
7794 }
7795 }
7796 }
7797 }
7798
7799 ///
7800 /// Sets the *request* property to the given value.
7801 ///
7802 /// Even though the property as already been set when instantiating this call,
7803 /// we provide this method for API completeness.
7804 pub fn request(
7805 mut self,
7806 new_value: EnrollmentToken,
7807 ) -> EnterpriseEnrollmentTokenCreateCall<'a, C> {
7808 self._request = new_value;
7809 self
7810 }
7811 /// The name of the enterprise in the form enterprises/{enterpriseId}.
7812 ///
7813 /// Sets the *parent* path property to the given value.
7814 ///
7815 /// Even though the property as already been set when instantiating this call,
7816 /// we provide this method for API completeness.
7817 pub fn parent(mut self, new_value: &str) -> EnterpriseEnrollmentTokenCreateCall<'a, C> {
7818 self._parent = new_value.to_string();
7819 self
7820 }
7821 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7822 /// while executing the actual API request.
7823 ///
7824 /// ````text
7825 /// It should be used to handle progress information, and to implement a certain level of resilience.
7826 /// ````
7827 ///
7828 /// Sets the *delegate* property to the given value.
7829 pub fn delegate(
7830 mut self,
7831 new_value: &'a mut dyn common::Delegate,
7832 ) -> EnterpriseEnrollmentTokenCreateCall<'a, C> {
7833 self._delegate = Some(new_value);
7834 self
7835 }
7836
7837 /// Set any additional parameter of the query string used in the request.
7838 /// It should be used to set parameters which are not yet available through their own
7839 /// setters.
7840 ///
7841 /// Please note that this method must not be used to set any of the known parameters
7842 /// which have their own setter method. If done anyway, the request will fail.
7843 ///
7844 /// # Additional Parameters
7845 ///
7846 /// * *$.xgafv* (query-string) - V1 error format.
7847 /// * *access_token* (query-string) - OAuth access token.
7848 /// * *alt* (query-string) - Data format for response.
7849 /// * *callback* (query-string) - JSONP
7850 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7851 /// * *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.
7852 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7853 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7854 /// * *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.
7855 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7856 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7857 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseEnrollmentTokenCreateCall<'a, C>
7858 where
7859 T: AsRef<str>,
7860 {
7861 self._additional_params
7862 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7863 self
7864 }
7865
7866 /// Identifies the authorization scope for the method you are building.
7867 ///
7868 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7869 /// [`Scope::Full`].
7870 ///
7871 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7872 /// tokens for more than one scope.
7873 ///
7874 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7875 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7876 /// sufficient, a read-write scope will do as well.
7877 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseEnrollmentTokenCreateCall<'a, C>
7878 where
7879 St: AsRef<str>,
7880 {
7881 self._scopes.insert(String::from(scope.as_ref()));
7882 self
7883 }
7884 /// Identifies the authorization scope(s) for the method you are building.
7885 ///
7886 /// See [`Self::add_scope()`] for details.
7887 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseEnrollmentTokenCreateCall<'a, C>
7888 where
7889 I: IntoIterator<Item = St>,
7890 St: AsRef<str>,
7891 {
7892 self._scopes
7893 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7894 self
7895 }
7896
7897 /// Removes all scopes, and no default scope will be used either.
7898 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7899 /// for details).
7900 pub fn clear_scopes(mut self) -> EnterpriseEnrollmentTokenCreateCall<'a, C> {
7901 self._scopes.clear();
7902 self
7903 }
7904}
7905
7906/// Deletes an enrollment token. This operation invalidates the token, preventing its future use.
7907///
7908/// A builder for the *enrollmentTokens.delete* method supported by a *enterprise* resource.
7909/// It is not used directly, but through a [`EnterpriseMethods`] instance.
7910///
7911/// # Example
7912///
7913/// Instantiate a resource method builder
7914///
7915/// ```test_harness,no_run
7916/// # extern crate hyper;
7917/// # extern crate hyper_rustls;
7918/// # extern crate google_androidmanagement1 as androidmanagement1;
7919/// # async fn dox() {
7920/// # use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7921///
7922/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7923/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7924/// # .with_native_roots()
7925/// # .unwrap()
7926/// # .https_only()
7927/// # .enable_http2()
7928/// # .build();
7929///
7930/// # let executor = hyper_util::rt::TokioExecutor::new();
7931/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7932/// # secret,
7933/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7934/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7935/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7936/// # ),
7937/// # ).build().await.unwrap();
7938///
7939/// # let client = hyper_util::client::legacy::Client::builder(
7940/// # hyper_util::rt::TokioExecutor::new()
7941/// # )
7942/// # .build(
7943/// # hyper_rustls::HttpsConnectorBuilder::new()
7944/// # .with_native_roots()
7945/// # .unwrap()
7946/// # .https_or_http()
7947/// # .enable_http2()
7948/// # .build()
7949/// # );
7950/// # let mut hub = AndroidManagement::new(client, auth);
7951/// // You can configure optional parameters by calling the respective setters at will, and
7952/// // execute the final call using `doit()`.
7953/// // Values shown here are possibly random and not representative !
7954/// let result = hub.enterprises().enrollment_tokens_delete("name")
7955/// .doit().await;
7956/// # }
7957/// ```
7958pub struct EnterpriseEnrollmentTokenDeleteCall<'a, C>
7959where
7960 C: 'a,
7961{
7962 hub: &'a AndroidManagement<C>,
7963 _name: String,
7964 _delegate: Option<&'a mut dyn common::Delegate>,
7965 _additional_params: HashMap<String, String>,
7966 _scopes: BTreeSet<String>,
7967}
7968
7969impl<'a, C> common::CallBuilder for EnterpriseEnrollmentTokenDeleteCall<'a, C> {}
7970
7971impl<'a, C> EnterpriseEnrollmentTokenDeleteCall<'a, C>
7972where
7973 C: common::Connector,
7974{
7975 /// Perform the operation you have build so far.
7976 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
7977 use std::borrow::Cow;
7978 use std::io::{Read, Seek};
7979
7980 use common::{url::Params, ToParts};
7981 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7982
7983 let mut dd = common::DefaultDelegate;
7984 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7985 dlg.begin(common::MethodInfo {
7986 id: "androidmanagement.enterprises.enrollmentTokens.delete",
7987 http_method: hyper::Method::DELETE,
7988 });
7989
7990 for &field in ["alt", "name"].iter() {
7991 if self._additional_params.contains_key(field) {
7992 dlg.finished(false);
7993 return Err(common::Error::FieldClash(field));
7994 }
7995 }
7996
7997 let mut params = Params::with_capacity(3 + self._additional_params.len());
7998 params.push("name", self._name);
7999
8000 params.extend(self._additional_params.iter());
8001
8002 params.push("alt", "json");
8003 let mut url = self.hub._base_url.clone() + "v1/{+name}";
8004 if self._scopes.is_empty() {
8005 self._scopes.insert(Scope::Full.as_ref().to_string());
8006 }
8007
8008 #[allow(clippy::single_element_loop)]
8009 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8010 url = params.uri_replacement(url, param_name, find_this, true);
8011 }
8012 {
8013 let to_remove = ["name"];
8014 params.remove_params(&to_remove);
8015 }
8016
8017 let url = params.parse_with_url(&url);
8018
8019 loop {
8020 let token = match self
8021 .hub
8022 .auth
8023 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8024 .await
8025 {
8026 Ok(token) => token,
8027 Err(e) => match dlg.token(e) {
8028 Ok(token) => token,
8029 Err(e) => {
8030 dlg.finished(false);
8031 return Err(common::Error::MissingToken(e));
8032 }
8033 },
8034 };
8035 let mut req_result = {
8036 let client = &self.hub.client;
8037 dlg.pre_request();
8038 let mut req_builder = hyper::Request::builder()
8039 .method(hyper::Method::DELETE)
8040 .uri(url.as_str())
8041 .header(USER_AGENT, self.hub._user_agent.clone());
8042
8043 if let Some(token) = token.as_ref() {
8044 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8045 }
8046
8047 let request = req_builder
8048 .header(CONTENT_LENGTH, 0_u64)
8049 .body(common::to_body::<String>(None));
8050
8051 client.request(request.unwrap()).await
8052 };
8053
8054 match req_result {
8055 Err(err) => {
8056 if let common::Retry::After(d) = dlg.http_error(&err) {
8057 sleep(d).await;
8058 continue;
8059 }
8060 dlg.finished(false);
8061 return Err(common::Error::HttpError(err));
8062 }
8063 Ok(res) => {
8064 let (mut parts, body) = res.into_parts();
8065 let mut body = common::Body::new(body);
8066 if !parts.status.is_success() {
8067 let bytes = common::to_bytes(body).await.unwrap_or_default();
8068 let error = serde_json::from_str(&common::to_string(&bytes));
8069 let response = common::to_response(parts, bytes.into());
8070
8071 if let common::Retry::After(d) =
8072 dlg.http_failure(&response, error.as_ref().ok())
8073 {
8074 sleep(d).await;
8075 continue;
8076 }
8077
8078 dlg.finished(false);
8079
8080 return Err(match error {
8081 Ok(value) => common::Error::BadRequest(value),
8082 _ => common::Error::Failure(response),
8083 });
8084 }
8085 let response = {
8086 let bytes = common::to_bytes(body).await.unwrap_or_default();
8087 let encoded = common::to_string(&bytes);
8088 match serde_json::from_str(&encoded) {
8089 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8090 Err(error) => {
8091 dlg.response_json_decode_error(&encoded, &error);
8092 return Err(common::Error::JsonDecodeError(
8093 encoded.to_string(),
8094 error,
8095 ));
8096 }
8097 }
8098 };
8099
8100 dlg.finished(true);
8101 return Ok(response);
8102 }
8103 }
8104 }
8105 }
8106
8107 /// The name of the enrollment token in the form enterprises/{enterpriseId}/enrollmentTokens/{enrollmentTokenId}.
8108 ///
8109 /// Sets the *name* path property to the given value.
8110 ///
8111 /// Even though the property as already been set when instantiating this call,
8112 /// we provide this method for API completeness.
8113 pub fn name(mut self, new_value: &str) -> EnterpriseEnrollmentTokenDeleteCall<'a, C> {
8114 self._name = new_value.to_string();
8115 self
8116 }
8117 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8118 /// while executing the actual API request.
8119 ///
8120 /// ````text
8121 /// It should be used to handle progress information, and to implement a certain level of resilience.
8122 /// ````
8123 ///
8124 /// Sets the *delegate* property to the given value.
8125 pub fn delegate(
8126 mut self,
8127 new_value: &'a mut dyn common::Delegate,
8128 ) -> EnterpriseEnrollmentTokenDeleteCall<'a, C> {
8129 self._delegate = Some(new_value);
8130 self
8131 }
8132
8133 /// Set any additional parameter of the query string used in the request.
8134 /// It should be used to set parameters which are not yet available through their own
8135 /// setters.
8136 ///
8137 /// Please note that this method must not be used to set any of the known parameters
8138 /// which have their own setter method. If done anyway, the request will fail.
8139 ///
8140 /// # Additional Parameters
8141 ///
8142 /// * *$.xgafv* (query-string) - V1 error format.
8143 /// * *access_token* (query-string) - OAuth access token.
8144 /// * *alt* (query-string) - Data format for response.
8145 /// * *callback* (query-string) - JSONP
8146 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8147 /// * *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.
8148 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8149 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8150 /// * *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.
8151 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8152 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8153 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseEnrollmentTokenDeleteCall<'a, C>
8154 where
8155 T: AsRef<str>,
8156 {
8157 self._additional_params
8158 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8159 self
8160 }
8161
8162 /// Identifies the authorization scope for the method you are building.
8163 ///
8164 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8165 /// [`Scope::Full`].
8166 ///
8167 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8168 /// tokens for more than one scope.
8169 ///
8170 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8171 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8172 /// sufficient, a read-write scope will do as well.
8173 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseEnrollmentTokenDeleteCall<'a, C>
8174 where
8175 St: AsRef<str>,
8176 {
8177 self._scopes.insert(String::from(scope.as_ref()));
8178 self
8179 }
8180 /// Identifies the authorization scope(s) for the method you are building.
8181 ///
8182 /// See [`Self::add_scope()`] for details.
8183 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseEnrollmentTokenDeleteCall<'a, C>
8184 where
8185 I: IntoIterator<Item = St>,
8186 St: AsRef<str>,
8187 {
8188 self._scopes
8189 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8190 self
8191 }
8192
8193 /// Removes all scopes, and no default scope will be used either.
8194 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8195 /// for details).
8196 pub fn clear_scopes(mut self) -> EnterpriseEnrollmentTokenDeleteCall<'a, C> {
8197 self._scopes.clear();
8198 self
8199 }
8200}
8201
8202/// Gets an active, unexpired enrollment token. A partial view of the enrollment token is returned. Only the following fields are populated: name, expirationTimestamp, allowPersonalUsage, value, qrCode. This method is meant to help manage active enrollment tokens lifecycle. For security reasons, it's recommended to delete active enrollment tokens as soon as they're not intended to be used anymore.
8203///
8204/// A builder for the *enrollmentTokens.get* method supported by a *enterprise* resource.
8205/// It is not used directly, but through a [`EnterpriseMethods`] instance.
8206///
8207/// # Example
8208///
8209/// Instantiate a resource method builder
8210///
8211/// ```test_harness,no_run
8212/// # extern crate hyper;
8213/// # extern crate hyper_rustls;
8214/// # extern crate google_androidmanagement1 as androidmanagement1;
8215/// # async fn dox() {
8216/// # use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8217///
8218/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8219/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8220/// # .with_native_roots()
8221/// # .unwrap()
8222/// # .https_only()
8223/// # .enable_http2()
8224/// # .build();
8225///
8226/// # let executor = hyper_util::rt::TokioExecutor::new();
8227/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8228/// # secret,
8229/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8230/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8231/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8232/// # ),
8233/// # ).build().await.unwrap();
8234///
8235/// # let client = hyper_util::client::legacy::Client::builder(
8236/// # hyper_util::rt::TokioExecutor::new()
8237/// # )
8238/// # .build(
8239/// # hyper_rustls::HttpsConnectorBuilder::new()
8240/// # .with_native_roots()
8241/// # .unwrap()
8242/// # .https_or_http()
8243/// # .enable_http2()
8244/// # .build()
8245/// # );
8246/// # let mut hub = AndroidManagement::new(client, auth);
8247/// // You can configure optional parameters by calling the respective setters at will, and
8248/// // execute the final call using `doit()`.
8249/// // Values shown here are possibly random and not representative !
8250/// let result = hub.enterprises().enrollment_tokens_get("name")
8251/// .doit().await;
8252/// # }
8253/// ```
8254pub struct EnterpriseEnrollmentTokenGetCall<'a, C>
8255where
8256 C: 'a,
8257{
8258 hub: &'a AndroidManagement<C>,
8259 _name: String,
8260 _delegate: Option<&'a mut dyn common::Delegate>,
8261 _additional_params: HashMap<String, String>,
8262 _scopes: BTreeSet<String>,
8263}
8264
8265impl<'a, C> common::CallBuilder for EnterpriseEnrollmentTokenGetCall<'a, C> {}
8266
8267impl<'a, C> EnterpriseEnrollmentTokenGetCall<'a, C>
8268where
8269 C: common::Connector,
8270{
8271 /// Perform the operation you have build so far.
8272 pub async fn doit(mut self) -> common::Result<(common::Response, EnrollmentToken)> {
8273 use std::borrow::Cow;
8274 use std::io::{Read, Seek};
8275
8276 use common::{url::Params, ToParts};
8277 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8278
8279 let mut dd = common::DefaultDelegate;
8280 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8281 dlg.begin(common::MethodInfo {
8282 id: "androidmanagement.enterprises.enrollmentTokens.get",
8283 http_method: hyper::Method::GET,
8284 });
8285
8286 for &field in ["alt", "name"].iter() {
8287 if self._additional_params.contains_key(field) {
8288 dlg.finished(false);
8289 return Err(common::Error::FieldClash(field));
8290 }
8291 }
8292
8293 let mut params = Params::with_capacity(3 + self._additional_params.len());
8294 params.push("name", self._name);
8295
8296 params.extend(self._additional_params.iter());
8297
8298 params.push("alt", "json");
8299 let mut url = self.hub._base_url.clone() + "v1/{+name}";
8300 if self._scopes.is_empty() {
8301 self._scopes.insert(Scope::Full.as_ref().to_string());
8302 }
8303
8304 #[allow(clippy::single_element_loop)]
8305 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8306 url = params.uri_replacement(url, param_name, find_this, true);
8307 }
8308 {
8309 let to_remove = ["name"];
8310 params.remove_params(&to_remove);
8311 }
8312
8313 let url = params.parse_with_url(&url);
8314
8315 loop {
8316 let token = match self
8317 .hub
8318 .auth
8319 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8320 .await
8321 {
8322 Ok(token) => token,
8323 Err(e) => match dlg.token(e) {
8324 Ok(token) => token,
8325 Err(e) => {
8326 dlg.finished(false);
8327 return Err(common::Error::MissingToken(e));
8328 }
8329 },
8330 };
8331 let mut req_result = {
8332 let client = &self.hub.client;
8333 dlg.pre_request();
8334 let mut req_builder = hyper::Request::builder()
8335 .method(hyper::Method::GET)
8336 .uri(url.as_str())
8337 .header(USER_AGENT, self.hub._user_agent.clone());
8338
8339 if let Some(token) = token.as_ref() {
8340 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8341 }
8342
8343 let request = req_builder
8344 .header(CONTENT_LENGTH, 0_u64)
8345 .body(common::to_body::<String>(None));
8346
8347 client.request(request.unwrap()).await
8348 };
8349
8350 match req_result {
8351 Err(err) => {
8352 if let common::Retry::After(d) = dlg.http_error(&err) {
8353 sleep(d).await;
8354 continue;
8355 }
8356 dlg.finished(false);
8357 return Err(common::Error::HttpError(err));
8358 }
8359 Ok(res) => {
8360 let (mut parts, body) = res.into_parts();
8361 let mut body = common::Body::new(body);
8362 if !parts.status.is_success() {
8363 let bytes = common::to_bytes(body).await.unwrap_or_default();
8364 let error = serde_json::from_str(&common::to_string(&bytes));
8365 let response = common::to_response(parts, bytes.into());
8366
8367 if let common::Retry::After(d) =
8368 dlg.http_failure(&response, error.as_ref().ok())
8369 {
8370 sleep(d).await;
8371 continue;
8372 }
8373
8374 dlg.finished(false);
8375
8376 return Err(match error {
8377 Ok(value) => common::Error::BadRequest(value),
8378 _ => common::Error::Failure(response),
8379 });
8380 }
8381 let response = {
8382 let bytes = common::to_bytes(body).await.unwrap_or_default();
8383 let encoded = common::to_string(&bytes);
8384 match serde_json::from_str(&encoded) {
8385 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8386 Err(error) => {
8387 dlg.response_json_decode_error(&encoded, &error);
8388 return Err(common::Error::JsonDecodeError(
8389 encoded.to_string(),
8390 error,
8391 ));
8392 }
8393 }
8394 };
8395
8396 dlg.finished(true);
8397 return Ok(response);
8398 }
8399 }
8400 }
8401 }
8402
8403 /// Required. The name of the enrollment token in the form enterprises/{enterpriseId}/enrollmentTokens/{enrollmentTokenId}.
8404 ///
8405 /// Sets the *name* path property to the given value.
8406 ///
8407 /// Even though the property as already been set when instantiating this call,
8408 /// we provide this method for API completeness.
8409 pub fn name(mut self, new_value: &str) -> EnterpriseEnrollmentTokenGetCall<'a, C> {
8410 self._name = new_value.to_string();
8411 self
8412 }
8413 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8414 /// while executing the actual API request.
8415 ///
8416 /// ````text
8417 /// It should be used to handle progress information, and to implement a certain level of resilience.
8418 /// ````
8419 ///
8420 /// Sets the *delegate* property to the given value.
8421 pub fn delegate(
8422 mut self,
8423 new_value: &'a mut dyn common::Delegate,
8424 ) -> EnterpriseEnrollmentTokenGetCall<'a, C> {
8425 self._delegate = Some(new_value);
8426 self
8427 }
8428
8429 /// Set any additional parameter of the query string used in the request.
8430 /// It should be used to set parameters which are not yet available through their own
8431 /// setters.
8432 ///
8433 /// Please note that this method must not be used to set any of the known parameters
8434 /// which have their own setter method. If done anyway, the request will fail.
8435 ///
8436 /// # Additional Parameters
8437 ///
8438 /// * *$.xgafv* (query-string) - V1 error format.
8439 /// * *access_token* (query-string) - OAuth access token.
8440 /// * *alt* (query-string) - Data format for response.
8441 /// * *callback* (query-string) - JSONP
8442 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8443 /// * *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.
8444 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8445 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8446 /// * *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.
8447 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8448 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8449 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseEnrollmentTokenGetCall<'a, C>
8450 where
8451 T: AsRef<str>,
8452 {
8453 self._additional_params
8454 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8455 self
8456 }
8457
8458 /// Identifies the authorization scope for the method you are building.
8459 ///
8460 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8461 /// [`Scope::Full`].
8462 ///
8463 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8464 /// tokens for more than one scope.
8465 ///
8466 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8467 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8468 /// sufficient, a read-write scope will do as well.
8469 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseEnrollmentTokenGetCall<'a, C>
8470 where
8471 St: AsRef<str>,
8472 {
8473 self._scopes.insert(String::from(scope.as_ref()));
8474 self
8475 }
8476 /// Identifies the authorization scope(s) for the method you are building.
8477 ///
8478 /// See [`Self::add_scope()`] for details.
8479 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseEnrollmentTokenGetCall<'a, C>
8480 where
8481 I: IntoIterator<Item = St>,
8482 St: AsRef<str>,
8483 {
8484 self._scopes
8485 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8486 self
8487 }
8488
8489 /// Removes all scopes, and no default scope will be used either.
8490 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8491 /// for details).
8492 pub fn clear_scopes(mut self) -> EnterpriseEnrollmentTokenGetCall<'a, C> {
8493 self._scopes.clear();
8494 self
8495 }
8496}
8497
8498/// Lists active, unexpired enrollment tokens for a given enterprise. The list items contain only a partial view of EnrollmentToken object. Only the following fields are populated: name, expirationTimestamp, allowPersonalUsage, value, qrCode. This method is meant to help manage active enrollment tokens lifecycle. For security reasons, it's recommended to delete active enrollment tokens as soon as they're not intended to be used anymore.
8499///
8500/// A builder for the *enrollmentTokens.list* method supported by a *enterprise* resource.
8501/// It is not used directly, but through a [`EnterpriseMethods`] instance.
8502///
8503/// # Example
8504///
8505/// Instantiate a resource method builder
8506///
8507/// ```test_harness,no_run
8508/// # extern crate hyper;
8509/// # extern crate hyper_rustls;
8510/// # extern crate google_androidmanagement1 as androidmanagement1;
8511/// # async fn dox() {
8512/// # use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8513///
8514/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8515/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8516/// # .with_native_roots()
8517/// # .unwrap()
8518/// # .https_only()
8519/// # .enable_http2()
8520/// # .build();
8521///
8522/// # let executor = hyper_util::rt::TokioExecutor::new();
8523/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8524/// # secret,
8525/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8526/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8527/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8528/// # ),
8529/// # ).build().await.unwrap();
8530///
8531/// # let client = hyper_util::client::legacy::Client::builder(
8532/// # hyper_util::rt::TokioExecutor::new()
8533/// # )
8534/// # .build(
8535/// # hyper_rustls::HttpsConnectorBuilder::new()
8536/// # .with_native_roots()
8537/// # .unwrap()
8538/// # .https_or_http()
8539/// # .enable_http2()
8540/// # .build()
8541/// # );
8542/// # let mut hub = AndroidManagement::new(client, auth);
8543/// // You can configure optional parameters by calling the respective setters at will, and
8544/// // execute the final call using `doit()`.
8545/// // Values shown here are possibly random and not representative !
8546/// let result = hub.enterprises().enrollment_tokens_list("parent")
8547/// .page_token("sed")
8548/// .page_size(-61)
8549/// .doit().await;
8550/// # }
8551/// ```
8552pub struct EnterpriseEnrollmentTokenListCall<'a, C>
8553where
8554 C: 'a,
8555{
8556 hub: &'a AndroidManagement<C>,
8557 _parent: String,
8558 _page_token: Option<String>,
8559 _page_size: Option<i32>,
8560 _delegate: Option<&'a mut dyn common::Delegate>,
8561 _additional_params: HashMap<String, String>,
8562 _scopes: BTreeSet<String>,
8563}
8564
8565impl<'a, C> common::CallBuilder for EnterpriseEnrollmentTokenListCall<'a, C> {}
8566
8567impl<'a, C> EnterpriseEnrollmentTokenListCall<'a, C>
8568where
8569 C: common::Connector,
8570{
8571 /// Perform the operation you have build so far.
8572 pub async fn doit(
8573 mut self,
8574 ) -> common::Result<(common::Response, ListEnrollmentTokensResponse)> {
8575 use std::borrow::Cow;
8576 use std::io::{Read, Seek};
8577
8578 use common::{url::Params, ToParts};
8579 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8580
8581 let mut dd = common::DefaultDelegate;
8582 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8583 dlg.begin(common::MethodInfo {
8584 id: "androidmanagement.enterprises.enrollmentTokens.list",
8585 http_method: hyper::Method::GET,
8586 });
8587
8588 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
8589 if self._additional_params.contains_key(field) {
8590 dlg.finished(false);
8591 return Err(common::Error::FieldClash(field));
8592 }
8593 }
8594
8595 let mut params = Params::with_capacity(5 + self._additional_params.len());
8596 params.push("parent", self._parent);
8597 if let Some(value) = self._page_token.as_ref() {
8598 params.push("pageToken", value);
8599 }
8600 if let Some(value) = self._page_size.as_ref() {
8601 params.push("pageSize", value.to_string());
8602 }
8603
8604 params.extend(self._additional_params.iter());
8605
8606 params.push("alt", "json");
8607 let mut url = self.hub._base_url.clone() + "v1/{+parent}/enrollmentTokens";
8608 if self._scopes.is_empty() {
8609 self._scopes.insert(Scope::Full.as_ref().to_string());
8610 }
8611
8612 #[allow(clippy::single_element_loop)]
8613 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8614 url = params.uri_replacement(url, param_name, find_this, true);
8615 }
8616 {
8617 let to_remove = ["parent"];
8618 params.remove_params(&to_remove);
8619 }
8620
8621 let url = params.parse_with_url(&url);
8622
8623 loop {
8624 let token = match self
8625 .hub
8626 .auth
8627 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8628 .await
8629 {
8630 Ok(token) => token,
8631 Err(e) => match dlg.token(e) {
8632 Ok(token) => token,
8633 Err(e) => {
8634 dlg.finished(false);
8635 return Err(common::Error::MissingToken(e));
8636 }
8637 },
8638 };
8639 let mut req_result = {
8640 let client = &self.hub.client;
8641 dlg.pre_request();
8642 let mut req_builder = hyper::Request::builder()
8643 .method(hyper::Method::GET)
8644 .uri(url.as_str())
8645 .header(USER_AGENT, self.hub._user_agent.clone());
8646
8647 if let Some(token) = token.as_ref() {
8648 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8649 }
8650
8651 let request = req_builder
8652 .header(CONTENT_LENGTH, 0_u64)
8653 .body(common::to_body::<String>(None));
8654
8655 client.request(request.unwrap()).await
8656 };
8657
8658 match req_result {
8659 Err(err) => {
8660 if let common::Retry::After(d) = dlg.http_error(&err) {
8661 sleep(d).await;
8662 continue;
8663 }
8664 dlg.finished(false);
8665 return Err(common::Error::HttpError(err));
8666 }
8667 Ok(res) => {
8668 let (mut parts, body) = res.into_parts();
8669 let mut body = common::Body::new(body);
8670 if !parts.status.is_success() {
8671 let bytes = common::to_bytes(body).await.unwrap_or_default();
8672 let error = serde_json::from_str(&common::to_string(&bytes));
8673 let response = common::to_response(parts, bytes.into());
8674
8675 if let common::Retry::After(d) =
8676 dlg.http_failure(&response, error.as_ref().ok())
8677 {
8678 sleep(d).await;
8679 continue;
8680 }
8681
8682 dlg.finished(false);
8683
8684 return Err(match error {
8685 Ok(value) => common::Error::BadRequest(value),
8686 _ => common::Error::Failure(response),
8687 });
8688 }
8689 let response = {
8690 let bytes = common::to_bytes(body).await.unwrap_or_default();
8691 let encoded = common::to_string(&bytes);
8692 match serde_json::from_str(&encoded) {
8693 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8694 Err(error) => {
8695 dlg.response_json_decode_error(&encoded, &error);
8696 return Err(common::Error::JsonDecodeError(
8697 encoded.to_string(),
8698 error,
8699 ));
8700 }
8701 }
8702 };
8703
8704 dlg.finished(true);
8705 return Ok(response);
8706 }
8707 }
8708 }
8709 }
8710
8711 /// Required. The name of the enterprise in the form enterprises/{enterpriseId}.
8712 ///
8713 /// Sets the *parent* path property to the given value.
8714 ///
8715 /// Even though the property as already been set when instantiating this call,
8716 /// we provide this method for API completeness.
8717 pub fn parent(mut self, new_value: &str) -> EnterpriseEnrollmentTokenListCall<'a, C> {
8718 self._parent = new_value.to_string();
8719 self
8720 }
8721 /// A token identifying a page of results returned by the server.
8722 ///
8723 /// Sets the *page token* query property to the given value.
8724 pub fn page_token(mut self, new_value: &str) -> EnterpriseEnrollmentTokenListCall<'a, C> {
8725 self._page_token = Some(new_value.to_string());
8726 self
8727 }
8728 /// The requested page size. The service may return fewer than this value. If unspecified, at most 10 items will be returned. The maximum value is 100; values above 100 will be coerced to 100.
8729 ///
8730 /// Sets the *page size* query property to the given value.
8731 pub fn page_size(mut self, new_value: i32) -> EnterpriseEnrollmentTokenListCall<'a, C> {
8732 self._page_size = Some(new_value);
8733 self
8734 }
8735 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8736 /// while executing the actual API request.
8737 ///
8738 /// ````text
8739 /// It should be used to handle progress information, and to implement a certain level of resilience.
8740 /// ````
8741 ///
8742 /// Sets the *delegate* property to the given value.
8743 pub fn delegate(
8744 mut self,
8745 new_value: &'a mut dyn common::Delegate,
8746 ) -> EnterpriseEnrollmentTokenListCall<'a, C> {
8747 self._delegate = Some(new_value);
8748 self
8749 }
8750
8751 /// Set any additional parameter of the query string used in the request.
8752 /// It should be used to set parameters which are not yet available through their own
8753 /// setters.
8754 ///
8755 /// Please note that this method must not be used to set any of the known parameters
8756 /// which have their own setter method. If done anyway, the request will fail.
8757 ///
8758 /// # Additional Parameters
8759 ///
8760 /// * *$.xgafv* (query-string) - V1 error format.
8761 /// * *access_token* (query-string) - OAuth access token.
8762 /// * *alt* (query-string) - Data format for response.
8763 /// * *callback* (query-string) - JSONP
8764 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8765 /// * *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.
8766 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8767 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8768 /// * *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.
8769 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8770 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8771 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseEnrollmentTokenListCall<'a, C>
8772 where
8773 T: AsRef<str>,
8774 {
8775 self._additional_params
8776 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8777 self
8778 }
8779
8780 /// Identifies the authorization scope for the method you are building.
8781 ///
8782 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8783 /// [`Scope::Full`].
8784 ///
8785 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8786 /// tokens for more than one scope.
8787 ///
8788 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8789 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8790 /// sufficient, a read-write scope will do as well.
8791 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseEnrollmentTokenListCall<'a, C>
8792 where
8793 St: AsRef<str>,
8794 {
8795 self._scopes.insert(String::from(scope.as_ref()));
8796 self
8797 }
8798 /// Identifies the authorization scope(s) for the method you are building.
8799 ///
8800 /// See [`Self::add_scope()`] for details.
8801 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseEnrollmentTokenListCall<'a, C>
8802 where
8803 I: IntoIterator<Item = St>,
8804 St: AsRef<str>,
8805 {
8806 self._scopes
8807 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8808 self
8809 }
8810
8811 /// Removes all scopes, and no default scope will be used either.
8812 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8813 /// for details).
8814 pub fn clear_scopes(mut self) -> EnterpriseEnrollmentTokenListCall<'a, C> {
8815 self._scopes.clear();
8816 self
8817 }
8818}
8819
8820/// Creates a migration token, to migrate an existing device from being managed by the EMM's Device Policy Controller (DPC) to being managed by the Android Management API. See the guide (https://developers.google.com/android/management/dpc-migration) for more details.
8821///
8822/// A builder for the *migrationTokens.create* method supported by a *enterprise* resource.
8823/// It is not used directly, but through a [`EnterpriseMethods`] instance.
8824///
8825/// # Example
8826///
8827/// Instantiate a resource method builder
8828///
8829/// ```test_harness,no_run
8830/// # extern crate hyper;
8831/// # extern crate hyper_rustls;
8832/// # extern crate google_androidmanagement1 as androidmanagement1;
8833/// use androidmanagement1::api::MigrationToken;
8834/// # async fn dox() {
8835/// # use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8836///
8837/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8838/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8839/// # .with_native_roots()
8840/// # .unwrap()
8841/// # .https_only()
8842/// # .enable_http2()
8843/// # .build();
8844///
8845/// # let executor = hyper_util::rt::TokioExecutor::new();
8846/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8847/// # secret,
8848/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8849/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8850/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8851/// # ),
8852/// # ).build().await.unwrap();
8853///
8854/// # let client = hyper_util::client::legacy::Client::builder(
8855/// # hyper_util::rt::TokioExecutor::new()
8856/// # )
8857/// # .build(
8858/// # hyper_rustls::HttpsConnectorBuilder::new()
8859/// # .with_native_roots()
8860/// # .unwrap()
8861/// # .https_or_http()
8862/// # .enable_http2()
8863/// # .build()
8864/// # );
8865/// # let mut hub = AndroidManagement::new(client, auth);
8866/// // As the method needs a request, you would usually fill it with the desired information
8867/// // into the respective structure. Some of the parts shown here might not be applicable !
8868/// // Values shown here are possibly random and not representative !
8869/// let mut req = MigrationToken::default();
8870///
8871/// // You can configure optional parameters by calling the respective setters at will, and
8872/// // execute the final call using `doit()`.
8873/// // Values shown here are possibly random and not representative !
8874/// let result = hub.enterprises().migration_tokens_create(req, "parent")
8875/// .doit().await;
8876/// # }
8877/// ```
8878pub struct EnterpriseMigrationTokenCreateCall<'a, C>
8879where
8880 C: 'a,
8881{
8882 hub: &'a AndroidManagement<C>,
8883 _request: MigrationToken,
8884 _parent: String,
8885 _delegate: Option<&'a mut dyn common::Delegate>,
8886 _additional_params: HashMap<String, String>,
8887 _scopes: BTreeSet<String>,
8888}
8889
8890impl<'a, C> common::CallBuilder for EnterpriseMigrationTokenCreateCall<'a, C> {}
8891
8892impl<'a, C> EnterpriseMigrationTokenCreateCall<'a, C>
8893where
8894 C: common::Connector,
8895{
8896 /// Perform the operation you have build so far.
8897 pub async fn doit(mut self) -> common::Result<(common::Response, MigrationToken)> {
8898 use std::borrow::Cow;
8899 use std::io::{Read, Seek};
8900
8901 use common::{url::Params, ToParts};
8902 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8903
8904 let mut dd = common::DefaultDelegate;
8905 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8906 dlg.begin(common::MethodInfo {
8907 id: "androidmanagement.enterprises.migrationTokens.create",
8908 http_method: hyper::Method::POST,
8909 });
8910
8911 for &field in ["alt", "parent"].iter() {
8912 if self._additional_params.contains_key(field) {
8913 dlg.finished(false);
8914 return Err(common::Error::FieldClash(field));
8915 }
8916 }
8917
8918 let mut params = Params::with_capacity(4 + self._additional_params.len());
8919 params.push("parent", self._parent);
8920
8921 params.extend(self._additional_params.iter());
8922
8923 params.push("alt", "json");
8924 let mut url = self.hub._base_url.clone() + "v1/{+parent}/migrationTokens";
8925 if self._scopes.is_empty() {
8926 self._scopes.insert(Scope::Full.as_ref().to_string());
8927 }
8928
8929 #[allow(clippy::single_element_loop)]
8930 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8931 url = params.uri_replacement(url, param_name, find_this, true);
8932 }
8933 {
8934 let to_remove = ["parent"];
8935 params.remove_params(&to_remove);
8936 }
8937
8938 let url = params.parse_with_url(&url);
8939
8940 let mut json_mime_type = mime::APPLICATION_JSON;
8941 let mut request_value_reader = {
8942 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8943 common::remove_json_null_values(&mut value);
8944 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8945 serde_json::to_writer(&mut dst, &value).unwrap();
8946 dst
8947 };
8948 let request_size = request_value_reader
8949 .seek(std::io::SeekFrom::End(0))
8950 .unwrap();
8951 request_value_reader
8952 .seek(std::io::SeekFrom::Start(0))
8953 .unwrap();
8954
8955 loop {
8956 let token = match self
8957 .hub
8958 .auth
8959 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8960 .await
8961 {
8962 Ok(token) => token,
8963 Err(e) => match dlg.token(e) {
8964 Ok(token) => token,
8965 Err(e) => {
8966 dlg.finished(false);
8967 return Err(common::Error::MissingToken(e));
8968 }
8969 },
8970 };
8971 request_value_reader
8972 .seek(std::io::SeekFrom::Start(0))
8973 .unwrap();
8974 let mut req_result = {
8975 let client = &self.hub.client;
8976 dlg.pre_request();
8977 let mut req_builder = hyper::Request::builder()
8978 .method(hyper::Method::POST)
8979 .uri(url.as_str())
8980 .header(USER_AGENT, self.hub._user_agent.clone());
8981
8982 if let Some(token) = token.as_ref() {
8983 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8984 }
8985
8986 let request = req_builder
8987 .header(CONTENT_TYPE, json_mime_type.to_string())
8988 .header(CONTENT_LENGTH, request_size as u64)
8989 .body(common::to_body(
8990 request_value_reader.get_ref().clone().into(),
8991 ));
8992
8993 client.request(request.unwrap()).await
8994 };
8995
8996 match req_result {
8997 Err(err) => {
8998 if let common::Retry::After(d) = dlg.http_error(&err) {
8999 sleep(d).await;
9000 continue;
9001 }
9002 dlg.finished(false);
9003 return Err(common::Error::HttpError(err));
9004 }
9005 Ok(res) => {
9006 let (mut parts, body) = res.into_parts();
9007 let mut body = common::Body::new(body);
9008 if !parts.status.is_success() {
9009 let bytes = common::to_bytes(body).await.unwrap_or_default();
9010 let error = serde_json::from_str(&common::to_string(&bytes));
9011 let response = common::to_response(parts, bytes.into());
9012
9013 if let common::Retry::After(d) =
9014 dlg.http_failure(&response, error.as_ref().ok())
9015 {
9016 sleep(d).await;
9017 continue;
9018 }
9019
9020 dlg.finished(false);
9021
9022 return Err(match error {
9023 Ok(value) => common::Error::BadRequest(value),
9024 _ => common::Error::Failure(response),
9025 });
9026 }
9027 let response = {
9028 let bytes = common::to_bytes(body).await.unwrap_or_default();
9029 let encoded = common::to_string(&bytes);
9030 match serde_json::from_str(&encoded) {
9031 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9032 Err(error) => {
9033 dlg.response_json_decode_error(&encoded, &error);
9034 return Err(common::Error::JsonDecodeError(
9035 encoded.to_string(),
9036 error,
9037 ));
9038 }
9039 }
9040 };
9041
9042 dlg.finished(true);
9043 return Ok(response);
9044 }
9045 }
9046 }
9047 }
9048
9049 ///
9050 /// Sets the *request* property to the given value.
9051 ///
9052 /// Even though the property as already been set when instantiating this call,
9053 /// we provide this method for API completeness.
9054 pub fn request(
9055 mut self,
9056 new_value: MigrationToken,
9057 ) -> EnterpriseMigrationTokenCreateCall<'a, C> {
9058 self._request = new_value;
9059 self
9060 }
9061 /// Required. The enterprise in which this migration token is created. This must be the same enterprise which already manages the device in the Play EMM API. Format: enterprises/{enterprise}
9062 ///
9063 /// Sets the *parent* path property to the given value.
9064 ///
9065 /// Even though the property as already been set when instantiating this call,
9066 /// we provide this method for API completeness.
9067 pub fn parent(mut self, new_value: &str) -> EnterpriseMigrationTokenCreateCall<'a, C> {
9068 self._parent = new_value.to_string();
9069 self
9070 }
9071 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9072 /// while executing the actual API request.
9073 ///
9074 /// ````text
9075 /// It should be used to handle progress information, and to implement a certain level of resilience.
9076 /// ````
9077 ///
9078 /// Sets the *delegate* property to the given value.
9079 pub fn delegate(
9080 mut self,
9081 new_value: &'a mut dyn common::Delegate,
9082 ) -> EnterpriseMigrationTokenCreateCall<'a, C> {
9083 self._delegate = Some(new_value);
9084 self
9085 }
9086
9087 /// Set any additional parameter of the query string used in the request.
9088 /// It should be used to set parameters which are not yet available through their own
9089 /// setters.
9090 ///
9091 /// Please note that this method must not be used to set any of the known parameters
9092 /// which have their own setter method. If done anyway, the request will fail.
9093 ///
9094 /// # Additional Parameters
9095 ///
9096 /// * *$.xgafv* (query-string) - V1 error format.
9097 /// * *access_token* (query-string) - OAuth access token.
9098 /// * *alt* (query-string) - Data format for response.
9099 /// * *callback* (query-string) - JSONP
9100 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9101 /// * *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.
9102 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9103 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9104 /// * *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.
9105 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9106 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9107 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseMigrationTokenCreateCall<'a, C>
9108 where
9109 T: AsRef<str>,
9110 {
9111 self._additional_params
9112 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9113 self
9114 }
9115
9116 /// Identifies the authorization scope for the method you are building.
9117 ///
9118 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9119 /// [`Scope::Full`].
9120 ///
9121 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9122 /// tokens for more than one scope.
9123 ///
9124 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9125 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9126 /// sufficient, a read-write scope will do as well.
9127 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseMigrationTokenCreateCall<'a, C>
9128 where
9129 St: AsRef<str>,
9130 {
9131 self._scopes.insert(String::from(scope.as_ref()));
9132 self
9133 }
9134 /// Identifies the authorization scope(s) for the method you are building.
9135 ///
9136 /// See [`Self::add_scope()`] for details.
9137 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseMigrationTokenCreateCall<'a, C>
9138 where
9139 I: IntoIterator<Item = St>,
9140 St: AsRef<str>,
9141 {
9142 self._scopes
9143 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9144 self
9145 }
9146
9147 /// Removes all scopes, and no default scope will be used either.
9148 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9149 /// for details).
9150 pub fn clear_scopes(mut self) -> EnterpriseMigrationTokenCreateCall<'a, C> {
9151 self._scopes.clear();
9152 self
9153 }
9154}
9155
9156/// Gets a migration token.
9157///
9158/// A builder for the *migrationTokens.get* method supported by a *enterprise* resource.
9159/// It is not used directly, but through a [`EnterpriseMethods`] instance.
9160///
9161/// # Example
9162///
9163/// Instantiate a resource method builder
9164///
9165/// ```test_harness,no_run
9166/// # extern crate hyper;
9167/// # extern crate hyper_rustls;
9168/// # extern crate google_androidmanagement1 as androidmanagement1;
9169/// # async fn dox() {
9170/// # use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9171///
9172/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9173/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9174/// # .with_native_roots()
9175/// # .unwrap()
9176/// # .https_only()
9177/// # .enable_http2()
9178/// # .build();
9179///
9180/// # let executor = hyper_util::rt::TokioExecutor::new();
9181/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9182/// # secret,
9183/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9184/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9185/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9186/// # ),
9187/// # ).build().await.unwrap();
9188///
9189/// # let client = hyper_util::client::legacy::Client::builder(
9190/// # hyper_util::rt::TokioExecutor::new()
9191/// # )
9192/// # .build(
9193/// # hyper_rustls::HttpsConnectorBuilder::new()
9194/// # .with_native_roots()
9195/// # .unwrap()
9196/// # .https_or_http()
9197/// # .enable_http2()
9198/// # .build()
9199/// # );
9200/// # let mut hub = AndroidManagement::new(client, auth);
9201/// // You can configure optional parameters by calling the respective setters at will, and
9202/// // execute the final call using `doit()`.
9203/// // Values shown here are possibly random and not representative !
9204/// let result = hub.enterprises().migration_tokens_get("name")
9205/// .doit().await;
9206/// # }
9207/// ```
9208pub struct EnterpriseMigrationTokenGetCall<'a, C>
9209where
9210 C: 'a,
9211{
9212 hub: &'a AndroidManagement<C>,
9213 _name: String,
9214 _delegate: Option<&'a mut dyn common::Delegate>,
9215 _additional_params: HashMap<String, String>,
9216 _scopes: BTreeSet<String>,
9217}
9218
9219impl<'a, C> common::CallBuilder for EnterpriseMigrationTokenGetCall<'a, C> {}
9220
9221impl<'a, C> EnterpriseMigrationTokenGetCall<'a, C>
9222where
9223 C: common::Connector,
9224{
9225 /// Perform the operation you have build so far.
9226 pub async fn doit(mut self) -> common::Result<(common::Response, MigrationToken)> {
9227 use std::borrow::Cow;
9228 use std::io::{Read, Seek};
9229
9230 use common::{url::Params, ToParts};
9231 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9232
9233 let mut dd = common::DefaultDelegate;
9234 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9235 dlg.begin(common::MethodInfo {
9236 id: "androidmanagement.enterprises.migrationTokens.get",
9237 http_method: hyper::Method::GET,
9238 });
9239
9240 for &field in ["alt", "name"].iter() {
9241 if self._additional_params.contains_key(field) {
9242 dlg.finished(false);
9243 return Err(common::Error::FieldClash(field));
9244 }
9245 }
9246
9247 let mut params = Params::with_capacity(3 + self._additional_params.len());
9248 params.push("name", self._name);
9249
9250 params.extend(self._additional_params.iter());
9251
9252 params.push("alt", "json");
9253 let mut url = self.hub._base_url.clone() + "v1/{+name}";
9254 if self._scopes.is_empty() {
9255 self._scopes.insert(Scope::Full.as_ref().to_string());
9256 }
9257
9258 #[allow(clippy::single_element_loop)]
9259 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9260 url = params.uri_replacement(url, param_name, find_this, true);
9261 }
9262 {
9263 let to_remove = ["name"];
9264 params.remove_params(&to_remove);
9265 }
9266
9267 let url = params.parse_with_url(&url);
9268
9269 loop {
9270 let token = match self
9271 .hub
9272 .auth
9273 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9274 .await
9275 {
9276 Ok(token) => token,
9277 Err(e) => match dlg.token(e) {
9278 Ok(token) => token,
9279 Err(e) => {
9280 dlg.finished(false);
9281 return Err(common::Error::MissingToken(e));
9282 }
9283 },
9284 };
9285 let mut req_result = {
9286 let client = &self.hub.client;
9287 dlg.pre_request();
9288 let mut req_builder = hyper::Request::builder()
9289 .method(hyper::Method::GET)
9290 .uri(url.as_str())
9291 .header(USER_AGENT, self.hub._user_agent.clone());
9292
9293 if let Some(token) = token.as_ref() {
9294 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9295 }
9296
9297 let request = req_builder
9298 .header(CONTENT_LENGTH, 0_u64)
9299 .body(common::to_body::<String>(None));
9300
9301 client.request(request.unwrap()).await
9302 };
9303
9304 match req_result {
9305 Err(err) => {
9306 if let common::Retry::After(d) = dlg.http_error(&err) {
9307 sleep(d).await;
9308 continue;
9309 }
9310 dlg.finished(false);
9311 return Err(common::Error::HttpError(err));
9312 }
9313 Ok(res) => {
9314 let (mut parts, body) = res.into_parts();
9315 let mut body = common::Body::new(body);
9316 if !parts.status.is_success() {
9317 let bytes = common::to_bytes(body).await.unwrap_or_default();
9318 let error = serde_json::from_str(&common::to_string(&bytes));
9319 let response = common::to_response(parts, bytes.into());
9320
9321 if let common::Retry::After(d) =
9322 dlg.http_failure(&response, error.as_ref().ok())
9323 {
9324 sleep(d).await;
9325 continue;
9326 }
9327
9328 dlg.finished(false);
9329
9330 return Err(match error {
9331 Ok(value) => common::Error::BadRequest(value),
9332 _ => common::Error::Failure(response),
9333 });
9334 }
9335 let response = {
9336 let bytes = common::to_bytes(body).await.unwrap_or_default();
9337 let encoded = common::to_string(&bytes);
9338 match serde_json::from_str(&encoded) {
9339 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9340 Err(error) => {
9341 dlg.response_json_decode_error(&encoded, &error);
9342 return Err(common::Error::JsonDecodeError(
9343 encoded.to_string(),
9344 error,
9345 ));
9346 }
9347 }
9348 };
9349
9350 dlg.finished(true);
9351 return Ok(response);
9352 }
9353 }
9354 }
9355 }
9356
9357 /// Required. The name of the migration token to retrieve. Format: enterprises/{enterprise}/migrationTokens/{migration_token}
9358 ///
9359 /// Sets the *name* path property to the given value.
9360 ///
9361 /// Even though the property as already been set when instantiating this call,
9362 /// we provide this method for API completeness.
9363 pub fn name(mut self, new_value: &str) -> EnterpriseMigrationTokenGetCall<'a, C> {
9364 self._name = new_value.to_string();
9365 self
9366 }
9367 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9368 /// while executing the actual API request.
9369 ///
9370 /// ````text
9371 /// It should be used to handle progress information, and to implement a certain level of resilience.
9372 /// ````
9373 ///
9374 /// Sets the *delegate* property to the given value.
9375 pub fn delegate(
9376 mut self,
9377 new_value: &'a mut dyn common::Delegate,
9378 ) -> EnterpriseMigrationTokenGetCall<'a, C> {
9379 self._delegate = Some(new_value);
9380 self
9381 }
9382
9383 /// Set any additional parameter of the query string used in the request.
9384 /// It should be used to set parameters which are not yet available through their own
9385 /// setters.
9386 ///
9387 /// Please note that this method must not be used to set any of the known parameters
9388 /// which have their own setter method. If done anyway, the request will fail.
9389 ///
9390 /// # Additional Parameters
9391 ///
9392 /// * *$.xgafv* (query-string) - V1 error format.
9393 /// * *access_token* (query-string) - OAuth access token.
9394 /// * *alt* (query-string) - Data format for response.
9395 /// * *callback* (query-string) - JSONP
9396 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9397 /// * *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.
9398 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9399 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9400 /// * *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.
9401 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9402 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9403 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseMigrationTokenGetCall<'a, C>
9404 where
9405 T: AsRef<str>,
9406 {
9407 self._additional_params
9408 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9409 self
9410 }
9411
9412 /// Identifies the authorization scope for the method you are building.
9413 ///
9414 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9415 /// [`Scope::Full`].
9416 ///
9417 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9418 /// tokens for more than one scope.
9419 ///
9420 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9421 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9422 /// sufficient, a read-write scope will do as well.
9423 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseMigrationTokenGetCall<'a, C>
9424 where
9425 St: AsRef<str>,
9426 {
9427 self._scopes.insert(String::from(scope.as_ref()));
9428 self
9429 }
9430 /// Identifies the authorization scope(s) for the method you are building.
9431 ///
9432 /// See [`Self::add_scope()`] for details.
9433 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseMigrationTokenGetCall<'a, C>
9434 where
9435 I: IntoIterator<Item = St>,
9436 St: AsRef<str>,
9437 {
9438 self._scopes
9439 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9440 self
9441 }
9442
9443 /// Removes all scopes, and no default scope will be used either.
9444 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9445 /// for details).
9446 pub fn clear_scopes(mut self) -> EnterpriseMigrationTokenGetCall<'a, C> {
9447 self._scopes.clear();
9448 self
9449 }
9450}
9451
9452/// Lists migration tokens.
9453///
9454/// A builder for the *migrationTokens.list* method supported by a *enterprise* resource.
9455/// It is not used directly, but through a [`EnterpriseMethods`] instance.
9456///
9457/// # Example
9458///
9459/// Instantiate a resource method builder
9460///
9461/// ```test_harness,no_run
9462/// # extern crate hyper;
9463/// # extern crate hyper_rustls;
9464/// # extern crate google_androidmanagement1 as androidmanagement1;
9465/// # async fn dox() {
9466/// # use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9467///
9468/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9469/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9470/// # .with_native_roots()
9471/// # .unwrap()
9472/// # .https_only()
9473/// # .enable_http2()
9474/// # .build();
9475///
9476/// # let executor = hyper_util::rt::TokioExecutor::new();
9477/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9478/// # secret,
9479/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9480/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9481/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9482/// # ),
9483/// # ).build().await.unwrap();
9484///
9485/// # let client = hyper_util::client::legacy::Client::builder(
9486/// # hyper_util::rt::TokioExecutor::new()
9487/// # )
9488/// # .build(
9489/// # hyper_rustls::HttpsConnectorBuilder::new()
9490/// # .with_native_roots()
9491/// # .unwrap()
9492/// # .https_or_http()
9493/// # .enable_http2()
9494/// # .build()
9495/// # );
9496/// # let mut hub = AndroidManagement::new(client, auth);
9497/// // You can configure optional parameters by calling the respective setters at will, and
9498/// // execute the final call using `doit()`.
9499/// // Values shown here are possibly random and not representative !
9500/// let result = hub.enterprises().migration_tokens_list("parent")
9501/// .page_token("sed")
9502/// .page_size(-24)
9503/// .doit().await;
9504/// # }
9505/// ```
9506pub struct EnterpriseMigrationTokenListCall<'a, C>
9507where
9508 C: 'a,
9509{
9510 hub: &'a AndroidManagement<C>,
9511 _parent: String,
9512 _page_token: Option<String>,
9513 _page_size: Option<i32>,
9514 _delegate: Option<&'a mut dyn common::Delegate>,
9515 _additional_params: HashMap<String, String>,
9516 _scopes: BTreeSet<String>,
9517}
9518
9519impl<'a, C> common::CallBuilder for EnterpriseMigrationTokenListCall<'a, C> {}
9520
9521impl<'a, C> EnterpriseMigrationTokenListCall<'a, C>
9522where
9523 C: common::Connector,
9524{
9525 /// Perform the operation you have build so far.
9526 pub async fn doit(mut self) -> common::Result<(common::Response, ListMigrationTokensResponse)> {
9527 use std::borrow::Cow;
9528 use std::io::{Read, Seek};
9529
9530 use common::{url::Params, ToParts};
9531 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9532
9533 let mut dd = common::DefaultDelegate;
9534 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9535 dlg.begin(common::MethodInfo {
9536 id: "androidmanagement.enterprises.migrationTokens.list",
9537 http_method: hyper::Method::GET,
9538 });
9539
9540 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
9541 if self._additional_params.contains_key(field) {
9542 dlg.finished(false);
9543 return Err(common::Error::FieldClash(field));
9544 }
9545 }
9546
9547 let mut params = Params::with_capacity(5 + self._additional_params.len());
9548 params.push("parent", self._parent);
9549 if let Some(value) = self._page_token.as_ref() {
9550 params.push("pageToken", value);
9551 }
9552 if let Some(value) = self._page_size.as_ref() {
9553 params.push("pageSize", value.to_string());
9554 }
9555
9556 params.extend(self._additional_params.iter());
9557
9558 params.push("alt", "json");
9559 let mut url = self.hub._base_url.clone() + "v1/{+parent}/migrationTokens";
9560 if self._scopes.is_empty() {
9561 self._scopes.insert(Scope::Full.as_ref().to_string());
9562 }
9563
9564 #[allow(clippy::single_element_loop)]
9565 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
9566 url = params.uri_replacement(url, param_name, find_this, true);
9567 }
9568 {
9569 let to_remove = ["parent"];
9570 params.remove_params(&to_remove);
9571 }
9572
9573 let url = params.parse_with_url(&url);
9574
9575 loop {
9576 let token = match self
9577 .hub
9578 .auth
9579 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9580 .await
9581 {
9582 Ok(token) => token,
9583 Err(e) => match dlg.token(e) {
9584 Ok(token) => token,
9585 Err(e) => {
9586 dlg.finished(false);
9587 return Err(common::Error::MissingToken(e));
9588 }
9589 },
9590 };
9591 let mut req_result = {
9592 let client = &self.hub.client;
9593 dlg.pre_request();
9594 let mut req_builder = hyper::Request::builder()
9595 .method(hyper::Method::GET)
9596 .uri(url.as_str())
9597 .header(USER_AGENT, self.hub._user_agent.clone());
9598
9599 if let Some(token) = token.as_ref() {
9600 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9601 }
9602
9603 let request = req_builder
9604 .header(CONTENT_LENGTH, 0_u64)
9605 .body(common::to_body::<String>(None));
9606
9607 client.request(request.unwrap()).await
9608 };
9609
9610 match req_result {
9611 Err(err) => {
9612 if let common::Retry::After(d) = dlg.http_error(&err) {
9613 sleep(d).await;
9614 continue;
9615 }
9616 dlg.finished(false);
9617 return Err(common::Error::HttpError(err));
9618 }
9619 Ok(res) => {
9620 let (mut parts, body) = res.into_parts();
9621 let mut body = common::Body::new(body);
9622 if !parts.status.is_success() {
9623 let bytes = common::to_bytes(body).await.unwrap_or_default();
9624 let error = serde_json::from_str(&common::to_string(&bytes));
9625 let response = common::to_response(parts, bytes.into());
9626
9627 if let common::Retry::After(d) =
9628 dlg.http_failure(&response, error.as_ref().ok())
9629 {
9630 sleep(d).await;
9631 continue;
9632 }
9633
9634 dlg.finished(false);
9635
9636 return Err(match error {
9637 Ok(value) => common::Error::BadRequest(value),
9638 _ => common::Error::Failure(response),
9639 });
9640 }
9641 let response = {
9642 let bytes = common::to_bytes(body).await.unwrap_or_default();
9643 let encoded = common::to_string(&bytes);
9644 match serde_json::from_str(&encoded) {
9645 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9646 Err(error) => {
9647 dlg.response_json_decode_error(&encoded, &error);
9648 return Err(common::Error::JsonDecodeError(
9649 encoded.to_string(),
9650 error,
9651 ));
9652 }
9653 }
9654 };
9655
9656 dlg.finished(true);
9657 return Ok(response);
9658 }
9659 }
9660 }
9661 }
9662
9663 /// Required. The enterprise which the migration tokens belong to. Format: enterprises/{enterprise}
9664 ///
9665 /// Sets the *parent* path property to the given value.
9666 ///
9667 /// Even though the property as already been set when instantiating this call,
9668 /// we provide this method for API completeness.
9669 pub fn parent(mut self, new_value: &str) -> EnterpriseMigrationTokenListCall<'a, C> {
9670 self._parent = new_value.to_string();
9671 self
9672 }
9673 /// A page token, received from a previous ListMigrationTokens call. Provide this to retrieve the subsequent page.When paginating, all other parameters provided to ListMigrationTokens must match the call that provided the page token.
9674 ///
9675 /// Sets the *page token* query property to the given value.
9676 pub fn page_token(mut self, new_value: &str) -> EnterpriseMigrationTokenListCall<'a, C> {
9677 self._page_token = Some(new_value.to_string());
9678 self
9679 }
9680 /// The maximum number of migration tokens to return. Fewer migration tokens may be returned. If unspecified, at most 100 migration tokens will be returned. The maximum value is 100; values above 100 will be coerced to 100.
9681 ///
9682 /// Sets the *page size* query property to the given value.
9683 pub fn page_size(mut self, new_value: i32) -> EnterpriseMigrationTokenListCall<'a, C> {
9684 self._page_size = Some(new_value);
9685 self
9686 }
9687 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9688 /// while executing the actual API request.
9689 ///
9690 /// ````text
9691 /// It should be used to handle progress information, and to implement a certain level of resilience.
9692 /// ````
9693 ///
9694 /// Sets the *delegate* property to the given value.
9695 pub fn delegate(
9696 mut self,
9697 new_value: &'a mut dyn common::Delegate,
9698 ) -> EnterpriseMigrationTokenListCall<'a, C> {
9699 self._delegate = Some(new_value);
9700 self
9701 }
9702
9703 /// Set any additional parameter of the query string used in the request.
9704 /// It should be used to set parameters which are not yet available through their own
9705 /// setters.
9706 ///
9707 /// Please note that this method must not be used to set any of the known parameters
9708 /// which have their own setter method. If done anyway, the request will fail.
9709 ///
9710 /// # Additional Parameters
9711 ///
9712 /// * *$.xgafv* (query-string) - V1 error format.
9713 /// * *access_token* (query-string) - OAuth access token.
9714 /// * *alt* (query-string) - Data format for response.
9715 /// * *callback* (query-string) - JSONP
9716 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9717 /// * *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.
9718 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9719 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9720 /// * *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.
9721 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9722 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9723 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseMigrationTokenListCall<'a, C>
9724 where
9725 T: AsRef<str>,
9726 {
9727 self._additional_params
9728 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9729 self
9730 }
9731
9732 /// Identifies the authorization scope for the method you are building.
9733 ///
9734 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9735 /// [`Scope::Full`].
9736 ///
9737 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9738 /// tokens for more than one scope.
9739 ///
9740 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9741 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9742 /// sufficient, a read-write scope will do as well.
9743 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseMigrationTokenListCall<'a, C>
9744 where
9745 St: AsRef<str>,
9746 {
9747 self._scopes.insert(String::from(scope.as_ref()));
9748 self
9749 }
9750 /// Identifies the authorization scope(s) for the method you are building.
9751 ///
9752 /// See [`Self::add_scope()`] for details.
9753 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseMigrationTokenListCall<'a, C>
9754 where
9755 I: IntoIterator<Item = St>,
9756 St: AsRef<str>,
9757 {
9758 self._scopes
9759 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9760 self
9761 }
9762
9763 /// Removes all scopes, and no default scope will be used either.
9764 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9765 /// for details).
9766 pub fn clear_scopes(mut self) -> EnterpriseMigrationTokenListCall<'a, C> {
9767 self._scopes.clear();
9768 self
9769 }
9770}
9771
9772/// Deletes a policy. This operation is only permitted if no devices are currently referencing the policy.
9773///
9774/// A builder for the *policies.delete* method supported by a *enterprise* resource.
9775/// It is not used directly, but through a [`EnterpriseMethods`] instance.
9776///
9777/// # Example
9778///
9779/// Instantiate a resource method builder
9780///
9781/// ```test_harness,no_run
9782/// # extern crate hyper;
9783/// # extern crate hyper_rustls;
9784/// # extern crate google_androidmanagement1 as androidmanagement1;
9785/// # async fn dox() {
9786/// # use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9787///
9788/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9789/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9790/// # .with_native_roots()
9791/// # .unwrap()
9792/// # .https_only()
9793/// # .enable_http2()
9794/// # .build();
9795///
9796/// # let executor = hyper_util::rt::TokioExecutor::new();
9797/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9798/// # secret,
9799/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9800/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9801/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9802/// # ),
9803/// # ).build().await.unwrap();
9804///
9805/// # let client = hyper_util::client::legacy::Client::builder(
9806/// # hyper_util::rt::TokioExecutor::new()
9807/// # )
9808/// # .build(
9809/// # hyper_rustls::HttpsConnectorBuilder::new()
9810/// # .with_native_roots()
9811/// # .unwrap()
9812/// # .https_or_http()
9813/// # .enable_http2()
9814/// # .build()
9815/// # );
9816/// # let mut hub = AndroidManagement::new(client, auth);
9817/// // You can configure optional parameters by calling the respective setters at will, and
9818/// // execute the final call using `doit()`.
9819/// // Values shown here are possibly random and not representative !
9820/// let result = hub.enterprises().policies_delete("name")
9821/// .doit().await;
9822/// # }
9823/// ```
9824pub struct EnterprisePolicyDeleteCall<'a, C>
9825where
9826 C: 'a,
9827{
9828 hub: &'a AndroidManagement<C>,
9829 _name: String,
9830 _delegate: Option<&'a mut dyn common::Delegate>,
9831 _additional_params: HashMap<String, String>,
9832 _scopes: BTreeSet<String>,
9833}
9834
9835impl<'a, C> common::CallBuilder for EnterprisePolicyDeleteCall<'a, C> {}
9836
9837impl<'a, C> EnterprisePolicyDeleteCall<'a, C>
9838where
9839 C: common::Connector,
9840{
9841 /// Perform the operation you have build so far.
9842 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
9843 use std::borrow::Cow;
9844 use std::io::{Read, Seek};
9845
9846 use common::{url::Params, ToParts};
9847 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9848
9849 let mut dd = common::DefaultDelegate;
9850 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9851 dlg.begin(common::MethodInfo {
9852 id: "androidmanagement.enterprises.policies.delete",
9853 http_method: hyper::Method::DELETE,
9854 });
9855
9856 for &field in ["alt", "name"].iter() {
9857 if self._additional_params.contains_key(field) {
9858 dlg.finished(false);
9859 return Err(common::Error::FieldClash(field));
9860 }
9861 }
9862
9863 let mut params = Params::with_capacity(3 + self._additional_params.len());
9864 params.push("name", self._name);
9865
9866 params.extend(self._additional_params.iter());
9867
9868 params.push("alt", "json");
9869 let mut url = self.hub._base_url.clone() + "v1/{+name}";
9870 if self._scopes.is_empty() {
9871 self._scopes.insert(Scope::Full.as_ref().to_string());
9872 }
9873
9874 #[allow(clippy::single_element_loop)]
9875 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9876 url = params.uri_replacement(url, param_name, find_this, true);
9877 }
9878 {
9879 let to_remove = ["name"];
9880 params.remove_params(&to_remove);
9881 }
9882
9883 let url = params.parse_with_url(&url);
9884
9885 loop {
9886 let token = match self
9887 .hub
9888 .auth
9889 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9890 .await
9891 {
9892 Ok(token) => token,
9893 Err(e) => match dlg.token(e) {
9894 Ok(token) => token,
9895 Err(e) => {
9896 dlg.finished(false);
9897 return Err(common::Error::MissingToken(e));
9898 }
9899 },
9900 };
9901 let mut req_result = {
9902 let client = &self.hub.client;
9903 dlg.pre_request();
9904 let mut req_builder = hyper::Request::builder()
9905 .method(hyper::Method::DELETE)
9906 .uri(url.as_str())
9907 .header(USER_AGENT, self.hub._user_agent.clone());
9908
9909 if let Some(token) = token.as_ref() {
9910 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9911 }
9912
9913 let request = req_builder
9914 .header(CONTENT_LENGTH, 0_u64)
9915 .body(common::to_body::<String>(None));
9916
9917 client.request(request.unwrap()).await
9918 };
9919
9920 match req_result {
9921 Err(err) => {
9922 if let common::Retry::After(d) = dlg.http_error(&err) {
9923 sleep(d).await;
9924 continue;
9925 }
9926 dlg.finished(false);
9927 return Err(common::Error::HttpError(err));
9928 }
9929 Ok(res) => {
9930 let (mut parts, body) = res.into_parts();
9931 let mut body = common::Body::new(body);
9932 if !parts.status.is_success() {
9933 let bytes = common::to_bytes(body).await.unwrap_or_default();
9934 let error = serde_json::from_str(&common::to_string(&bytes));
9935 let response = common::to_response(parts, bytes.into());
9936
9937 if let common::Retry::After(d) =
9938 dlg.http_failure(&response, error.as_ref().ok())
9939 {
9940 sleep(d).await;
9941 continue;
9942 }
9943
9944 dlg.finished(false);
9945
9946 return Err(match error {
9947 Ok(value) => common::Error::BadRequest(value),
9948 _ => common::Error::Failure(response),
9949 });
9950 }
9951 let response = {
9952 let bytes = common::to_bytes(body).await.unwrap_or_default();
9953 let encoded = common::to_string(&bytes);
9954 match serde_json::from_str(&encoded) {
9955 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9956 Err(error) => {
9957 dlg.response_json_decode_error(&encoded, &error);
9958 return Err(common::Error::JsonDecodeError(
9959 encoded.to_string(),
9960 error,
9961 ));
9962 }
9963 }
9964 };
9965
9966 dlg.finished(true);
9967 return Ok(response);
9968 }
9969 }
9970 }
9971 }
9972
9973 /// The name of the policy in the form enterprises/{enterpriseId}/policies/{policyId}.
9974 ///
9975 /// Sets the *name* path property to the given value.
9976 ///
9977 /// Even though the property as already been set when instantiating this call,
9978 /// we provide this method for API completeness.
9979 pub fn name(mut self, new_value: &str) -> EnterprisePolicyDeleteCall<'a, C> {
9980 self._name = new_value.to_string();
9981 self
9982 }
9983 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9984 /// while executing the actual API request.
9985 ///
9986 /// ````text
9987 /// It should be used to handle progress information, and to implement a certain level of resilience.
9988 /// ````
9989 ///
9990 /// Sets the *delegate* property to the given value.
9991 pub fn delegate(
9992 mut self,
9993 new_value: &'a mut dyn common::Delegate,
9994 ) -> EnterprisePolicyDeleteCall<'a, C> {
9995 self._delegate = Some(new_value);
9996 self
9997 }
9998
9999 /// Set any additional parameter of the query string used in the request.
10000 /// It should be used to set parameters which are not yet available through their own
10001 /// setters.
10002 ///
10003 /// Please note that this method must not be used to set any of the known parameters
10004 /// which have their own setter method. If done anyway, the request will fail.
10005 ///
10006 /// # Additional Parameters
10007 ///
10008 /// * *$.xgafv* (query-string) - V1 error format.
10009 /// * *access_token* (query-string) - OAuth access token.
10010 /// * *alt* (query-string) - Data format for response.
10011 /// * *callback* (query-string) - JSONP
10012 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10013 /// * *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.
10014 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10015 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10016 /// * *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.
10017 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10018 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10019 pub fn param<T>(mut self, name: T, value: T) -> EnterprisePolicyDeleteCall<'a, C>
10020 where
10021 T: AsRef<str>,
10022 {
10023 self._additional_params
10024 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10025 self
10026 }
10027
10028 /// Identifies the authorization scope for the method you are building.
10029 ///
10030 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10031 /// [`Scope::Full`].
10032 ///
10033 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10034 /// tokens for more than one scope.
10035 ///
10036 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10037 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10038 /// sufficient, a read-write scope will do as well.
10039 pub fn add_scope<St>(mut self, scope: St) -> EnterprisePolicyDeleteCall<'a, C>
10040 where
10041 St: AsRef<str>,
10042 {
10043 self._scopes.insert(String::from(scope.as_ref()));
10044 self
10045 }
10046 /// Identifies the authorization scope(s) for the method you are building.
10047 ///
10048 /// See [`Self::add_scope()`] for details.
10049 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterprisePolicyDeleteCall<'a, C>
10050 where
10051 I: IntoIterator<Item = St>,
10052 St: AsRef<str>,
10053 {
10054 self._scopes
10055 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10056 self
10057 }
10058
10059 /// Removes all scopes, and no default scope will be used either.
10060 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10061 /// for details).
10062 pub fn clear_scopes(mut self) -> EnterprisePolicyDeleteCall<'a, C> {
10063 self._scopes.clear();
10064 self
10065 }
10066}
10067
10068/// Gets a policy.
10069///
10070/// A builder for the *policies.get* method supported by a *enterprise* resource.
10071/// It is not used directly, but through a [`EnterpriseMethods`] instance.
10072///
10073/// # Example
10074///
10075/// Instantiate a resource method builder
10076///
10077/// ```test_harness,no_run
10078/// # extern crate hyper;
10079/// # extern crate hyper_rustls;
10080/// # extern crate google_androidmanagement1 as androidmanagement1;
10081/// # async fn dox() {
10082/// # use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10083///
10084/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10085/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10086/// # .with_native_roots()
10087/// # .unwrap()
10088/// # .https_only()
10089/// # .enable_http2()
10090/// # .build();
10091///
10092/// # let executor = hyper_util::rt::TokioExecutor::new();
10093/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10094/// # secret,
10095/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10096/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10097/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10098/// # ),
10099/// # ).build().await.unwrap();
10100///
10101/// # let client = hyper_util::client::legacy::Client::builder(
10102/// # hyper_util::rt::TokioExecutor::new()
10103/// # )
10104/// # .build(
10105/// # hyper_rustls::HttpsConnectorBuilder::new()
10106/// # .with_native_roots()
10107/// # .unwrap()
10108/// # .https_or_http()
10109/// # .enable_http2()
10110/// # .build()
10111/// # );
10112/// # let mut hub = AndroidManagement::new(client, auth);
10113/// // You can configure optional parameters by calling the respective setters at will, and
10114/// // execute the final call using `doit()`.
10115/// // Values shown here are possibly random and not representative !
10116/// let result = hub.enterprises().policies_get("name")
10117/// .doit().await;
10118/// # }
10119/// ```
10120pub struct EnterprisePolicyGetCall<'a, C>
10121where
10122 C: 'a,
10123{
10124 hub: &'a AndroidManagement<C>,
10125 _name: String,
10126 _delegate: Option<&'a mut dyn common::Delegate>,
10127 _additional_params: HashMap<String, String>,
10128 _scopes: BTreeSet<String>,
10129}
10130
10131impl<'a, C> common::CallBuilder for EnterprisePolicyGetCall<'a, C> {}
10132
10133impl<'a, C> EnterprisePolicyGetCall<'a, C>
10134where
10135 C: common::Connector,
10136{
10137 /// Perform the operation you have build so far.
10138 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
10139 use std::borrow::Cow;
10140 use std::io::{Read, Seek};
10141
10142 use common::{url::Params, ToParts};
10143 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10144
10145 let mut dd = common::DefaultDelegate;
10146 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10147 dlg.begin(common::MethodInfo {
10148 id: "androidmanagement.enterprises.policies.get",
10149 http_method: hyper::Method::GET,
10150 });
10151
10152 for &field in ["alt", "name"].iter() {
10153 if self._additional_params.contains_key(field) {
10154 dlg.finished(false);
10155 return Err(common::Error::FieldClash(field));
10156 }
10157 }
10158
10159 let mut params = Params::with_capacity(3 + self._additional_params.len());
10160 params.push("name", self._name);
10161
10162 params.extend(self._additional_params.iter());
10163
10164 params.push("alt", "json");
10165 let mut url = self.hub._base_url.clone() + "v1/{+name}";
10166 if self._scopes.is_empty() {
10167 self._scopes.insert(Scope::Full.as_ref().to_string());
10168 }
10169
10170 #[allow(clippy::single_element_loop)]
10171 for &(find_this, param_name) in [("{+name}", "name")].iter() {
10172 url = params.uri_replacement(url, param_name, find_this, true);
10173 }
10174 {
10175 let to_remove = ["name"];
10176 params.remove_params(&to_remove);
10177 }
10178
10179 let url = params.parse_with_url(&url);
10180
10181 loop {
10182 let token = match self
10183 .hub
10184 .auth
10185 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10186 .await
10187 {
10188 Ok(token) => token,
10189 Err(e) => match dlg.token(e) {
10190 Ok(token) => token,
10191 Err(e) => {
10192 dlg.finished(false);
10193 return Err(common::Error::MissingToken(e));
10194 }
10195 },
10196 };
10197 let mut req_result = {
10198 let client = &self.hub.client;
10199 dlg.pre_request();
10200 let mut req_builder = hyper::Request::builder()
10201 .method(hyper::Method::GET)
10202 .uri(url.as_str())
10203 .header(USER_AGENT, self.hub._user_agent.clone());
10204
10205 if let Some(token) = token.as_ref() {
10206 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10207 }
10208
10209 let request = req_builder
10210 .header(CONTENT_LENGTH, 0_u64)
10211 .body(common::to_body::<String>(None));
10212
10213 client.request(request.unwrap()).await
10214 };
10215
10216 match req_result {
10217 Err(err) => {
10218 if let common::Retry::After(d) = dlg.http_error(&err) {
10219 sleep(d).await;
10220 continue;
10221 }
10222 dlg.finished(false);
10223 return Err(common::Error::HttpError(err));
10224 }
10225 Ok(res) => {
10226 let (mut parts, body) = res.into_parts();
10227 let mut body = common::Body::new(body);
10228 if !parts.status.is_success() {
10229 let bytes = common::to_bytes(body).await.unwrap_or_default();
10230 let error = serde_json::from_str(&common::to_string(&bytes));
10231 let response = common::to_response(parts, bytes.into());
10232
10233 if let common::Retry::After(d) =
10234 dlg.http_failure(&response, error.as_ref().ok())
10235 {
10236 sleep(d).await;
10237 continue;
10238 }
10239
10240 dlg.finished(false);
10241
10242 return Err(match error {
10243 Ok(value) => common::Error::BadRequest(value),
10244 _ => common::Error::Failure(response),
10245 });
10246 }
10247 let response = {
10248 let bytes = common::to_bytes(body).await.unwrap_or_default();
10249 let encoded = common::to_string(&bytes);
10250 match serde_json::from_str(&encoded) {
10251 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10252 Err(error) => {
10253 dlg.response_json_decode_error(&encoded, &error);
10254 return Err(common::Error::JsonDecodeError(
10255 encoded.to_string(),
10256 error,
10257 ));
10258 }
10259 }
10260 };
10261
10262 dlg.finished(true);
10263 return Ok(response);
10264 }
10265 }
10266 }
10267 }
10268
10269 /// The name of the policy in the form enterprises/{enterpriseId}/policies/{policyId}.
10270 ///
10271 /// Sets the *name* path property to the given value.
10272 ///
10273 /// Even though the property as already been set when instantiating this call,
10274 /// we provide this method for API completeness.
10275 pub fn name(mut self, new_value: &str) -> EnterprisePolicyGetCall<'a, C> {
10276 self._name = new_value.to_string();
10277 self
10278 }
10279 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10280 /// while executing the actual API request.
10281 ///
10282 /// ````text
10283 /// It should be used to handle progress information, and to implement a certain level of resilience.
10284 /// ````
10285 ///
10286 /// Sets the *delegate* property to the given value.
10287 pub fn delegate(
10288 mut self,
10289 new_value: &'a mut dyn common::Delegate,
10290 ) -> EnterprisePolicyGetCall<'a, C> {
10291 self._delegate = Some(new_value);
10292 self
10293 }
10294
10295 /// Set any additional parameter of the query string used in the request.
10296 /// It should be used to set parameters which are not yet available through their own
10297 /// setters.
10298 ///
10299 /// Please note that this method must not be used to set any of the known parameters
10300 /// which have their own setter method. If done anyway, the request will fail.
10301 ///
10302 /// # Additional Parameters
10303 ///
10304 /// * *$.xgafv* (query-string) - V1 error format.
10305 /// * *access_token* (query-string) - OAuth access token.
10306 /// * *alt* (query-string) - Data format for response.
10307 /// * *callback* (query-string) - JSONP
10308 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10309 /// * *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.
10310 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10311 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10312 /// * *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.
10313 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10314 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10315 pub fn param<T>(mut self, name: T, value: T) -> EnterprisePolicyGetCall<'a, C>
10316 where
10317 T: AsRef<str>,
10318 {
10319 self._additional_params
10320 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10321 self
10322 }
10323
10324 /// Identifies the authorization scope for the method you are building.
10325 ///
10326 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10327 /// [`Scope::Full`].
10328 ///
10329 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10330 /// tokens for more than one scope.
10331 ///
10332 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10333 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10334 /// sufficient, a read-write scope will do as well.
10335 pub fn add_scope<St>(mut self, scope: St) -> EnterprisePolicyGetCall<'a, C>
10336 where
10337 St: AsRef<str>,
10338 {
10339 self._scopes.insert(String::from(scope.as_ref()));
10340 self
10341 }
10342 /// Identifies the authorization scope(s) for the method you are building.
10343 ///
10344 /// See [`Self::add_scope()`] for details.
10345 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterprisePolicyGetCall<'a, C>
10346 where
10347 I: IntoIterator<Item = St>,
10348 St: AsRef<str>,
10349 {
10350 self._scopes
10351 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10352 self
10353 }
10354
10355 /// Removes all scopes, and no default scope will be used either.
10356 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10357 /// for details).
10358 pub fn clear_scopes(mut self) -> EnterprisePolicyGetCall<'a, C> {
10359 self._scopes.clear();
10360 self
10361 }
10362}
10363
10364/// Lists policies for a given enterprise.
10365///
10366/// A builder for the *policies.list* method supported by a *enterprise* resource.
10367/// It is not used directly, but through a [`EnterpriseMethods`] instance.
10368///
10369/// # Example
10370///
10371/// Instantiate a resource method builder
10372///
10373/// ```test_harness,no_run
10374/// # extern crate hyper;
10375/// # extern crate hyper_rustls;
10376/// # extern crate google_androidmanagement1 as androidmanagement1;
10377/// # async fn dox() {
10378/// # use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10379///
10380/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10381/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10382/// # .with_native_roots()
10383/// # .unwrap()
10384/// # .https_only()
10385/// # .enable_http2()
10386/// # .build();
10387///
10388/// # let executor = hyper_util::rt::TokioExecutor::new();
10389/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10390/// # secret,
10391/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10392/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10393/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10394/// # ),
10395/// # ).build().await.unwrap();
10396///
10397/// # let client = hyper_util::client::legacy::Client::builder(
10398/// # hyper_util::rt::TokioExecutor::new()
10399/// # )
10400/// # .build(
10401/// # hyper_rustls::HttpsConnectorBuilder::new()
10402/// # .with_native_roots()
10403/// # .unwrap()
10404/// # .https_or_http()
10405/// # .enable_http2()
10406/// # .build()
10407/// # );
10408/// # let mut hub = AndroidManagement::new(client, auth);
10409/// // You can configure optional parameters by calling the respective setters at will, and
10410/// // execute the final call using `doit()`.
10411/// // Values shown here are possibly random and not representative !
10412/// let result = hub.enterprises().policies_list("parent")
10413/// .page_token("sed")
10414/// .page_size(-20)
10415/// .doit().await;
10416/// # }
10417/// ```
10418pub struct EnterprisePolicyListCall<'a, C>
10419where
10420 C: 'a,
10421{
10422 hub: &'a AndroidManagement<C>,
10423 _parent: String,
10424 _page_token: Option<String>,
10425 _page_size: Option<i32>,
10426 _delegate: Option<&'a mut dyn common::Delegate>,
10427 _additional_params: HashMap<String, String>,
10428 _scopes: BTreeSet<String>,
10429}
10430
10431impl<'a, C> common::CallBuilder for EnterprisePolicyListCall<'a, C> {}
10432
10433impl<'a, C> EnterprisePolicyListCall<'a, C>
10434where
10435 C: common::Connector,
10436{
10437 /// Perform the operation you have build so far.
10438 pub async fn doit(mut self) -> common::Result<(common::Response, ListPoliciesResponse)> {
10439 use std::borrow::Cow;
10440 use std::io::{Read, Seek};
10441
10442 use common::{url::Params, ToParts};
10443 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10444
10445 let mut dd = common::DefaultDelegate;
10446 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10447 dlg.begin(common::MethodInfo {
10448 id: "androidmanagement.enterprises.policies.list",
10449 http_method: hyper::Method::GET,
10450 });
10451
10452 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
10453 if self._additional_params.contains_key(field) {
10454 dlg.finished(false);
10455 return Err(common::Error::FieldClash(field));
10456 }
10457 }
10458
10459 let mut params = Params::with_capacity(5 + self._additional_params.len());
10460 params.push("parent", self._parent);
10461 if let Some(value) = self._page_token.as_ref() {
10462 params.push("pageToken", value);
10463 }
10464 if let Some(value) = self._page_size.as_ref() {
10465 params.push("pageSize", value.to_string());
10466 }
10467
10468 params.extend(self._additional_params.iter());
10469
10470 params.push("alt", "json");
10471 let mut url = self.hub._base_url.clone() + "v1/{+parent}/policies";
10472 if self._scopes.is_empty() {
10473 self._scopes.insert(Scope::Full.as_ref().to_string());
10474 }
10475
10476 #[allow(clippy::single_element_loop)]
10477 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10478 url = params.uri_replacement(url, param_name, find_this, true);
10479 }
10480 {
10481 let to_remove = ["parent"];
10482 params.remove_params(&to_remove);
10483 }
10484
10485 let url = params.parse_with_url(&url);
10486
10487 loop {
10488 let token = match self
10489 .hub
10490 .auth
10491 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10492 .await
10493 {
10494 Ok(token) => token,
10495 Err(e) => match dlg.token(e) {
10496 Ok(token) => token,
10497 Err(e) => {
10498 dlg.finished(false);
10499 return Err(common::Error::MissingToken(e));
10500 }
10501 },
10502 };
10503 let mut req_result = {
10504 let client = &self.hub.client;
10505 dlg.pre_request();
10506 let mut req_builder = hyper::Request::builder()
10507 .method(hyper::Method::GET)
10508 .uri(url.as_str())
10509 .header(USER_AGENT, self.hub._user_agent.clone());
10510
10511 if let Some(token) = token.as_ref() {
10512 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10513 }
10514
10515 let request = req_builder
10516 .header(CONTENT_LENGTH, 0_u64)
10517 .body(common::to_body::<String>(None));
10518
10519 client.request(request.unwrap()).await
10520 };
10521
10522 match req_result {
10523 Err(err) => {
10524 if let common::Retry::After(d) = dlg.http_error(&err) {
10525 sleep(d).await;
10526 continue;
10527 }
10528 dlg.finished(false);
10529 return Err(common::Error::HttpError(err));
10530 }
10531 Ok(res) => {
10532 let (mut parts, body) = res.into_parts();
10533 let mut body = common::Body::new(body);
10534 if !parts.status.is_success() {
10535 let bytes = common::to_bytes(body).await.unwrap_or_default();
10536 let error = serde_json::from_str(&common::to_string(&bytes));
10537 let response = common::to_response(parts, bytes.into());
10538
10539 if let common::Retry::After(d) =
10540 dlg.http_failure(&response, error.as_ref().ok())
10541 {
10542 sleep(d).await;
10543 continue;
10544 }
10545
10546 dlg.finished(false);
10547
10548 return Err(match error {
10549 Ok(value) => common::Error::BadRequest(value),
10550 _ => common::Error::Failure(response),
10551 });
10552 }
10553 let response = {
10554 let bytes = common::to_bytes(body).await.unwrap_or_default();
10555 let encoded = common::to_string(&bytes);
10556 match serde_json::from_str(&encoded) {
10557 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10558 Err(error) => {
10559 dlg.response_json_decode_error(&encoded, &error);
10560 return Err(common::Error::JsonDecodeError(
10561 encoded.to_string(),
10562 error,
10563 ));
10564 }
10565 }
10566 };
10567
10568 dlg.finished(true);
10569 return Ok(response);
10570 }
10571 }
10572 }
10573 }
10574
10575 /// The name of the enterprise in the form enterprises/{enterpriseId}.
10576 ///
10577 /// Sets the *parent* path property to the given value.
10578 ///
10579 /// Even though the property as already been set when instantiating this call,
10580 /// we provide this method for API completeness.
10581 pub fn parent(mut self, new_value: &str) -> EnterprisePolicyListCall<'a, C> {
10582 self._parent = new_value.to_string();
10583 self
10584 }
10585 /// A token identifying a page of results returned by the server.
10586 ///
10587 /// Sets the *page token* query property to the given value.
10588 pub fn page_token(mut self, new_value: &str) -> EnterprisePolicyListCall<'a, C> {
10589 self._page_token = Some(new_value.to_string());
10590 self
10591 }
10592 /// The requested page size. The actual page size may be fixed to a min or max value.
10593 ///
10594 /// Sets the *page size* query property to the given value.
10595 pub fn page_size(mut self, new_value: i32) -> EnterprisePolicyListCall<'a, C> {
10596 self._page_size = Some(new_value);
10597 self
10598 }
10599 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10600 /// while executing the actual API request.
10601 ///
10602 /// ````text
10603 /// It should be used to handle progress information, and to implement a certain level of resilience.
10604 /// ````
10605 ///
10606 /// Sets the *delegate* property to the given value.
10607 pub fn delegate(
10608 mut self,
10609 new_value: &'a mut dyn common::Delegate,
10610 ) -> EnterprisePolicyListCall<'a, C> {
10611 self._delegate = Some(new_value);
10612 self
10613 }
10614
10615 /// Set any additional parameter of the query string used in the request.
10616 /// It should be used to set parameters which are not yet available through their own
10617 /// setters.
10618 ///
10619 /// Please note that this method must not be used to set any of the known parameters
10620 /// which have their own setter method. If done anyway, the request will fail.
10621 ///
10622 /// # Additional Parameters
10623 ///
10624 /// * *$.xgafv* (query-string) - V1 error format.
10625 /// * *access_token* (query-string) - OAuth access token.
10626 /// * *alt* (query-string) - Data format for response.
10627 /// * *callback* (query-string) - JSONP
10628 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10629 /// * *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.
10630 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10631 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10632 /// * *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.
10633 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10634 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10635 pub fn param<T>(mut self, name: T, value: T) -> EnterprisePolicyListCall<'a, C>
10636 where
10637 T: AsRef<str>,
10638 {
10639 self._additional_params
10640 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10641 self
10642 }
10643
10644 /// Identifies the authorization scope for the method you are building.
10645 ///
10646 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10647 /// [`Scope::Full`].
10648 ///
10649 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10650 /// tokens for more than one scope.
10651 ///
10652 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10653 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10654 /// sufficient, a read-write scope will do as well.
10655 pub fn add_scope<St>(mut self, scope: St) -> EnterprisePolicyListCall<'a, C>
10656 where
10657 St: AsRef<str>,
10658 {
10659 self._scopes.insert(String::from(scope.as_ref()));
10660 self
10661 }
10662 /// Identifies the authorization scope(s) for the method you are building.
10663 ///
10664 /// See [`Self::add_scope()`] for details.
10665 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterprisePolicyListCall<'a, C>
10666 where
10667 I: IntoIterator<Item = St>,
10668 St: AsRef<str>,
10669 {
10670 self._scopes
10671 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10672 self
10673 }
10674
10675 /// Removes all scopes, and no default scope will be used either.
10676 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10677 /// for details).
10678 pub fn clear_scopes(mut self) -> EnterprisePolicyListCall<'a, C> {
10679 self._scopes.clear();
10680 self
10681 }
10682}
10683
10684/// Updates or creates applications in a policy.
10685///
10686/// A builder for the *policies.modifyPolicyApplications* method supported by a *enterprise* resource.
10687/// It is not used directly, but through a [`EnterpriseMethods`] instance.
10688///
10689/// # Example
10690///
10691/// Instantiate a resource method builder
10692///
10693/// ```test_harness,no_run
10694/// # extern crate hyper;
10695/// # extern crate hyper_rustls;
10696/// # extern crate google_androidmanagement1 as androidmanagement1;
10697/// use androidmanagement1::api::ModifyPolicyApplicationsRequest;
10698/// # async fn dox() {
10699/// # use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10700///
10701/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10702/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10703/// # .with_native_roots()
10704/// # .unwrap()
10705/// # .https_only()
10706/// # .enable_http2()
10707/// # .build();
10708///
10709/// # let executor = hyper_util::rt::TokioExecutor::new();
10710/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10711/// # secret,
10712/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10713/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10714/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10715/// # ),
10716/// # ).build().await.unwrap();
10717///
10718/// # let client = hyper_util::client::legacy::Client::builder(
10719/// # hyper_util::rt::TokioExecutor::new()
10720/// # )
10721/// # .build(
10722/// # hyper_rustls::HttpsConnectorBuilder::new()
10723/// # .with_native_roots()
10724/// # .unwrap()
10725/// # .https_or_http()
10726/// # .enable_http2()
10727/// # .build()
10728/// # );
10729/// # let mut hub = AndroidManagement::new(client, auth);
10730/// // As the method needs a request, you would usually fill it with the desired information
10731/// // into the respective structure. Some of the parts shown here might not be applicable !
10732/// // Values shown here are possibly random and not representative !
10733/// let mut req = ModifyPolicyApplicationsRequest::default();
10734///
10735/// // You can configure optional parameters by calling the respective setters at will, and
10736/// // execute the final call using `doit()`.
10737/// // Values shown here are possibly random and not representative !
10738/// let result = hub.enterprises().policies_modify_policy_applications(req, "name")
10739/// .doit().await;
10740/// # }
10741/// ```
10742pub struct EnterprisePolicyModifyPolicyApplicationCall<'a, C>
10743where
10744 C: 'a,
10745{
10746 hub: &'a AndroidManagement<C>,
10747 _request: ModifyPolicyApplicationsRequest,
10748 _name: String,
10749 _delegate: Option<&'a mut dyn common::Delegate>,
10750 _additional_params: HashMap<String, String>,
10751 _scopes: BTreeSet<String>,
10752}
10753
10754impl<'a, C> common::CallBuilder for EnterprisePolicyModifyPolicyApplicationCall<'a, C> {}
10755
10756impl<'a, C> EnterprisePolicyModifyPolicyApplicationCall<'a, C>
10757where
10758 C: common::Connector,
10759{
10760 /// Perform the operation you have build so far.
10761 pub async fn doit(
10762 mut self,
10763 ) -> common::Result<(common::Response, ModifyPolicyApplicationsResponse)> {
10764 use std::borrow::Cow;
10765 use std::io::{Read, Seek};
10766
10767 use common::{url::Params, ToParts};
10768 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10769
10770 let mut dd = common::DefaultDelegate;
10771 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10772 dlg.begin(common::MethodInfo {
10773 id: "androidmanagement.enterprises.policies.modifyPolicyApplications",
10774 http_method: hyper::Method::POST,
10775 });
10776
10777 for &field in ["alt", "name"].iter() {
10778 if self._additional_params.contains_key(field) {
10779 dlg.finished(false);
10780 return Err(common::Error::FieldClash(field));
10781 }
10782 }
10783
10784 let mut params = Params::with_capacity(4 + self._additional_params.len());
10785 params.push("name", self._name);
10786
10787 params.extend(self._additional_params.iter());
10788
10789 params.push("alt", "json");
10790 let mut url = self.hub._base_url.clone() + "v1/{+name}:modifyPolicyApplications";
10791 if self._scopes.is_empty() {
10792 self._scopes.insert(Scope::Full.as_ref().to_string());
10793 }
10794
10795 #[allow(clippy::single_element_loop)]
10796 for &(find_this, param_name) in [("{+name}", "name")].iter() {
10797 url = params.uri_replacement(url, param_name, find_this, true);
10798 }
10799 {
10800 let to_remove = ["name"];
10801 params.remove_params(&to_remove);
10802 }
10803
10804 let url = params.parse_with_url(&url);
10805
10806 let mut json_mime_type = mime::APPLICATION_JSON;
10807 let mut request_value_reader = {
10808 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10809 common::remove_json_null_values(&mut value);
10810 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10811 serde_json::to_writer(&mut dst, &value).unwrap();
10812 dst
10813 };
10814 let request_size = request_value_reader
10815 .seek(std::io::SeekFrom::End(0))
10816 .unwrap();
10817 request_value_reader
10818 .seek(std::io::SeekFrom::Start(0))
10819 .unwrap();
10820
10821 loop {
10822 let token = match self
10823 .hub
10824 .auth
10825 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10826 .await
10827 {
10828 Ok(token) => token,
10829 Err(e) => match dlg.token(e) {
10830 Ok(token) => token,
10831 Err(e) => {
10832 dlg.finished(false);
10833 return Err(common::Error::MissingToken(e));
10834 }
10835 },
10836 };
10837 request_value_reader
10838 .seek(std::io::SeekFrom::Start(0))
10839 .unwrap();
10840 let mut req_result = {
10841 let client = &self.hub.client;
10842 dlg.pre_request();
10843 let mut req_builder = hyper::Request::builder()
10844 .method(hyper::Method::POST)
10845 .uri(url.as_str())
10846 .header(USER_AGENT, self.hub._user_agent.clone());
10847
10848 if let Some(token) = token.as_ref() {
10849 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10850 }
10851
10852 let request = req_builder
10853 .header(CONTENT_TYPE, json_mime_type.to_string())
10854 .header(CONTENT_LENGTH, request_size as u64)
10855 .body(common::to_body(
10856 request_value_reader.get_ref().clone().into(),
10857 ));
10858
10859 client.request(request.unwrap()).await
10860 };
10861
10862 match req_result {
10863 Err(err) => {
10864 if let common::Retry::After(d) = dlg.http_error(&err) {
10865 sleep(d).await;
10866 continue;
10867 }
10868 dlg.finished(false);
10869 return Err(common::Error::HttpError(err));
10870 }
10871 Ok(res) => {
10872 let (mut parts, body) = res.into_parts();
10873 let mut body = common::Body::new(body);
10874 if !parts.status.is_success() {
10875 let bytes = common::to_bytes(body).await.unwrap_or_default();
10876 let error = serde_json::from_str(&common::to_string(&bytes));
10877 let response = common::to_response(parts, bytes.into());
10878
10879 if let common::Retry::After(d) =
10880 dlg.http_failure(&response, error.as_ref().ok())
10881 {
10882 sleep(d).await;
10883 continue;
10884 }
10885
10886 dlg.finished(false);
10887
10888 return Err(match error {
10889 Ok(value) => common::Error::BadRequest(value),
10890 _ => common::Error::Failure(response),
10891 });
10892 }
10893 let response = {
10894 let bytes = common::to_bytes(body).await.unwrap_or_default();
10895 let encoded = common::to_string(&bytes);
10896 match serde_json::from_str(&encoded) {
10897 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10898 Err(error) => {
10899 dlg.response_json_decode_error(&encoded, &error);
10900 return Err(common::Error::JsonDecodeError(
10901 encoded.to_string(),
10902 error,
10903 ));
10904 }
10905 }
10906 };
10907
10908 dlg.finished(true);
10909 return Ok(response);
10910 }
10911 }
10912 }
10913 }
10914
10915 ///
10916 /// Sets the *request* property to the given value.
10917 ///
10918 /// Even though the property as already been set when instantiating this call,
10919 /// we provide this method for API completeness.
10920 pub fn request(
10921 mut self,
10922 new_value: ModifyPolicyApplicationsRequest,
10923 ) -> EnterprisePolicyModifyPolicyApplicationCall<'a, C> {
10924 self._request = new_value;
10925 self
10926 }
10927 /// Required. The name of the Policy containing the ApplicationPolicy objects to be updated, in the form enterprises/{enterpriseId}/policies/{policyId}.
10928 ///
10929 /// Sets the *name* path property to the given value.
10930 ///
10931 /// Even though the property as already been set when instantiating this call,
10932 /// we provide this method for API completeness.
10933 pub fn name(mut self, new_value: &str) -> EnterprisePolicyModifyPolicyApplicationCall<'a, C> {
10934 self._name = new_value.to_string();
10935 self
10936 }
10937 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10938 /// while executing the actual API request.
10939 ///
10940 /// ````text
10941 /// It should be used to handle progress information, and to implement a certain level of resilience.
10942 /// ````
10943 ///
10944 /// Sets the *delegate* property to the given value.
10945 pub fn delegate(
10946 mut self,
10947 new_value: &'a mut dyn common::Delegate,
10948 ) -> EnterprisePolicyModifyPolicyApplicationCall<'a, C> {
10949 self._delegate = Some(new_value);
10950 self
10951 }
10952
10953 /// Set any additional parameter of the query string used in the request.
10954 /// It should be used to set parameters which are not yet available through their own
10955 /// setters.
10956 ///
10957 /// Please note that this method must not be used to set any of the known parameters
10958 /// which have their own setter method. If done anyway, the request will fail.
10959 ///
10960 /// # Additional Parameters
10961 ///
10962 /// * *$.xgafv* (query-string) - V1 error format.
10963 /// * *access_token* (query-string) - OAuth access token.
10964 /// * *alt* (query-string) - Data format for response.
10965 /// * *callback* (query-string) - JSONP
10966 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10967 /// * *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.
10968 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10969 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10970 /// * *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.
10971 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10972 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10973 pub fn param<T>(
10974 mut self,
10975 name: T,
10976 value: T,
10977 ) -> EnterprisePolicyModifyPolicyApplicationCall<'a, C>
10978 where
10979 T: AsRef<str>,
10980 {
10981 self._additional_params
10982 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10983 self
10984 }
10985
10986 /// Identifies the authorization scope for the method you are building.
10987 ///
10988 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10989 /// [`Scope::Full`].
10990 ///
10991 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10992 /// tokens for more than one scope.
10993 ///
10994 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10995 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10996 /// sufficient, a read-write scope will do as well.
10997 pub fn add_scope<St>(mut self, scope: St) -> EnterprisePolicyModifyPolicyApplicationCall<'a, C>
10998 where
10999 St: AsRef<str>,
11000 {
11001 self._scopes.insert(String::from(scope.as_ref()));
11002 self
11003 }
11004 /// Identifies the authorization scope(s) for the method you are building.
11005 ///
11006 /// See [`Self::add_scope()`] for details.
11007 pub fn add_scopes<I, St>(
11008 mut self,
11009 scopes: I,
11010 ) -> EnterprisePolicyModifyPolicyApplicationCall<'a, C>
11011 where
11012 I: IntoIterator<Item = St>,
11013 St: AsRef<str>,
11014 {
11015 self._scopes
11016 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11017 self
11018 }
11019
11020 /// Removes all scopes, and no default scope will be used either.
11021 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11022 /// for details).
11023 pub fn clear_scopes(mut self) -> EnterprisePolicyModifyPolicyApplicationCall<'a, C> {
11024 self._scopes.clear();
11025 self
11026 }
11027}
11028
11029/// Updates or creates a policy.
11030///
11031/// A builder for the *policies.patch* method supported by a *enterprise* resource.
11032/// It is not used directly, but through a [`EnterpriseMethods`] instance.
11033///
11034/// # Example
11035///
11036/// Instantiate a resource method builder
11037///
11038/// ```test_harness,no_run
11039/// # extern crate hyper;
11040/// # extern crate hyper_rustls;
11041/// # extern crate google_androidmanagement1 as androidmanagement1;
11042/// use androidmanagement1::api::Policy;
11043/// # async fn dox() {
11044/// # use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11045///
11046/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11047/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11048/// # .with_native_roots()
11049/// # .unwrap()
11050/// # .https_only()
11051/// # .enable_http2()
11052/// # .build();
11053///
11054/// # let executor = hyper_util::rt::TokioExecutor::new();
11055/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11056/// # secret,
11057/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11058/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11059/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11060/// # ),
11061/// # ).build().await.unwrap();
11062///
11063/// # let client = hyper_util::client::legacy::Client::builder(
11064/// # hyper_util::rt::TokioExecutor::new()
11065/// # )
11066/// # .build(
11067/// # hyper_rustls::HttpsConnectorBuilder::new()
11068/// # .with_native_roots()
11069/// # .unwrap()
11070/// # .https_or_http()
11071/// # .enable_http2()
11072/// # .build()
11073/// # );
11074/// # let mut hub = AndroidManagement::new(client, auth);
11075/// // As the method needs a request, you would usually fill it with the desired information
11076/// // into the respective structure. Some of the parts shown here might not be applicable !
11077/// // Values shown here are possibly random and not representative !
11078/// let mut req = Policy::default();
11079///
11080/// // You can configure optional parameters by calling the respective setters at will, and
11081/// // execute the final call using `doit()`.
11082/// // Values shown here are possibly random and not representative !
11083/// let result = hub.enterprises().policies_patch(req, "name")
11084/// .update_mask(FieldMask::new::<&str>(&[]))
11085/// .doit().await;
11086/// # }
11087/// ```
11088pub struct EnterprisePolicyPatchCall<'a, C>
11089where
11090 C: 'a,
11091{
11092 hub: &'a AndroidManagement<C>,
11093 _request: Policy,
11094 _name: String,
11095 _update_mask: Option<common::FieldMask>,
11096 _delegate: Option<&'a mut dyn common::Delegate>,
11097 _additional_params: HashMap<String, String>,
11098 _scopes: BTreeSet<String>,
11099}
11100
11101impl<'a, C> common::CallBuilder for EnterprisePolicyPatchCall<'a, C> {}
11102
11103impl<'a, C> EnterprisePolicyPatchCall<'a, C>
11104where
11105 C: common::Connector,
11106{
11107 /// Perform the operation you have build so far.
11108 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
11109 use std::borrow::Cow;
11110 use std::io::{Read, Seek};
11111
11112 use common::{url::Params, ToParts};
11113 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11114
11115 let mut dd = common::DefaultDelegate;
11116 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11117 dlg.begin(common::MethodInfo {
11118 id: "androidmanagement.enterprises.policies.patch",
11119 http_method: hyper::Method::PATCH,
11120 });
11121
11122 for &field in ["alt", "name", "updateMask"].iter() {
11123 if self._additional_params.contains_key(field) {
11124 dlg.finished(false);
11125 return Err(common::Error::FieldClash(field));
11126 }
11127 }
11128
11129 let mut params = Params::with_capacity(5 + self._additional_params.len());
11130 params.push("name", self._name);
11131 if let Some(value) = self._update_mask.as_ref() {
11132 params.push("updateMask", value.to_string());
11133 }
11134
11135 params.extend(self._additional_params.iter());
11136
11137 params.push("alt", "json");
11138 let mut url = self.hub._base_url.clone() + "v1/{+name}";
11139 if self._scopes.is_empty() {
11140 self._scopes.insert(Scope::Full.as_ref().to_string());
11141 }
11142
11143 #[allow(clippy::single_element_loop)]
11144 for &(find_this, param_name) in [("{+name}", "name")].iter() {
11145 url = params.uri_replacement(url, param_name, find_this, true);
11146 }
11147 {
11148 let to_remove = ["name"];
11149 params.remove_params(&to_remove);
11150 }
11151
11152 let url = params.parse_with_url(&url);
11153
11154 let mut json_mime_type = mime::APPLICATION_JSON;
11155 let mut request_value_reader = {
11156 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11157 common::remove_json_null_values(&mut value);
11158 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11159 serde_json::to_writer(&mut dst, &value).unwrap();
11160 dst
11161 };
11162 let request_size = request_value_reader
11163 .seek(std::io::SeekFrom::End(0))
11164 .unwrap();
11165 request_value_reader
11166 .seek(std::io::SeekFrom::Start(0))
11167 .unwrap();
11168
11169 loop {
11170 let token = match self
11171 .hub
11172 .auth
11173 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11174 .await
11175 {
11176 Ok(token) => token,
11177 Err(e) => match dlg.token(e) {
11178 Ok(token) => token,
11179 Err(e) => {
11180 dlg.finished(false);
11181 return Err(common::Error::MissingToken(e));
11182 }
11183 },
11184 };
11185 request_value_reader
11186 .seek(std::io::SeekFrom::Start(0))
11187 .unwrap();
11188 let mut req_result = {
11189 let client = &self.hub.client;
11190 dlg.pre_request();
11191 let mut req_builder = hyper::Request::builder()
11192 .method(hyper::Method::PATCH)
11193 .uri(url.as_str())
11194 .header(USER_AGENT, self.hub._user_agent.clone());
11195
11196 if let Some(token) = token.as_ref() {
11197 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11198 }
11199
11200 let request = req_builder
11201 .header(CONTENT_TYPE, json_mime_type.to_string())
11202 .header(CONTENT_LENGTH, request_size as u64)
11203 .body(common::to_body(
11204 request_value_reader.get_ref().clone().into(),
11205 ));
11206
11207 client.request(request.unwrap()).await
11208 };
11209
11210 match req_result {
11211 Err(err) => {
11212 if let common::Retry::After(d) = dlg.http_error(&err) {
11213 sleep(d).await;
11214 continue;
11215 }
11216 dlg.finished(false);
11217 return Err(common::Error::HttpError(err));
11218 }
11219 Ok(res) => {
11220 let (mut parts, body) = res.into_parts();
11221 let mut body = common::Body::new(body);
11222 if !parts.status.is_success() {
11223 let bytes = common::to_bytes(body).await.unwrap_or_default();
11224 let error = serde_json::from_str(&common::to_string(&bytes));
11225 let response = common::to_response(parts, bytes.into());
11226
11227 if let common::Retry::After(d) =
11228 dlg.http_failure(&response, error.as_ref().ok())
11229 {
11230 sleep(d).await;
11231 continue;
11232 }
11233
11234 dlg.finished(false);
11235
11236 return Err(match error {
11237 Ok(value) => common::Error::BadRequest(value),
11238 _ => common::Error::Failure(response),
11239 });
11240 }
11241 let response = {
11242 let bytes = common::to_bytes(body).await.unwrap_or_default();
11243 let encoded = common::to_string(&bytes);
11244 match serde_json::from_str(&encoded) {
11245 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11246 Err(error) => {
11247 dlg.response_json_decode_error(&encoded, &error);
11248 return Err(common::Error::JsonDecodeError(
11249 encoded.to_string(),
11250 error,
11251 ));
11252 }
11253 }
11254 };
11255
11256 dlg.finished(true);
11257 return Ok(response);
11258 }
11259 }
11260 }
11261 }
11262
11263 ///
11264 /// Sets the *request* property to the given value.
11265 ///
11266 /// Even though the property as already been set when instantiating this call,
11267 /// we provide this method for API completeness.
11268 pub fn request(mut self, new_value: Policy) -> EnterprisePolicyPatchCall<'a, C> {
11269 self._request = new_value;
11270 self
11271 }
11272 /// The name of the policy in the form enterprises/{enterpriseId}/policies/{policyId}.
11273 ///
11274 /// Sets the *name* path property to the given value.
11275 ///
11276 /// Even though the property as already been set when instantiating this call,
11277 /// we provide this method for API completeness.
11278 pub fn name(mut self, new_value: &str) -> EnterprisePolicyPatchCall<'a, C> {
11279 self._name = new_value.to_string();
11280 self
11281 }
11282 /// The field mask indicating the fields to update. If not set, all modifiable fields will be modified.
11283 ///
11284 /// Sets the *update mask* query property to the given value.
11285 pub fn update_mask(mut self, new_value: common::FieldMask) -> EnterprisePolicyPatchCall<'a, C> {
11286 self._update_mask = Some(new_value);
11287 self
11288 }
11289 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11290 /// while executing the actual API request.
11291 ///
11292 /// ````text
11293 /// It should be used to handle progress information, and to implement a certain level of resilience.
11294 /// ````
11295 ///
11296 /// Sets the *delegate* property to the given value.
11297 pub fn delegate(
11298 mut self,
11299 new_value: &'a mut dyn common::Delegate,
11300 ) -> EnterprisePolicyPatchCall<'a, C> {
11301 self._delegate = Some(new_value);
11302 self
11303 }
11304
11305 /// Set any additional parameter of the query string used in the request.
11306 /// It should be used to set parameters which are not yet available through their own
11307 /// setters.
11308 ///
11309 /// Please note that this method must not be used to set any of the known parameters
11310 /// which have their own setter method. If done anyway, the request will fail.
11311 ///
11312 /// # Additional Parameters
11313 ///
11314 /// * *$.xgafv* (query-string) - V1 error format.
11315 /// * *access_token* (query-string) - OAuth access token.
11316 /// * *alt* (query-string) - Data format for response.
11317 /// * *callback* (query-string) - JSONP
11318 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11319 /// * *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.
11320 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11321 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11322 /// * *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.
11323 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11324 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11325 pub fn param<T>(mut self, name: T, value: T) -> EnterprisePolicyPatchCall<'a, C>
11326 where
11327 T: AsRef<str>,
11328 {
11329 self._additional_params
11330 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11331 self
11332 }
11333
11334 /// Identifies the authorization scope for the method you are building.
11335 ///
11336 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11337 /// [`Scope::Full`].
11338 ///
11339 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11340 /// tokens for more than one scope.
11341 ///
11342 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11343 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11344 /// sufficient, a read-write scope will do as well.
11345 pub fn add_scope<St>(mut self, scope: St) -> EnterprisePolicyPatchCall<'a, C>
11346 where
11347 St: AsRef<str>,
11348 {
11349 self._scopes.insert(String::from(scope.as_ref()));
11350 self
11351 }
11352 /// Identifies the authorization scope(s) for the method you are building.
11353 ///
11354 /// See [`Self::add_scope()`] for details.
11355 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterprisePolicyPatchCall<'a, C>
11356 where
11357 I: IntoIterator<Item = St>,
11358 St: AsRef<str>,
11359 {
11360 self._scopes
11361 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11362 self
11363 }
11364
11365 /// Removes all scopes, and no default scope will be used either.
11366 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11367 /// for details).
11368 pub fn clear_scopes(mut self) -> EnterprisePolicyPatchCall<'a, C> {
11369 self._scopes.clear();
11370 self
11371 }
11372}
11373
11374/// Removes applications in a policy.
11375///
11376/// A builder for the *policies.removePolicyApplications* method supported by a *enterprise* resource.
11377/// It is not used directly, but through a [`EnterpriseMethods`] instance.
11378///
11379/// # Example
11380///
11381/// Instantiate a resource method builder
11382///
11383/// ```test_harness,no_run
11384/// # extern crate hyper;
11385/// # extern crate hyper_rustls;
11386/// # extern crate google_androidmanagement1 as androidmanagement1;
11387/// use androidmanagement1::api::RemovePolicyApplicationsRequest;
11388/// # async fn dox() {
11389/// # use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11390///
11391/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11392/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11393/// # .with_native_roots()
11394/// # .unwrap()
11395/// # .https_only()
11396/// # .enable_http2()
11397/// # .build();
11398///
11399/// # let executor = hyper_util::rt::TokioExecutor::new();
11400/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11401/// # secret,
11402/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11403/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11404/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11405/// # ),
11406/// # ).build().await.unwrap();
11407///
11408/// # let client = hyper_util::client::legacy::Client::builder(
11409/// # hyper_util::rt::TokioExecutor::new()
11410/// # )
11411/// # .build(
11412/// # hyper_rustls::HttpsConnectorBuilder::new()
11413/// # .with_native_roots()
11414/// # .unwrap()
11415/// # .https_or_http()
11416/// # .enable_http2()
11417/// # .build()
11418/// # );
11419/// # let mut hub = AndroidManagement::new(client, auth);
11420/// // As the method needs a request, you would usually fill it with the desired information
11421/// // into the respective structure. Some of the parts shown here might not be applicable !
11422/// // Values shown here are possibly random and not representative !
11423/// let mut req = RemovePolicyApplicationsRequest::default();
11424///
11425/// // You can configure optional parameters by calling the respective setters at will, and
11426/// // execute the final call using `doit()`.
11427/// // Values shown here are possibly random and not representative !
11428/// let result = hub.enterprises().policies_remove_policy_applications(req, "name")
11429/// .doit().await;
11430/// # }
11431/// ```
11432pub struct EnterprisePolicyRemovePolicyApplicationCall<'a, C>
11433where
11434 C: 'a,
11435{
11436 hub: &'a AndroidManagement<C>,
11437 _request: RemovePolicyApplicationsRequest,
11438 _name: String,
11439 _delegate: Option<&'a mut dyn common::Delegate>,
11440 _additional_params: HashMap<String, String>,
11441 _scopes: BTreeSet<String>,
11442}
11443
11444impl<'a, C> common::CallBuilder for EnterprisePolicyRemovePolicyApplicationCall<'a, C> {}
11445
11446impl<'a, C> EnterprisePolicyRemovePolicyApplicationCall<'a, C>
11447where
11448 C: common::Connector,
11449{
11450 /// Perform the operation you have build so far.
11451 pub async fn doit(
11452 mut self,
11453 ) -> common::Result<(common::Response, RemovePolicyApplicationsResponse)> {
11454 use std::borrow::Cow;
11455 use std::io::{Read, Seek};
11456
11457 use common::{url::Params, ToParts};
11458 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11459
11460 let mut dd = common::DefaultDelegate;
11461 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11462 dlg.begin(common::MethodInfo {
11463 id: "androidmanagement.enterprises.policies.removePolicyApplications",
11464 http_method: hyper::Method::POST,
11465 });
11466
11467 for &field in ["alt", "name"].iter() {
11468 if self._additional_params.contains_key(field) {
11469 dlg.finished(false);
11470 return Err(common::Error::FieldClash(field));
11471 }
11472 }
11473
11474 let mut params = Params::with_capacity(4 + self._additional_params.len());
11475 params.push("name", self._name);
11476
11477 params.extend(self._additional_params.iter());
11478
11479 params.push("alt", "json");
11480 let mut url = self.hub._base_url.clone() + "v1/{+name}:removePolicyApplications";
11481 if self._scopes.is_empty() {
11482 self._scopes.insert(Scope::Full.as_ref().to_string());
11483 }
11484
11485 #[allow(clippy::single_element_loop)]
11486 for &(find_this, param_name) in [("{+name}", "name")].iter() {
11487 url = params.uri_replacement(url, param_name, find_this, true);
11488 }
11489 {
11490 let to_remove = ["name"];
11491 params.remove_params(&to_remove);
11492 }
11493
11494 let url = params.parse_with_url(&url);
11495
11496 let mut json_mime_type = mime::APPLICATION_JSON;
11497 let mut request_value_reader = {
11498 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11499 common::remove_json_null_values(&mut value);
11500 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11501 serde_json::to_writer(&mut dst, &value).unwrap();
11502 dst
11503 };
11504 let request_size = request_value_reader
11505 .seek(std::io::SeekFrom::End(0))
11506 .unwrap();
11507 request_value_reader
11508 .seek(std::io::SeekFrom::Start(0))
11509 .unwrap();
11510
11511 loop {
11512 let token = match self
11513 .hub
11514 .auth
11515 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11516 .await
11517 {
11518 Ok(token) => token,
11519 Err(e) => match dlg.token(e) {
11520 Ok(token) => token,
11521 Err(e) => {
11522 dlg.finished(false);
11523 return Err(common::Error::MissingToken(e));
11524 }
11525 },
11526 };
11527 request_value_reader
11528 .seek(std::io::SeekFrom::Start(0))
11529 .unwrap();
11530 let mut req_result = {
11531 let client = &self.hub.client;
11532 dlg.pre_request();
11533 let mut req_builder = hyper::Request::builder()
11534 .method(hyper::Method::POST)
11535 .uri(url.as_str())
11536 .header(USER_AGENT, self.hub._user_agent.clone());
11537
11538 if let Some(token) = token.as_ref() {
11539 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11540 }
11541
11542 let request = req_builder
11543 .header(CONTENT_TYPE, json_mime_type.to_string())
11544 .header(CONTENT_LENGTH, request_size as u64)
11545 .body(common::to_body(
11546 request_value_reader.get_ref().clone().into(),
11547 ));
11548
11549 client.request(request.unwrap()).await
11550 };
11551
11552 match req_result {
11553 Err(err) => {
11554 if let common::Retry::After(d) = dlg.http_error(&err) {
11555 sleep(d).await;
11556 continue;
11557 }
11558 dlg.finished(false);
11559 return Err(common::Error::HttpError(err));
11560 }
11561 Ok(res) => {
11562 let (mut parts, body) = res.into_parts();
11563 let mut body = common::Body::new(body);
11564 if !parts.status.is_success() {
11565 let bytes = common::to_bytes(body).await.unwrap_or_default();
11566 let error = serde_json::from_str(&common::to_string(&bytes));
11567 let response = common::to_response(parts, bytes.into());
11568
11569 if let common::Retry::After(d) =
11570 dlg.http_failure(&response, error.as_ref().ok())
11571 {
11572 sleep(d).await;
11573 continue;
11574 }
11575
11576 dlg.finished(false);
11577
11578 return Err(match error {
11579 Ok(value) => common::Error::BadRequest(value),
11580 _ => common::Error::Failure(response),
11581 });
11582 }
11583 let response = {
11584 let bytes = common::to_bytes(body).await.unwrap_or_default();
11585 let encoded = common::to_string(&bytes);
11586 match serde_json::from_str(&encoded) {
11587 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11588 Err(error) => {
11589 dlg.response_json_decode_error(&encoded, &error);
11590 return Err(common::Error::JsonDecodeError(
11591 encoded.to_string(),
11592 error,
11593 ));
11594 }
11595 }
11596 };
11597
11598 dlg.finished(true);
11599 return Ok(response);
11600 }
11601 }
11602 }
11603 }
11604
11605 ///
11606 /// Sets the *request* property to the given value.
11607 ///
11608 /// Even though the property as already been set when instantiating this call,
11609 /// we provide this method for API completeness.
11610 pub fn request(
11611 mut self,
11612 new_value: RemovePolicyApplicationsRequest,
11613 ) -> EnterprisePolicyRemovePolicyApplicationCall<'a, C> {
11614 self._request = new_value;
11615 self
11616 }
11617 /// Required. The name of the policy containing the ApplicationPolicy objects to be removed, in the form enterprises/{enterpriseId}/policies/{policyId}.
11618 ///
11619 /// Sets the *name* path property to the given value.
11620 ///
11621 /// Even though the property as already been set when instantiating this call,
11622 /// we provide this method for API completeness.
11623 pub fn name(mut self, new_value: &str) -> EnterprisePolicyRemovePolicyApplicationCall<'a, C> {
11624 self._name = new_value.to_string();
11625 self
11626 }
11627 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11628 /// while executing the actual API request.
11629 ///
11630 /// ````text
11631 /// It should be used to handle progress information, and to implement a certain level of resilience.
11632 /// ````
11633 ///
11634 /// Sets the *delegate* property to the given value.
11635 pub fn delegate(
11636 mut self,
11637 new_value: &'a mut dyn common::Delegate,
11638 ) -> EnterprisePolicyRemovePolicyApplicationCall<'a, C> {
11639 self._delegate = Some(new_value);
11640 self
11641 }
11642
11643 /// Set any additional parameter of the query string used in the request.
11644 /// It should be used to set parameters which are not yet available through their own
11645 /// setters.
11646 ///
11647 /// Please note that this method must not be used to set any of the known parameters
11648 /// which have their own setter method. If done anyway, the request will fail.
11649 ///
11650 /// # Additional Parameters
11651 ///
11652 /// * *$.xgafv* (query-string) - V1 error format.
11653 /// * *access_token* (query-string) - OAuth access token.
11654 /// * *alt* (query-string) - Data format for response.
11655 /// * *callback* (query-string) - JSONP
11656 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11657 /// * *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.
11658 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11659 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11660 /// * *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.
11661 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11662 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11663 pub fn param<T>(
11664 mut self,
11665 name: T,
11666 value: T,
11667 ) -> EnterprisePolicyRemovePolicyApplicationCall<'a, C>
11668 where
11669 T: AsRef<str>,
11670 {
11671 self._additional_params
11672 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11673 self
11674 }
11675
11676 /// Identifies the authorization scope for the method you are building.
11677 ///
11678 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11679 /// [`Scope::Full`].
11680 ///
11681 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11682 /// tokens for more than one scope.
11683 ///
11684 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11685 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11686 /// sufficient, a read-write scope will do as well.
11687 pub fn add_scope<St>(mut self, scope: St) -> EnterprisePolicyRemovePolicyApplicationCall<'a, C>
11688 where
11689 St: AsRef<str>,
11690 {
11691 self._scopes.insert(String::from(scope.as_ref()));
11692 self
11693 }
11694 /// Identifies the authorization scope(s) for the method you are building.
11695 ///
11696 /// See [`Self::add_scope()`] for details.
11697 pub fn add_scopes<I, St>(
11698 mut self,
11699 scopes: I,
11700 ) -> EnterprisePolicyRemovePolicyApplicationCall<'a, C>
11701 where
11702 I: IntoIterator<Item = St>,
11703 St: AsRef<str>,
11704 {
11705 self._scopes
11706 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11707 self
11708 }
11709
11710 /// Removes all scopes, and no default scope will be used either.
11711 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11712 /// for details).
11713 pub fn clear_scopes(mut self) -> EnterprisePolicyRemovePolicyApplicationCall<'a, C> {
11714 self._scopes.clear();
11715 self
11716 }
11717}
11718
11719/// Creates a web app.
11720///
11721/// A builder for the *webApps.create* method supported by a *enterprise* resource.
11722/// It is not used directly, but through a [`EnterpriseMethods`] instance.
11723///
11724/// # Example
11725///
11726/// Instantiate a resource method builder
11727///
11728/// ```test_harness,no_run
11729/// # extern crate hyper;
11730/// # extern crate hyper_rustls;
11731/// # extern crate google_androidmanagement1 as androidmanagement1;
11732/// use androidmanagement1::api::WebApp;
11733/// # async fn dox() {
11734/// # use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11735///
11736/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11737/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11738/// # .with_native_roots()
11739/// # .unwrap()
11740/// # .https_only()
11741/// # .enable_http2()
11742/// # .build();
11743///
11744/// # let executor = hyper_util::rt::TokioExecutor::new();
11745/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11746/// # secret,
11747/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11748/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11749/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11750/// # ),
11751/// # ).build().await.unwrap();
11752///
11753/// # let client = hyper_util::client::legacy::Client::builder(
11754/// # hyper_util::rt::TokioExecutor::new()
11755/// # )
11756/// # .build(
11757/// # hyper_rustls::HttpsConnectorBuilder::new()
11758/// # .with_native_roots()
11759/// # .unwrap()
11760/// # .https_or_http()
11761/// # .enable_http2()
11762/// # .build()
11763/// # );
11764/// # let mut hub = AndroidManagement::new(client, auth);
11765/// // As the method needs a request, you would usually fill it with the desired information
11766/// // into the respective structure. Some of the parts shown here might not be applicable !
11767/// // Values shown here are possibly random and not representative !
11768/// let mut req = WebApp::default();
11769///
11770/// // You can configure optional parameters by calling the respective setters at will, and
11771/// // execute the final call using `doit()`.
11772/// // Values shown here are possibly random and not representative !
11773/// let result = hub.enterprises().web_apps_create(req, "parent")
11774/// .doit().await;
11775/// # }
11776/// ```
11777pub struct EnterpriseWebAppCreateCall<'a, C>
11778where
11779 C: 'a,
11780{
11781 hub: &'a AndroidManagement<C>,
11782 _request: WebApp,
11783 _parent: String,
11784 _delegate: Option<&'a mut dyn common::Delegate>,
11785 _additional_params: HashMap<String, String>,
11786 _scopes: BTreeSet<String>,
11787}
11788
11789impl<'a, C> common::CallBuilder for EnterpriseWebAppCreateCall<'a, C> {}
11790
11791impl<'a, C> EnterpriseWebAppCreateCall<'a, C>
11792where
11793 C: common::Connector,
11794{
11795 /// Perform the operation you have build so far.
11796 pub async fn doit(mut self) -> common::Result<(common::Response, WebApp)> {
11797 use std::borrow::Cow;
11798 use std::io::{Read, Seek};
11799
11800 use common::{url::Params, ToParts};
11801 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11802
11803 let mut dd = common::DefaultDelegate;
11804 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11805 dlg.begin(common::MethodInfo {
11806 id: "androidmanagement.enterprises.webApps.create",
11807 http_method: hyper::Method::POST,
11808 });
11809
11810 for &field in ["alt", "parent"].iter() {
11811 if self._additional_params.contains_key(field) {
11812 dlg.finished(false);
11813 return Err(common::Error::FieldClash(field));
11814 }
11815 }
11816
11817 let mut params = Params::with_capacity(4 + self._additional_params.len());
11818 params.push("parent", self._parent);
11819
11820 params.extend(self._additional_params.iter());
11821
11822 params.push("alt", "json");
11823 let mut url = self.hub._base_url.clone() + "v1/{+parent}/webApps";
11824 if self._scopes.is_empty() {
11825 self._scopes.insert(Scope::Full.as_ref().to_string());
11826 }
11827
11828 #[allow(clippy::single_element_loop)]
11829 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
11830 url = params.uri_replacement(url, param_name, find_this, true);
11831 }
11832 {
11833 let to_remove = ["parent"];
11834 params.remove_params(&to_remove);
11835 }
11836
11837 let url = params.parse_with_url(&url);
11838
11839 let mut json_mime_type = mime::APPLICATION_JSON;
11840 let mut request_value_reader = {
11841 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11842 common::remove_json_null_values(&mut value);
11843 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11844 serde_json::to_writer(&mut dst, &value).unwrap();
11845 dst
11846 };
11847 let request_size = request_value_reader
11848 .seek(std::io::SeekFrom::End(0))
11849 .unwrap();
11850 request_value_reader
11851 .seek(std::io::SeekFrom::Start(0))
11852 .unwrap();
11853
11854 loop {
11855 let token = match self
11856 .hub
11857 .auth
11858 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11859 .await
11860 {
11861 Ok(token) => token,
11862 Err(e) => match dlg.token(e) {
11863 Ok(token) => token,
11864 Err(e) => {
11865 dlg.finished(false);
11866 return Err(common::Error::MissingToken(e));
11867 }
11868 },
11869 };
11870 request_value_reader
11871 .seek(std::io::SeekFrom::Start(0))
11872 .unwrap();
11873 let mut req_result = {
11874 let client = &self.hub.client;
11875 dlg.pre_request();
11876 let mut req_builder = hyper::Request::builder()
11877 .method(hyper::Method::POST)
11878 .uri(url.as_str())
11879 .header(USER_AGENT, self.hub._user_agent.clone());
11880
11881 if let Some(token) = token.as_ref() {
11882 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11883 }
11884
11885 let request = req_builder
11886 .header(CONTENT_TYPE, json_mime_type.to_string())
11887 .header(CONTENT_LENGTH, request_size as u64)
11888 .body(common::to_body(
11889 request_value_reader.get_ref().clone().into(),
11890 ));
11891
11892 client.request(request.unwrap()).await
11893 };
11894
11895 match req_result {
11896 Err(err) => {
11897 if let common::Retry::After(d) = dlg.http_error(&err) {
11898 sleep(d).await;
11899 continue;
11900 }
11901 dlg.finished(false);
11902 return Err(common::Error::HttpError(err));
11903 }
11904 Ok(res) => {
11905 let (mut parts, body) = res.into_parts();
11906 let mut body = common::Body::new(body);
11907 if !parts.status.is_success() {
11908 let bytes = common::to_bytes(body).await.unwrap_or_default();
11909 let error = serde_json::from_str(&common::to_string(&bytes));
11910 let response = common::to_response(parts, bytes.into());
11911
11912 if let common::Retry::After(d) =
11913 dlg.http_failure(&response, error.as_ref().ok())
11914 {
11915 sleep(d).await;
11916 continue;
11917 }
11918
11919 dlg.finished(false);
11920
11921 return Err(match error {
11922 Ok(value) => common::Error::BadRequest(value),
11923 _ => common::Error::Failure(response),
11924 });
11925 }
11926 let response = {
11927 let bytes = common::to_bytes(body).await.unwrap_or_default();
11928 let encoded = common::to_string(&bytes);
11929 match serde_json::from_str(&encoded) {
11930 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11931 Err(error) => {
11932 dlg.response_json_decode_error(&encoded, &error);
11933 return Err(common::Error::JsonDecodeError(
11934 encoded.to_string(),
11935 error,
11936 ));
11937 }
11938 }
11939 };
11940
11941 dlg.finished(true);
11942 return Ok(response);
11943 }
11944 }
11945 }
11946 }
11947
11948 ///
11949 /// Sets the *request* property to the given value.
11950 ///
11951 /// Even though the property as already been set when instantiating this call,
11952 /// we provide this method for API completeness.
11953 pub fn request(mut self, new_value: WebApp) -> EnterpriseWebAppCreateCall<'a, C> {
11954 self._request = new_value;
11955 self
11956 }
11957 /// The name of the enterprise in the form enterprises/{enterpriseId}.
11958 ///
11959 /// Sets the *parent* path property to the given value.
11960 ///
11961 /// Even though the property as already been set when instantiating this call,
11962 /// we provide this method for API completeness.
11963 pub fn parent(mut self, new_value: &str) -> EnterpriseWebAppCreateCall<'a, C> {
11964 self._parent = new_value.to_string();
11965 self
11966 }
11967 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11968 /// while executing the actual API request.
11969 ///
11970 /// ````text
11971 /// It should be used to handle progress information, and to implement a certain level of resilience.
11972 /// ````
11973 ///
11974 /// Sets the *delegate* property to the given value.
11975 pub fn delegate(
11976 mut self,
11977 new_value: &'a mut dyn common::Delegate,
11978 ) -> EnterpriseWebAppCreateCall<'a, C> {
11979 self._delegate = Some(new_value);
11980 self
11981 }
11982
11983 /// Set any additional parameter of the query string used in the request.
11984 /// It should be used to set parameters which are not yet available through their own
11985 /// setters.
11986 ///
11987 /// Please note that this method must not be used to set any of the known parameters
11988 /// which have their own setter method. If done anyway, the request will fail.
11989 ///
11990 /// # Additional Parameters
11991 ///
11992 /// * *$.xgafv* (query-string) - V1 error format.
11993 /// * *access_token* (query-string) - OAuth access token.
11994 /// * *alt* (query-string) - Data format for response.
11995 /// * *callback* (query-string) - JSONP
11996 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11997 /// * *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.
11998 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11999 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12000 /// * *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.
12001 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12002 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12003 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseWebAppCreateCall<'a, C>
12004 where
12005 T: AsRef<str>,
12006 {
12007 self._additional_params
12008 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12009 self
12010 }
12011
12012 /// Identifies the authorization scope for the method you are building.
12013 ///
12014 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12015 /// [`Scope::Full`].
12016 ///
12017 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12018 /// tokens for more than one scope.
12019 ///
12020 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12021 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12022 /// sufficient, a read-write scope will do as well.
12023 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseWebAppCreateCall<'a, C>
12024 where
12025 St: AsRef<str>,
12026 {
12027 self._scopes.insert(String::from(scope.as_ref()));
12028 self
12029 }
12030 /// Identifies the authorization scope(s) for the method you are building.
12031 ///
12032 /// See [`Self::add_scope()`] for details.
12033 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseWebAppCreateCall<'a, C>
12034 where
12035 I: IntoIterator<Item = St>,
12036 St: AsRef<str>,
12037 {
12038 self._scopes
12039 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12040 self
12041 }
12042
12043 /// Removes all scopes, and no default scope will be used either.
12044 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12045 /// for details).
12046 pub fn clear_scopes(mut self) -> EnterpriseWebAppCreateCall<'a, C> {
12047 self._scopes.clear();
12048 self
12049 }
12050}
12051
12052/// Deletes a web app.
12053///
12054/// A builder for the *webApps.delete* method supported by a *enterprise* resource.
12055/// It is not used directly, but through a [`EnterpriseMethods`] instance.
12056///
12057/// # Example
12058///
12059/// Instantiate a resource method builder
12060///
12061/// ```test_harness,no_run
12062/// # extern crate hyper;
12063/// # extern crate hyper_rustls;
12064/// # extern crate google_androidmanagement1 as androidmanagement1;
12065/// # async fn dox() {
12066/// # use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12067///
12068/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12069/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12070/// # .with_native_roots()
12071/// # .unwrap()
12072/// # .https_only()
12073/// # .enable_http2()
12074/// # .build();
12075///
12076/// # let executor = hyper_util::rt::TokioExecutor::new();
12077/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12078/// # secret,
12079/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12080/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12081/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12082/// # ),
12083/// # ).build().await.unwrap();
12084///
12085/// # let client = hyper_util::client::legacy::Client::builder(
12086/// # hyper_util::rt::TokioExecutor::new()
12087/// # )
12088/// # .build(
12089/// # hyper_rustls::HttpsConnectorBuilder::new()
12090/// # .with_native_roots()
12091/// # .unwrap()
12092/// # .https_or_http()
12093/// # .enable_http2()
12094/// # .build()
12095/// # );
12096/// # let mut hub = AndroidManagement::new(client, auth);
12097/// // You can configure optional parameters by calling the respective setters at will, and
12098/// // execute the final call using `doit()`.
12099/// // Values shown here are possibly random and not representative !
12100/// let result = hub.enterprises().web_apps_delete("name")
12101/// .doit().await;
12102/// # }
12103/// ```
12104pub struct EnterpriseWebAppDeleteCall<'a, C>
12105where
12106 C: 'a,
12107{
12108 hub: &'a AndroidManagement<C>,
12109 _name: String,
12110 _delegate: Option<&'a mut dyn common::Delegate>,
12111 _additional_params: HashMap<String, String>,
12112 _scopes: BTreeSet<String>,
12113}
12114
12115impl<'a, C> common::CallBuilder for EnterpriseWebAppDeleteCall<'a, C> {}
12116
12117impl<'a, C> EnterpriseWebAppDeleteCall<'a, C>
12118where
12119 C: common::Connector,
12120{
12121 /// Perform the operation you have build so far.
12122 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
12123 use std::borrow::Cow;
12124 use std::io::{Read, Seek};
12125
12126 use common::{url::Params, ToParts};
12127 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12128
12129 let mut dd = common::DefaultDelegate;
12130 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12131 dlg.begin(common::MethodInfo {
12132 id: "androidmanagement.enterprises.webApps.delete",
12133 http_method: hyper::Method::DELETE,
12134 });
12135
12136 for &field in ["alt", "name"].iter() {
12137 if self._additional_params.contains_key(field) {
12138 dlg.finished(false);
12139 return Err(common::Error::FieldClash(field));
12140 }
12141 }
12142
12143 let mut params = Params::with_capacity(3 + self._additional_params.len());
12144 params.push("name", self._name);
12145
12146 params.extend(self._additional_params.iter());
12147
12148 params.push("alt", "json");
12149 let mut url = self.hub._base_url.clone() + "v1/{+name}";
12150 if self._scopes.is_empty() {
12151 self._scopes.insert(Scope::Full.as_ref().to_string());
12152 }
12153
12154 #[allow(clippy::single_element_loop)]
12155 for &(find_this, param_name) in [("{+name}", "name")].iter() {
12156 url = params.uri_replacement(url, param_name, find_this, true);
12157 }
12158 {
12159 let to_remove = ["name"];
12160 params.remove_params(&to_remove);
12161 }
12162
12163 let url = params.parse_with_url(&url);
12164
12165 loop {
12166 let token = match self
12167 .hub
12168 .auth
12169 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12170 .await
12171 {
12172 Ok(token) => token,
12173 Err(e) => match dlg.token(e) {
12174 Ok(token) => token,
12175 Err(e) => {
12176 dlg.finished(false);
12177 return Err(common::Error::MissingToken(e));
12178 }
12179 },
12180 };
12181 let mut req_result = {
12182 let client = &self.hub.client;
12183 dlg.pre_request();
12184 let mut req_builder = hyper::Request::builder()
12185 .method(hyper::Method::DELETE)
12186 .uri(url.as_str())
12187 .header(USER_AGENT, self.hub._user_agent.clone());
12188
12189 if let Some(token) = token.as_ref() {
12190 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12191 }
12192
12193 let request = req_builder
12194 .header(CONTENT_LENGTH, 0_u64)
12195 .body(common::to_body::<String>(None));
12196
12197 client.request(request.unwrap()).await
12198 };
12199
12200 match req_result {
12201 Err(err) => {
12202 if let common::Retry::After(d) = dlg.http_error(&err) {
12203 sleep(d).await;
12204 continue;
12205 }
12206 dlg.finished(false);
12207 return Err(common::Error::HttpError(err));
12208 }
12209 Ok(res) => {
12210 let (mut parts, body) = res.into_parts();
12211 let mut body = common::Body::new(body);
12212 if !parts.status.is_success() {
12213 let bytes = common::to_bytes(body).await.unwrap_or_default();
12214 let error = serde_json::from_str(&common::to_string(&bytes));
12215 let response = common::to_response(parts, bytes.into());
12216
12217 if let common::Retry::After(d) =
12218 dlg.http_failure(&response, error.as_ref().ok())
12219 {
12220 sleep(d).await;
12221 continue;
12222 }
12223
12224 dlg.finished(false);
12225
12226 return Err(match error {
12227 Ok(value) => common::Error::BadRequest(value),
12228 _ => common::Error::Failure(response),
12229 });
12230 }
12231 let response = {
12232 let bytes = common::to_bytes(body).await.unwrap_or_default();
12233 let encoded = common::to_string(&bytes);
12234 match serde_json::from_str(&encoded) {
12235 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12236 Err(error) => {
12237 dlg.response_json_decode_error(&encoded, &error);
12238 return Err(common::Error::JsonDecodeError(
12239 encoded.to_string(),
12240 error,
12241 ));
12242 }
12243 }
12244 };
12245
12246 dlg.finished(true);
12247 return Ok(response);
12248 }
12249 }
12250 }
12251 }
12252
12253 /// The name of the web app in the form enterprises/{enterpriseId}/webApps/{packageName}.
12254 ///
12255 /// Sets the *name* path property to the given value.
12256 ///
12257 /// Even though the property as already been set when instantiating this call,
12258 /// we provide this method for API completeness.
12259 pub fn name(mut self, new_value: &str) -> EnterpriseWebAppDeleteCall<'a, C> {
12260 self._name = new_value.to_string();
12261 self
12262 }
12263 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12264 /// while executing the actual API request.
12265 ///
12266 /// ````text
12267 /// It should be used to handle progress information, and to implement a certain level of resilience.
12268 /// ````
12269 ///
12270 /// Sets the *delegate* property to the given value.
12271 pub fn delegate(
12272 mut self,
12273 new_value: &'a mut dyn common::Delegate,
12274 ) -> EnterpriseWebAppDeleteCall<'a, C> {
12275 self._delegate = Some(new_value);
12276 self
12277 }
12278
12279 /// Set any additional parameter of the query string used in the request.
12280 /// It should be used to set parameters which are not yet available through their own
12281 /// setters.
12282 ///
12283 /// Please note that this method must not be used to set any of the known parameters
12284 /// which have their own setter method. If done anyway, the request will fail.
12285 ///
12286 /// # Additional Parameters
12287 ///
12288 /// * *$.xgafv* (query-string) - V1 error format.
12289 /// * *access_token* (query-string) - OAuth access token.
12290 /// * *alt* (query-string) - Data format for response.
12291 /// * *callback* (query-string) - JSONP
12292 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12293 /// * *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.
12294 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12295 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12296 /// * *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.
12297 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12298 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12299 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseWebAppDeleteCall<'a, C>
12300 where
12301 T: AsRef<str>,
12302 {
12303 self._additional_params
12304 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12305 self
12306 }
12307
12308 /// Identifies the authorization scope for the method you are building.
12309 ///
12310 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12311 /// [`Scope::Full`].
12312 ///
12313 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12314 /// tokens for more than one scope.
12315 ///
12316 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12317 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12318 /// sufficient, a read-write scope will do as well.
12319 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseWebAppDeleteCall<'a, C>
12320 where
12321 St: AsRef<str>,
12322 {
12323 self._scopes.insert(String::from(scope.as_ref()));
12324 self
12325 }
12326 /// Identifies the authorization scope(s) for the method you are building.
12327 ///
12328 /// See [`Self::add_scope()`] for details.
12329 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseWebAppDeleteCall<'a, C>
12330 where
12331 I: IntoIterator<Item = St>,
12332 St: AsRef<str>,
12333 {
12334 self._scopes
12335 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12336 self
12337 }
12338
12339 /// Removes all scopes, and no default scope will be used either.
12340 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12341 /// for details).
12342 pub fn clear_scopes(mut self) -> EnterpriseWebAppDeleteCall<'a, C> {
12343 self._scopes.clear();
12344 self
12345 }
12346}
12347
12348/// Gets a web app.
12349///
12350/// A builder for the *webApps.get* method supported by a *enterprise* resource.
12351/// It is not used directly, but through a [`EnterpriseMethods`] instance.
12352///
12353/// # Example
12354///
12355/// Instantiate a resource method builder
12356///
12357/// ```test_harness,no_run
12358/// # extern crate hyper;
12359/// # extern crate hyper_rustls;
12360/// # extern crate google_androidmanagement1 as androidmanagement1;
12361/// # async fn dox() {
12362/// # use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12363///
12364/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12365/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12366/// # .with_native_roots()
12367/// # .unwrap()
12368/// # .https_only()
12369/// # .enable_http2()
12370/// # .build();
12371///
12372/// # let executor = hyper_util::rt::TokioExecutor::new();
12373/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12374/// # secret,
12375/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12376/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12377/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12378/// # ),
12379/// # ).build().await.unwrap();
12380///
12381/// # let client = hyper_util::client::legacy::Client::builder(
12382/// # hyper_util::rt::TokioExecutor::new()
12383/// # )
12384/// # .build(
12385/// # hyper_rustls::HttpsConnectorBuilder::new()
12386/// # .with_native_roots()
12387/// # .unwrap()
12388/// # .https_or_http()
12389/// # .enable_http2()
12390/// # .build()
12391/// # );
12392/// # let mut hub = AndroidManagement::new(client, auth);
12393/// // You can configure optional parameters by calling the respective setters at will, and
12394/// // execute the final call using `doit()`.
12395/// // Values shown here are possibly random and not representative !
12396/// let result = hub.enterprises().web_apps_get("name")
12397/// .doit().await;
12398/// # }
12399/// ```
12400pub struct EnterpriseWebAppGetCall<'a, C>
12401where
12402 C: 'a,
12403{
12404 hub: &'a AndroidManagement<C>,
12405 _name: String,
12406 _delegate: Option<&'a mut dyn common::Delegate>,
12407 _additional_params: HashMap<String, String>,
12408 _scopes: BTreeSet<String>,
12409}
12410
12411impl<'a, C> common::CallBuilder for EnterpriseWebAppGetCall<'a, C> {}
12412
12413impl<'a, C> EnterpriseWebAppGetCall<'a, C>
12414where
12415 C: common::Connector,
12416{
12417 /// Perform the operation you have build so far.
12418 pub async fn doit(mut self) -> common::Result<(common::Response, WebApp)> {
12419 use std::borrow::Cow;
12420 use std::io::{Read, Seek};
12421
12422 use common::{url::Params, ToParts};
12423 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12424
12425 let mut dd = common::DefaultDelegate;
12426 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12427 dlg.begin(common::MethodInfo {
12428 id: "androidmanagement.enterprises.webApps.get",
12429 http_method: hyper::Method::GET,
12430 });
12431
12432 for &field in ["alt", "name"].iter() {
12433 if self._additional_params.contains_key(field) {
12434 dlg.finished(false);
12435 return Err(common::Error::FieldClash(field));
12436 }
12437 }
12438
12439 let mut params = Params::with_capacity(3 + self._additional_params.len());
12440 params.push("name", self._name);
12441
12442 params.extend(self._additional_params.iter());
12443
12444 params.push("alt", "json");
12445 let mut url = self.hub._base_url.clone() + "v1/{+name}";
12446 if self._scopes.is_empty() {
12447 self._scopes.insert(Scope::Full.as_ref().to_string());
12448 }
12449
12450 #[allow(clippy::single_element_loop)]
12451 for &(find_this, param_name) in [("{+name}", "name")].iter() {
12452 url = params.uri_replacement(url, param_name, find_this, true);
12453 }
12454 {
12455 let to_remove = ["name"];
12456 params.remove_params(&to_remove);
12457 }
12458
12459 let url = params.parse_with_url(&url);
12460
12461 loop {
12462 let token = match self
12463 .hub
12464 .auth
12465 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12466 .await
12467 {
12468 Ok(token) => token,
12469 Err(e) => match dlg.token(e) {
12470 Ok(token) => token,
12471 Err(e) => {
12472 dlg.finished(false);
12473 return Err(common::Error::MissingToken(e));
12474 }
12475 },
12476 };
12477 let mut req_result = {
12478 let client = &self.hub.client;
12479 dlg.pre_request();
12480 let mut req_builder = hyper::Request::builder()
12481 .method(hyper::Method::GET)
12482 .uri(url.as_str())
12483 .header(USER_AGENT, self.hub._user_agent.clone());
12484
12485 if let Some(token) = token.as_ref() {
12486 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12487 }
12488
12489 let request = req_builder
12490 .header(CONTENT_LENGTH, 0_u64)
12491 .body(common::to_body::<String>(None));
12492
12493 client.request(request.unwrap()).await
12494 };
12495
12496 match req_result {
12497 Err(err) => {
12498 if let common::Retry::After(d) = dlg.http_error(&err) {
12499 sleep(d).await;
12500 continue;
12501 }
12502 dlg.finished(false);
12503 return Err(common::Error::HttpError(err));
12504 }
12505 Ok(res) => {
12506 let (mut parts, body) = res.into_parts();
12507 let mut body = common::Body::new(body);
12508 if !parts.status.is_success() {
12509 let bytes = common::to_bytes(body).await.unwrap_or_default();
12510 let error = serde_json::from_str(&common::to_string(&bytes));
12511 let response = common::to_response(parts, bytes.into());
12512
12513 if let common::Retry::After(d) =
12514 dlg.http_failure(&response, error.as_ref().ok())
12515 {
12516 sleep(d).await;
12517 continue;
12518 }
12519
12520 dlg.finished(false);
12521
12522 return Err(match error {
12523 Ok(value) => common::Error::BadRequest(value),
12524 _ => common::Error::Failure(response),
12525 });
12526 }
12527 let response = {
12528 let bytes = common::to_bytes(body).await.unwrap_or_default();
12529 let encoded = common::to_string(&bytes);
12530 match serde_json::from_str(&encoded) {
12531 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12532 Err(error) => {
12533 dlg.response_json_decode_error(&encoded, &error);
12534 return Err(common::Error::JsonDecodeError(
12535 encoded.to_string(),
12536 error,
12537 ));
12538 }
12539 }
12540 };
12541
12542 dlg.finished(true);
12543 return Ok(response);
12544 }
12545 }
12546 }
12547 }
12548
12549 /// The name of the web app in the form enterprises/{enterpriseId}/webApps/{packageName}.
12550 ///
12551 /// Sets the *name* path property to the given value.
12552 ///
12553 /// Even though the property as already been set when instantiating this call,
12554 /// we provide this method for API completeness.
12555 pub fn name(mut self, new_value: &str) -> EnterpriseWebAppGetCall<'a, C> {
12556 self._name = new_value.to_string();
12557 self
12558 }
12559 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12560 /// while executing the actual API request.
12561 ///
12562 /// ````text
12563 /// It should be used to handle progress information, and to implement a certain level of resilience.
12564 /// ````
12565 ///
12566 /// Sets the *delegate* property to the given value.
12567 pub fn delegate(
12568 mut self,
12569 new_value: &'a mut dyn common::Delegate,
12570 ) -> EnterpriseWebAppGetCall<'a, C> {
12571 self._delegate = Some(new_value);
12572 self
12573 }
12574
12575 /// Set any additional parameter of the query string used in the request.
12576 /// It should be used to set parameters which are not yet available through their own
12577 /// setters.
12578 ///
12579 /// Please note that this method must not be used to set any of the known parameters
12580 /// which have their own setter method. If done anyway, the request will fail.
12581 ///
12582 /// # Additional Parameters
12583 ///
12584 /// * *$.xgafv* (query-string) - V1 error format.
12585 /// * *access_token* (query-string) - OAuth access token.
12586 /// * *alt* (query-string) - Data format for response.
12587 /// * *callback* (query-string) - JSONP
12588 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12589 /// * *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.
12590 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12591 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12592 /// * *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.
12593 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12594 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12595 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseWebAppGetCall<'a, C>
12596 where
12597 T: AsRef<str>,
12598 {
12599 self._additional_params
12600 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12601 self
12602 }
12603
12604 /// Identifies the authorization scope for the method you are building.
12605 ///
12606 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12607 /// [`Scope::Full`].
12608 ///
12609 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12610 /// tokens for more than one scope.
12611 ///
12612 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12613 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12614 /// sufficient, a read-write scope will do as well.
12615 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseWebAppGetCall<'a, C>
12616 where
12617 St: AsRef<str>,
12618 {
12619 self._scopes.insert(String::from(scope.as_ref()));
12620 self
12621 }
12622 /// Identifies the authorization scope(s) for the method you are building.
12623 ///
12624 /// See [`Self::add_scope()`] for details.
12625 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseWebAppGetCall<'a, C>
12626 where
12627 I: IntoIterator<Item = St>,
12628 St: AsRef<str>,
12629 {
12630 self._scopes
12631 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12632 self
12633 }
12634
12635 /// Removes all scopes, and no default scope will be used either.
12636 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12637 /// for details).
12638 pub fn clear_scopes(mut self) -> EnterpriseWebAppGetCall<'a, C> {
12639 self._scopes.clear();
12640 self
12641 }
12642}
12643
12644/// Lists web apps for a given enterprise.
12645///
12646/// A builder for the *webApps.list* method supported by a *enterprise* resource.
12647/// It is not used directly, but through a [`EnterpriseMethods`] instance.
12648///
12649/// # Example
12650///
12651/// Instantiate a resource method builder
12652///
12653/// ```test_harness,no_run
12654/// # extern crate hyper;
12655/// # extern crate hyper_rustls;
12656/// # extern crate google_androidmanagement1 as androidmanagement1;
12657/// # async fn dox() {
12658/// # use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12659///
12660/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12661/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12662/// # .with_native_roots()
12663/// # .unwrap()
12664/// # .https_only()
12665/// # .enable_http2()
12666/// # .build();
12667///
12668/// # let executor = hyper_util::rt::TokioExecutor::new();
12669/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12670/// # secret,
12671/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12672/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12673/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12674/// # ),
12675/// # ).build().await.unwrap();
12676///
12677/// # let client = hyper_util::client::legacy::Client::builder(
12678/// # hyper_util::rt::TokioExecutor::new()
12679/// # )
12680/// # .build(
12681/// # hyper_rustls::HttpsConnectorBuilder::new()
12682/// # .with_native_roots()
12683/// # .unwrap()
12684/// # .https_or_http()
12685/// # .enable_http2()
12686/// # .build()
12687/// # );
12688/// # let mut hub = AndroidManagement::new(client, auth);
12689/// // You can configure optional parameters by calling the respective setters at will, and
12690/// // execute the final call using `doit()`.
12691/// // Values shown here are possibly random and not representative !
12692/// let result = hub.enterprises().web_apps_list("parent")
12693/// .page_token("et")
12694/// .page_size(-22)
12695/// .doit().await;
12696/// # }
12697/// ```
12698pub struct EnterpriseWebAppListCall<'a, C>
12699where
12700 C: 'a,
12701{
12702 hub: &'a AndroidManagement<C>,
12703 _parent: String,
12704 _page_token: Option<String>,
12705 _page_size: Option<i32>,
12706 _delegate: Option<&'a mut dyn common::Delegate>,
12707 _additional_params: HashMap<String, String>,
12708 _scopes: BTreeSet<String>,
12709}
12710
12711impl<'a, C> common::CallBuilder for EnterpriseWebAppListCall<'a, C> {}
12712
12713impl<'a, C> EnterpriseWebAppListCall<'a, C>
12714where
12715 C: common::Connector,
12716{
12717 /// Perform the operation you have build so far.
12718 pub async fn doit(mut self) -> common::Result<(common::Response, ListWebAppsResponse)> {
12719 use std::borrow::Cow;
12720 use std::io::{Read, Seek};
12721
12722 use common::{url::Params, ToParts};
12723 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12724
12725 let mut dd = common::DefaultDelegate;
12726 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12727 dlg.begin(common::MethodInfo {
12728 id: "androidmanagement.enterprises.webApps.list",
12729 http_method: hyper::Method::GET,
12730 });
12731
12732 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
12733 if self._additional_params.contains_key(field) {
12734 dlg.finished(false);
12735 return Err(common::Error::FieldClash(field));
12736 }
12737 }
12738
12739 let mut params = Params::with_capacity(5 + self._additional_params.len());
12740 params.push("parent", self._parent);
12741 if let Some(value) = self._page_token.as_ref() {
12742 params.push("pageToken", value);
12743 }
12744 if let Some(value) = self._page_size.as_ref() {
12745 params.push("pageSize", value.to_string());
12746 }
12747
12748 params.extend(self._additional_params.iter());
12749
12750 params.push("alt", "json");
12751 let mut url = self.hub._base_url.clone() + "v1/{+parent}/webApps";
12752 if self._scopes.is_empty() {
12753 self._scopes.insert(Scope::Full.as_ref().to_string());
12754 }
12755
12756 #[allow(clippy::single_element_loop)]
12757 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
12758 url = params.uri_replacement(url, param_name, find_this, true);
12759 }
12760 {
12761 let to_remove = ["parent"];
12762 params.remove_params(&to_remove);
12763 }
12764
12765 let url = params.parse_with_url(&url);
12766
12767 loop {
12768 let token = match self
12769 .hub
12770 .auth
12771 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12772 .await
12773 {
12774 Ok(token) => token,
12775 Err(e) => match dlg.token(e) {
12776 Ok(token) => token,
12777 Err(e) => {
12778 dlg.finished(false);
12779 return Err(common::Error::MissingToken(e));
12780 }
12781 },
12782 };
12783 let mut req_result = {
12784 let client = &self.hub.client;
12785 dlg.pre_request();
12786 let mut req_builder = hyper::Request::builder()
12787 .method(hyper::Method::GET)
12788 .uri(url.as_str())
12789 .header(USER_AGENT, self.hub._user_agent.clone());
12790
12791 if let Some(token) = token.as_ref() {
12792 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12793 }
12794
12795 let request = req_builder
12796 .header(CONTENT_LENGTH, 0_u64)
12797 .body(common::to_body::<String>(None));
12798
12799 client.request(request.unwrap()).await
12800 };
12801
12802 match req_result {
12803 Err(err) => {
12804 if let common::Retry::After(d) = dlg.http_error(&err) {
12805 sleep(d).await;
12806 continue;
12807 }
12808 dlg.finished(false);
12809 return Err(common::Error::HttpError(err));
12810 }
12811 Ok(res) => {
12812 let (mut parts, body) = res.into_parts();
12813 let mut body = common::Body::new(body);
12814 if !parts.status.is_success() {
12815 let bytes = common::to_bytes(body).await.unwrap_or_default();
12816 let error = serde_json::from_str(&common::to_string(&bytes));
12817 let response = common::to_response(parts, bytes.into());
12818
12819 if let common::Retry::After(d) =
12820 dlg.http_failure(&response, error.as_ref().ok())
12821 {
12822 sleep(d).await;
12823 continue;
12824 }
12825
12826 dlg.finished(false);
12827
12828 return Err(match error {
12829 Ok(value) => common::Error::BadRequest(value),
12830 _ => common::Error::Failure(response),
12831 });
12832 }
12833 let response = {
12834 let bytes = common::to_bytes(body).await.unwrap_or_default();
12835 let encoded = common::to_string(&bytes);
12836 match serde_json::from_str(&encoded) {
12837 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12838 Err(error) => {
12839 dlg.response_json_decode_error(&encoded, &error);
12840 return Err(common::Error::JsonDecodeError(
12841 encoded.to_string(),
12842 error,
12843 ));
12844 }
12845 }
12846 };
12847
12848 dlg.finished(true);
12849 return Ok(response);
12850 }
12851 }
12852 }
12853 }
12854
12855 /// The name of the enterprise in the form enterprises/{enterpriseId}.
12856 ///
12857 /// Sets the *parent* path property to the given value.
12858 ///
12859 /// Even though the property as already been set when instantiating this call,
12860 /// we provide this method for API completeness.
12861 pub fn parent(mut self, new_value: &str) -> EnterpriseWebAppListCall<'a, C> {
12862 self._parent = new_value.to_string();
12863 self
12864 }
12865 /// A token identifying a page of results returned by the server.
12866 ///
12867 /// Sets the *page token* query property to the given value.
12868 pub fn page_token(mut self, new_value: &str) -> EnterpriseWebAppListCall<'a, C> {
12869 self._page_token = Some(new_value.to_string());
12870 self
12871 }
12872 /// The requested page size. This is a hint and the actual page size in the response may be different.
12873 ///
12874 /// Sets the *page size* query property to the given value.
12875 pub fn page_size(mut self, new_value: i32) -> EnterpriseWebAppListCall<'a, C> {
12876 self._page_size = Some(new_value);
12877 self
12878 }
12879 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12880 /// while executing the actual API request.
12881 ///
12882 /// ````text
12883 /// It should be used to handle progress information, and to implement a certain level of resilience.
12884 /// ````
12885 ///
12886 /// Sets the *delegate* property to the given value.
12887 pub fn delegate(
12888 mut self,
12889 new_value: &'a mut dyn common::Delegate,
12890 ) -> EnterpriseWebAppListCall<'a, C> {
12891 self._delegate = Some(new_value);
12892 self
12893 }
12894
12895 /// Set any additional parameter of the query string used in the request.
12896 /// It should be used to set parameters which are not yet available through their own
12897 /// setters.
12898 ///
12899 /// Please note that this method must not be used to set any of the known parameters
12900 /// which have their own setter method. If done anyway, the request will fail.
12901 ///
12902 /// # Additional Parameters
12903 ///
12904 /// * *$.xgafv* (query-string) - V1 error format.
12905 /// * *access_token* (query-string) - OAuth access token.
12906 /// * *alt* (query-string) - Data format for response.
12907 /// * *callback* (query-string) - JSONP
12908 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12909 /// * *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.
12910 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12911 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12912 /// * *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.
12913 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12914 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12915 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseWebAppListCall<'a, C>
12916 where
12917 T: AsRef<str>,
12918 {
12919 self._additional_params
12920 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12921 self
12922 }
12923
12924 /// Identifies the authorization scope for the method you are building.
12925 ///
12926 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12927 /// [`Scope::Full`].
12928 ///
12929 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12930 /// tokens for more than one scope.
12931 ///
12932 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12933 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12934 /// sufficient, a read-write scope will do as well.
12935 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseWebAppListCall<'a, C>
12936 where
12937 St: AsRef<str>,
12938 {
12939 self._scopes.insert(String::from(scope.as_ref()));
12940 self
12941 }
12942 /// Identifies the authorization scope(s) for the method you are building.
12943 ///
12944 /// See [`Self::add_scope()`] for details.
12945 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseWebAppListCall<'a, C>
12946 where
12947 I: IntoIterator<Item = St>,
12948 St: AsRef<str>,
12949 {
12950 self._scopes
12951 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12952 self
12953 }
12954
12955 /// Removes all scopes, and no default scope will be used either.
12956 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12957 /// for details).
12958 pub fn clear_scopes(mut self) -> EnterpriseWebAppListCall<'a, C> {
12959 self._scopes.clear();
12960 self
12961 }
12962}
12963
12964/// Updates a web app.
12965///
12966/// A builder for the *webApps.patch* method supported by a *enterprise* resource.
12967/// It is not used directly, but through a [`EnterpriseMethods`] instance.
12968///
12969/// # Example
12970///
12971/// Instantiate a resource method builder
12972///
12973/// ```test_harness,no_run
12974/// # extern crate hyper;
12975/// # extern crate hyper_rustls;
12976/// # extern crate google_androidmanagement1 as androidmanagement1;
12977/// use androidmanagement1::api::WebApp;
12978/// # async fn dox() {
12979/// # use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12980///
12981/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12982/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12983/// # .with_native_roots()
12984/// # .unwrap()
12985/// # .https_only()
12986/// # .enable_http2()
12987/// # .build();
12988///
12989/// # let executor = hyper_util::rt::TokioExecutor::new();
12990/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12991/// # secret,
12992/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12993/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12994/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12995/// # ),
12996/// # ).build().await.unwrap();
12997///
12998/// # let client = hyper_util::client::legacy::Client::builder(
12999/// # hyper_util::rt::TokioExecutor::new()
13000/// # )
13001/// # .build(
13002/// # hyper_rustls::HttpsConnectorBuilder::new()
13003/// # .with_native_roots()
13004/// # .unwrap()
13005/// # .https_or_http()
13006/// # .enable_http2()
13007/// # .build()
13008/// # );
13009/// # let mut hub = AndroidManagement::new(client, auth);
13010/// // As the method needs a request, you would usually fill it with the desired information
13011/// // into the respective structure. Some of the parts shown here might not be applicable !
13012/// // Values shown here are possibly random and not representative !
13013/// let mut req = WebApp::default();
13014///
13015/// // You can configure optional parameters by calling the respective setters at will, and
13016/// // execute the final call using `doit()`.
13017/// // Values shown here are possibly random and not representative !
13018/// let result = hub.enterprises().web_apps_patch(req, "name")
13019/// .update_mask(FieldMask::new::<&str>(&[]))
13020/// .doit().await;
13021/// # }
13022/// ```
13023pub struct EnterpriseWebAppPatchCall<'a, C>
13024where
13025 C: 'a,
13026{
13027 hub: &'a AndroidManagement<C>,
13028 _request: WebApp,
13029 _name: String,
13030 _update_mask: Option<common::FieldMask>,
13031 _delegate: Option<&'a mut dyn common::Delegate>,
13032 _additional_params: HashMap<String, String>,
13033 _scopes: BTreeSet<String>,
13034}
13035
13036impl<'a, C> common::CallBuilder for EnterpriseWebAppPatchCall<'a, C> {}
13037
13038impl<'a, C> EnterpriseWebAppPatchCall<'a, C>
13039where
13040 C: common::Connector,
13041{
13042 /// Perform the operation you have build so far.
13043 pub async fn doit(mut self) -> common::Result<(common::Response, WebApp)> {
13044 use std::borrow::Cow;
13045 use std::io::{Read, Seek};
13046
13047 use common::{url::Params, ToParts};
13048 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13049
13050 let mut dd = common::DefaultDelegate;
13051 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13052 dlg.begin(common::MethodInfo {
13053 id: "androidmanagement.enterprises.webApps.patch",
13054 http_method: hyper::Method::PATCH,
13055 });
13056
13057 for &field in ["alt", "name", "updateMask"].iter() {
13058 if self._additional_params.contains_key(field) {
13059 dlg.finished(false);
13060 return Err(common::Error::FieldClash(field));
13061 }
13062 }
13063
13064 let mut params = Params::with_capacity(5 + self._additional_params.len());
13065 params.push("name", self._name);
13066 if let Some(value) = self._update_mask.as_ref() {
13067 params.push("updateMask", value.to_string());
13068 }
13069
13070 params.extend(self._additional_params.iter());
13071
13072 params.push("alt", "json");
13073 let mut url = self.hub._base_url.clone() + "v1/{+name}";
13074 if self._scopes.is_empty() {
13075 self._scopes.insert(Scope::Full.as_ref().to_string());
13076 }
13077
13078 #[allow(clippy::single_element_loop)]
13079 for &(find_this, param_name) in [("{+name}", "name")].iter() {
13080 url = params.uri_replacement(url, param_name, find_this, true);
13081 }
13082 {
13083 let to_remove = ["name"];
13084 params.remove_params(&to_remove);
13085 }
13086
13087 let url = params.parse_with_url(&url);
13088
13089 let mut json_mime_type = mime::APPLICATION_JSON;
13090 let mut request_value_reader = {
13091 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13092 common::remove_json_null_values(&mut value);
13093 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13094 serde_json::to_writer(&mut dst, &value).unwrap();
13095 dst
13096 };
13097 let request_size = request_value_reader
13098 .seek(std::io::SeekFrom::End(0))
13099 .unwrap();
13100 request_value_reader
13101 .seek(std::io::SeekFrom::Start(0))
13102 .unwrap();
13103
13104 loop {
13105 let token = match self
13106 .hub
13107 .auth
13108 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13109 .await
13110 {
13111 Ok(token) => token,
13112 Err(e) => match dlg.token(e) {
13113 Ok(token) => token,
13114 Err(e) => {
13115 dlg.finished(false);
13116 return Err(common::Error::MissingToken(e));
13117 }
13118 },
13119 };
13120 request_value_reader
13121 .seek(std::io::SeekFrom::Start(0))
13122 .unwrap();
13123 let mut req_result = {
13124 let client = &self.hub.client;
13125 dlg.pre_request();
13126 let mut req_builder = hyper::Request::builder()
13127 .method(hyper::Method::PATCH)
13128 .uri(url.as_str())
13129 .header(USER_AGENT, self.hub._user_agent.clone());
13130
13131 if let Some(token) = token.as_ref() {
13132 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13133 }
13134
13135 let request = req_builder
13136 .header(CONTENT_TYPE, json_mime_type.to_string())
13137 .header(CONTENT_LENGTH, request_size as u64)
13138 .body(common::to_body(
13139 request_value_reader.get_ref().clone().into(),
13140 ));
13141
13142 client.request(request.unwrap()).await
13143 };
13144
13145 match req_result {
13146 Err(err) => {
13147 if let common::Retry::After(d) = dlg.http_error(&err) {
13148 sleep(d).await;
13149 continue;
13150 }
13151 dlg.finished(false);
13152 return Err(common::Error::HttpError(err));
13153 }
13154 Ok(res) => {
13155 let (mut parts, body) = res.into_parts();
13156 let mut body = common::Body::new(body);
13157 if !parts.status.is_success() {
13158 let bytes = common::to_bytes(body).await.unwrap_or_default();
13159 let error = serde_json::from_str(&common::to_string(&bytes));
13160 let response = common::to_response(parts, bytes.into());
13161
13162 if let common::Retry::After(d) =
13163 dlg.http_failure(&response, error.as_ref().ok())
13164 {
13165 sleep(d).await;
13166 continue;
13167 }
13168
13169 dlg.finished(false);
13170
13171 return Err(match error {
13172 Ok(value) => common::Error::BadRequest(value),
13173 _ => common::Error::Failure(response),
13174 });
13175 }
13176 let response = {
13177 let bytes = common::to_bytes(body).await.unwrap_or_default();
13178 let encoded = common::to_string(&bytes);
13179 match serde_json::from_str(&encoded) {
13180 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13181 Err(error) => {
13182 dlg.response_json_decode_error(&encoded, &error);
13183 return Err(common::Error::JsonDecodeError(
13184 encoded.to_string(),
13185 error,
13186 ));
13187 }
13188 }
13189 };
13190
13191 dlg.finished(true);
13192 return Ok(response);
13193 }
13194 }
13195 }
13196 }
13197
13198 ///
13199 /// Sets the *request* property to the given value.
13200 ///
13201 /// Even though the property as already been set when instantiating this call,
13202 /// we provide this method for API completeness.
13203 pub fn request(mut self, new_value: WebApp) -> EnterpriseWebAppPatchCall<'a, C> {
13204 self._request = new_value;
13205 self
13206 }
13207 /// The name of the web app in the form enterprises/{enterpriseId}/webApps/{packageName}.
13208 ///
13209 /// Sets the *name* path property to the given value.
13210 ///
13211 /// Even though the property as already been set when instantiating this call,
13212 /// we provide this method for API completeness.
13213 pub fn name(mut self, new_value: &str) -> EnterpriseWebAppPatchCall<'a, C> {
13214 self._name = new_value.to_string();
13215 self
13216 }
13217 /// The field mask indicating the fields to update. If not set, all modifiable fields will be modified.
13218 ///
13219 /// Sets the *update mask* query property to the given value.
13220 pub fn update_mask(mut self, new_value: common::FieldMask) -> EnterpriseWebAppPatchCall<'a, C> {
13221 self._update_mask = Some(new_value);
13222 self
13223 }
13224 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13225 /// while executing the actual API request.
13226 ///
13227 /// ````text
13228 /// It should be used to handle progress information, and to implement a certain level of resilience.
13229 /// ````
13230 ///
13231 /// Sets the *delegate* property to the given value.
13232 pub fn delegate(
13233 mut self,
13234 new_value: &'a mut dyn common::Delegate,
13235 ) -> EnterpriseWebAppPatchCall<'a, C> {
13236 self._delegate = Some(new_value);
13237 self
13238 }
13239
13240 /// Set any additional parameter of the query string used in the request.
13241 /// It should be used to set parameters which are not yet available through their own
13242 /// setters.
13243 ///
13244 /// Please note that this method must not be used to set any of the known parameters
13245 /// which have their own setter method. If done anyway, the request will fail.
13246 ///
13247 /// # Additional Parameters
13248 ///
13249 /// * *$.xgafv* (query-string) - V1 error format.
13250 /// * *access_token* (query-string) - OAuth access token.
13251 /// * *alt* (query-string) - Data format for response.
13252 /// * *callback* (query-string) - JSONP
13253 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13254 /// * *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.
13255 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13256 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13257 /// * *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.
13258 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13259 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13260 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseWebAppPatchCall<'a, C>
13261 where
13262 T: AsRef<str>,
13263 {
13264 self._additional_params
13265 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13266 self
13267 }
13268
13269 /// Identifies the authorization scope for the method you are building.
13270 ///
13271 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13272 /// [`Scope::Full`].
13273 ///
13274 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13275 /// tokens for more than one scope.
13276 ///
13277 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13278 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13279 /// sufficient, a read-write scope will do as well.
13280 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseWebAppPatchCall<'a, C>
13281 where
13282 St: AsRef<str>,
13283 {
13284 self._scopes.insert(String::from(scope.as_ref()));
13285 self
13286 }
13287 /// Identifies the authorization scope(s) for the method you are building.
13288 ///
13289 /// See [`Self::add_scope()`] for details.
13290 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseWebAppPatchCall<'a, C>
13291 where
13292 I: IntoIterator<Item = St>,
13293 St: AsRef<str>,
13294 {
13295 self._scopes
13296 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13297 self
13298 }
13299
13300 /// Removes all scopes, and no default scope will be used either.
13301 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13302 /// for details).
13303 pub fn clear_scopes(mut self) -> EnterpriseWebAppPatchCall<'a, C> {
13304 self._scopes.clear();
13305 self
13306 }
13307}
13308
13309/// Creates a web token to access an embeddable managed Google Play web UI for a given enterprise.
13310///
13311/// A builder for the *webTokens.create* method supported by a *enterprise* resource.
13312/// It is not used directly, but through a [`EnterpriseMethods`] instance.
13313///
13314/// # Example
13315///
13316/// Instantiate a resource method builder
13317///
13318/// ```test_harness,no_run
13319/// # extern crate hyper;
13320/// # extern crate hyper_rustls;
13321/// # extern crate google_androidmanagement1 as androidmanagement1;
13322/// use androidmanagement1::api::WebToken;
13323/// # async fn dox() {
13324/// # use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13325///
13326/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13327/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13328/// # .with_native_roots()
13329/// # .unwrap()
13330/// # .https_only()
13331/// # .enable_http2()
13332/// # .build();
13333///
13334/// # let executor = hyper_util::rt::TokioExecutor::new();
13335/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13336/// # secret,
13337/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13338/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13339/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13340/// # ),
13341/// # ).build().await.unwrap();
13342///
13343/// # let client = hyper_util::client::legacy::Client::builder(
13344/// # hyper_util::rt::TokioExecutor::new()
13345/// # )
13346/// # .build(
13347/// # hyper_rustls::HttpsConnectorBuilder::new()
13348/// # .with_native_roots()
13349/// # .unwrap()
13350/// # .https_or_http()
13351/// # .enable_http2()
13352/// # .build()
13353/// # );
13354/// # let mut hub = AndroidManagement::new(client, auth);
13355/// // As the method needs a request, you would usually fill it with the desired information
13356/// // into the respective structure. Some of the parts shown here might not be applicable !
13357/// // Values shown here are possibly random and not representative !
13358/// let mut req = WebToken::default();
13359///
13360/// // You can configure optional parameters by calling the respective setters at will, and
13361/// // execute the final call using `doit()`.
13362/// // Values shown here are possibly random and not representative !
13363/// let result = hub.enterprises().web_tokens_create(req, "parent")
13364/// .doit().await;
13365/// # }
13366/// ```
13367pub struct EnterpriseWebTokenCreateCall<'a, C>
13368where
13369 C: 'a,
13370{
13371 hub: &'a AndroidManagement<C>,
13372 _request: WebToken,
13373 _parent: String,
13374 _delegate: Option<&'a mut dyn common::Delegate>,
13375 _additional_params: HashMap<String, String>,
13376 _scopes: BTreeSet<String>,
13377}
13378
13379impl<'a, C> common::CallBuilder for EnterpriseWebTokenCreateCall<'a, C> {}
13380
13381impl<'a, C> EnterpriseWebTokenCreateCall<'a, C>
13382where
13383 C: common::Connector,
13384{
13385 /// Perform the operation you have build so far.
13386 pub async fn doit(mut self) -> common::Result<(common::Response, WebToken)> {
13387 use std::borrow::Cow;
13388 use std::io::{Read, Seek};
13389
13390 use common::{url::Params, ToParts};
13391 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13392
13393 let mut dd = common::DefaultDelegate;
13394 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13395 dlg.begin(common::MethodInfo {
13396 id: "androidmanagement.enterprises.webTokens.create",
13397 http_method: hyper::Method::POST,
13398 });
13399
13400 for &field in ["alt", "parent"].iter() {
13401 if self._additional_params.contains_key(field) {
13402 dlg.finished(false);
13403 return Err(common::Error::FieldClash(field));
13404 }
13405 }
13406
13407 let mut params = Params::with_capacity(4 + self._additional_params.len());
13408 params.push("parent", self._parent);
13409
13410 params.extend(self._additional_params.iter());
13411
13412 params.push("alt", "json");
13413 let mut url = self.hub._base_url.clone() + "v1/{+parent}/webTokens";
13414 if self._scopes.is_empty() {
13415 self._scopes.insert(Scope::Full.as_ref().to_string());
13416 }
13417
13418 #[allow(clippy::single_element_loop)]
13419 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
13420 url = params.uri_replacement(url, param_name, find_this, true);
13421 }
13422 {
13423 let to_remove = ["parent"];
13424 params.remove_params(&to_remove);
13425 }
13426
13427 let url = params.parse_with_url(&url);
13428
13429 let mut json_mime_type = mime::APPLICATION_JSON;
13430 let mut request_value_reader = {
13431 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13432 common::remove_json_null_values(&mut value);
13433 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13434 serde_json::to_writer(&mut dst, &value).unwrap();
13435 dst
13436 };
13437 let request_size = request_value_reader
13438 .seek(std::io::SeekFrom::End(0))
13439 .unwrap();
13440 request_value_reader
13441 .seek(std::io::SeekFrom::Start(0))
13442 .unwrap();
13443
13444 loop {
13445 let token = match self
13446 .hub
13447 .auth
13448 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13449 .await
13450 {
13451 Ok(token) => token,
13452 Err(e) => match dlg.token(e) {
13453 Ok(token) => token,
13454 Err(e) => {
13455 dlg.finished(false);
13456 return Err(common::Error::MissingToken(e));
13457 }
13458 },
13459 };
13460 request_value_reader
13461 .seek(std::io::SeekFrom::Start(0))
13462 .unwrap();
13463 let mut req_result = {
13464 let client = &self.hub.client;
13465 dlg.pre_request();
13466 let mut req_builder = hyper::Request::builder()
13467 .method(hyper::Method::POST)
13468 .uri(url.as_str())
13469 .header(USER_AGENT, self.hub._user_agent.clone());
13470
13471 if let Some(token) = token.as_ref() {
13472 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13473 }
13474
13475 let request = req_builder
13476 .header(CONTENT_TYPE, json_mime_type.to_string())
13477 .header(CONTENT_LENGTH, request_size as u64)
13478 .body(common::to_body(
13479 request_value_reader.get_ref().clone().into(),
13480 ));
13481
13482 client.request(request.unwrap()).await
13483 };
13484
13485 match req_result {
13486 Err(err) => {
13487 if let common::Retry::After(d) = dlg.http_error(&err) {
13488 sleep(d).await;
13489 continue;
13490 }
13491 dlg.finished(false);
13492 return Err(common::Error::HttpError(err));
13493 }
13494 Ok(res) => {
13495 let (mut parts, body) = res.into_parts();
13496 let mut body = common::Body::new(body);
13497 if !parts.status.is_success() {
13498 let bytes = common::to_bytes(body).await.unwrap_or_default();
13499 let error = serde_json::from_str(&common::to_string(&bytes));
13500 let response = common::to_response(parts, bytes.into());
13501
13502 if let common::Retry::After(d) =
13503 dlg.http_failure(&response, error.as_ref().ok())
13504 {
13505 sleep(d).await;
13506 continue;
13507 }
13508
13509 dlg.finished(false);
13510
13511 return Err(match error {
13512 Ok(value) => common::Error::BadRequest(value),
13513 _ => common::Error::Failure(response),
13514 });
13515 }
13516 let response = {
13517 let bytes = common::to_bytes(body).await.unwrap_or_default();
13518 let encoded = common::to_string(&bytes);
13519 match serde_json::from_str(&encoded) {
13520 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13521 Err(error) => {
13522 dlg.response_json_decode_error(&encoded, &error);
13523 return Err(common::Error::JsonDecodeError(
13524 encoded.to_string(),
13525 error,
13526 ));
13527 }
13528 }
13529 };
13530
13531 dlg.finished(true);
13532 return Ok(response);
13533 }
13534 }
13535 }
13536 }
13537
13538 ///
13539 /// Sets the *request* property to the given value.
13540 ///
13541 /// Even though the property as already been set when instantiating this call,
13542 /// we provide this method for API completeness.
13543 pub fn request(mut self, new_value: WebToken) -> EnterpriseWebTokenCreateCall<'a, C> {
13544 self._request = new_value;
13545 self
13546 }
13547 /// The name of the enterprise in the form enterprises/{enterpriseId}.
13548 ///
13549 /// Sets the *parent* path property to the given value.
13550 ///
13551 /// Even though the property as already been set when instantiating this call,
13552 /// we provide this method for API completeness.
13553 pub fn parent(mut self, new_value: &str) -> EnterpriseWebTokenCreateCall<'a, C> {
13554 self._parent = new_value.to_string();
13555 self
13556 }
13557 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13558 /// while executing the actual API request.
13559 ///
13560 /// ````text
13561 /// It should be used to handle progress information, and to implement a certain level of resilience.
13562 /// ````
13563 ///
13564 /// Sets the *delegate* property to the given value.
13565 pub fn delegate(
13566 mut self,
13567 new_value: &'a mut dyn common::Delegate,
13568 ) -> EnterpriseWebTokenCreateCall<'a, C> {
13569 self._delegate = Some(new_value);
13570 self
13571 }
13572
13573 /// Set any additional parameter of the query string used in the request.
13574 /// It should be used to set parameters which are not yet available through their own
13575 /// setters.
13576 ///
13577 /// Please note that this method must not be used to set any of the known parameters
13578 /// which have their own setter method. If done anyway, the request will fail.
13579 ///
13580 /// # Additional Parameters
13581 ///
13582 /// * *$.xgafv* (query-string) - V1 error format.
13583 /// * *access_token* (query-string) - OAuth access token.
13584 /// * *alt* (query-string) - Data format for response.
13585 /// * *callback* (query-string) - JSONP
13586 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13587 /// * *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.
13588 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13589 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13590 /// * *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.
13591 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13592 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13593 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseWebTokenCreateCall<'a, C>
13594 where
13595 T: AsRef<str>,
13596 {
13597 self._additional_params
13598 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13599 self
13600 }
13601
13602 /// Identifies the authorization scope for the method you are building.
13603 ///
13604 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13605 /// [`Scope::Full`].
13606 ///
13607 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13608 /// tokens for more than one scope.
13609 ///
13610 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13611 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13612 /// sufficient, a read-write scope will do as well.
13613 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseWebTokenCreateCall<'a, C>
13614 where
13615 St: AsRef<str>,
13616 {
13617 self._scopes.insert(String::from(scope.as_ref()));
13618 self
13619 }
13620 /// Identifies the authorization scope(s) for the method you are building.
13621 ///
13622 /// See [`Self::add_scope()`] for details.
13623 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseWebTokenCreateCall<'a, C>
13624 where
13625 I: IntoIterator<Item = St>,
13626 St: AsRef<str>,
13627 {
13628 self._scopes
13629 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13630 self
13631 }
13632
13633 /// Removes all scopes, and no default scope will be used either.
13634 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13635 /// for details).
13636 pub fn clear_scopes(mut self) -> EnterpriseWebTokenCreateCall<'a, C> {
13637 self._scopes.clear();
13638 self
13639 }
13640}
13641
13642/// Creates an enterprise. This is the last step in the enterprise signup flow. See also: SigninDetail
13643///
13644/// A builder for the *create* method supported by a *enterprise* resource.
13645/// It is not used directly, but through a [`EnterpriseMethods`] instance.
13646///
13647/// # Example
13648///
13649/// Instantiate a resource method builder
13650///
13651/// ```test_harness,no_run
13652/// # extern crate hyper;
13653/// # extern crate hyper_rustls;
13654/// # extern crate google_androidmanagement1 as androidmanagement1;
13655/// use androidmanagement1::api::Enterprise;
13656/// # async fn dox() {
13657/// # use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13658///
13659/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13660/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13661/// # .with_native_roots()
13662/// # .unwrap()
13663/// # .https_only()
13664/// # .enable_http2()
13665/// # .build();
13666///
13667/// # let executor = hyper_util::rt::TokioExecutor::new();
13668/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13669/// # secret,
13670/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13671/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13672/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13673/// # ),
13674/// # ).build().await.unwrap();
13675///
13676/// # let client = hyper_util::client::legacy::Client::builder(
13677/// # hyper_util::rt::TokioExecutor::new()
13678/// # )
13679/// # .build(
13680/// # hyper_rustls::HttpsConnectorBuilder::new()
13681/// # .with_native_roots()
13682/// # .unwrap()
13683/// # .https_or_http()
13684/// # .enable_http2()
13685/// # .build()
13686/// # );
13687/// # let mut hub = AndroidManagement::new(client, auth);
13688/// // As the method needs a request, you would usually fill it with the desired information
13689/// // into the respective structure. Some of the parts shown here might not be applicable !
13690/// // Values shown here are possibly random and not representative !
13691/// let mut req = Enterprise::default();
13692///
13693/// // You can configure optional parameters by calling the respective setters at will, and
13694/// // execute the final call using `doit()`.
13695/// // Values shown here are possibly random and not representative !
13696/// let result = hub.enterprises().create(req)
13697/// .signup_url_name("dolor")
13698/// .project_id("duo")
13699/// .enterprise_token("vero")
13700/// .agreement_accepted(false)
13701/// .doit().await;
13702/// # }
13703/// ```
13704pub struct EnterpriseCreateCall<'a, C>
13705where
13706 C: 'a,
13707{
13708 hub: &'a AndroidManagement<C>,
13709 _request: Enterprise,
13710 _signup_url_name: Option<String>,
13711 _project_id: Option<String>,
13712 _enterprise_token: Option<String>,
13713 _agreement_accepted: Option<bool>,
13714 _delegate: Option<&'a mut dyn common::Delegate>,
13715 _additional_params: HashMap<String, String>,
13716 _scopes: BTreeSet<String>,
13717}
13718
13719impl<'a, C> common::CallBuilder for EnterpriseCreateCall<'a, C> {}
13720
13721impl<'a, C> EnterpriseCreateCall<'a, C>
13722where
13723 C: common::Connector,
13724{
13725 /// Perform the operation you have build so far.
13726 pub async fn doit(mut self) -> common::Result<(common::Response, Enterprise)> {
13727 use std::borrow::Cow;
13728 use std::io::{Read, Seek};
13729
13730 use common::{url::Params, ToParts};
13731 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13732
13733 let mut dd = common::DefaultDelegate;
13734 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13735 dlg.begin(common::MethodInfo {
13736 id: "androidmanagement.enterprises.create",
13737 http_method: hyper::Method::POST,
13738 });
13739
13740 for &field in [
13741 "alt",
13742 "signupUrlName",
13743 "projectId",
13744 "enterpriseToken",
13745 "agreementAccepted",
13746 ]
13747 .iter()
13748 {
13749 if self._additional_params.contains_key(field) {
13750 dlg.finished(false);
13751 return Err(common::Error::FieldClash(field));
13752 }
13753 }
13754
13755 let mut params = Params::with_capacity(7 + self._additional_params.len());
13756 if let Some(value) = self._signup_url_name.as_ref() {
13757 params.push("signupUrlName", value);
13758 }
13759 if let Some(value) = self._project_id.as_ref() {
13760 params.push("projectId", value);
13761 }
13762 if let Some(value) = self._enterprise_token.as_ref() {
13763 params.push("enterpriseToken", value);
13764 }
13765 if let Some(value) = self._agreement_accepted.as_ref() {
13766 params.push("agreementAccepted", value.to_string());
13767 }
13768
13769 params.extend(self._additional_params.iter());
13770
13771 params.push("alt", "json");
13772 let mut url = self.hub._base_url.clone() + "v1/enterprises";
13773 if self._scopes.is_empty() {
13774 self._scopes.insert(Scope::Full.as_ref().to_string());
13775 }
13776
13777 let url = params.parse_with_url(&url);
13778
13779 let mut json_mime_type = mime::APPLICATION_JSON;
13780 let mut request_value_reader = {
13781 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13782 common::remove_json_null_values(&mut value);
13783 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13784 serde_json::to_writer(&mut dst, &value).unwrap();
13785 dst
13786 };
13787 let request_size = request_value_reader
13788 .seek(std::io::SeekFrom::End(0))
13789 .unwrap();
13790 request_value_reader
13791 .seek(std::io::SeekFrom::Start(0))
13792 .unwrap();
13793
13794 loop {
13795 let token = match self
13796 .hub
13797 .auth
13798 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13799 .await
13800 {
13801 Ok(token) => token,
13802 Err(e) => match dlg.token(e) {
13803 Ok(token) => token,
13804 Err(e) => {
13805 dlg.finished(false);
13806 return Err(common::Error::MissingToken(e));
13807 }
13808 },
13809 };
13810 request_value_reader
13811 .seek(std::io::SeekFrom::Start(0))
13812 .unwrap();
13813 let mut req_result = {
13814 let client = &self.hub.client;
13815 dlg.pre_request();
13816 let mut req_builder = hyper::Request::builder()
13817 .method(hyper::Method::POST)
13818 .uri(url.as_str())
13819 .header(USER_AGENT, self.hub._user_agent.clone());
13820
13821 if let Some(token) = token.as_ref() {
13822 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13823 }
13824
13825 let request = req_builder
13826 .header(CONTENT_TYPE, json_mime_type.to_string())
13827 .header(CONTENT_LENGTH, request_size as u64)
13828 .body(common::to_body(
13829 request_value_reader.get_ref().clone().into(),
13830 ));
13831
13832 client.request(request.unwrap()).await
13833 };
13834
13835 match req_result {
13836 Err(err) => {
13837 if let common::Retry::After(d) = dlg.http_error(&err) {
13838 sleep(d).await;
13839 continue;
13840 }
13841 dlg.finished(false);
13842 return Err(common::Error::HttpError(err));
13843 }
13844 Ok(res) => {
13845 let (mut parts, body) = res.into_parts();
13846 let mut body = common::Body::new(body);
13847 if !parts.status.is_success() {
13848 let bytes = common::to_bytes(body).await.unwrap_or_default();
13849 let error = serde_json::from_str(&common::to_string(&bytes));
13850 let response = common::to_response(parts, bytes.into());
13851
13852 if let common::Retry::After(d) =
13853 dlg.http_failure(&response, error.as_ref().ok())
13854 {
13855 sleep(d).await;
13856 continue;
13857 }
13858
13859 dlg.finished(false);
13860
13861 return Err(match error {
13862 Ok(value) => common::Error::BadRequest(value),
13863 _ => common::Error::Failure(response),
13864 });
13865 }
13866 let response = {
13867 let bytes = common::to_bytes(body).await.unwrap_or_default();
13868 let encoded = common::to_string(&bytes);
13869 match serde_json::from_str(&encoded) {
13870 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13871 Err(error) => {
13872 dlg.response_json_decode_error(&encoded, &error);
13873 return Err(common::Error::JsonDecodeError(
13874 encoded.to_string(),
13875 error,
13876 ));
13877 }
13878 }
13879 };
13880
13881 dlg.finished(true);
13882 return Ok(response);
13883 }
13884 }
13885 }
13886 }
13887
13888 ///
13889 /// Sets the *request* property to the given value.
13890 ///
13891 /// Even though the property as already been set when instantiating this call,
13892 /// we provide this method for API completeness.
13893 pub fn request(mut self, new_value: Enterprise) -> EnterpriseCreateCall<'a, C> {
13894 self._request = new_value;
13895 self
13896 }
13897 /// The name of the SignupUrl used to sign up for the enterprise. Set this when creating a customer-managed enterprise (https://developers.google.com/android/management/create-enterprise#customer-managed_enterprises) and not when creating a deprecated EMM-managed enterprise (https://developers.google.com/android/management/create-enterprise#emm-managed_enterprises).
13898 ///
13899 /// Sets the *signup url name* query property to the given value.
13900 pub fn signup_url_name(mut self, new_value: &str) -> EnterpriseCreateCall<'a, C> {
13901 self._signup_url_name = Some(new_value.to_string());
13902 self
13903 }
13904 /// The ID of the Google Cloud Platform project which will own the enterprise.
13905 ///
13906 /// Sets the *project id* query property to the given value.
13907 pub fn project_id(mut self, new_value: &str) -> EnterpriseCreateCall<'a, C> {
13908 self._project_id = Some(new_value.to_string());
13909 self
13910 }
13911 /// The enterprise token appended to the callback URL. Set this when creating a customer-managed enterprise (https://developers.google.com/android/management/create-enterprise#customer-managed_enterprises) and not when creating a deprecated EMM-managed enterprise (https://developers.google.com/android/management/create-enterprise#emm-managed_enterprises).
13912 ///
13913 /// Sets the *enterprise token* query property to the given value.
13914 pub fn enterprise_token(mut self, new_value: &str) -> EnterpriseCreateCall<'a, C> {
13915 self._enterprise_token = Some(new_value.to_string());
13916 self
13917 }
13918 /// Whether the enterprise admin has seen and agreed to the managed Google Play Agreement (https://www.android.com/enterprise/terms/). Do not set this field for any customer-managed enterprise (https://developers.google.com/android/management/create-enterprise#customer-managed_enterprises). Set this to field to true for all EMM-managed enterprises (https://developers.google.com/android/management/create-enterprise#emm-managed_enterprises).
13919 ///
13920 /// Sets the *agreement accepted* query property to the given value.
13921 pub fn agreement_accepted(mut self, new_value: bool) -> EnterpriseCreateCall<'a, C> {
13922 self._agreement_accepted = Some(new_value);
13923 self
13924 }
13925 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13926 /// while executing the actual API request.
13927 ///
13928 /// ````text
13929 /// It should be used to handle progress information, and to implement a certain level of resilience.
13930 /// ````
13931 ///
13932 /// Sets the *delegate* property to the given value.
13933 pub fn delegate(
13934 mut self,
13935 new_value: &'a mut dyn common::Delegate,
13936 ) -> EnterpriseCreateCall<'a, C> {
13937 self._delegate = Some(new_value);
13938 self
13939 }
13940
13941 /// Set any additional parameter of the query string used in the request.
13942 /// It should be used to set parameters which are not yet available through their own
13943 /// setters.
13944 ///
13945 /// Please note that this method must not be used to set any of the known parameters
13946 /// which have their own setter method. If done anyway, the request will fail.
13947 ///
13948 /// # Additional Parameters
13949 ///
13950 /// * *$.xgafv* (query-string) - V1 error format.
13951 /// * *access_token* (query-string) - OAuth access token.
13952 /// * *alt* (query-string) - Data format for response.
13953 /// * *callback* (query-string) - JSONP
13954 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13955 /// * *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.
13956 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13957 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13958 /// * *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.
13959 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13960 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13961 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseCreateCall<'a, C>
13962 where
13963 T: AsRef<str>,
13964 {
13965 self._additional_params
13966 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13967 self
13968 }
13969
13970 /// Identifies the authorization scope for the method you are building.
13971 ///
13972 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13973 /// [`Scope::Full`].
13974 ///
13975 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13976 /// tokens for more than one scope.
13977 ///
13978 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13979 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13980 /// sufficient, a read-write scope will do as well.
13981 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseCreateCall<'a, C>
13982 where
13983 St: AsRef<str>,
13984 {
13985 self._scopes.insert(String::from(scope.as_ref()));
13986 self
13987 }
13988 /// Identifies the authorization scope(s) for the method you are building.
13989 ///
13990 /// See [`Self::add_scope()`] for details.
13991 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseCreateCall<'a, C>
13992 where
13993 I: IntoIterator<Item = St>,
13994 St: AsRef<str>,
13995 {
13996 self._scopes
13997 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13998 self
13999 }
14000
14001 /// Removes all scopes, and no default scope will be used either.
14002 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14003 /// for details).
14004 pub fn clear_scopes(mut self) -> EnterpriseCreateCall<'a, C> {
14005 self._scopes.clear();
14006 self
14007 }
14008}
14009
14010/// Permanently deletes an enterprise and all accounts and data associated with it. Warning: this will result in a cascaded deletion of all AM API devices associated with the deleted enterprise. Only available for EMM-managed enterprises.
14011///
14012/// A builder for the *delete* method supported by a *enterprise* resource.
14013/// It is not used directly, but through a [`EnterpriseMethods`] instance.
14014///
14015/// # Example
14016///
14017/// Instantiate a resource method builder
14018///
14019/// ```test_harness,no_run
14020/// # extern crate hyper;
14021/// # extern crate hyper_rustls;
14022/// # extern crate google_androidmanagement1 as androidmanagement1;
14023/// # async fn dox() {
14024/// # use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14025///
14026/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14027/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14028/// # .with_native_roots()
14029/// # .unwrap()
14030/// # .https_only()
14031/// # .enable_http2()
14032/// # .build();
14033///
14034/// # let executor = hyper_util::rt::TokioExecutor::new();
14035/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14036/// # secret,
14037/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14038/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14039/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14040/// # ),
14041/// # ).build().await.unwrap();
14042///
14043/// # let client = hyper_util::client::legacy::Client::builder(
14044/// # hyper_util::rt::TokioExecutor::new()
14045/// # )
14046/// # .build(
14047/// # hyper_rustls::HttpsConnectorBuilder::new()
14048/// # .with_native_roots()
14049/// # .unwrap()
14050/// # .https_or_http()
14051/// # .enable_http2()
14052/// # .build()
14053/// # );
14054/// # let mut hub = AndroidManagement::new(client, auth);
14055/// // You can configure optional parameters by calling the respective setters at will, and
14056/// // execute the final call using `doit()`.
14057/// // Values shown here are possibly random and not representative !
14058/// let result = hub.enterprises().delete("name")
14059/// .doit().await;
14060/// # }
14061/// ```
14062pub struct EnterpriseDeleteCall<'a, C>
14063where
14064 C: 'a,
14065{
14066 hub: &'a AndroidManagement<C>,
14067 _name: String,
14068 _delegate: Option<&'a mut dyn common::Delegate>,
14069 _additional_params: HashMap<String, String>,
14070 _scopes: BTreeSet<String>,
14071}
14072
14073impl<'a, C> common::CallBuilder for EnterpriseDeleteCall<'a, C> {}
14074
14075impl<'a, C> EnterpriseDeleteCall<'a, C>
14076where
14077 C: common::Connector,
14078{
14079 /// Perform the operation you have build so far.
14080 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
14081 use std::borrow::Cow;
14082 use std::io::{Read, Seek};
14083
14084 use common::{url::Params, ToParts};
14085 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14086
14087 let mut dd = common::DefaultDelegate;
14088 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14089 dlg.begin(common::MethodInfo {
14090 id: "androidmanagement.enterprises.delete",
14091 http_method: hyper::Method::DELETE,
14092 });
14093
14094 for &field in ["alt", "name"].iter() {
14095 if self._additional_params.contains_key(field) {
14096 dlg.finished(false);
14097 return Err(common::Error::FieldClash(field));
14098 }
14099 }
14100
14101 let mut params = Params::with_capacity(3 + self._additional_params.len());
14102 params.push("name", self._name);
14103
14104 params.extend(self._additional_params.iter());
14105
14106 params.push("alt", "json");
14107 let mut url = self.hub._base_url.clone() + "v1/{+name}";
14108 if self._scopes.is_empty() {
14109 self._scopes.insert(Scope::Full.as_ref().to_string());
14110 }
14111
14112 #[allow(clippy::single_element_loop)]
14113 for &(find_this, param_name) in [("{+name}", "name")].iter() {
14114 url = params.uri_replacement(url, param_name, find_this, true);
14115 }
14116 {
14117 let to_remove = ["name"];
14118 params.remove_params(&to_remove);
14119 }
14120
14121 let url = params.parse_with_url(&url);
14122
14123 loop {
14124 let token = match self
14125 .hub
14126 .auth
14127 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14128 .await
14129 {
14130 Ok(token) => token,
14131 Err(e) => match dlg.token(e) {
14132 Ok(token) => token,
14133 Err(e) => {
14134 dlg.finished(false);
14135 return Err(common::Error::MissingToken(e));
14136 }
14137 },
14138 };
14139 let mut req_result = {
14140 let client = &self.hub.client;
14141 dlg.pre_request();
14142 let mut req_builder = hyper::Request::builder()
14143 .method(hyper::Method::DELETE)
14144 .uri(url.as_str())
14145 .header(USER_AGENT, self.hub._user_agent.clone());
14146
14147 if let Some(token) = token.as_ref() {
14148 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14149 }
14150
14151 let request = req_builder
14152 .header(CONTENT_LENGTH, 0_u64)
14153 .body(common::to_body::<String>(None));
14154
14155 client.request(request.unwrap()).await
14156 };
14157
14158 match req_result {
14159 Err(err) => {
14160 if let common::Retry::After(d) = dlg.http_error(&err) {
14161 sleep(d).await;
14162 continue;
14163 }
14164 dlg.finished(false);
14165 return Err(common::Error::HttpError(err));
14166 }
14167 Ok(res) => {
14168 let (mut parts, body) = res.into_parts();
14169 let mut body = common::Body::new(body);
14170 if !parts.status.is_success() {
14171 let bytes = common::to_bytes(body).await.unwrap_or_default();
14172 let error = serde_json::from_str(&common::to_string(&bytes));
14173 let response = common::to_response(parts, bytes.into());
14174
14175 if let common::Retry::After(d) =
14176 dlg.http_failure(&response, error.as_ref().ok())
14177 {
14178 sleep(d).await;
14179 continue;
14180 }
14181
14182 dlg.finished(false);
14183
14184 return Err(match error {
14185 Ok(value) => common::Error::BadRequest(value),
14186 _ => common::Error::Failure(response),
14187 });
14188 }
14189 let response = {
14190 let bytes = common::to_bytes(body).await.unwrap_or_default();
14191 let encoded = common::to_string(&bytes);
14192 match serde_json::from_str(&encoded) {
14193 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14194 Err(error) => {
14195 dlg.response_json_decode_error(&encoded, &error);
14196 return Err(common::Error::JsonDecodeError(
14197 encoded.to_string(),
14198 error,
14199 ));
14200 }
14201 }
14202 };
14203
14204 dlg.finished(true);
14205 return Ok(response);
14206 }
14207 }
14208 }
14209 }
14210
14211 /// The name of the enterprise in the form enterprises/{enterpriseId}.
14212 ///
14213 /// Sets the *name* path property to the given value.
14214 ///
14215 /// Even though the property as already been set when instantiating this call,
14216 /// we provide this method for API completeness.
14217 pub fn name(mut self, new_value: &str) -> EnterpriseDeleteCall<'a, C> {
14218 self._name = new_value.to_string();
14219 self
14220 }
14221 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14222 /// while executing the actual API request.
14223 ///
14224 /// ````text
14225 /// It should be used to handle progress information, and to implement a certain level of resilience.
14226 /// ````
14227 ///
14228 /// Sets the *delegate* property to the given value.
14229 pub fn delegate(
14230 mut self,
14231 new_value: &'a mut dyn common::Delegate,
14232 ) -> EnterpriseDeleteCall<'a, C> {
14233 self._delegate = Some(new_value);
14234 self
14235 }
14236
14237 /// Set any additional parameter of the query string used in the request.
14238 /// It should be used to set parameters which are not yet available through their own
14239 /// setters.
14240 ///
14241 /// Please note that this method must not be used to set any of the known parameters
14242 /// which have their own setter method. If done anyway, the request will fail.
14243 ///
14244 /// # Additional Parameters
14245 ///
14246 /// * *$.xgafv* (query-string) - V1 error format.
14247 /// * *access_token* (query-string) - OAuth access token.
14248 /// * *alt* (query-string) - Data format for response.
14249 /// * *callback* (query-string) - JSONP
14250 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14251 /// * *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.
14252 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14253 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14254 /// * *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.
14255 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14256 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14257 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseDeleteCall<'a, C>
14258 where
14259 T: AsRef<str>,
14260 {
14261 self._additional_params
14262 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14263 self
14264 }
14265
14266 /// Identifies the authorization scope for the method you are building.
14267 ///
14268 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14269 /// [`Scope::Full`].
14270 ///
14271 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14272 /// tokens for more than one scope.
14273 ///
14274 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14275 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14276 /// sufficient, a read-write scope will do as well.
14277 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseDeleteCall<'a, C>
14278 where
14279 St: AsRef<str>,
14280 {
14281 self._scopes.insert(String::from(scope.as_ref()));
14282 self
14283 }
14284 /// Identifies the authorization scope(s) for the method you are building.
14285 ///
14286 /// See [`Self::add_scope()`] for details.
14287 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseDeleteCall<'a, C>
14288 where
14289 I: IntoIterator<Item = St>,
14290 St: AsRef<str>,
14291 {
14292 self._scopes
14293 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14294 self
14295 }
14296
14297 /// Removes all scopes, and no default scope will be used either.
14298 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14299 /// for details).
14300 pub fn clear_scopes(mut self) -> EnterpriseDeleteCall<'a, C> {
14301 self._scopes.clear();
14302 self
14303 }
14304}
14305
14306/// Generates an enterprise upgrade URL to upgrade an existing managed Google Play Accounts enterprise to a managed Google domain. See the guide (https://developers.google.com/android/management/upgrade-an-enterprise) for more details.
14307///
14308/// A builder for the *generateEnterpriseUpgradeUrl* method supported by a *enterprise* resource.
14309/// It is not used directly, but through a [`EnterpriseMethods`] instance.
14310///
14311/// # Example
14312///
14313/// Instantiate a resource method builder
14314///
14315/// ```test_harness,no_run
14316/// # extern crate hyper;
14317/// # extern crate hyper_rustls;
14318/// # extern crate google_androidmanagement1 as androidmanagement1;
14319/// use androidmanagement1::api::GenerateEnterpriseUpgradeUrlRequest;
14320/// # async fn dox() {
14321/// # use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14322///
14323/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14324/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14325/// # .with_native_roots()
14326/// # .unwrap()
14327/// # .https_only()
14328/// # .enable_http2()
14329/// # .build();
14330///
14331/// # let executor = hyper_util::rt::TokioExecutor::new();
14332/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14333/// # secret,
14334/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14335/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14336/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14337/// # ),
14338/// # ).build().await.unwrap();
14339///
14340/// # let client = hyper_util::client::legacy::Client::builder(
14341/// # hyper_util::rt::TokioExecutor::new()
14342/// # )
14343/// # .build(
14344/// # hyper_rustls::HttpsConnectorBuilder::new()
14345/// # .with_native_roots()
14346/// # .unwrap()
14347/// # .https_or_http()
14348/// # .enable_http2()
14349/// # .build()
14350/// # );
14351/// # let mut hub = AndroidManagement::new(client, auth);
14352/// // As the method needs a request, you would usually fill it with the desired information
14353/// // into the respective structure. Some of the parts shown here might not be applicable !
14354/// // Values shown here are possibly random and not representative !
14355/// let mut req = GenerateEnterpriseUpgradeUrlRequest::default();
14356///
14357/// // You can configure optional parameters by calling the respective setters at will, and
14358/// // execute the final call using `doit()`.
14359/// // Values shown here are possibly random and not representative !
14360/// let result = hub.enterprises().generate_enterprise_upgrade_url(req, "name")
14361/// .doit().await;
14362/// # }
14363/// ```
14364pub struct EnterpriseGenerateEnterpriseUpgradeUrlCall<'a, C>
14365where
14366 C: 'a,
14367{
14368 hub: &'a AndroidManagement<C>,
14369 _request: GenerateEnterpriseUpgradeUrlRequest,
14370 _name: String,
14371 _delegate: Option<&'a mut dyn common::Delegate>,
14372 _additional_params: HashMap<String, String>,
14373 _scopes: BTreeSet<String>,
14374}
14375
14376impl<'a, C> common::CallBuilder for EnterpriseGenerateEnterpriseUpgradeUrlCall<'a, C> {}
14377
14378impl<'a, C> EnterpriseGenerateEnterpriseUpgradeUrlCall<'a, C>
14379where
14380 C: common::Connector,
14381{
14382 /// Perform the operation you have build so far.
14383 pub async fn doit(
14384 mut self,
14385 ) -> common::Result<(common::Response, GenerateEnterpriseUpgradeUrlResponse)> {
14386 use std::borrow::Cow;
14387 use std::io::{Read, Seek};
14388
14389 use common::{url::Params, ToParts};
14390 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14391
14392 let mut dd = common::DefaultDelegate;
14393 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14394 dlg.begin(common::MethodInfo {
14395 id: "androidmanagement.enterprises.generateEnterpriseUpgradeUrl",
14396 http_method: hyper::Method::POST,
14397 });
14398
14399 for &field in ["alt", "name"].iter() {
14400 if self._additional_params.contains_key(field) {
14401 dlg.finished(false);
14402 return Err(common::Error::FieldClash(field));
14403 }
14404 }
14405
14406 let mut params = Params::with_capacity(4 + self._additional_params.len());
14407 params.push("name", self._name);
14408
14409 params.extend(self._additional_params.iter());
14410
14411 params.push("alt", "json");
14412 let mut url = self.hub._base_url.clone() + "v1/{+name}:generateEnterpriseUpgradeUrl";
14413 if self._scopes.is_empty() {
14414 self._scopes.insert(Scope::Full.as_ref().to_string());
14415 }
14416
14417 #[allow(clippy::single_element_loop)]
14418 for &(find_this, param_name) in [("{+name}", "name")].iter() {
14419 url = params.uri_replacement(url, param_name, find_this, true);
14420 }
14421 {
14422 let to_remove = ["name"];
14423 params.remove_params(&to_remove);
14424 }
14425
14426 let url = params.parse_with_url(&url);
14427
14428 let mut json_mime_type = mime::APPLICATION_JSON;
14429 let mut request_value_reader = {
14430 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14431 common::remove_json_null_values(&mut value);
14432 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14433 serde_json::to_writer(&mut dst, &value).unwrap();
14434 dst
14435 };
14436 let request_size = request_value_reader
14437 .seek(std::io::SeekFrom::End(0))
14438 .unwrap();
14439 request_value_reader
14440 .seek(std::io::SeekFrom::Start(0))
14441 .unwrap();
14442
14443 loop {
14444 let token = match self
14445 .hub
14446 .auth
14447 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14448 .await
14449 {
14450 Ok(token) => token,
14451 Err(e) => match dlg.token(e) {
14452 Ok(token) => token,
14453 Err(e) => {
14454 dlg.finished(false);
14455 return Err(common::Error::MissingToken(e));
14456 }
14457 },
14458 };
14459 request_value_reader
14460 .seek(std::io::SeekFrom::Start(0))
14461 .unwrap();
14462 let mut req_result = {
14463 let client = &self.hub.client;
14464 dlg.pre_request();
14465 let mut req_builder = hyper::Request::builder()
14466 .method(hyper::Method::POST)
14467 .uri(url.as_str())
14468 .header(USER_AGENT, self.hub._user_agent.clone());
14469
14470 if let Some(token) = token.as_ref() {
14471 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14472 }
14473
14474 let request = req_builder
14475 .header(CONTENT_TYPE, json_mime_type.to_string())
14476 .header(CONTENT_LENGTH, request_size as u64)
14477 .body(common::to_body(
14478 request_value_reader.get_ref().clone().into(),
14479 ));
14480
14481 client.request(request.unwrap()).await
14482 };
14483
14484 match req_result {
14485 Err(err) => {
14486 if let common::Retry::After(d) = dlg.http_error(&err) {
14487 sleep(d).await;
14488 continue;
14489 }
14490 dlg.finished(false);
14491 return Err(common::Error::HttpError(err));
14492 }
14493 Ok(res) => {
14494 let (mut parts, body) = res.into_parts();
14495 let mut body = common::Body::new(body);
14496 if !parts.status.is_success() {
14497 let bytes = common::to_bytes(body).await.unwrap_or_default();
14498 let error = serde_json::from_str(&common::to_string(&bytes));
14499 let response = common::to_response(parts, bytes.into());
14500
14501 if let common::Retry::After(d) =
14502 dlg.http_failure(&response, error.as_ref().ok())
14503 {
14504 sleep(d).await;
14505 continue;
14506 }
14507
14508 dlg.finished(false);
14509
14510 return Err(match error {
14511 Ok(value) => common::Error::BadRequest(value),
14512 _ => common::Error::Failure(response),
14513 });
14514 }
14515 let response = {
14516 let bytes = common::to_bytes(body).await.unwrap_or_default();
14517 let encoded = common::to_string(&bytes);
14518 match serde_json::from_str(&encoded) {
14519 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14520 Err(error) => {
14521 dlg.response_json_decode_error(&encoded, &error);
14522 return Err(common::Error::JsonDecodeError(
14523 encoded.to_string(),
14524 error,
14525 ));
14526 }
14527 }
14528 };
14529
14530 dlg.finished(true);
14531 return Ok(response);
14532 }
14533 }
14534 }
14535 }
14536
14537 ///
14538 /// Sets the *request* property to the given value.
14539 ///
14540 /// Even though the property as already been set when instantiating this call,
14541 /// we provide this method for API completeness.
14542 pub fn request(
14543 mut self,
14544 new_value: GenerateEnterpriseUpgradeUrlRequest,
14545 ) -> EnterpriseGenerateEnterpriseUpgradeUrlCall<'a, C> {
14546 self._request = new_value;
14547 self
14548 }
14549 /// Required. The name of the enterprise to be upgraded in the form enterprises/{enterpriseId}.
14550 ///
14551 /// Sets the *name* path property to the given value.
14552 ///
14553 /// Even though the property as already been set when instantiating this call,
14554 /// we provide this method for API completeness.
14555 pub fn name(mut self, new_value: &str) -> EnterpriseGenerateEnterpriseUpgradeUrlCall<'a, C> {
14556 self._name = new_value.to_string();
14557 self
14558 }
14559 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14560 /// while executing the actual API request.
14561 ///
14562 /// ````text
14563 /// It should be used to handle progress information, and to implement a certain level of resilience.
14564 /// ````
14565 ///
14566 /// Sets the *delegate* property to the given value.
14567 pub fn delegate(
14568 mut self,
14569 new_value: &'a mut dyn common::Delegate,
14570 ) -> EnterpriseGenerateEnterpriseUpgradeUrlCall<'a, C> {
14571 self._delegate = Some(new_value);
14572 self
14573 }
14574
14575 /// Set any additional parameter of the query string used in the request.
14576 /// It should be used to set parameters which are not yet available through their own
14577 /// setters.
14578 ///
14579 /// Please note that this method must not be used to set any of the known parameters
14580 /// which have their own setter method. If done anyway, the request will fail.
14581 ///
14582 /// # Additional Parameters
14583 ///
14584 /// * *$.xgafv* (query-string) - V1 error format.
14585 /// * *access_token* (query-string) - OAuth access token.
14586 /// * *alt* (query-string) - Data format for response.
14587 /// * *callback* (query-string) - JSONP
14588 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14589 /// * *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.
14590 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14591 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14592 /// * *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.
14593 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14594 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14595 pub fn param<T>(
14596 mut self,
14597 name: T,
14598 value: T,
14599 ) -> EnterpriseGenerateEnterpriseUpgradeUrlCall<'a, C>
14600 where
14601 T: AsRef<str>,
14602 {
14603 self._additional_params
14604 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14605 self
14606 }
14607
14608 /// Identifies the authorization scope for the method you are building.
14609 ///
14610 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14611 /// [`Scope::Full`].
14612 ///
14613 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14614 /// tokens for more than one scope.
14615 ///
14616 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14617 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14618 /// sufficient, a read-write scope will do as well.
14619 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseGenerateEnterpriseUpgradeUrlCall<'a, C>
14620 where
14621 St: AsRef<str>,
14622 {
14623 self._scopes.insert(String::from(scope.as_ref()));
14624 self
14625 }
14626 /// Identifies the authorization scope(s) for the method you are building.
14627 ///
14628 /// See [`Self::add_scope()`] for details.
14629 pub fn add_scopes<I, St>(
14630 mut self,
14631 scopes: I,
14632 ) -> EnterpriseGenerateEnterpriseUpgradeUrlCall<'a, C>
14633 where
14634 I: IntoIterator<Item = St>,
14635 St: AsRef<str>,
14636 {
14637 self._scopes
14638 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14639 self
14640 }
14641
14642 /// Removes all scopes, and no default scope will be used either.
14643 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14644 /// for details).
14645 pub fn clear_scopes(mut self) -> EnterpriseGenerateEnterpriseUpgradeUrlCall<'a, C> {
14646 self._scopes.clear();
14647 self
14648 }
14649}
14650
14651/// Gets an enterprise.
14652///
14653/// A builder for the *get* method supported by a *enterprise* resource.
14654/// It is not used directly, but through a [`EnterpriseMethods`] instance.
14655///
14656/// # Example
14657///
14658/// Instantiate a resource method builder
14659///
14660/// ```test_harness,no_run
14661/// # extern crate hyper;
14662/// # extern crate hyper_rustls;
14663/// # extern crate google_androidmanagement1 as androidmanagement1;
14664/// # async fn dox() {
14665/// # use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14666///
14667/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14668/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14669/// # .with_native_roots()
14670/// # .unwrap()
14671/// # .https_only()
14672/// # .enable_http2()
14673/// # .build();
14674///
14675/// # let executor = hyper_util::rt::TokioExecutor::new();
14676/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14677/// # secret,
14678/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14679/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14680/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14681/// # ),
14682/// # ).build().await.unwrap();
14683///
14684/// # let client = hyper_util::client::legacy::Client::builder(
14685/// # hyper_util::rt::TokioExecutor::new()
14686/// # )
14687/// # .build(
14688/// # hyper_rustls::HttpsConnectorBuilder::new()
14689/// # .with_native_roots()
14690/// # .unwrap()
14691/// # .https_or_http()
14692/// # .enable_http2()
14693/// # .build()
14694/// # );
14695/// # let mut hub = AndroidManagement::new(client, auth);
14696/// // You can configure optional parameters by calling the respective setters at will, and
14697/// // execute the final call using `doit()`.
14698/// // Values shown here are possibly random and not representative !
14699/// let result = hub.enterprises().get("name")
14700/// .doit().await;
14701/// # }
14702/// ```
14703pub struct EnterpriseGetCall<'a, C>
14704where
14705 C: 'a,
14706{
14707 hub: &'a AndroidManagement<C>,
14708 _name: String,
14709 _delegate: Option<&'a mut dyn common::Delegate>,
14710 _additional_params: HashMap<String, String>,
14711 _scopes: BTreeSet<String>,
14712}
14713
14714impl<'a, C> common::CallBuilder for EnterpriseGetCall<'a, C> {}
14715
14716impl<'a, C> EnterpriseGetCall<'a, C>
14717where
14718 C: common::Connector,
14719{
14720 /// Perform the operation you have build so far.
14721 pub async fn doit(mut self) -> common::Result<(common::Response, Enterprise)> {
14722 use std::borrow::Cow;
14723 use std::io::{Read, Seek};
14724
14725 use common::{url::Params, ToParts};
14726 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14727
14728 let mut dd = common::DefaultDelegate;
14729 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14730 dlg.begin(common::MethodInfo {
14731 id: "androidmanagement.enterprises.get",
14732 http_method: hyper::Method::GET,
14733 });
14734
14735 for &field in ["alt", "name"].iter() {
14736 if self._additional_params.contains_key(field) {
14737 dlg.finished(false);
14738 return Err(common::Error::FieldClash(field));
14739 }
14740 }
14741
14742 let mut params = Params::with_capacity(3 + self._additional_params.len());
14743 params.push("name", self._name);
14744
14745 params.extend(self._additional_params.iter());
14746
14747 params.push("alt", "json");
14748 let mut url = self.hub._base_url.clone() + "v1/{+name}";
14749 if self._scopes.is_empty() {
14750 self._scopes.insert(Scope::Full.as_ref().to_string());
14751 }
14752
14753 #[allow(clippy::single_element_loop)]
14754 for &(find_this, param_name) in [("{+name}", "name")].iter() {
14755 url = params.uri_replacement(url, param_name, find_this, true);
14756 }
14757 {
14758 let to_remove = ["name"];
14759 params.remove_params(&to_remove);
14760 }
14761
14762 let url = params.parse_with_url(&url);
14763
14764 loop {
14765 let token = match self
14766 .hub
14767 .auth
14768 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14769 .await
14770 {
14771 Ok(token) => token,
14772 Err(e) => match dlg.token(e) {
14773 Ok(token) => token,
14774 Err(e) => {
14775 dlg.finished(false);
14776 return Err(common::Error::MissingToken(e));
14777 }
14778 },
14779 };
14780 let mut req_result = {
14781 let client = &self.hub.client;
14782 dlg.pre_request();
14783 let mut req_builder = hyper::Request::builder()
14784 .method(hyper::Method::GET)
14785 .uri(url.as_str())
14786 .header(USER_AGENT, self.hub._user_agent.clone());
14787
14788 if let Some(token) = token.as_ref() {
14789 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14790 }
14791
14792 let request = req_builder
14793 .header(CONTENT_LENGTH, 0_u64)
14794 .body(common::to_body::<String>(None));
14795
14796 client.request(request.unwrap()).await
14797 };
14798
14799 match req_result {
14800 Err(err) => {
14801 if let common::Retry::After(d) = dlg.http_error(&err) {
14802 sleep(d).await;
14803 continue;
14804 }
14805 dlg.finished(false);
14806 return Err(common::Error::HttpError(err));
14807 }
14808 Ok(res) => {
14809 let (mut parts, body) = res.into_parts();
14810 let mut body = common::Body::new(body);
14811 if !parts.status.is_success() {
14812 let bytes = common::to_bytes(body).await.unwrap_or_default();
14813 let error = serde_json::from_str(&common::to_string(&bytes));
14814 let response = common::to_response(parts, bytes.into());
14815
14816 if let common::Retry::After(d) =
14817 dlg.http_failure(&response, error.as_ref().ok())
14818 {
14819 sleep(d).await;
14820 continue;
14821 }
14822
14823 dlg.finished(false);
14824
14825 return Err(match error {
14826 Ok(value) => common::Error::BadRequest(value),
14827 _ => common::Error::Failure(response),
14828 });
14829 }
14830 let response = {
14831 let bytes = common::to_bytes(body).await.unwrap_or_default();
14832 let encoded = common::to_string(&bytes);
14833 match serde_json::from_str(&encoded) {
14834 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14835 Err(error) => {
14836 dlg.response_json_decode_error(&encoded, &error);
14837 return Err(common::Error::JsonDecodeError(
14838 encoded.to_string(),
14839 error,
14840 ));
14841 }
14842 }
14843 };
14844
14845 dlg.finished(true);
14846 return Ok(response);
14847 }
14848 }
14849 }
14850 }
14851
14852 /// The name of the enterprise in the form enterprises/{enterpriseId}.
14853 ///
14854 /// Sets the *name* path property to the given value.
14855 ///
14856 /// Even though the property as already been set when instantiating this call,
14857 /// we provide this method for API completeness.
14858 pub fn name(mut self, new_value: &str) -> EnterpriseGetCall<'a, C> {
14859 self._name = new_value.to_string();
14860 self
14861 }
14862 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14863 /// while executing the actual API request.
14864 ///
14865 /// ````text
14866 /// It should be used to handle progress information, and to implement a certain level of resilience.
14867 /// ````
14868 ///
14869 /// Sets the *delegate* property to the given value.
14870 pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> EnterpriseGetCall<'a, C> {
14871 self._delegate = Some(new_value);
14872 self
14873 }
14874
14875 /// Set any additional parameter of the query string used in the request.
14876 /// It should be used to set parameters which are not yet available through their own
14877 /// setters.
14878 ///
14879 /// Please note that this method must not be used to set any of the known parameters
14880 /// which have their own setter method. If done anyway, the request will fail.
14881 ///
14882 /// # Additional Parameters
14883 ///
14884 /// * *$.xgafv* (query-string) - V1 error format.
14885 /// * *access_token* (query-string) - OAuth access token.
14886 /// * *alt* (query-string) - Data format for response.
14887 /// * *callback* (query-string) - JSONP
14888 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14889 /// * *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.
14890 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14891 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14892 /// * *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.
14893 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14894 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14895 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseGetCall<'a, C>
14896 where
14897 T: AsRef<str>,
14898 {
14899 self._additional_params
14900 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14901 self
14902 }
14903
14904 /// Identifies the authorization scope for the method you are building.
14905 ///
14906 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14907 /// [`Scope::Full`].
14908 ///
14909 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14910 /// tokens for more than one scope.
14911 ///
14912 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14913 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14914 /// sufficient, a read-write scope will do as well.
14915 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseGetCall<'a, C>
14916 where
14917 St: AsRef<str>,
14918 {
14919 self._scopes.insert(String::from(scope.as_ref()));
14920 self
14921 }
14922 /// Identifies the authorization scope(s) for the method you are building.
14923 ///
14924 /// See [`Self::add_scope()`] for details.
14925 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseGetCall<'a, C>
14926 where
14927 I: IntoIterator<Item = St>,
14928 St: AsRef<str>,
14929 {
14930 self._scopes
14931 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14932 self
14933 }
14934
14935 /// Removes all scopes, and no default scope will be used either.
14936 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14937 /// for details).
14938 pub fn clear_scopes(mut self) -> EnterpriseGetCall<'a, C> {
14939 self._scopes.clear();
14940 self
14941 }
14942}
14943
14944/// Lists EMM-managed enterprises. Only BASIC fields are returned.
14945///
14946/// A builder for the *list* method supported by a *enterprise* resource.
14947/// It is not used directly, but through a [`EnterpriseMethods`] instance.
14948///
14949/// # Example
14950///
14951/// Instantiate a resource method builder
14952///
14953/// ```test_harness,no_run
14954/// # extern crate hyper;
14955/// # extern crate hyper_rustls;
14956/// # extern crate google_androidmanagement1 as androidmanagement1;
14957/// # async fn dox() {
14958/// # use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14959///
14960/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14961/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14962/// # .with_native_roots()
14963/// # .unwrap()
14964/// # .https_only()
14965/// # .enable_http2()
14966/// # .build();
14967///
14968/// # let executor = hyper_util::rt::TokioExecutor::new();
14969/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14970/// # secret,
14971/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14972/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14973/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14974/// # ),
14975/// # ).build().await.unwrap();
14976///
14977/// # let client = hyper_util::client::legacy::Client::builder(
14978/// # hyper_util::rt::TokioExecutor::new()
14979/// # )
14980/// # .build(
14981/// # hyper_rustls::HttpsConnectorBuilder::new()
14982/// # .with_native_roots()
14983/// # .unwrap()
14984/// # .https_or_http()
14985/// # .enable_http2()
14986/// # .build()
14987/// # );
14988/// # let mut hub = AndroidManagement::new(client, auth);
14989/// // You can configure optional parameters by calling the respective setters at will, and
14990/// // execute the final call using `doit()`.
14991/// // Values shown here are possibly random and not representative !
14992/// let result = hub.enterprises().list()
14993/// .view("elitr")
14994/// .project_id("Lorem")
14995/// .page_token("diam")
14996/// .page_size(-61)
14997/// .doit().await;
14998/// # }
14999/// ```
15000pub struct EnterpriseListCall<'a, C>
15001where
15002 C: 'a,
15003{
15004 hub: &'a AndroidManagement<C>,
15005 _view: Option<String>,
15006 _project_id: Option<String>,
15007 _page_token: Option<String>,
15008 _page_size: Option<i32>,
15009 _delegate: Option<&'a mut dyn common::Delegate>,
15010 _additional_params: HashMap<String, String>,
15011 _scopes: BTreeSet<String>,
15012}
15013
15014impl<'a, C> common::CallBuilder for EnterpriseListCall<'a, C> {}
15015
15016impl<'a, C> EnterpriseListCall<'a, C>
15017where
15018 C: common::Connector,
15019{
15020 /// Perform the operation you have build so far.
15021 pub async fn doit(mut self) -> common::Result<(common::Response, ListEnterprisesResponse)> {
15022 use std::borrow::Cow;
15023 use std::io::{Read, Seek};
15024
15025 use common::{url::Params, ToParts};
15026 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15027
15028 let mut dd = common::DefaultDelegate;
15029 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15030 dlg.begin(common::MethodInfo {
15031 id: "androidmanagement.enterprises.list",
15032 http_method: hyper::Method::GET,
15033 });
15034
15035 for &field in ["alt", "view", "projectId", "pageToken", "pageSize"].iter() {
15036 if self._additional_params.contains_key(field) {
15037 dlg.finished(false);
15038 return Err(common::Error::FieldClash(field));
15039 }
15040 }
15041
15042 let mut params = Params::with_capacity(6 + self._additional_params.len());
15043 if let Some(value) = self._view.as_ref() {
15044 params.push("view", value);
15045 }
15046 if let Some(value) = self._project_id.as_ref() {
15047 params.push("projectId", value);
15048 }
15049 if let Some(value) = self._page_token.as_ref() {
15050 params.push("pageToken", value);
15051 }
15052 if let Some(value) = self._page_size.as_ref() {
15053 params.push("pageSize", value.to_string());
15054 }
15055
15056 params.extend(self._additional_params.iter());
15057
15058 params.push("alt", "json");
15059 let mut url = self.hub._base_url.clone() + "v1/enterprises";
15060 if self._scopes.is_empty() {
15061 self._scopes.insert(Scope::Full.as_ref().to_string());
15062 }
15063
15064 let url = params.parse_with_url(&url);
15065
15066 loop {
15067 let token = match self
15068 .hub
15069 .auth
15070 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15071 .await
15072 {
15073 Ok(token) => token,
15074 Err(e) => match dlg.token(e) {
15075 Ok(token) => token,
15076 Err(e) => {
15077 dlg.finished(false);
15078 return Err(common::Error::MissingToken(e));
15079 }
15080 },
15081 };
15082 let mut req_result = {
15083 let client = &self.hub.client;
15084 dlg.pre_request();
15085 let mut req_builder = hyper::Request::builder()
15086 .method(hyper::Method::GET)
15087 .uri(url.as_str())
15088 .header(USER_AGENT, self.hub._user_agent.clone());
15089
15090 if let Some(token) = token.as_ref() {
15091 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15092 }
15093
15094 let request = req_builder
15095 .header(CONTENT_LENGTH, 0_u64)
15096 .body(common::to_body::<String>(None));
15097
15098 client.request(request.unwrap()).await
15099 };
15100
15101 match req_result {
15102 Err(err) => {
15103 if let common::Retry::After(d) = dlg.http_error(&err) {
15104 sleep(d).await;
15105 continue;
15106 }
15107 dlg.finished(false);
15108 return Err(common::Error::HttpError(err));
15109 }
15110 Ok(res) => {
15111 let (mut parts, body) = res.into_parts();
15112 let mut body = common::Body::new(body);
15113 if !parts.status.is_success() {
15114 let bytes = common::to_bytes(body).await.unwrap_or_default();
15115 let error = serde_json::from_str(&common::to_string(&bytes));
15116 let response = common::to_response(parts, bytes.into());
15117
15118 if let common::Retry::After(d) =
15119 dlg.http_failure(&response, error.as_ref().ok())
15120 {
15121 sleep(d).await;
15122 continue;
15123 }
15124
15125 dlg.finished(false);
15126
15127 return Err(match error {
15128 Ok(value) => common::Error::BadRequest(value),
15129 _ => common::Error::Failure(response),
15130 });
15131 }
15132 let response = {
15133 let bytes = common::to_bytes(body).await.unwrap_or_default();
15134 let encoded = common::to_string(&bytes);
15135 match serde_json::from_str(&encoded) {
15136 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15137 Err(error) => {
15138 dlg.response_json_decode_error(&encoded, &error);
15139 return Err(common::Error::JsonDecodeError(
15140 encoded.to_string(),
15141 error,
15142 ));
15143 }
15144 }
15145 };
15146
15147 dlg.finished(true);
15148 return Ok(response);
15149 }
15150 }
15151 }
15152 }
15153
15154 /// Specifies which Enterprise fields to return. This method only supports BASIC.
15155 ///
15156 /// Sets the *view* query property to the given value.
15157 pub fn view(mut self, new_value: &str) -> EnterpriseListCall<'a, C> {
15158 self._view = Some(new_value.to_string());
15159 self
15160 }
15161 /// Required. The Cloud project ID of the EMM managing the enterprises.
15162 ///
15163 /// Sets the *project id* query property to the given value.
15164 pub fn project_id(mut self, new_value: &str) -> EnterpriseListCall<'a, C> {
15165 self._project_id = Some(new_value.to_string());
15166 self
15167 }
15168 /// A token identifying a page of results returned by the server.
15169 ///
15170 /// Sets the *page token* query property to the given value.
15171 pub fn page_token(mut self, new_value: &str) -> EnterpriseListCall<'a, C> {
15172 self._page_token = Some(new_value.to_string());
15173 self
15174 }
15175 /// The requested page size. The actual page size may be fixed to a min or max value.
15176 ///
15177 /// Sets the *page size* query property to the given value.
15178 pub fn page_size(mut self, new_value: i32) -> EnterpriseListCall<'a, C> {
15179 self._page_size = Some(new_value);
15180 self
15181 }
15182 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15183 /// while executing the actual API request.
15184 ///
15185 /// ````text
15186 /// It should be used to handle progress information, and to implement a certain level of resilience.
15187 /// ````
15188 ///
15189 /// Sets the *delegate* property to the given value.
15190 pub fn delegate(
15191 mut self,
15192 new_value: &'a mut dyn common::Delegate,
15193 ) -> EnterpriseListCall<'a, C> {
15194 self._delegate = Some(new_value);
15195 self
15196 }
15197
15198 /// Set any additional parameter of the query string used in the request.
15199 /// It should be used to set parameters which are not yet available through their own
15200 /// setters.
15201 ///
15202 /// Please note that this method must not be used to set any of the known parameters
15203 /// which have their own setter method. If done anyway, the request will fail.
15204 ///
15205 /// # Additional Parameters
15206 ///
15207 /// * *$.xgafv* (query-string) - V1 error format.
15208 /// * *access_token* (query-string) - OAuth access token.
15209 /// * *alt* (query-string) - Data format for response.
15210 /// * *callback* (query-string) - JSONP
15211 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15212 /// * *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.
15213 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15214 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15215 /// * *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.
15216 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15217 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15218 pub fn param<T>(mut self, name: T, value: T) -> EnterpriseListCall<'a, C>
15219 where
15220 T: AsRef<str>,
15221 {
15222 self._additional_params
15223 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15224 self
15225 }
15226
15227 /// Identifies the authorization scope for the method you are building.
15228 ///
15229 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15230 /// [`Scope::Full`].
15231 ///
15232 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15233 /// tokens for more than one scope.
15234 ///
15235 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15236 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15237 /// sufficient, a read-write scope will do as well.
15238 pub fn add_scope<St>(mut self, scope: St) -> EnterpriseListCall<'a, C>
15239 where
15240 St: AsRef<str>,
15241 {
15242 self._scopes.insert(String::from(scope.as_ref()));
15243 self
15244 }
15245 /// Identifies the authorization scope(s) for the method you are building.
15246 ///
15247 /// See [`Self::add_scope()`] for details.
15248 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterpriseListCall<'a, C>
15249 where
15250 I: IntoIterator<Item = St>,
15251 St: AsRef<str>,
15252 {
15253 self._scopes
15254 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15255 self
15256 }
15257
15258 /// Removes all scopes, and no default scope will be used either.
15259 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15260 /// for details).
15261 pub fn clear_scopes(mut self) -> EnterpriseListCall<'a, C> {
15262 self._scopes.clear();
15263 self
15264 }
15265}
15266
15267/// Updates an enterprise. See also: SigninDetail
15268///
15269/// A builder for the *patch* method supported by a *enterprise* resource.
15270/// It is not used directly, but through a [`EnterpriseMethods`] instance.
15271///
15272/// # Example
15273///
15274/// Instantiate a resource method builder
15275///
15276/// ```test_harness,no_run
15277/// # extern crate hyper;
15278/// # extern crate hyper_rustls;
15279/// # extern crate google_androidmanagement1 as androidmanagement1;
15280/// use androidmanagement1::api::Enterprise;
15281/// # async fn dox() {
15282/// # use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15283///
15284/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15285/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15286/// # .with_native_roots()
15287/// # .unwrap()
15288/// # .https_only()
15289/// # .enable_http2()
15290/// # .build();
15291///
15292/// # let executor = hyper_util::rt::TokioExecutor::new();
15293/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15294/// # secret,
15295/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15296/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15297/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15298/// # ),
15299/// # ).build().await.unwrap();
15300///
15301/// # let client = hyper_util::client::legacy::Client::builder(
15302/// # hyper_util::rt::TokioExecutor::new()
15303/// # )
15304/// # .build(
15305/// # hyper_rustls::HttpsConnectorBuilder::new()
15306/// # .with_native_roots()
15307/// # .unwrap()
15308/// # .https_or_http()
15309/// # .enable_http2()
15310/// # .build()
15311/// # );
15312/// # let mut hub = AndroidManagement::new(client, auth);
15313/// // As the method needs a request, you would usually fill it with the desired information
15314/// // into the respective structure. Some of the parts shown here might not be applicable !
15315/// // Values shown here are possibly random and not representative !
15316/// let mut req = Enterprise::default();
15317///
15318/// // You can configure optional parameters by calling the respective setters at will, and
15319/// // execute the final call using `doit()`.
15320/// // Values shown here are possibly random and not representative !
15321/// let result = hub.enterprises().patch(req, "name")
15322/// .update_mask(FieldMask::new::<&str>(&[]))
15323/// .doit().await;
15324/// # }
15325/// ```
15326pub struct EnterprisePatchCall<'a, C>
15327where
15328 C: 'a,
15329{
15330 hub: &'a AndroidManagement<C>,
15331 _request: Enterprise,
15332 _name: String,
15333 _update_mask: Option<common::FieldMask>,
15334 _delegate: Option<&'a mut dyn common::Delegate>,
15335 _additional_params: HashMap<String, String>,
15336 _scopes: BTreeSet<String>,
15337}
15338
15339impl<'a, C> common::CallBuilder for EnterprisePatchCall<'a, C> {}
15340
15341impl<'a, C> EnterprisePatchCall<'a, C>
15342where
15343 C: common::Connector,
15344{
15345 /// Perform the operation you have build so far.
15346 pub async fn doit(mut self) -> common::Result<(common::Response, Enterprise)> {
15347 use std::borrow::Cow;
15348 use std::io::{Read, Seek};
15349
15350 use common::{url::Params, ToParts};
15351 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15352
15353 let mut dd = common::DefaultDelegate;
15354 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15355 dlg.begin(common::MethodInfo {
15356 id: "androidmanagement.enterprises.patch",
15357 http_method: hyper::Method::PATCH,
15358 });
15359
15360 for &field in ["alt", "name", "updateMask"].iter() {
15361 if self._additional_params.contains_key(field) {
15362 dlg.finished(false);
15363 return Err(common::Error::FieldClash(field));
15364 }
15365 }
15366
15367 let mut params = Params::with_capacity(5 + self._additional_params.len());
15368 params.push("name", self._name);
15369 if let Some(value) = self._update_mask.as_ref() {
15370 params.push("updateMask", value.to_string());
15371 }
15372
15373 params.extend(self._additional_params.iter());
15374
15375 params.push("alt", "json");
15376 let mut url = self.hub._base_url.clone() + "v1/{+name}";
15377 if self._scopes.is_empty() {
15378 self._scopes.insert(Scope::Full.as_ref().to_string());
15379 }
15380
15381 #[allow(clippy::single_element_loop)]
15382 for &(find_this, param_name) in [("{+name}", "name")].iter() {
15383 url = params.uri_replacement(url, param_name, find_this, true);
15384 }
15385 {
15386 let to_remove = ["name"];
15387 params.remove_params(&to_remove);
15388 }
15389
15390 let url = params.parse_with_url(&url);
15391
15392 let mut json_mime_type = mime::APPLICATION_JSON;
15393 let mut request_value_reader = {
15394 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15395 common::remove_json_null_values(&mut value);
15396 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15397 serde_json::to_writer(&mut dst, &value).unwrap();
15398 dst
15399 };
15400 let request_size = request_value_reader
15401 .seek(std::io::SeekFrom::End(0))
15402 .unwrap();
15403 request_value_reader
15404 .seek(std::io::SeekFrom::Start(0))
15405 .unwrap();
15406
15407 loop {
15408 let token = match self
15409 .hub
15410 .auth
15411 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15412 .await
15413 {
15414 Ok(token) => token,
15415 Err(e) => match dlg.token(e) {
15416 Ok(token) => token,
15417 Err(e) => {
15418 dlg.finished(false);
15419 return Err(common::Error::MissingToken(e));
15420 }
15421 },
15422 };
15423 request_value_reader
15424 .seek(std::io::SeekFrom::Start(0))
15425 .unwrap();
15426 let mut req_result = {
15427 let client = &self.hub.client;
15428 dlg.pre_request();
15429 let mut req_builder = hyper::Request::builder()
15430 .method(hyper::Method::PATCH)
15431 .uri(url.as_str())
15432 .header(USER_AGENT, self.hub._user_agent.clone());
15433
15434 if let Some(token) = token.as_ref() {
15435 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15436 }
15437
15438 let request = req_builder
15439 .header(CONTENT_TYPE, json_mime_type.to_string())
15440 .header(CONTENT_LENGTH, request_size as u64)
15441 .body(common::to_body(
15442 request_value_reader.get_ref().clone().into(),
15443 ));
15444
15445 client.request(request.unwrap()).await
15446 };
15447
15448 match req_result {
15449 Err(err) => {
15450 if let common::Retry::After(d) = dlg.http_error(&err) {
15451 sleep(d).await;
15452 continue;
15453 }
15454 dlg.finished(false);
15455 return Err(common::Error::HttpError(err));
15456 }
15457 Ok(res) => {
15458 let (mut parts, body) = res.into_parts();
15459 let mut body = common::Body::new(body);
15460 if !parts.status.is_success() {
15461 let bytes = common::to_bytes(body).await.unwrap_or_default();
15462 let error = serde_json::from_str(&common::to_string(&bytes));
15463 let response = common::to_response(parts, bytes.into());
15464
15465 if let common::Retry::After(d) =
15466 dlg.http_failure(&response, error.as_ref().ok())
15467 {
15468 sleep(d).await;
15469 continue;
15470 }
15471
15472 dlg.finished(false);
15473
15474 return Err(match error {
15475 Ok(value) => common::Error::BadRequest(value),
15476 _ => common::Error::Failure(response),
15477 });
15478 }
15479 let response = {
15480 let bytes = common::to_bytes(body).await.unwrap_or_default();
15481 let encoded = common::to_string(&bytes);
15482 match serde_json::from_str(&encoded) {
15483 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15484 Err(error) => {
15485 dlg.response_json_decode_error(&encoded, &error);
15486 return Err(common::Error::JsonDecodeError(
15487 encoded.to_string(),
15488 error,
15489 ));
15490 }
15491 }
15492 };
15493
15494 dlg.finished(true);
15495 return Ok(response);
15496 }
15497 }
15498 }
15499 }
15500
15501 ///
15502 /// Sets the *request* property to the given value.
15503 ///
15504 /// Even though the property as already been set when instantiating this call,
15505 /// we provide this method for API completeness.
15506 pub fn request(mut self, new_value: Enterprise) -> EnterprisePatchCall<'a, C> {
15507 self._request = new_value;
15508 self
15509 }
15510 /// The name of the enterprise in the form enterprises/{enterpriseId}.
15511 ///
15512 /// Sets the *name* path property to the given value.
15513 ///
15514 /// Even though the property as already been set when instantiating this call,
15515 /// we provide this method for API completeness.
15516 pub fn name(mut self, new_value: &str) -> EnterprisePatchCall<'a, C> {
15517 self._name = new_value.to_string();
15518 self
15519 }
15520 /// The field mask indicating the fields to update. If not set, all modifiable fields will be modified.
15521 ///
15522 /// Sets the *update mask* query property to the given value.
15523 pub fn update_mask(mut self, new_value: common::FieldMask) -> EnterprisePatchCall<'a, C> {
15524 self._update_mask = Some(new_value);
15525 self
15526 }
15527 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15528 /// while executing the actual API request.
15529 ///
15530 /// ````text
15531 /// It should be used to handle progress information, and to implement a certain level of resilience.
15532 /// ````
15533 ///
15534 /// Sets the *delegate* property to the given value.
15535 pub fn delegate(
15536 mut self,
15537 new_value: &'a mut dyn common::Delegate,
15538 ) -> EnterprisePatchCall<'a, C> {
15539 self._delegate = Some(new_value);
15540 self
15541 }
15542
15543 /// Set any additional parameter of the query string used in the request.
15544 /// It should be used to set parameters which are not yet available through their own
15545 /// setters.
15546 ///
15547 /// Please note that this method must not be used to set any of the known parameters
15548 /// which have their own setter method. If done anyway, the request will fail.
15549 ///
15550 /// # Additional Parameters
15551 ///
15552 /// * *$.xgafv* (query-string) - V1 error format.
15553 /// * *access_token* (query-string) - OAuth access token.
15554 /// * *alt* (query-string) - Data format for response.
15555 /// * *callback* (query-string) - JSONP
15556 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15557 /// * *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.
15558 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15559 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15560 /// * *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.
15561 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15562 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15563 pub fn param<T>(mut self, name: T, value: T) -> EnterprisePatchCall<'a, C>
15564 where
15565 T: AsRef<str>,
15566 {
15567 self._additional_params
15568 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15569 self
15570 }
15571
15572 /// Identifies the authorization scope for the method you are building.
15573 ///
15574 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15575 /// [`Scope::Full`].
15576 ///
15577 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15578 /// tokens for more than one scope.
15579 ///
15580 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15581 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15582 /// sufficient, a read-write scope will do as well.
15583 pub fn add_scope<St>(mut self, scope: St) -> EnterprisePatchCall<'a, C>
15584 where
15585 St: AsRef<str>,
15586 {
15587 self._scopes.insert(String::from(scope.as_ref()));
15588 self
15589 }
15590 /// Identifies the authorization scope(s) for the method you are building.
15591 ///
15592 /// See [`Self::add_scope()`] for details.
15593 pub fn add_scopes<I, St>(mut self, scopes: I) -> EnterprisePatchCall<'a, C>
15594 where
15595 I: IntoIterator<Item = St>,
15596 St: AsRef<str>,
15597 {
15598 self._scopes
15599 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15600 self
15601 }
15602
15603 /// Removes all scopes, and no default scope will be used either.
15604 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15605 /// for details).
15606 pub fn clear_scopes(mut self) -> EnterprisePatchCall<'a, C> {
15607 self._scopes.clear();
15608 self
15609 }
15610}
15611
15612/// Get the device provisioning information by the identifier provided in the sign-in url.
15613///
15614/// A builder for the *get* method supported by a *provisioningInfo* resource.
15615/// It is not used directly, but through a [`ProvisioningInfoMethods`] instance.
15616///
15617/// # Example
15618///
15619/// Instantiate a resource method builder
15620///
15621/// ```test_harness,no_run
15622/// # extern crate hyper;
15623/// # extern crate hyper_rustls;
15624/// # extern crate google_androidmanagement1 as androidmanagement1;
15625/// # async fn dox() {
15626/// # use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15627///
15628/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15629/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15630/// # .with_native_roots()
15631/// # .unwrap()
15632/// # .https_only()
15633/// # .enable_http2()
15634/// # .build();
15635///
15636/// # let executor = hyper_util::rt::TokioExecutor::new();
15637/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15638/// # secret,
15639/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15640/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15641/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15642/// # ),
15643/// # ).build().await.unwrap();
15644///
15645/// # let client = hyper_util::client::legacy::Client::builder(
15646/// # hyper_util::rt::TokioExecutor::new()
15647/// # )
15648/// # .build(
15649/// # hyper_rustls::HttpsConnectorBuilder::new()
15650/// # .with_native_roots()
15651/// # .unwrap()
15652/// # .https_or_http()
15653/// # .enable_http2()
15654/// # .build()
15655/// # );
15656/// # let mut hub = AndroidManagement::new(client, auth);
15657/// // You can configure optional parameters by calling the respective setters at will, and
15658/// // execute the final call using `doit()`.
15659/// // Values shown here are possibly random and not representative !
15660/// let result = hub.provisioning_info().get("name")
15661/// .doit().await;
15662/// # }
15663/// ```
15664pub struct ProvisioningInfoGetCall<'a, C>
15665where
15666 C: 'a,
15667{
15668 hub: &'a AndroidManagement<C>,
15669 _name: String,
15670 _delegate: Option<&'a mut dyn common::Delegate>,
15671 _additional_params: HashMap<String, String>,
15672 _scopes: BTreeSet<String>,
15673}
15674
15675impl<'a, C> common::CallBuilder for ProvisioningInfoGetCall<'a, C> {}
15676
15677impl<'a, C> ProvisioningInfoGetCall<'a, C>
15678where
15679 C: common::Connector,
15680{
15681 /// Perform the operation you have build so far.
15682 pub async fn doit(mut self) -> common::Result<(common::Response, ProvisioningInfo)> {
15683 use std::borrow::Cow;
15684 use std::io::{Read, Seek};
15685
15686 use common::{url::Params, ToParts};
15687 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15688
15689 let mut dd = common::DefaultDelegate;
15690 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15691 dlg.begin(common::MethodInfo {
15692 id: "androidmanagement.provisioningInfo.get",
15693 http_method: hyper::Method::GET,
15694 });
15695
15696 for &field in ["alt", "name"].iter() {
15697 if self._additional_params.contains_key(field) {
15698 dlg.finished(false);
15699 return Err(common::Error::FieldClash(field));
15700 }
15701 }
15702
15703 let mut params = Params::with_capacity(3 + self._additional_params.len());
15704 params.push("name", self._name);
15705
15706 params.extend(self._additional_params.iter());
15707
15708 params.push("alt", "json");
15709 let mut url = self.hub._base_url.clone() + "v1/{+name}";
15710 if self._scopes.is_empty() {
15711 self._scopes.insert(Scope::Full.as_ref().to_string());
15712 }
15713
15714 #[allow(clippy::single_element_loop)]
15715 for &(find_this, param_name) in [("{+name}", "name")].iter() {
15716 url = params.uri_replacement(url, param_name, find_this, true);
15717 }
15718 {
15719 let to_remove = ["name"];
15720 params.remove_params(&to_remove);
15721 }
15722
15723 let url = params.parse_with_url(&url);
15724
15725 loop {
15726 let token = match self
15727 .hub
15728 .auth
15729 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15730 .await
15731 {
15732 Ok(token) => token,
15733 Err(e) => match dlg.token(e) {
15734 Ok(token) => token,
15735 Err(e) => {
15736 dlg.finished(false);
15737 return Err(common::Error::MissingToken(e));
15738 }
15739 },
15740 };
15741 let mut req_result = {
15742 let client = &self.hub.client;
15743 dlg.pre_request();
15744 let mut req_builder = hyper::Request::builder()
15745 .method(hyper::Method::GET)
15746 .uri(url.as_str())
15747 .header(USER_AGENT, self.hub._user_agent.clone());
15748
15749 if let Some(token) = token.as_ref() {
15750 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15751 }
15752
15753 let request = req_builder
15754 .header(CONTENT_LENGTH, 0_u64)
15755 .body(common::to_body::<String>(None));
15756
15757 client.request(request.unwrap()).await
15758 };
15759
15760 match req_result {
15761 Err(err) => {
15762 if let common::Retry::After(d) = dlg.http_error(&err) {
15763 sleep(d).await;
15764 continue;
15765 }
15766 dlg.finished(false);
15767 return Err(common::Error::HttpError(err));
15768 }
15769 Ok(res) => {
15770 let (mut parts, body) = res.into_parts();
15771 let mut body = common::Body::new(body);
15772 if !parts.status.is_success() {
15773 let bytes = common::to_bytes(body).await.unwrap_or_default();
15774 let error = serde_json::from_str(&common::to_string(&bytes));
15775 let response = common::to_response(parts, bytes.into());
15776
15777 if let common::Retry::After(d) =
15778 dlg.http_failure(&response, error.as_ref().ok())
15779 {
15780 sleep(d).await;
15781 continue;
15782 }
15783
15784 dlg.finished(false);
15785
15786 return Err(match error {
15787 Ok(value) => common::Error::BadRequest(value),
15788 _ => common::Error::Failure(response),
15789 });
15790 }
15791 let response = {
15792 let bytes = common::to_bytes(body).await.unwrap_or_default();
15793 let encoded = common::to_string(&bytes);
15794 match serde_json::from_str(&encoded) {
15795 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15796 Err(error) => {
15797 dlg.response_json_decode_error(&encoded, &error);
15798 return Err(common::Error::JsonDecodeError(
15799 encoded.to_string(),
15800 error,
15801 ));
15802 }
15803 }
15804 };
15805
15806 dlg.finished(true);
15807 return Ok(response);
15808 }
15809 }
15810 }
15811 }
15812
15813 /// Required. The identifier that Android Device Policy passes to the 3P sign-in page in the form of provisioningInfo/{provisioning_info}.
15814 ///
15815 /// Sets the *name* path property to the given value.
15816 ///
15817 /// Even though the property as already been set when instantiating this call,
15818 /// we provide this method for API completeness.
15819 pub fn name(mut self, new_value: &str) -> ProvisioningInfoGetCall<'a, C> {
15820 self._name = new_value.to_string();
15821 self
15822 }
15823 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15824 /// while executing the actual API request.
15825 ///
15826 /// ````text
15827 /// It should be used to handle progress information, and to implement a certain level of resilience.
15828 /// ````
15829 ///
15830 /// Sets the *delegate* property to the given value.
15831 pub fn delegate(
15832 mut self,
15833 new_value: &'a mut dyn common::Delegate,
15834 ) -> ProvisioningInfoGetCall<'a, C> {
15835 self._delegate = Some(new_value);
15836 self
15837 }
15838
15839 /// Set any additional parameter of the query string used in the request.
15840 /// It should be used to set parameters which are not yet available through their own
15841 /// setters.
15842 ///
15843 /// Please note that this method must not be used to set any of the known parameters
15844 /// which have their own setter method. If done anyway, the request will fail.
15845 ///
15846 /// # Additional Parameters
15847 ///
15848 /// * *$.xgafv* (query-string) - V1 error format.
15849 /// * *access_token* (query-string) - OAuth access token.
15850 /// * *alt* (query-string) - Data format for response.
15851 /// * *callback* (query-string) - JSONP
15852 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15853 /// * *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.
15854 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15855 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15856 /// * *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.
15857 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15858 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15859 pub fn param<T>(mut self, name: T, value: T) -> ProvisioningInfoGetCall<'a, C>
15860 where
15861 T: AsRef<str>,
15862 {
15863 self._additional_params
15864 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15865 self
15866 }
15867
15868 /// Identifies the authorization scope for the method you are building.
15869 ///
15870 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15871 /// [`Scope::Full`].
15872 ///
15873 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15874 /// tokens for more than one scope.
15875 ///
15876 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15877 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15878 /// sufficient, a read-write scope will do as well.
15879 pub fn add_scope<St>(mut self, scope: St) -> ProvisioningInfoGetCall<'a, C>
15880 where
15881 St: AsRef<str>,
15882 {
15883 self._scopes.insert(String::from(scope.as_ref()));
15884 self
15885 }
15886 /// Identifies the authorization scope(s) for the method you are building.
15887 ///
15888 /// See [`Self::add_scope()`] for details.
15889 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProvisioningInfoGetCall<'a, C>
15890 where
15891 I: IntoIterator<Item = St>,
15892 St: AsRef<str>,
15893 {
15894 self._scopes
15895 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15896 self
15897 }
15898
15899 /// Removes all scopes, and no default scope will be used either.
15900 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15901 /// for details).
15902 pub fn clear_scopes(mut self) -> ProvisioningInfoGetCall<'a, C> {
15903 self._scopes.clear();
15904 self
15905 }
15906}
15907
15908/// Creates an enterprise signup URL.
15909///
15910/// A builder for the *create* method supported by a *signupUrl* resource.
15911/// It is not used directly, but through a [`SignupUrlMethods`] instance.
15912///
15913/// # Example
15914///
15915/// Instantiate a resource method builder
15916///
15917/// ```test_harness,no_run
15918/// # extern crate hyper;
15919/// # extern crate hyper_rustls;
15920/// # extern crate google_androidmanagement1 as androidmanagement1;
15921/// # async fn dox() {
15922/// # use androidmanagement1::{AndroidManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15923///
15924/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15925/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15926/// # .with_native_roots()
15927/// # .unwrap()
15928/// # .https_only()
15929/// # .enable_http2()
15930/// # .build();
15931///
15932/// # let executor = hyper_util::rt::TokioExecutor::new();
15933/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15934/// # secret,
15935/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15936/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15937/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15938/// # ),
15939/// # ).build().await.unwrap();
15940///
15941/// # let client = hyper_util::client::legacy::Client::builder(
15942/// # hyper_util::rt::TokioExecutor::new()
15943/// # )
15944/// # .build(
15945/// # hyper_rustls::HttpsConnectorBuilder::new()
15946/// # .with_native_roots()
15947/// # .unwrap()
15948/// # .https_or_http()
15949/// # .enable_http2()
15950/// # .build()
15951/// # );
15952/// # let mut hub = AndroidManagement::new(client, auth);
15953/// // You can configure optional parameters by calling the respective setters at will, and
15954/// // execute the final call using `doit()`.
15955/// // Values shown here are possibly random and not representative !
15956/// let result = hub.signup_urls().create()
15957/// .project_id("takimata")
15958/// .callback_url("consetetur")
15959/// .add_allowed_domains("voluptua.")
15960/// .admin_email("et")
15961/// .doit().await;
15962/// # }
15963/// ```
15964pub struct SignupUrlCreateCall<'a, C>
15965where
15966 C: 'a,
15967{
15968 hub: &'a AndroidManagement<C>,
15969 _project_id: Option<String>,
15970 _callback_url: Option<String>,
15971 _allowed_domains: Vec<String>,
15972 _admin_email: Option<String>,
15973 _delegate: Option<&'a mut dyn common::Delegate>,
15974 _additional_params: HashMap<String, String>,
15975 _scopes: BTreeSet<String>,
15976}
15977
15978impl<'a, C> common::CallBuilder for SignupUrlCreateCall<'a, C> {}
15979
15980impl<'a, C> SignupUrlCreateCall<'a, C>
15981where
15982 C: common::Connector,
15983{
15984 /// Perform the operation you have build so far.
15985 pub async fn doit(mut self) -> common::Result<(common::Response, SignupUrl)> {
15986 use std::borrow::Cow;
15987 use std::io::{Read, Seek};
15988
15989 use common::{url::Params, ToParts};
15990 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15991
15992 let mut dd = common::DefaultDelegate;
15993 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15994 dlg.begin(common::MethodInfo {
15995 id: "androidmanagement.signupUrls.create",
15996 http_method: hyper::Method::POST,
15997 });
15998
15999 for &field in [
16000 "alt",
16001 "projectId",
16002 "callbackUrl",
16003 "allowedDomains",
16004 "adminEmail",
16005 ]
16006 .iter()
16007 {
16008 if self._additional_params.contains_key(field) {
16009 dlg.finished(false);
16010 return Err(common::Error::FieldClash(field));
16011 }
16012 }
16013
16014 let mut params = Params::with_capacity(6 + self._additional_params.len());
16015 if let Some(value) = self._project_id.as_ref() {
16016 params.push("projectId", value);
16017 }
16018 if let Some(value) = self._callback_url.as_ref() {
16019 params.push("callbackUrl", value);
16020 }
16021 if !self._allowed_domains.is_empty() {
16022 for f in self._allowed_domains.iter() {
16023 params.push("allowedDomains", f);
16024 }
16025 }
16026 if let Some(value) = self._admin_email.as_ref() {
16027 params.push("adminEmail", value);
16028 }
16029
16030 params.extend(self._additional_params.iter());
16031
16032 params.push("alt", "json");
16033 let mut url = self.hub._base_url.clone() + "v1/signupUrls";
16034 if self._scopes.is_empty() {
16035 self._scopes.insert(Scope::Full.as_ref().to_string());
16036 }
16037
16038 let url = params.parse_with_url(&url);
16039
16040 loop {
16041 let token = match self
16042 .hub
16043 .auth
16044 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16045 .await
16046 {
16047 Ok(token) => token,
16048 Err(e) => match dlg.token(e) {
16049 Ok(token) => token,
16050 Err(e) => {
16051 dlg.finished(false);
16052 return Err(common::Error::MissingToken(e));
16053 }
16054 },
16055 };
16056 let mut req_result = {
16057 let client = &self.hub.client;
16058 dlg.pre_request();
16059 let mut req_builder = hyper::Request::builder()
16060 .method(hyper::Method::POST)
16061 .uri(url.as_str())
16062 .header(USER_AGENT, self.hub._user_agent.clone());
16063
16064 if let Some(token) = token.as_ref() {
16065 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16066 }
16067
16068 let request = req_builder
16069 .header(CONTENT_LENGTH, 0_u64)
16070 .body(common::to_body::<String>(None));
16071
16072 client.request(request.unwrap()).await
16073 };
16074
16075 match req_result {
16076 Err(err) => {
16077 if let common::Retry::After(d) = dlg.http_error(&err) {
16078 sleep(d).await;
16079 continue;
16080 }
16081 dlg.finished(false);
16082 return Err(common::Error::HttpError(err));
16083 }
16084 Ok(res) => {
16085 let (mut parts, body) = res.into_parts();
16086 let mut body = common::Body::new(body);
16087 if !parts.status.is_success() {
16088 let bytes = common::to_bytes(body).await.unwrap_or_default();
16089 let error = serde_json::from_str(&common::to_string(&bytes));
16090 let response = common::to_response(parts, bytes.into());
16091
16092 if let common::Retry::After(d) =
16093 dlg.http_failure(&response, error.as_ref().ok())
16094 {
16095 sleep(d).await;
16096 continue;
16097 }
16098
16099 dlg.finished(false);
16100
16101 return Err(match error {
16102 Ok(value) => common::Error::BadRequest(value),
16103 _ => common::Error::Failure(response),
16104 });
16105 }
16106 let response = {
16107 let bytes = common::to_bytes(body).await.unwrap_or_default();
16108 let encoded = common::to_string(&bytes);
16109 match serde_json::from_str(&encoded) {
16110 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16111 Err(error) => {
16112 dlg.response_json_decode_error(&encoded, &error);
16113 return Err(common::Error::JsonDecodeError(
16114 encoded.to_string(),
16115 error,
16116 ));
16117 }
16118 }
16119 };
16120
16121 dlg.finished(true);
16122 return Ok(response);
16123 }
16124 }
16125 }
16126 }
16127
16128 /// The ID of the Google Cloud Platform project which will own the enterprise.
16129 ///
16130 /// Sets the *project id* query property to the given value.
16131 pub fn project_id(mut self, new_value: &str) -> SignupUrlCreateCall<'a, C> {
16132 self._project_id = Some(new_value.to_string());
16133 self
16134 }
16135 /// The callback URL that the admin will be redirected to after successfully creating an enterprise. Before redirecting there the system will add a query parameter to this URL named enterpriseToken which will contain an opaque token to be used for the create enterprise request. The URL will be parsed then reformatted in order to add the enterpriseToken parameter, so there may be some minor formatting changes.
16136 ///
16137 /// Sets the *callback url* query property to the given value.
16138 pub fn callback_url(mut self, new_value: &str) -> SignupUrlCreateCall<'a, C> {
16139 self._callback_url = Some(new_value.to_string());
16140 self
16141 }
16142 /// Optional. A list of domains that are permitted for the admin email. The IT admin cannot enter an email address with a domain name that is not in this list. Subdomains of domains in this list are not allowed but can be allowed by adding a second entry which has *. prefixed to the domain name (e.g. *.example.com). If the field is not present or is an empty list then the IT admin is free to use any valid domain name. Personal email domains are always allowed, but will result in the creation of a managed Google Play Accounts enterprise.
16143 ///
16144 /// Append the given value to the *allowed domains* query property.
16145 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
16146 pub fn add_allowed_domains(mut self, new_value: &str) -> SignupUrlCreateCall<'a, C> {
16147 self._allowed_domains.push(new_value.to_string());
16148 self
16149 }
16150 /// Optional. Email address used to prefill the admin field of the enterprise signup form. This value is a hint only and can be altered by the user. If allowedDomains is non-empty then this must belong to one of the allowedDomains.
16151 ///
16152 /// Sets the *admin email* query property to the given value.
16153 pub fn admin_email(mut self, new_value: &str) -> SignupUrlCreateCall<'a, C> {
16154 self._admin_email = Some(new_value.to_string());
16155 self
16156 }
16157 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16158 /// while executing the actual API request.
16159 ///
16160 /// ````text
16161 /// It should be used to handle progress information, and to implement a certain level of resilience.
16162 /// ````
16163 ///
16164 /// Sets the *delegate* property to the given value.
16165 pub fn delegate(
16166 mut self,
16167 new_value: &'a mut dyn common::Delegate,
16168 ) -> SignupUrlCreateCall<'a, C> {
16169 self._delegate = Some(new_value);
16170 self
16171 }
16172
16173 /// Set any additional parameter of the query string used in the request.
16174 /// It should be used to set parameters which are not yet available through their own
16175 /// setters.
16176 ///
16177 /// Please note that this method must not be used to set any of the known parameters
16178 /// which have their own setter method. If done anyway, the request will fail.
16179 ///
16180 /// # Additional Parameters
16181 ///
16182 /// * *$.xgafv* (query-string) - V1 error format.
16183 /// * *access_token* (query-string) - OAuth access token.
16184 /// * *alt* (query-string) - Data format for response.
16185 /// * *callback* (query-string) - JSONP
16186 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16187 /// * *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.
16188 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16189 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16190 /// * *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.
16191 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16192 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16193 pub fn param<T>(mut self, name: T, value: T) -> SignupUrlCreateCall<'a, C>
16194 where
16195 T: AsRef<str>,
16196 {
16197 self._additional_params
16198 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16199 self
16200 }
16201
16202 /// Identifies the authorization scope for the method you are building.
16203 ///
16204 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16205 /// [`Scope::Full`].
16206 ///
16207 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16208 /// tokens for more than one scope.
16209 ///
16210 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16211 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16212 /// sufficient, a read-write scope will do as well.
16213 pub fn add_scope<St>(mut self, scope: St) -> SignupUrlCreateCall<'a, C>
16214 where
16215 St: AsRef<str>,
16216 {
16217 self._scopes.insert(String::from(scope.as_ref()));
16218 self
16219 }
16220 /// Identifies the authorization scope(s) for the method you are building.
16221 ///
16222 /// See [`Self::add_scope()`] for details.
16223 pub fn add_scopes<I, St>(mut self, scopes: I) -> SignupUrlCreateCall<'a, C>
16224 where
16225 I: IntoIterator<Item = St>,
16226 St: AsRef<str>,
16227 {
16228 self._scopes
16229 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16230 self
16231 }
16232
16233 /// Removes all scopes, and no default scope will be used either.
16234 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16235 /// for details).
16236 pub fn clear_scopes(mut self) -> SignupUrlCreateCall<'a, C> {
16237 self._scopes.clear();
16238 self
16239 }
16240}