google_networkmanagement1/
api.rs

1#![allow(clippy::ptr_arg)]
2
3use std::collections::{BTreeSet, HashMap};
4
5use tokio::time::sleep;
6
7// ##############
8// UTILITIES ###
9// ############
10
11/// Identifies the an OAuth2 authorization scope.
12/// A scope is needed when requesting an
13/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
14#[derive(PartialEq, Eq, Ord, PartialOrd, Hash, Debug, Clone, Copy)]
15pub enum Scope {
16    /// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
17    CloudPlatform,
18}
19
20impl AsRef<str> for Scope {
21    fn as_ref(&self) -> &str {
22        match *self {
23            Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
24        }
25    }
26}
27
28#[allow(clippy::derivable_impls)]
29impl Default for Scope {
30    fn default() -> Scope {
31        Scope::CloudPlatform
32    }
33}
34
35// ########
36// HUB ###
37// ######
38
39/// Central instance to access all NetworkManagement 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_networkmanagement1 as networkmanagement1;
49/// use networkmanagement1::api::VpcFlowLogsConfig;
50/// use networkmanagement1::{Result, Error};
51/// # async fn dox() {
52/// use networkmanagement1::{NetworkManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
53///
54/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
55/// // `client_secret`, among other things.
56/// let secret: yup_oauth2::ApplicationSecret = Default::default();
57/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
58/// // unless you replace  `None` with the desired Flow.
59/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
60/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
61/// // retrieve them from storage.
62/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
63///     .with_native_roots()
64///     .unwrap()
65///     .https_only()
66///     .enable_http2()
67///     .build();
68///
69/// let executor = hyper_util::rt::TokioExecutor::new();
70/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
71///     secret,
72///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
73///     yup_oauth2::client::CustomHyperClientBuilder::from(
74///         hyper_util::client::legacy::Client::builder(executor).build(connector),
75///     ),
76/// ).build().await.unwrap();
77///
78/// let client = hyper_util::client::legacy::Client::builder(
79///     hyper_util::rt::TokioExecutor::new()
80/// )
81/// .build(
82///     hyper_rustls::HttpsConnectorBuilder::new()
83///         .with_native_roots()
84///         .unwrap()
85///         .https_or_http()
86///         .enable_http2()
87///         .build()
88/// );
89/// let mut hub = NetworkManagement::new(client, auth);
90/// // As the method needs a request, you would usually fill it with the desired information
91/// // into the respective structure. Some of the parts shown here might not be applicable !
92/// // Values shown here are possibly random and not representative !
93/// let mut req = VpcFlowLogsConfig::default();
94///
95/// // You can configure optional parameters by calling the respective setters at will, and
96/// // execute the final call using `doit()`.
97/// // Values shown here are possibly random and not representative !
98/// let result = hub.organizations().locations_vpc_flow_logs_configs_create(req, "parent")
99///              .vpc_flow_logs_config_id("At")
100///              .doit().await;
101///
102/// match result {
103///     Err(e) => match e {
104///         // The Error enum provides details about what exactly happened.
105///         // You can also just use its `Debug`, `Display` or `Error` traits
106///          Error::HttpError(_)
107///         |Error::Io(_)
108///         |Error::MissingAPIKey
109///         |Error::MissingToken(_)
110///         |Error::Cancelled
111///         |Error::UploadSizeLimitExceeded(_, _)
112///         |Error::Failure(_)
113///         |Error::BadRequest(_)
114///         |Error::FieldClash(_)
115///         |Error::JsonDecodeError(_, _) => println!("{}", e),
116///     },
117///     Ok(res) => println!("Success: {:?}", res),
118/// }
119/// # }
120/// ```
121#[derive(Clone)]
122pub struct NetworkManagement<C> {
123    pub client: common::Client<C>,
124    pub auth: Box<dyn common::GetToken>,
125    _user_agent: String,
126    _base_url: String,
127    _root_url: String,
128}
129
130impl<C> common::Hub for NetworkManagement<C> {}
131
132impl<'a, C> NetworkManagement<C> {
133    pub fn new<A: 'static + common::GetToken>(
134        client: common::Client<C>,
135        auth: A,
136    ) -> NetworkManagement<C> {
137        NetworkManagement {
138            client,
139            auth: Box::new(auth),
140            _user_agent: "google-api-rust-client/7.0.0".to_string(),
141            _base_url: "https://networkmanagement.googleapis.com/".to_string(),
142            _root_url: "https://networkmanagement.googleapis.com/".to_string(),
143        }
144    }
145
146    pub fn organizations(&'a self) -> OrganizationMethods<'a, C> {
147        OrganizationMethods { hub: self }
148    }
149    pub fn projects(&'a self) -> ProjectMethods<'a, C> {
150        ProjectMethods { 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://networkmanagement.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://networkmanagement.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/// Details of the final state "abort" and associated resource.
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 AbortInfo {
189    /// Causes that the analysis is aborted.
190    pub cause: Option<String>,
191    /// IP address that caused the abort.
192    #[serde(rename = "ipAddress")]
193    pub ip_address: Option<String>,
194    /// List of project IDs the user specified in the request but lacks access to. In this case, analysis is aborted with the PERMISSION_DENIED cause.
195    #[serde(rename = "projectsMissingPermission")]
196    pub projects_missing_permission: Option<Vec<String>>,
197    /// URI of the resource that caused the abort.
198    #[serde(rename = "resourceUri")]
199    pub resource_uri: Option<String>,
200}
201
202impl common::Part for AbortInfo {}
203
204/// Wrapper for the App Engine service version attributes.
205///
206/// This type is not used in any activity, and only used as *part* of another schema.
207///
208#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
209#[serde_with::serde_as]
210#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
211pub struct AppEngineVersionEndpoint {
212    /// An [App Engine](https://cloud.google.com/appengine) [service version](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions) name.
213    pub uri: Option<String>,
214}
215
216impl common::Part for AppEngineVersionEndpoint {}
217
218/// For display only. Metadata associated with an App Engine version.
219///
220/// This type is not used in any activity, and only used as *part* of another schema.
221///
222#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
223#[serde_with::serde_as]
224#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
225pub struct AppEngineVersionInfo {
226    /// Name of an App Engine version.
227    #[serde(rename = "displayName")]
228    pub display_name: Option<String>,
229    /// App Engine execution environment for a version.
230    pub environment: Option<String>,
231    /// Runtime of the App Engine version.
232    pub runtime: Option<String>,
233    /// URI of an App Engine version.
234    pub uri: Option<String>,
235}
236
237impl common::Part for AppEngineVersionInfo {}
238
239/// Specifies the audit configuration for a service. The configuration determines which permission types are logged, and what identities, if any, are exempted from logging. An AuditConfig must have one or more AuditLogConfigs. If there are AuditConfigs for both `allServices` and a specific service, the union of the two AuditConfigs is used for that service: the log_types specified in each AuditConfig are enabled, and the exempted_members in each AuditLogConfig are exempted. Example Policy with multiple AuditConfigs: { "audit_configs": [ { "service": "allServices", "audit_log_configs": [ { "log_type": "DATA_READ", "exempted_members": [ "user:jose@example.com" ] }, { "log_type": "DATA_WRITE" }, { "log_type": "ADMIN_READ" } ] }, { "service": "sampleservice.googleapis.com", "audit_log_configs": [ { "log_type": "DATA_READ" }, { "log_type": "DATA_WRITE", "exempted_members": [ "user:aliya@example.com" ] } ] } ] } For sampleservice, this policy enables DATA_READ, DATA_WRITE and ADMIN_READ logging. It also exempts `jose@example.com` from DATA_READ logging, and `aliya@example.com` from DATA_WRITE logging.
240///
241/// This type is not used in any activity, and only used as *part* of another schema.
242///
243#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
244#[serde_with::serde_as]
245#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
246pub struct AuditConfig {
247    /// The configuration for logging of each type of permission.
248    #[serde(rename = "auditLogConfigs")]
249    pub audit_log_configs: Option<Vec<AuditLogConfig>>,
250    /// Specifies a service that will be enabled for audit logging. For example, `storage.googleapis.com`, `cloudsql.googleapis.com`. `allServices` is a special value that covers all services.
251    pub service: Option<String>,
252}
253
254impl common::Part for AuditConfig {}
255
256/// Provides the configuration for logging a type of permissions. Example: { "audit_log_configs": [ { "log_type": "DATA_READ", "exempted_members": [ "user:jose@example.com" ] }, { "log_type": "DATA_WRITE" } ] } This enables 'DATA_READ' and 'DATA_WRITE' logging, while exempting jose@example.com from DATA_READ logging.
257///
258/// This type is not used in any activity, and only used as *part* of another schema.
259///
260#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
261#[serde_with::serde_as]
262#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
263pub struct AuditLogConfig {
264    /// Specifies the identities that do not cause logging for this type of permission. Follows the same format of Binding.members.
265    #[serde(rename = "exemptedMembers")]
266    pub exempted_members: Option<Vec<String>>,
267    /// The log type that this config enables.
268    #[serde(rename = "logType")]
269    pub log_type: Option<String>,
270}
271
272impl common::Part for AuditLogConfig {}
273
274/// Associates `members`, or principals, with a `role`.
275///
276/// This type is not used in any activity, and only used as *part* of another schema.
277///
278#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
279#[serde_with::serde_as]
280#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
281pub struct Binding {
282    /// The condition that is associated with this binding. If the condition evaluates to `true`, then this binding applies to the current request. If the condition evaluates to `false`, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
283    pub condition: Option<Expr>,
284    /// Specifies the principals requesting access for a Google Cloud resource. `members` can have the following values: * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. Does not include identities that come from external identity providers (IdPs) through identity federation. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@example.com` . * `serviceAccount:{emailid}`: An email address that represents a Google service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `serviceAccount:{projectid}.svc.id.goog[{namespace}/{kubernetes-sa}]`: An identifier for a [Kubernetes service account](https://cloud.google.com/kubernetes-engine/docs/how-to/kubernetes-service-accounts). For example, `my-project.svc.id.goog[my-namespace/my-kubernetes-sa]`. * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. * `domain:{domain}`: The G Suite domain (primary) that represents all the users of that domain. For example, `google.com` or `example.com`. * `principal://iam.googleapis.com/locations/global/workforcePools/{pool_id}/subject/{subject_attribute_value}`: A single identity in a workforce identity pool. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/group/{group_id}`: All workforce identities in a group. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/attribute.{attribute_name}/{attribute_value}`: All workforce identities with a specific attribute value. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/*`: All identities in a workforce identity pool. * `principal://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/subject/{subject_attribute_value}`: A single identity in a workload identity pool. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/group/{group_id}`: A workload identity pool group. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/attribute.{attribute_name}/{attribute_value}`: All identities in a workload identity pool with a certain attribute. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/*`: All identities in a workload identity pool. * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a user that has been recently deleted. For example, `alice@example.com?uid=123456789012345678901`. If the user is recovered, this value reverts to `user:{emailid}` and the recovered user retains the role in the binding. * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a service account that has been recently deleted. For example, `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`. If the service account is undeleted, this value reverts to `serviceAccount:{emailid}` and the undeleted service account retains the role in the binding. * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a Google group that has been recently deleted. For example, `admins@example.com?uid=123456789012345678901`. If the group is recovered, this value reverts to `group:{emailid}` and the recovered group retains the role in the binding. * `deleted:principal://iam.googleapis.com/locations/global/workforcePools/{pool_id}/subject/{subject_attribute_value}`: Deleted single identity in a workforce identity pool. For example, `deleted:principal://iam.googleapis.com/locations/global/workforcePools/my-pool-id/subject/my-subject-attribute-value`.
285    pub members: Option<Vec<String>>,
286    /// Role that is assigned to the list of `members`, or principals. For example, `roles/viewer`, `roles/editor`, or `roles/owner`. For an overview of the IAM roles and permissions, see the [IAM documentation](https://cloud.google.com/iam/docs/roles-overview). For a list of the available pre-defined roles, see [here](https://cloud.google.com/iam/docs/understanding-roles).
287    pub role: Option<String>,
288}
289
290impl common::Part for Binding {}
291
292/// The request message for Operations.CancelOperation.
293///
294/// # Activities
295///
296/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
297/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
298///
299/// * [locations operations cancel organizations](OrganizationLocationOperationCancelCall) (request)
300/// * [locations global operations cancel projects](ProjectLocationGlobalOperationCancelCall) (request)
301#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
302#[serde_with::serde_as]
303#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
304pub struct CancelOperationRequest {
305    _never_set: Option<bool>,
306}
307
308impl common::RequestValue for CancelOperationRequest {}
309
310/// Wrapper for Cloud Function attributes.
311///
312/// This type is not used in any activity, and only used as *part* of another schema.
313///
314#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
315#[serde_with::serde_as]
316#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
317pub struct CloudFunctionEndpoint {
318    /// A [Cloud Function](https://cloud.google.com/functions) name.
319    pub uri: Option<String>,
320}
321
322impl common::Part for CloudFunctionEndpoint {}
323
324/// For display only. Metadata associated with a Cloud Function.
325///
326/// This type is not used in any activity, and only used as *part* of another schema.
327///
328#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
329#[serde_with::serde_as]
330#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
331pub struct CloudFunctionInfo {
332    /// Name of a Cloud Function.
333    #[serde(rename = "displayName")]
334    pub display_name: Option<String>,
335    /// Location in which the Cloud Function is deployed.
336    pub location: Option<String>,
337    /// URI of a Cloud Function.
338    pub uri: Option<String>,
339    /// Latest successfully deployed version id of the Cloud Function.
340    #[serde(rename = "versionId")]
341    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
342    pub version_id: Option<i64>,
343}
344
345impl common::Part for CloudFunctionInfo {}
346
347/// Wrapper for Cloud Run revision attributes.
348///
349/// This type is not used in any activity, and only used as *part* of another schema.
350///
351#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
352#[serde_with::serde_as]
353#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
354pub struct CloudRunRevisionEndpoint {
355    /// Output only. The URI of the Cloud Run service that the revision belongs to. The format is: projects/{project}/locations/{location}/services/{service}
356    #[serde(rename = "serviceUri")]
357    pub service_uri: Option<String>,
358    /// A [Cloud Run](https://cloud.google.com/run) [revision](https://cloud.google.com/run/docs/reference/rest/v1/namespaces.revisions/get) URI. The format is: projects/{project}/locations/{location}/revisions/{revision}
359    pub uri: Option<String>,
360}
361
362impl common::Part for CloudRunRevisionEndpoint {}
363
364/// For display only. Metadata associated with a Cloud Run revision.
365///
366/// This type is not used in any activity, and only used as *part* of another schema.
367///
368#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
369#[serde_with::serde_as]
370#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
371pub struct CloudRunRevisionInfo {
372    /// Name of a Cloud Run revision.
373    #[serde(rename = "displayName")]
374    pub display_name: Option<String>,
375    /// Location in which this revision is deployed.
376    pub location: Option<String>,
377    /// URI of Cloud Run service this revision belongs to.
378    #[serde(rename = "serviceUri")]
379    pub service_uri: Option<String>,
380    /// URI of a Cloud Run revision.
381    pub uri: Option<String>,
382}
383
384impl common::Part for CloudRunRevisionInfo {}
385
386/// For display only. Metadata associated with a Cloud SQL instance.
387///
388/// This type is not used in any activity, and only used as *part* of another schema.
389///
390#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
391#[serde_with::serde_as]
392#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
393pub struct CloudSQLInstanceInfo {
394    /// Name of a Cloud SQL instance.
395    #[serde(rename = "displayName")]
396    pub display_name: Option<String>,
397    /// External IP address of a Cloud SQL instance.
398    #[serde(rename = "externalIp")]
399    pub external_ip: Option<String>,
400    /// Internal IP address of a Cloud SQL instance.
401    #[serde(rename = "internalIp")]
402    pub internal_ip: Option<String>,
403    /// URI of a Cloud SQL instance network or empty string if the instance does not have one.
404    #[serde(rename = "networkUri")]
405    pub network_uri: Option<String>,
406    /// Region in which the Cloud SQL instance is running.
407    pub region: Option<String>,
408    /// URI of a Cloud SQL instance.
409    pub uri: Option<String>,
410}
411
412impl common::Part for CloudSQLInstanceInfo {}
413
414/// A Connectivity Test for a network reachability analysis.
415///
416/// # Activities
417///
418/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
419/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
420///
421/// * [locations global connectivity tests create projects](ProjectLocationGlobalConnectivityTestCreateCall) (request)
422/// * [locations global connectivity tests get projects](ProjectLocationGlobalConnectivityTestGetCall) (response)
423/// * [locations global connectivity tests patch projects](ProjectLocationGlobalConnectivityTestPatchCall) (request)
424#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
425#[serde_with::serde_as]
426#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
427pub struct ConnectivityTest {
428    /// Whether the analysis should skip firewall checking. Default value is false.
429    #[serde(rename = "bypassFirewallChecks")]
430    pub bypass_firewall_checks: Option<bool>,
431    /// Output only. The time the test was created.
432    #[serde(rename = "createTime")]
433    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
434    /// The user-supplied description of the Connectivity Test. Maximum of 512 characters.
435    pub description: Option<String>,
436    /// Required. Destination specification of the Connectivity Test. You can use a combination of destination IP address, URI of a supported endpoint, project ID, or VPC network to identify the destination location. Reachability analysis proceeds even if the destination location is ambiguous. However, the test result might include endpoints or use a destination that you don't intend to test.
437    pub destination: Option<Endpoint>,
438    /// Output only. The display name of a Connectivity Test.
439    #[serde(rename = "displayName")]
440    pub display_name: Option<String>,
441    /// Resource labels to represent user-provided metadata.
442    pub labels: Option<HashMap<String, String>>,
443    /// Identifier. Unique name of the resource using the form: `projects/{project_id}/locations/global/connectivityTests/{test_id}`
444    pub name: Option<String>,
445    /// Output only. The probing details of this test from the latest run, present for applicable tests only. The details are updated when creating a new test, updating an existing test, or triggering a one-time rerun of an existing test.
446    #[serde(rename = "probingDetails")]
447    pub probing_details: Option<ProbingDetails>,
448    /// IP Protocol of the test. When not provided, "TCP" is assumed.
449    pub protocol: Option<String>,
450    /// Output only. The reachability details of this test from the latest run. The details are updated when creating a new test, updating an existing test, or triggering a one-time rerun of an existing test.
451    #[serde(rename = "reachabilityDetails")]
452    pub reachability_details: Option<ReachabilityDetails>,
453    /// Other projects that may be relevant for reachability analysis. This is applicable to scenarios where a test can cross project boundaries.
454    #[serde(rename = "relatedProjects")]
455    pub related_projects: Option<Vec<String>>,
456    /// Output only. The reachability details of this test from the latest run for the return path. The details are updated when creating a new test, updating an existing test, or triggering a one-time rerun of an existing test.
457    #[serde(rename = "returnReachabilityDetails")]
458    pub return_reachability_details: Option<ReachabilityDetails>,
459    /// Whether run analysis for the return path from destination to source. Default value is false.
460    #[serde(rename = "roundTrip")]
461    pub round_trip: Option<bool>,
462    /// Required. Source specification of the Connectivity Test. You can use a combination of source IP address, URI of a supported endpoint, project ID, or VPC network to identify the source location. Reachability analysis might proceed even if the source location is ambiguous. However, the test result might include endpoints or use a source that you don't intend to test.
463    pub source: Option<Endpoint>,
464    /// Output only. The time the test's configuration was updated.
465    #[serde(rename = "updateTime")]
466    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
467}
468
469impl common::RequestValue for ConnectivityTest {}
470impl common::ResponseResult for ConnectivityTest {}
471
472/// Details of the final state "deliver" and associated resource.
473///
474/// This type is not used in any activity, and only used as *part* of another schema.
475///
476#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
477#[serde_with::serde_as]
478#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
479pub struct DeliverInfo {
480    /// Recognized type of a Google Service the packet is delivered to (if applicable).
481    #[serde(rename = "googleServiceType")]
482    pub google_service_type: Option<String>,
483    /// IP address of the target (if applicable).
484    #[serde(rename = "ipAddress")]
485    pub ip_address: Option<String>,
486    /// PSC Google API target the packet is delivered to (if applicable).
487    #[serde(rename = "pscGoogleApiTarget")]
488    pub psc_google_api_target: Option<String>,
489    /// URI of the resource that the packet is delivered to.
490    #[serde(rename = "resourceUri")]
491    pub resource_uri: Option<String>,
492    /// Name of the Cloud Storage Bucket the packet is delivered to (if applicable).
493    #[serde(rename = "storageBucket")]
494    pub storage_bucket: Option<String>,
495    /// Target type where the packet is delivered to.
496    pub target: Option<String>,
497}
498
499impl common::Part for DeliverInfo {}
500
501/// For display only. Metadata associated with a serverless direct VPC egress connection.
502///
503/// This type is not used in any activity, and only used as *part* of another schema.
504///
505#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
506#[serde_with::serde_as]
507#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
508pub struct DirectVpcEgressConnectionInfo {
509    /// URI of direct access network.
510    #[serde(rename = "networkUri")]
511    pub network_uri: Option<String>,
512    /// Region in which the Direct VPC egress is deployed.
513    pub region: Option<String>,
514    /// Selected starting IP address, from the selected IP range.
515    #[serde(rename = "selectedIpAddress")]
516    pub selected_ip_address: Option<String>,
517    /// Selected IP range.
518    #[serde(rename = "selectedIpRange")]
519    pub selected_ip_range: Option<String>,
520    /// URI of direct access subnetwork.
521    #[serde(rename = "subnetworkUri")]
522    pub subnetwork_uri: Option<String>,
523}
524
525impl common::Part for DirectVpcEgressConnectionInfo {}
526
527/// Details of the final state "drop" and associated resource.
528///
529/// This type is not used in any activity, and only used as *part* of another schema.
530///
531#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
532#[serde_with::serde_as]
533#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
534pub struct DropInfo {
535    /// Cause that the packet is dropped.
536    pub cause: Option<String>,
537    /// Geolocation (region code) of the destination IP address (if relevant).
538    #[serde(rename = "destinationGeolocationCode")]
539    pub destination_geolocation_code: Option<String>,
540    /// Destination IP address of the dropped packet (if relevant).
541    #[serde(rename = "destinationIp")]
542    pub destination_ip: Option<String>,
543    /// Region of the dropped packet (if relevant).
544    pub region: Option<String>,
545    /// URI of the resource that caused the drop.
546    #[serde(rename = "resourceUri")]
547    pub resource_uri: Option<String>,
548    /// Geolocation (region code) of the source IP address (if relevant).
549    #[serde(rename = "sourceGeolocationCode")]
550    pub source_geolocation_code: Option<String>,
551    /// Source IP address of the dropped packet (if relevant).
552    #[serde(rename = "sourceIp")]
553    pub source_ip: Option<String>,
554}
555
556impl common::Part for DropInfo {}
557
558/// Representation of a network edge location as per https://cloud.google.com/vpc/docs/edge-locations.
559///
560/// This type is not used in any activity, and only used as *part* of another schema.
561///
562#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
563#[serde_with::serde_as]
564#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
565pub struct EdgeLocation {
566    /// Name of the metropolitan area.
567    #[serde(rename = "metropolitanArea")]
568    pub metropolitan_area: Option<String>,
569}
570
571impl common::Part for EdgeLocation {}
572
573/// A configuration to generate a response for GetEffectiveVpcFlowLogsConfig request.
574///
575/// This type is not used in any activity, and only used as *part* of another schema.
576///
577#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
578#[serde_with::serde_as]
579#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
580pub struct EffectiveVpcFlowLogsConfig {
581    /// The aggregation interval for the logs. Default value is INTERVAL_5_SEC.
582    #[serde(rename = "aggregationInterval")]
583    pub aggregation_interval: Option<String>,
584    /// Determines whether to include cross project annotations in the logs. This field is available only for organization configurations. If not specified in org configs will be set to CROSS_PROJECT_METADATA_ENABLED.
585    #[serde(rename = "crossProjectMetadata")]
586    pub cross_project_metadata: Option<String>,
587    /// Export filter used to define which VPC Flow Logs should be logged.
588    #[serde(rename = "filterExpr")]
589    pub filter_expr: Option<String>,
590    /// The value of the field must be in (0, 1]. The sampling rate of VPC Flow Logs where 1.0 means all collected logs are reported. Setting the sampling rate to 0.0 is not allowed. If you want to disable VPC Flow Logs, use the state field instead. Default value is 1.0.
591    #[serde(rename = "flowSampling")]
592    pub flow_sampling: Option<f32>,
593    /// Traffic will be logged from the Interconnect Attachment. Format: projects/{project_id}/regions/{region}/interconnectAttachments/{name}
594    #[serde(rename = "interconnectAttachment")]
595    pub interconnect_attachment: Option<String>,
596    /// Configures whether all, none or a subset of metadata fields should be added to the reported VPC flow logs. Default value is INCLUDE_ALL_METADATA.
597    pub metadata: Option<String>,
598    /// Custom metadata fields to include in the reported VPC flow logs. Can only be specified if "metadata" was set to CUSTOM_METADATA.
599    #[serde(rename = "metadataFields")]
600    pub metadata_fields: Option<Vec<String>>,
601    /// Unique name of the configuration. The name can have one of the following forms: - For project-level configurations: `projects/{project_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}` - For organization-level configurations: `organizations/{organization_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}` - For a Compute config, the name will be the path of the subnet: `projects/{project_id}/regions/{region}/subnetworks/{subnet_id}`
602    pub name: Option<String>,
603    /// Traffic will be logged from VMs, VPN tunnels and Interconnect Attachments within the network. Format: projects/{project_id}/global/networks/{name}
604    pub network: Option<String>,
605    /// Specifies the scope of the config (e.g., SUBNET, NETWORK, ORGANIZATION..).
606    pub scope: Option<String>,
607    /// The state of the VPC Flow Log configuration. Default value is ENABLED. When creating a new configuration, it must be enabled. Setting state=DISABLED will pause the log generation for this config.
608    pub state: Option<String>,
609    /// Traffic will be logged from VMs within the subnetwork. Format: projects/{project_id}/regions/{region}/subnetworks/{name}
610    pub subnet: Option<String>,
611    /// Traffic will be logged from the VPN Tunnel. Format: projects/{project_id}/regions/{region}/vpnTunnels/{name}
612    #[serde(rename = "vpnTunnel")]
613    pub vpn_tunnel: Option<String>,
614}
615
616impl common::Part for EffectiveVpcFlowLogsConfig {}
617
618/// 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); }
619///
620/// # Activities
621///
622/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
623/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
624///
625/// * [locations operations cancel organizations](OrganizationLocationOperationCancelCall) (response)
626/// * [locations operations delete organizations](OrganizationLocationOperationDeleteCall) (response)
627/// * [locations global operations cancel projects](ProjectLocationGlobalOperationCancelCall) (response)
628/// * [locations global operations delete projects](ProjectLocationGlobalOperationDeleteCall) (response)
629#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
630#[serde_with::serde_as]
631#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
632pub struct Empty {
633    _never_set: Option<bool>,
634}
635
636impl common::ResponseResult for Empty {}
637
638/// Source or destination of the Connectivity Test.
639///
640/// This type is not used in any activity, and only used as *part* of another schema.
641///
642#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
643#[serde_with::serde_as]
644#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
645pub struct Endpoint {
646    /// An [App Engine](https://cloud.google.com/appengine) [service version](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions). Applicable only to source endpoint.
647    #[serde(rename = "appEngineVersion")]
648    pub app_engine_version: Option<AppEngineVersionEndpoint>,
649    /// A [Cloud Function](https://cloud.google.com/functions). Applicable only to source endpoint.
650    #[serde(rename = "cloudFunction")]
651    pub cloud_function: Option<CloudFunctionEndpoint>,
652    /// A [Cloud Run](https://cloud.google.com/run) [revision](https://cloud.google.com/run/docs/reference/rest/v1/namespaces.revisions/get) Applicable only to source endpoint.
653    #[serde(rename = "cloudRunRevision")]
654    pub cloud_run_revision: Option<CloudRunRevisionEndpoint>,
655    /// A [Cloud SQL](https://cloud.google.com/sql) instance URI.
656    #[serde(rename = "cloudSqlInstance")]
657    pub cloud_sql_instance: Option<String>,
658    /// A forwarding rule and its corresponding IP address represent the frontend configuration of a Google Cloud load balancer. Forwarding rules are also used for protocol forwarding, Private Service Connect and other network services to provide forwarding information in the control plane. Applicable only to destination endpoint. Format: `projects/{project}/global/forwardingRules/{id}` or `projects/{project}/regions/{region}/forwardingRules/{id}`
659    #[serde(rename = "forwardingRule")]
660    pub forwarding_rule: Option<String>,
661    /// Output only. Specifies the type of the target of the forwarding rule.
662    #[serde(rename = "forwardingRuleTarget")]
663    pub forwarding_rule_target: Option<String>,
664    /// DNS endpoint of [Google Kubernetes Engine cluster control plane](https://cloud.google.com/kubernetes-engine/docs/concepts/cluster-architecture). Requires gke_master_cluster to be set, can't be used simultaneoulsly with ip_address or network. Applicable only to destination endpoint.
665    pub fqdn: Option<String>,
666    /// A cluster URI for [Google Kubernetes Engine cluster control plane](https://cloud.google.com/kubernetes-engine/docs/concepts/cluster-architecture).
667    #[serde(rename = "gkeMasterCluster")]
668    pub gke_master_cluster: Option<String>,
669    /// A Compute Engine instance URI.
670    pub instance: Option<String>,
671    /// The IP address of the endpoint, which can be an external or internal IP.
672    #[serde(rename = "ipAddress")]
673    pub ip_address: Option<String>,
674    /// Output only. ID of the load balancer the forwarding rule points to. Empty for forwarding rules not related to load balancers.
675    #[serde(rename = "loadBalancerId")]
676    pub load_balancer_id: Option<String>,
677    /// Output only. Type of the load balancer the forwarding rule points to.
678    #[serde(rename = "loadBalancerType")]
679    pub load_balancer_type: Option<String>,
680    /// A VPC network URI.
681    pub network: Option<String>,
682    /// Type of the network where the endpoint is located. Applicable only to source endpoint, as destination network type can be inferred from the source.
683    #[serde(rename = "networkType")]
684    pub network_type: Option<String>,
685    /// The IP protocol port of the endpoint. Only applicable when protocol is TCP or UDP.
686    pub port: Option<i32>,
687    /// Project ID where the endpoint is located. The project ID can be derived from the URI if you provide a endpoint or network URI. The following are two cases where you may need to provide the project ID: 1. Only the IP address is specified, and the IP address is within a Google Cloud project. 2. When you are using Shared VPC and the IP address that you provide is from the service project. In this case, the network that the IP address resides in is defined in the host project.
688    #[serde(rename = "projectId")]
689    pub project_id: Option<String>,
690    /// A [Redis Cluster](https://cloud.google.com/memorystore/docs/cluster) URI. Applicable only to destination endpoint.
691    #[serde(rename = "redisCluster")]
692    pub redis_cluster: Option<String>,
693    /// A [Redis Instance](https://cloud.google.com/memorystore/docs/redis) URI. Applicable only to destination endpoint.
694    #[serde(rename = "redisInstance")]
695    pub redis_instance: Option<String>,
696}
697
698impl common::Part for Endpoint {}
699
700/// For display only. The specification of the endpoints for the test. EndpointInfo is derived from source and destination Endpoint and validated by the backend data plane model.
701///
702/// This type is not used in any activity, and only used as *part* of another schema.
703///
704#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
705#[serde_with::serde_as]
706#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
707pub struct EndpointInfo {
708    /// Destination IP address.
709    #[serde(rename = "destinationIp")]
710    pub destination_ip: Option<String>,
711    /// URI of the network where this packet is sent to.
712    #[serde(rename = "destinationNetworkUri")]
713    pub destination_network_uri: Option<String>,
714    /// Destination port. Only valid when protocol is TCP or UDP.
715    #[serde(rename = "destinationPort")]
716    pub destination_port: Option<i32>,
717    /// IP protocol in string format, for example: "TCP", "UDP", "ICMP".
718    pub protocol: Option<String>,
719    /// URI of the source telemetry agent this packet originates from.
720    #[serde(rename = "sourceAgentUri")]
721    pub source_agent_uri: Option<String>,
722    /// Source IP address.
723    #[serde(rename = "sourceIp")]
724    pub source_ip: Option<String>,
725    /// URI of the network where this packet originates from.
726    #[serde(rename = "sourceNetworkUri")]
727    pub source_network_uri: Option<String>,
728    /// Source port. Only valid when protocol is TCP or UDP.
729    #[serde(rename = "sourcePort")]
730    pub source_port: Option<i32>,
731}
732
733impl common::Part for EndpointInfo {}
734
735/// Represents a textual expression in the Common Expression Language (CEL) syntax. CEL is a C-like expression language. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec. Example (Comparison): title: "Summary size limit" description: "Determines if a summary is less than 100 chars" expression: "document.summary.size() < 100" Example (Equality): title: "Requestor is owner" description: "Determines if requestor is the document owner" expression: "document.owner == request.auth.claims.email" Example (Logic): title: "Public documents" description: "Determine whether the document should be publicly visible" expression: "document.type != 'private' && document.type != 'internal'" Example (Data Manipulation): title: "Notification string" description: "Create a notification string with a timestamp." expression: "'New message received at ' + string(document.create_time)" The exact variables and functions that may be referenced within an expression are determined by the service that evaluates it. See the service documentation for additional information.
736///
737/// This type is not used in any activity, and only used as *part* of another schema.
738///
739#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
740#[serde_with::serde_as]
741#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
742pub struct Expr {
743    /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
744    pub description: Option<String>,
745    /// Textual representation of an expression in Common Expression Language syntax.
746    pub expression: Option<String>,
747    /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
748    pub location: Option<String>,
749    /// Optional. Title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression.
750    pub title: Option<String>,
751}
752
753impl common::Part for Expr {}
754
755/// For display only. Metadata associated with a VPC firewall rule, an implied VPC firewall rule, or a firewall policy rule.
756///
757/// This type is not used in any activity, and only used as *part* of another schema.
758///
759#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
760#[serde_with::serde_as]
761#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
762pub struct FirewallInfo {
763    /// Possible values: ALLOW, DENY, APPLY_SECURITY_PROFILE_GROUP
764    pub action: Option<String>,
765    /// Possible values: INGRESS, EGRESS
766    pub direction: Option<String>,
767    /// The display name of the firewall rule. This field might be empty for firewall policy rules.
768    #[serde(rename = "displayName")]
769    pub display_name: Option<String>,
770    /// The firewall rule's type.
771    #[serde(rename = "firewallRuleType")]
772    pub firewall_rule_type: Option<String>,
773    /// The URI of the VPC network that the firewall rule is associated with. This field is not applicable to hierarchical firewall policy rules.
774    #[serde(rename = "networkUri")]
775    pub network_uri: Option<String>,
776    /// The name of the firewall policy that this rule is associated with. This field is not applicable to VPC firewall rules and implied VPC firewall rules.
777    pub policy: Option<String>,
778    /// The priority of the firewall policy that this rule is associated with. This field is not applicable to VPC firewall rules and implied VPC firewall rules.
779    #[serde(rename = "policyPriority")]
780    pub policy_priority: Option<i32>,
781    /// The URI of the firewall policy that this rule is associated with. This field is not applicable to VPC firewall rules and implied VPC firewall rules.
782    #[serde(rename = "policyUri")]
783    pub policy_uri: Option<String>,
784    /// The priority of the firewall rule.
785    pub priority: Option<i32>,
786    /// The target service accounts specified by the firewall rule.
787    #[serde(rename = "targetServiceAccounts")]
788    pub target_service_accounts: Option<Vec<String>>,
789    /// The target tags defined by the VPC firewall rule. This field is not applicable to firewall policy rules.
790    #[serde(rename = "targetTags")]
791    pub target_tags: Option<Vec<String>>,
792    /// Target type of the firewall rule.
793    #[serde(rename = "targetType")]
794    pub target_type: Option<String>,
795    /// The URI of the firewall rule. This field is not applicable to implied VPC firewall rules.
796    pub uri: Option<String>,
797}
798
799impl common::Part for FirewallInfo {}
800
801/// Details of the final state "forward" and associated resource.
802///
803/// This type is not used in any activity, and only used as *part* of another schema.
804///
805#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
806#[serde_with::serde_as]
807#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
808pub struct ForwardInfo {
809    /// IP address of the target (if applicable).
810    #[serde(rename = "ipAddress")]
811    pub ip_address: Option<String>,
812    /// URI of the resource that the packet is forwarded to.
813    #[serde(rename = "resourceUri")]
814    pub resource_uri: Option<String>,
815    /// Target type where this packet is forwarded to.
816    pub target: Option<String>,
817}
818
819impl common::Part for ForwardInfo {}
820
821/// For display only. Metadata associated with a Compute Engine forwarding rule.
822///
823/// This type is not used in any activity, and only used as *part* of another schema.
824///
825#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
826#[serde_with::serde_as]
827#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
828pub struct ForwardingRuleInfo {
829    /// Name of the forwarding rule.
830    #[serde(rename = "displayName")]
831    pub display_name: Option<String>,
832    /// Name of the load balancer the forwarding rule belongs to. Empty for forwarding rules not related to load balancers (like PSC forwarding rules).
833    #[serde(rename = "loadBalancerName")]
834    pub load_balancer_name: Option<String>,
835    /// Port range defined in the forwarding rule that matches the packet.
836    #[serde(rename = "matchedPortRange")]
837    pub matched_port_range: Option<String>,
838    /// Protocol defined in the forwarding rule that matches the packet.
839    #[serde(rename = "matchedProtocol")]
840    pub matched_protocol: Option<String>,
841    /// Network URI.
842    #[serde(rename = "networkUri")]
843    pub network_uri: Option<String>,
844    /// PSC Google API target this forwarding rule targets (if applicable).
845    #[serde(rename = "pscGoogleApiTarget")]
846    pub psc_google_api_target: Option<String>,
847    /// URI of the PSC service attachment this forwarding rule targets (if applicable).
848    #[serde(rename = "pscServiceAttachmentUri")]
849    pub psc_service_attachment_uri: Option<String>,
850    /// Region of the forwarding rule. Set only for regional forwarding rules.
851    pub region: Option<String>,
852    /// Target type of the forwarding rule.
853    pub target: Option<String>,
854    /// URI of the forwarding rule.
855    pub uri: Option<String>,
856    /// VIP of the forwarding rule.
857    pub vip: Option<String>,
858}
859
860impl common::Part for ForwardingRuleInfo {}
861
862/// For display only. Metadata associated with a Google Kubernetes Engine (GKE) cluster master.
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 GKEMasterInfo {
870    /// URI of a GKE cluster network.
871    #[serde(rename = "clusterNetworkUri")]
872    pub cluster_network_uri: Option<String>,
873    /// URI of a GKE cluster.
874    #[serde(rename = "clusterUri")]
875    pub cluster_uri: Option<String>,
876    /// DNS endpoint of a GKE cluster control plane.
877    #[serde(rename = "dnsEndpoint")]
878    pub dns_endpoint: Option<String>,
879    /// External IP address of a GKE cluster control plane.
880    #[serde(rename = "externalIp")]
881    pub external_ip: Option<String>,
882    /// Internal IP address of a GKE cluster control plane.
883    #[serde(rename = "internalIp")]
884    pub internal_ip: Option<String>,
885}
886
887impl common::Part for GKEMasterInfo {}
888
889/// For display only. Details of a Google Service sending packets to a VPC network. Although the source IP might be a publicly routable address, some Google Services use special routes within Google production infrastructure to reach Compute Engine Instances. https://cloud.google.com/vpc/docs/routes#special_return_paths
890///
891/// This type is not used in any activity, and only used as *part* of another schema.
892///
893#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
894#[serde_with::serde_as]
895#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
896pub struct GoogleServiceInfo {
897    /// Recognized type of a Google Service.
898    #[serde(rename = "googleServiceType")]
899    pub google_service_type: Option<String>,
900    /// Source IP address.
901    #[serde(rename = "sourceIp")]
902    pub source_ip: Option<String>,
903}
904
905impl common::Part for GoogleServiceInfo {}
906
907/// For display only. Metadata associated with a hybrid subnet.
908///
909/// This type is not used in any activity, and only used as *part* of another schema.
910///
911#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
912#[serde_with::serde_as]
913#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
914pub struct HybridSubnetInfo {
915    /// Name of a hybrid subnet.
916    #[serde(rename = "displayName")]
917    pub display_name: Option<String>,
918    /// Name of a Google Cloud region where the hybrid subnet is configured.
919    pub region: Option<String>,
920    /// URI of a hybrid subnet.
921    pub uri: Option<String>,
922}
923
924impl common::Part for HybridSubnetInfo {}
925
926/// For display only. Metadata associated with a Compute Engine instance.
927///
928/// This type is not used in any activity, and only used as *part* of another schema.
929///
930#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
931#[serde_with::serde_as]
932#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
933pub struct InstanceInfo {
934    /// Name of a Compute Engine instance.
935    #[serde(rename = "displayName")]
936    pub display_name: Option<String>,
937    /// External IP address of the network interface.
938    #[serde(rename = "externalIp")]
939    pub external_ip: Option<String>,
940    /// Name of the network interface of a Compute Engine instance.
941    pub interface: Option<String>,
942    /// Internal IP address of the network interface.
943    #[serde(rename = "internalIp")]
944    pub internal_ip: Option<String>,
945    /// Network tags configured on the instance.
946    #[serde(rename = "networkTags")]
947    pub network_tags: Option<Vec<String>>,
948    /// URI of a Compute Engine network.
949    #[serde(rename = "networkUri")]
950    pub network_uri: Option<String>,
951    /// URI of the PSC network attachment the NIC is attached to (if relevant).
952    #[serde(rename = "pscNetworkAttachmentUri")]
953    pub psc_network_attachment_uri: Option<String>,
954    /// Indicates whether the Compute Engine instance is running. Deprecated: use the `status` field instead.
955    pub running: Option<bool>,
956    /// Service account authorized for the instance.
957    #[serde(rename = "serviceAccount")]
958    pub service_account: Option<String>,
959    /// The status of the instance.
960    pub status: Option<String>,
961    /// URI of a Compute Engine instance.
962    pub uri: Option<String>,
963}
964
965impl common::Part for InstanceInfo {}
966
967/// For display only. Metadata associated with an Interconnect attachment.
968///
969/// This type is not used in any activity, and only used as *part* of another schema.
970///
971#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
972#[serde_with::serde_as]
973#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
974pub struct InterconnectAttachmentInfo {
975    /// URI of the Cloud Router to be used for dynamic routing.
976    #[serde(rename = "cloudRouterUri")]
977    pub cloud_router_uri: Option<String>,
978    /// Name of an Interconnect attachment.
979    #[serde(rename = "displayName")]
980    pub display_name: Option<String>,
981    /// URI of the Interconnect where the Interconnect attachment is configured.
982    #[serde(rename = "interconnectUri")]
983    pub interconnect_uri: Option<String>,
984    /// Appliance IP address that was matched for L2_DEDICATED attachments.
985    #[serde(rename = "l2AttachmentMatchedIpAddress")]
986    pub l2_attachment_matched_ip_address: Option<String>,
987    /// Name of a Google Cloud region where the Interconnect attachment is configured.
988    pub region: Option<String>,
989    /// The type of interconnect attachment this is.
990    #[serde(rename = "type")]
991    pub type_: Option<String>,
992    /// URI of an Interconnect attachment.
993    pub uri: Option<String>,
994}
995
996impl common::Part for InterconnectAttachmentInfo {}
997
998/// Describes measured latency distribution.
999///
1000/// This type is not used in any activity, and only used as *part* of another schema.
1001///
1002#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1003#[serde_with::serde_as]
1004#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1005pub struct LatencyDistribution {
1006    /// Representative latency percentiles.
1007    #[serde(rename = "latencyPercentiles")]
1008    pub latency_percentiles: Option<Vec<LatencyPercentile>>,
1009}
1010
1011impl common::Part for LatencyDistribution {}
1012
1013/// Latency percentile rank and value.
1014///
1015/// This type is not used in any activity, and only used as *part* of another schema.
1016///
1017#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1018#[serde_with::serde_as]
1019#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1020pub struct LatencyPercentile {
1021    /// percent-th percentile of latency observed, in microseconds. Fraction of percent/100 of samples have latency lower or equal to the value of this field.
1022    #[serde(rename = "latencyMicros")]
1023    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1024    pub latency_micros: Option<i64>,
1025    /// Percentage of samples this data point applies to.
1026    pub percent: Option<i32>,
1027}
1028
1029impl common::Part for LatencyPercentile {}
1030
1031/// Response for the `ListConnectivityTests` method.
1032///
1033/// # Activities
1034///
1035/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1036/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1037///
1038/// * [locations global connectivity tests list projects](ProjectLocationGlobalConnectivityTestListCall) (response)
1039#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1040#[serde_with::serde_as]
1041#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1042pub struct ListConnectivityTestsResponse {
1043    /// Page token to fetch the next set of Connectivity Tests.
1044    #[serde(rename = "nextPageToken")]
1045    pub next_page_token: Option<String>,
1046    /// List of Connectivity Tests.
1047    pub resources: Option<Vec<ConnectivityTest>>,
1048    /// Locations that could not be reached (when querying all locations with `-`).
1049    pub unreachable: Option<Vec<String>>,
1050}
1051
1052impl common::ResponseResult for ListConnectivityTestsResponse {}
1053
1054/// The response message for Locations.ListLocations.
1055///
1056/// # Activities
1057///
1058/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1059/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1060///
1061/// * [locations list organizations](OrganizationLocationListCall) (response)
1062/// * [locations list projects](ProjectLocationListCall) (response)
1063#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1064#[serde_with::serde_as]
1065#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1066pub struct ListLocationsResponse {
1067    /// A list of locations that matches the specified filter in the request.
1068    pub locations: Option<Vec<Location>>,
1069    /// The standard List next-page token.
1070    #[serde(rename = "nextPageToken")]
1071    pub next_page_token: Option<String>,
1072}
1073
1074impl common::ResponseResult for ListLocationsResponse {}
1075
1076/// The response message for Operations.ListOperations.
1077///
1078/// # Activities
1079///
1080/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1081/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1082///
1083/// * [locations operations list organizations](OrganizationLocationOperationListCall) (response)
1084/// * [locations global operations list projects](ProjectLocationGlobalOperationListCall) (response)
1085#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1086#[serde_with::serde_as]
1087#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1088pub struct ListOperationsResponse {
1089    /// The standard List next-page token.
1090    #[serde(rename = "nextPageToken")]
1091    pub next_page_token: Option<String>,
1092    /// A list of operations that matches the specified filter in the request.
1093    pub operations: Option<Vec<Operation>>,
1094    /// 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.
1095    pub unreachable: Option<Vec<String>>,
1096}
1097
1098impl common::ResponseResult for ListOperationsResponse {}
1099
1100/// Response for the `ListVpcFlowLogsConfigs` method.
1101///
1102/// # Activities
1103///
1104/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1105/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1106///
1107/// * [locations vpc flow logs configs list organizations](OrganizationLocationVpcFlowLogsConfigListCall) (response)
1108/// * [locations vpc flow logs configs list projects](ProjectLocationVpcFlowLogsConfigListCall) (response)
1109#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1110#[serde_with::serde_as]
1111#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1112pub struct ListVpcFlowLogsConfigsResponse {
1113    /// Page token to fetch the next set of configurations.
1114    #[serde(rename = "nextPageToken")]
1115    pub next_page_token: Option<String>,
1116    /// Locations that could not be reached (when querying all locations with `-`).
1117    pub unreachable: Option<Vec<String>>,
1118    /// List of VPC Flow Log configurations.
1119    #[serde(rename = "vpcFlowLogsConfigs")]
1120    pub vpc_flow_logs_configs: Option<Vec<VpcFlowLogsConfig>>,
1121}
1122
1123impl common::ResponseResult for ListVpcFlowLogsConfigsResponse {}
1124
1125/// For display only. Metadata associated with a specific load balancer backend.
1126///
1127/// This type is not used in any activity, and only used as *part* of another schema.
1128///
1129#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1130#[serde_with::serde_as]
1131#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1132pub struct LoadBalancerBackend {
1133    /// Name of a Compute Engine instance or network endpoint.
1134    #[serde(rename = "displayName")]
1135    pub display_name: Option<String>,
1136    /// A list of firewall rule URIs allowing probes from health check IP ranges.
1137    #[serde(rename = "healthCheckAllowingFirewallRules")]
1138    pub health_check_allowing_firewall_rules: Option<Vec<String>>,
1139    /// A list of firewall rule URIs blocking probes from health check IP ranges.
1140    #[serde(rename = "healthCheckBlockingFirewallRules")]
1141    pub health_check_blocking_firewall_rules: Option<Vec<String>>,
1142    /// State of the health check firewall configuration.
1143    #[serde(rename = "healthCheckFirewallState")]
1144    pub health_check_firewall_state: Option<String>,
1145    /// URI of a Compute Engine instance or network endpoint.
1146    pub uri: Option<String>,
1147}
1148
1149impl common::Part for LoadBalancerBackend {}
1150
1151/// For display only. Metadata associated with the load balancer backend.
1152///
1153/// This type is not used in any activity, and only used as *part* of another schema.
1154///
1155#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1156#[serde_with::serde_as]
1157#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1158pub struct LoadBalancerBackendInfo {
1159    /// URI of the backend bucket this backend targets (if applicable).
1160    #[serde(rename = "backendBucketUri")]
1161    pub backend_bucket_uri: Option<String>,
1162    /// URI of the backend service this backend belongs to (if applicable).
1163    #[serde(rename = "backendServiceUri")]
1164    pub backend_service_uri: Option<String>,
1165    /// Output only. Health check firewalls configuration state for the backend. This is a result of the static firewall analysis (verifying that health check traffic from required IP ranges to the backend is allowed or not). The backend might still be unhealthy even if these firewalls are configured. Please refer to the documentation for more information: https://cloud.google.com/load-balancing/docs/firewall-rules
1166    #[serde(rename = "healthCheckFirewallsConfigState")]
1167    pub health_check_firewalls_config_state: Option<String>,
1168    /// URI of the health check attached to this backend (if applicable).
1169    #[serde(rename = "healthCheckUri")]
1170    pub health_check_uri: Option<String>,
1171    /// URI of the instance group this backend belongs to (if applicable).
1172    #[serde(rename = "instanceGroupUri")]
1173    pub instance_group_uri: Option<String>,
1174    /// URI of the backend instance (if applicable). Populated for instance group backends, and zonal NEG backends.
1175    #[serde(rename = "instanceUri")]
1176    pub instance_uri: Option<String>,
1177    /// Display name of the backend. For example, it might be an instance name for the instance group backends, or an IP address and port for zonal network endpoint group backends.
1178    pub name: Option<String>,
1179    /// URI of the network endpoint group this backend belongs to (if applicable).
1180    #[serde(rename = "networkEndpointGroupUri")]
1181    pub network_endpoint_group_uri: Option<String>,
1182    /// PSC Google API target this PSC NEG backend targets (if applicable).
1183    #[serde(rename = "pscGoogleApiTarget")]
1184    pub psc_google_api_target: Option<String>,
1185    /// URI of the PSC service attachment this PSC NEG backend targets (if applicable).
1186    #[serde(rename = "pscServiceAttachmentUri")]
1187    pub psc_service_attachment_uri: Option<String>,
1188}
1189
1190impl common::Part for LoadBalancerBackendInfo {}
1191
1192/// For display only. Metadata associated with a load balancer.
1193///
1194/// This type is not used in any activity, and only used as *part* of another schema.
1195///
1196#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1197#[serde_with::serde_as]
1198#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1199pub struct LoadBalancerInfo {
1200    /// Type of load balancer's backend configuration.
1201    #[serde(rename = "backendType")]
1202    pub backend_type: Option<String>,
1203    /// Backend configuration URI.
1204    #[serde(rename = "backendUri")]
1205    pub backend_uri: Option<String>,
1206    /// Information for the loadbalancer backends.
1207    pub backends: Option<Vec<LoadBalancerBackend>>,
1208    /// URI of the health check for the load balancer. Deprecated and no longer populated as different load balancer backends might have different health checks.
1209    #[serde(rename = "healthCheckUri")]
1210    pub health_check_uri: Option<String>,
1211    /// Type of the load balancer.
1212    #[serde(rename = "loadBalancerType")]
1213    pub load_balancer_type: Option<String>,
1214}
1215
1216impl common::Part for LoadBalancerInfo {}
1217
1218/// A resource that represents a Google Cloud location.
1219///
1220/// # Activities
1221///
1222/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1223/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1224///
1225/// * [locations get organizations](OrganizationLocationGetCall) (response)
1226/// * [locations get projects](ProjectLocationGetCall) (response)
1227#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1228#[serde_with::serde_as]
1229#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1230pub struct Location {
1231    /// The friendly name for this location, typically a nearby city name. For example, "Tokyo".
1232    #[serde(rename = "displayName")]
1233    pub display_name: Option<String>,
1234    /// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"}
1235    pub labels: Option<HashMap<String, String>>,
1236    /// The canonical id for this location. For example: `"us-east1"`.
1237    #[serde(rename = "locationId")]
1238    pub location_id: Option<String>,
1239    /// Service-specific metadata. For example the available capacity at the given location.
1240    pub metadata: Option<HashMap<String, serde_json::Value>>,
1241    /// Resource name for the location, which may vary between implementations. For example: `"projects/example-project/locations/us-east1"`
1242    pub name: Option<String>,
1243}
1244
1245impl common::ResponseResult for Location {}
1246
1247/// For display only. Metadata associated with NAT.
1248///
1249/// This type is not used in any activity, and only used as *part* of another schema.
1250///
1251#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1252#[serde_with::serde_as]
1253#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1254pub struct NatInfo {
1255    /// Type of Cloud NAT gateway. Only valid when `type` is CLOUD_NAT.
1256    #[serde(rename = "cloudNatGatewayType")]
1257    pub cloud_nat_gateway_type: Option<String>,
1258    /// The name of Cloud NAT Gateway. Only valid when type is CLOUD_NAT.
1259    #[serde(rename = "natGatewayName")]
1260    pub nat_gateway_name: Option<String>,
1261    /// URI of the network where NAT translation takes place.
1262    #[serde(rename = "networkUri")]
1263    pub network_uri: Option<String>,
1264    /// Destination IP address after NAT translation.
1265    #[serde(rename = "newDestinationIp")]
1266    pub new_destination_ip: Option<String>,
1267    /// Destination port after NAT translation. Only valid when protocol is TCP or UDP.
1268    #[serde(rename = "newDestinationPort")]
1269    pub new_destination_port: Option<i32>,
1270    /// Source IP address after NAT translation.
1271    #[serde(rename = "newSourceIp")]
1272    pub new_source_ip: Option<String>,
1273    /// Source port after NAT translation. Only valid when protocol is TCP or UDP.
1274    #[serde(rename = "newSourcePort")]
1275    pub new_source_port: Option<i32>,
1276    /// Destination IP address before NAT translation.
1277    #[serde(rename = "oldDestinationIp")]
1278    pub old_destination_ip: Option<String>,
1279    /// Destination port before NAT translation. Only valid when protocol is TCP or UDP.
1280    #[serde(rename = "oldDestinationPort")]
1281    pub old_destination_port: Option<i32>,
1282    /// Source IP address before NAT translation.
1283    #[serde(rename = "oldSourceIp")]
1284    pub old_source_ip: Option<String>,
1285    /// Source port before NAT translation. Only valid when protocol is TCP or UDP.
1286    #[serde(rename = "oldSourcePort")]
1287    pub old_source_port: Option<i32>,
1288    /// IP protocol in string format, for example: "TCP", "UDP", "ICMP".
1289    pub protocol: Option<String>,
1290    /// Uri of the Cloud Router. Only valid when type is CLOUD_NAT.
1291    #[serde(rename = "routerUri")]
1292    pub router_uri: Option<String>,
1293    /// Type of NAT.
1294    #[serde(rename = "type")]
1295    pub type_: Option<String>,
1296}
1297
1298impl common::Part for NatInfo {}
1299
1300/// For display only. Metadata associated with a Compute Engine network.
1301///
1302/// This type is not used in any activity, and only used as *part* of another schema.
1303///
1304#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1305#[serde_with::serde_as]
1306#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1307pub struct NetworkInfo {
1308    /// Name of a Compute Engine network.
1309    #[serde(rename = "displayName")]
1310    pub display_name: Option<String>,
1311    /// The IP range of the subnet matching the source IP address of the test.
1312    #[serde(rename = "matchedIpRange")]
1313    pub matched_ip_range: Option<String>,
1314    /// URI of the subnet matching the source IP address of the test.
1315    #[serde(rename = "matchedSubnetUri")]
1316    pub matched_subnet_uri: Option<String>,
1317    /// The region of the subnet matching the source IP address of the test.
1318    pub region: Option<String>,
1319    /// URI of a Compute Engine network.
1320    pub uri: Option<String>,
1321}
1322
1323impl common::Part for NetworkInfo {}
1324
1325/// This resource represents a long-running operation that is the result of a network API call.
1326///
1327/// # Activities
1328///
1329/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1330/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1331///
1332/// * [locations operations get organizations](OrganizationLocationOperationGetCall) (response)
1333/// * [locations vpc flow logs configs create organizations](OrganizationLocationVpcFlowLogsConfigCreateCall) (response)
1334/// * [locations vpc flow logs configs delete organizations](OrganizationLocationVpcFlowLogsConfigDeleteCall) (response)
1335/// * [locations vpc flow logs configs patch organizations](OrganizationLocationVpcFlowLogsConfigPatchCall) (response)
1336/// * [locations global connectivity tests create projects](ProjectLocationGlobalConnectivityTestCreateCall) (response)
1337/// * [locations global connectivity tests delete projects](ProjectLocationGlobalConnectivityTestDeleteCall) (response)
1338/// * [locations global connectivity tests patch projects](ProjectLocationGlobalConnectivityTestPatchCall) (response)
1339/// * [locations global connectivity tests rerun projects](ProjectLocationGlobalConnectivityTestRerunCall) (response)
1340/// * [locations global operations get projects](ProjectLocationGlobalOperationGetCall) (response)
1341/// * [locations vpc flow logs configs create projects](ProjectLocationVpcFlowLogsConfigCreateCall) (response)
1342/// * [locations vpc flow logs configs delete projects](ProjectLocationVpcFlowLogsConfigDeleteCall) (response)
1343/// * [locations vpc flow logs configs patch projects](ProjectLocationVpcFlowLogsConfigPatchCall) (response)
1344#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1345#[serde_with::serde_as]
1346#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1347pub struct Operation {
1348    /// 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.
1349    pub done: Option<bool>,
1350    /// The error result of the operation in case of failure or cancellation.
1351    pub error: Option<Status>,
1352    /// 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.
1353    pub metadata: Option<HashMap<String, serde_json::Value>>,
1354    /// 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}`.
1355    pub name: Option<String>,
1356    /// 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`.
1357    pub response: Option<HashMap<String, serde_json::Value>>,
1358}
1359
1360impl common::ResponseResult for Operation {}
1361
1362/// An Identity and Access Management (IAM) policy, which specifies access controls for Google Cloud resources. A `Policy` is a collection of `bindings`. A `binding` binds one or more `members`, or principals, to a single `role`. Principals can be user accounts, service accounts, Google groups, and domains (such as G Suite). A `role` is a named list of permissions; each `role` can be an IAM predefined role or a user-created custom role. For some types of Google Cloud resources, a `binding` can also specify a `condition`, which is a logical expression that allows access to a resource only if the expression evaluates to `true`. A condition can add constraints based on attributes of the request, the resource, or both. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies). **JSON example:** `{ "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": [ "user:eve@example.com" ], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": "BwWWja0YfJA=", "version": 3 }` **YAML example:** `bindings: - members: - user:mike@example.com - group:admins@example.com - domain:google.com - serviceAccount:my-project-id@appspot.gserviceaccount.com role: roles/resourcemanager.organizationAdmin - members: - user:eve@example.com role: roles/resourcemanager.organizationViewer condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= version: 3` For a description of IAM and its features, see the [IAM documentation](https://cloud.google.com/iam/docs/).
1363///
1364/// # Activities
1365///
1366/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1367/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1368///
1369/// * [locations global connectivity tests get iam policy projects](ProjectLocationGlobalConnectivityTestGetIamPolicyCall) (response)
1370/// * [locations global connectivity tests set iam policy projects](ProjectLocationGlobalConnectivityTestSetIamPolicyCall) (response)
1371#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1372#[serde_with::serde_as]
1373#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1374pub struct Policy {
1375    /// Specifies cloud audit logging configuration for this policy.
1376    #[serde(rename = "auditConfigs")]
1377    pub audit_configs: Option<Vec<AuditConfig>>,
1378    /// Associates a list of `members`, or principals, with a `role`. Optionally, may specify a `condition` that determines how and when the `bindings` are applied. Each of the `bindings` must contain at least one principal. The `bindings` in a `Policy` can refer to up to 1,500 principals; up to 250 of these principals can be Google groups. Each occurrence of a principal counts towards these limits. For example, if the `bindings` grant 50 different roles to `user:alice@example.com`, and not to any other principal, then you can add another 1,450 principals to the `bindings` in the `Policy`.
1379    pub bindings: Option<Vec<Binding>>,
1380    /// `etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy. **Important:** If you use IAM Conditions, you must include the `etag` field whenever you call `setIamPolicy`. If you omit this field, then IAM allows you to overwrite a version `3` policy with a version `1` policy, and all of the conditions in the version `3` policy are lost.
1381    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1382    pub etag: Option<Vec<u8>>,
1383    /// Specifies the format of the policy. Valid values are `0`, `1`, and `3`. Requests that specify an invalid value are rejected. Any operation that affects conditional role bindings must specify version `3`. This requirement applies to the following operations: * Getting a policy that includes a conditional role binding * Adding a conditional role binding to a policy * Changing a conditional role binding in a policy * Removing any role binding, with or without a condition, from a policy that includes conditions **Important:** If you use IAM Conditions, you must include the `etag` field whenever you call `setIamPolicy`. If you omit this field, then IAM allows you to overwrite a version `3` policy with a version `1` policy, and all of the conditions in the version `3` policy are lost. If a policy does not include any conditions, operations on that policy may specify any valid version or leave the field unset. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
1384    pub version: Option<i32>,
1385}
1386
1387impl common::ResponseResult for Policy {}
1388
1389/// Results of active probing from the last run of the test.
1390///
1391/// This type is not used in any activity, and only used as *part* of another schema.
1392///
1393#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1394#[serde_with::serde_as]
1395#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1396pub struct ProbingDetails {
1397    /// The reason probing was aborted.
1398    #[serde(rename = "abortCause")]
1399    pub abort_cause: Option<String>,
1400    /// The EdgeLocation from which a packet, destined to the internet, will egress the Google network. This will only be populated for a connectivity test which has an internet destination address. The absence of this field *must not* be used as an indication that the destination is part of the Google network.
1401    #[serde(rename = "destinationEgressLocation")]
1402    pub destination_egress_location: Option<EdgeLocation>,
1403    /// Probing results for all edge devices.
1404    #[serde(rename = "edgeResponses")]
1405    pub edge_responses: Option<Vec<SingleEdgeResponse>>,
1406    /// The source and destination endpoints derived from the test input and used for active probing.
1407    #[serde(rename = "endpointInfo")]
1408    pub endpoint_info: Option<EndpointInfo>,
1409    /// Details about an internal failure or the cancellation of active probing.
1410    pub error: Option<Status>,
1411    /// Whether all relevant edge devices were probed.
1412    #[serde(rename = "probedAllDevices")]
1413    pub probed_all_devices: Option<bool>,
1414    /// Latency as measured by active probing in one direction: from the source to the destination endpoint.
1415    #[serde(rename = "probingLatency")]
1416    pub probing_latency: Option<LatencyDistribution>,
1417    /// The overall result of active probing.
1418    pub result: Option<String>,
1419    /// Number of probes sent.
1420    #[serde(rename = "sentProbeCount")]
1421    pub sent_probe_count: Option<i32>,
1422    /// Number of probes that reached the destination.
1423    #[serde(rename = "successfulProbeCount")]
1424    pub successful_probe_count: Option<i32>,
1425    /// The time that reachability was assessed through active probing.
1426    #[serde(rename = "verifyTime")]
1427    pub verify_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1428}
1429
1430impl common::Part for ProbingDetails {}
1431
1432/// For display only. Metadata associated with ProxyConnection.
1433///
1434/// This type is not used in any activity, and only used as *part* of another schema.
1435///
1436#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1437#[serde_with::serde_as]
1438#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1439pub struct ProxyConnectionInfo {
1440    /// URI of the network where connection is proxied.
1441    #[serde(rename = "networkUri")]
1442    pub network_uri: Option<String>,
1443    /// Destination IP address of a new connection.
1444    #[serde(rename = "newDestinationIp")]
1445    pub new_destination_ip: Option<String>,
1446    /// Destination port of a new connection. Only valid when protocol is TCP or UDP.
1447    #[serde(rename = "newDestinationPort")]
1448    pub new_destination_port: Option<i32>,
1449    /// Source IP address of a new connection.
1450    #[serde(rename = "newSourceIp")]
1451    pub new_source_ip: Option<String>,
1452    /// Source port of a new connection. Only valid when protocol is TCP or UDP.
1453    #[serde(rename = "newSourcePort")]
1454    pub new_source_port: Option<i32>,
1455    /// Destination IP address of an original connection
1456    #[serde(rename = "oldDestinationIp")]
1457    pub old_destination_ip: Option<String>,
1458    /// Destination port of an original connection. Only valid when protocol is TCP or UDP.
1459    #[serde(rename = "oldDestinationPort")]
1460    pub old_destination_port: Option<i32>,
1461    /// Source IP address of an original connection.
1462    #[serde(rename = "oldSourceIp")]
1463    pub old_source_ip: Option<String>,
1464    /// Source port of an original connection. Only valid when protocol is TCP or UDP.
1465    #[serde(rename = "oldSourcePort")]
1466    pub old_source_port: Option<i32>,
1467    /// IP protocol in string format, for example: "TCP", "UDP", "ICMP".
1468    pub protocol: Option<String>,
1469    /// Uri of proxy subnet.
1470    #[serde(rename = "subnetUri")]
1471    pub subnet_uri: Option<String>,
1472}
1473
1474impl common::Part for ProxyConnectionInfo {}
1475
1476/// Response for the `QueryVpcFlowLogsConfigs` method.
1477///
1478/// # Activities
1479///
1480/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1481/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1482///
1483/// * [locations vpc flow logs configs query org vpc flow logs configs projects](ProjectLocationVpcFlowLogsConfigQueryOrgVpcFlowLogsConfigCall) (response)
1484#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1485#[serde_with::serde_as]
1486#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1487pub struct QueryOrgVpcFlowLogsConfigsResponse {
1488    /// Page token to fetch the next set of configurations.
1489    #[serde(rename = "nextPageToken")]
1490    pub next_page_token: Option<String>,
1491    /// Locations that could not be reached (when querying all locations with `-`).
1492    pub unreachable: Option<Vec<String>>,
1493    /// List of VPC Flow Log configurations.
1494    #[serde(rename = "vpcFlowLogsConfigs")]
1495    pub vpc_flow_logs_configs: Option<Vec<VpcFlowLogsConfig>>,
1496}
1497
1498impl common::ResponseResult for QueryOrgVpcFlowLogsConfigsResponse {}
1499
1500/// Results of the configuration analysis from the last run of the test.
1501///
1502/// This type is not used in any activity, and only used as *part* of another schema.
1503///
1504#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1505#[serde_with::serde_as]
1506#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1507pub struct ReachabilityDetails {
1508    /// The details of a failure or a cancellation of reachability analysis.
1509    pub error: Option<Status>,
1510    /// The overall result of the test's configuration analysis.
1511    pub result: Option<String>,
1512    /// Result may contain a list of traces if a test has multiple possible paths in the network, such as when destination endpoint is a load balancer with multiple backends.
1513    pub traces: Option<Vec<Trace>>,
1514    /// The time of the configuration analysis.
1515    #[serde(rename = "verifyTime")]
1516    pub verify_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1517}
1518
1519impl common::Part for ReachabilityDetails {}
1520
1521/// For display only. Metadata associated with a Redis Cluster.
1522///
1523/// This type is not used in any activity, and only used as *part* of another schema.
1524///
1525#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1526#[serde_with::serde_as]
1527#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1528pub struct RedisClusterInfo {
1529    /// Discovery endpoint IP address of a Redis Cluster.
1530    #[serde(rename = "discoveryEndpointIpAddress")]
1531    pub discovery_endpoint_ip_address: Option<String>,
1532    /// Name of a Redis Cluster.
1533    #[serde(rename = "displayName")]
1534    pub display_name: Option<String>,
1535    /// Name of the region in which the Redis Cluster is defined. For example, "us-central1".
1536    pub location: Option<String>,
1537    /// URI of the network containing the Redis Cluster endpoints in format "projects/{project_id}/global/networks/{network_id}".
1538    #[serde(rename = "networkUri")]
1539    pub network_uri: Option<String>,
1540    /// Secondary endpoint IP address of a Redis Cluster.
1541    #[serde(rename = "secondaryEndpointIpAddress")]
1542    pub secondary_endpoint_ip_address: Option<String>,
1543    /// URI of a Redis Cluster in format "projects/{project_id}/locations/{location}/clusters/{cluster_id}"
1544    pub uri: Option<String>,
1545}
1546
1547impl common::Part for RedisClusterInfo {}
1548
1549/// For display only. Metadata associated with a Cloud Redis Instance.
1550///
1551/// This type is not used in any activity, and only used as *part* of another schema.
1552///
1553#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1554#[serde_with::serde_as]
1555#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1556pub struct RedisInstanceInfo {
1557    /// Name of a Cloud Redis Instance.
1558    #[serde(rename = "displayName")]
1559    pub display_name: Option<String>,
1560    /// URI of a Cloud Redis Instance network.
1561    #[serde(rename = "networkUri")]
1562    pub network_uri: Option<String>,
1563    /// Primary endpoint IP address of a Cloud Redis Instance.
1564    #[serde(rename = "primaryEndpointIp")]
1565    pub primary_endpoint_ip: Option<String>,
1566    /// Read endpoint IP address of a Cloud Redis Instance (if applicable).
1567    #[serde(rename = "readEndpointIp")]
1568    pub read_endpoint_ip: Option<String>,
1569    /// Region in which the Cloud Redis Instance is defined.
1570    pub region: Option<String>,
1571    /// URI of a Cloud Redis Instance.
1572    pub uri: Option<String>,
1573}
1574
1575impl common::Part for RedisInstanceInfo {}
1576
1577/// Request for the `RerunConnectivityTest` method.
1578///
1579/// # Activities
1580///
1581/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1582/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1583///
1584/// * [locations global connectivity tests rerun projects](ProjectLocationGlobalConnectivityTestRerunCall) (request)
1585#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1586#[serde_with::serde_as]
1587#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1588pub struct RerunConnectivityTestRequest {
1589    _never_set: Option<bool>,
1590}
1591
1592impl common::RequestValue for RerunConnectivityTestRequest {}
1593
1594/// For display only. Metadata associated with a Compute Engine route.
1595///
1596/// This type is not used in any activity, and only used as *part* of another schema.
1597///
1598#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1599#[serde_with::serde_as]
1600#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1601pub struct RouteInfo {
1602    /// For ADVERTISED routes, the URI of their next hop, i.e. the URI of the hybrid endpoint (VPN tunnel, Interconnect attachment, NCC router appliance) the advertised prefix is advertised through, or URI of the source peered network. Deprecated in favor of the next_hop_uri field, not used in new tests.
1603    #[serde(rename = "advertisedRouteNextHopUri")]
1604    pub advertised_route_next_hop_uri: Option<String>,
1605    /// For ADVERTISED dynamic routes, the URI of the Cloud Router that advertised the corresponding IP prefix.
1606    #[serde(rename = "advertisedRouteSourceRouterUri")]
1607    pub advertised_route_source_router_uri: Option<String>,
1608    /// Destination IP range of the route.
1609    #[serde(rename = "destIpRange")]
1610    pub dest_ip_range: Option<String>,
1611    /// Destination port ranges of the route. POLICY_BASED routes only.
1612    #[serde(rename = "destPortRanges")]
1613    pub dest_port_ranges: Option<Vec<String>>,
1614    /// Name of a route.
1615    #[serde(rename = "displayName")]
1616    pub display_name: Option<String>,
1617    /// Instance tags of the route.
1618    #[serde(rename = "instanceTags")]
1619    pub instance_tags: Option<Vec<String>>,
1620    /// For PEERING_SUBNET and PEERING_DYNAMIC routes that are advertised by NCC Hub, the URI of the corresponding route in NCC Hub's routing table.
1621    #[serde(rename = "nccHubRouteUri")]
1622    pub ncc_hub_route_uri: Option<String>,
1623    /// URI of the NCC Hub the route is advertised by. PEERING_SUBNET and PEERING_DYNAMIC routes that are advertised by NCC Hub only.
1624    #[serde(rename = "nccHubUri")]
1625    pub ncc_hub_uri: Option<String>,
1626    /// URI of the destination NCC Spoke. PEERING_SUBNET and PEERING_DYNAMIC routes that are advertised by NCC Hub only.
1627    #[serde(rename = "nccSpokeUri")]
1628    pub ncc_spoke_uri: Option<String>,
1629    /// URI of a VPC network where route is located.
1630    #[serde(rename = "networkUri")]
1631    pub network_uri: Option<String>,
1632    /// String type of the next hop of the route (for example, "VPN tunnel"). Deprecated in favor of the next_hop_type and next_hop_uri fields, not used in new tests.
1633    #[serde(rename = "nextHop")]
1634    pub next_hop: Option<String>,
1635    /// URI of a VPC network where the next hop resource is located.
1636    #[serde(rename = "nextHopNetworkUri")]
1637    pub next_hop_network_uri: Option<String>,
1638    /// Type of next hop.
1639    #[serde(rename = "nextHopType")]
1640    pub next_hop_type: Option<String>,
1641    /// URI of the next hop resource.
1642    #[serde(rename = "nextHopUri")]
1643    pub next_hop_uri: Option<String>,
1644    /// For PEERING_SUBNET, PEERING_STATIC and PEERING_DYNAMIC routes, the name of the originating SUBNET/STATIC/DYNAMIC route.
1645    #[serde(rename = "originatingRouteDisplayName")]
1646    pub originating_route_display_name: Option<String>,
1647    /// For PEERING_SUBNET and PEERING_STATIC routes, the URI of the originating SUBNET/STATIC route.
1648    #[serde(rename = "originatingRouteUri")]
1649    pub originating_route_uri: Option<String>,
1650    /// Priority of the route.
1651    pub priority: Option<i32>,
1652    /// Protocols of the route. POLICY_BASED routes only.
1653    pub protocols: Option<Vec<String>>,
1654    /// Region of the route. DYNAMIC, PEERING_DYNAMIC, POLICY_BASED and ADVERTISED routes only. If set for POLICY_BASED route, this is a region of VLAN attachments for Cloud Interconnect the route applies to.
1655    pub region: Option<String>,
1656    /// Indicates where route is applicable. Deprecated, routes with NCC_HUB scope are not included in the trace in new tests.
1657    #[serde(rename = "routeScope")]
1658    pub route_scope: Option<String>,
1659    /// Type of route.
1660    #[serde(rename = "routeType")]
1661    pub route_type: Option<String>,
1662    /// Source IP address range of the route. POLICY_BASED routes only.
1663    #[serde(rename = "srcIpRange")]
1664    pub src_ip_range: Option<String>,
1665    /// Source port ranges of the route. POLICY_BASED routes only.
1666    #[serde(rename = "srcPortRanges")]
1667    pub src_port_ranges: Option<Vec<String>>,
1668    /// URI of a route. SUBNET, STATIC, PEERING_SUBNET (only for peering network) and POLICY_BASED routes only.
1669    pub uri: Option<String>,
1670}
1671
1672impl common::Part for RouteInfo {}
1673
1674/// For display only. Metadata associated with a serverless public connection.
1675///
1676/// This type is not used in any activity, and only used as *part* of another schema.
1677///
1678#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1679#[serde_with::serde_as]
1680#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1681pub struct ServerlessExternalConnectionInfo {
1682    /// Selected starting IP address, from the Google dynamic address pool.
1683    #[serde(rename = "selectedIpAddress")]
1684    pub selected_ip_address: Option<String>,
1685}
1686
1687impl common::Part for ServerlessExternalConnectionInfo {}
1688
1689/// For display only. Metadata associated with the serverless network endpoint group backend.
1690///
1691/// This type is not used in any activity, and only used as *part* of another schema.
1692///
1693#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1694#[serde_with::serde_as]
1695#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1696pub struct ServerlessNegInfo {
1697    /// URI of the serverless network endpoint group.
1698    #[serde(rename = "negUri")]
1699    pub neg_uri: Option<String>,
1700}
1701
1702impl common::Part for ServerlessNegInfo {}
1703
1704/// Request message for `SetIamPolicy` method.
1705///
1706/// # Activities
1707///
1708/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1709/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1710///
1711/// * [locations global connectivity tests set iam policy projects](ProjectLocationGlobalConnectivityTestSetIamPolicyCall) (request)
1712#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1713#[serde_with::serde_as]
1714#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1715pub struct SetIamPolicyRequest {
1716    /// REQUIRED: The complete policy to be applied to the `resource`. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Google Cloud services (such as Projects) might reject them.
1717    pub policy: Option<Policy>,
1718    /// OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only the fields in the mask will be modified. If no mask is provided, the following default mask is used: `paths: "bindings, etag"`
1719    #[serde(rename = "updateMask")]
1720    pub update_mask: Option<common::FieldMask>,
1721}
1722
1723impl common::RequestValue for SetIamPolicyRequest {}
1724
1725/// Response for the `ShowEffectiveFlowLogsConfigs` method.
1726///
1727/// # Activities
1728///
1729/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1730/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1731///
1732/// * [locations vpc flow logs configs show effective flow logs configs projects](ProjectLocationVpcFlowLogsConfigShowEffectiveFlowLogsConfigCall) (response)
1733#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1734#[serde_with::serde_as]
1735#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1736pub struct ShowEffectiveFlowLogsConfigsResponse {
1737    /// List of Effective Vpc Flow Logs configurations.
1738    #[serde(rename = "effectiveFlowLogsConfigs")]
1739    pub effective_flow_logs_configs: Option<Vec<EffectiveVpcFlowLogsConfig>>,
1740    /// Page token to fetch the next set of configurations.
1741    #[serde(rename = "nextPageToken")]
1742    pub next_page_token: Option<String>,
1743    /// Locations that could not be reached (when querying all locations with `-`).
1744    pub unreachable: Option<Vec<String>>,
1745}
1746
1747impl common::ResponseResult for ShowEffectiveFlowLogsConfigsResponse {}
1748
1749/// Probing results for a single edge device.
1750///
1751/// This type is not used in any activity, and only used as *part* of another schema.
1752///
1753#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1754#[serde_with::serde_as]
1755#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1756pub struct SingleEdgeResponse {
1757    /// The EdgeLocation from which a packet, destined to the internet, will egress the Google network. This will only be populated for a connectivity test which has an internet destination address. The absence of this field *must not* be used as an indication that the destination is part of the Google network.
1758    #[serde(rename = "destinationEgressLocation")]
1759    pub destination_egress_location: Option<EdgeLocation>,
1760    /// Router name in the format '{router}.{metroshard}'. For example: pf01.aaa01, pr02.aaa01.
1761    #[serde(rename = "destinationRouter")]
1762    pub destination_router: Option<String>,
1763    /// Latency as measured by active probing in one direction: from the source to the destination endpoint.
1764    #[serde(rename = "probingLatency")]
1765    pub probing_latency: Option<LatencyDistribution>,
1766    /// The overall result of active probing for this egress device.
1767    pub result: Option<String>,
1768    /// Number of probes sent.
1769    #[serde(rename = "sentProbeCount")]
1770    pub sent_probe_count: Option<i32>,
1771    /// Number of probes that reached the destination.
1772    #[serde(rename = "successfulProbeCount")]
1773    pub successful_probe_count: Option<i32>,
1774}
1775
1776impl common::Part for SingleEdgeResponse {}
1777
1778/// 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).
1779///
1780/// This type is not used in any activity, and only used as *part* of another schema.
1781///
1782#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1783#[serde_with::serde_as]
1784#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1785pub struct Status {
1786    /// The status code, which should be an enum value of google.rpc.Code.
1787    pub code: Option<i32>,
1788    /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
1789    pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
1790    /// 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.
1791    pub message: Option<String>,
1792}
1793
1794impl common::Part for Status {}
1795
1796/// A simulated forwarding path is composed of multiple steps. Each step has a well-defined state and an associated configuration.
1797///
1798/// This type is not used in any activity, and only used as *part* of another schema.
1799///
1800#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1801#[serde_with::serde_as]
1802#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1803pub struct Step {
1804    /// Display information of the final state "abort" and reason.
1805    pub abort: Option<AbortInfo>,
1806    /// Display information of an App Engine service version.
1807    #[serde(rename = "appEngineVersion")]
1808    pub app_engine_version: Option<AppEngineVersionInfo>,
1809    /// This is a step that leads to the final state Drop.
1810    #[serde(rename = "causesDrop")]
1811    pub causes_drop: Option<bool>,
1812    /// Display information of a Cloud Function.
1813    #[serde(rename = "cloudFunction")]
1814    pub cloud_function: Option<CloudFunctionInfo>,
1815    /// Display information of a Cloud Run revision.
1816    #[serde(rename = "cloudRunRevision")]
1817    pub cloud_run_revision: Option<CloudRunRevisionInfo>,
1818    /// Display information of a Cloud SQL instance.
1819    #[serde(rename = "cloudSqlInstance")]
1820    pub cloud_sql_instance: Option<CloudSQLInstanceInfo>,
1821    /// Display information of the final state "deliver" and reason.
1822    pub deliver: Option<DeliverInfo>,
1823    /// A description of the step. Usually this is a summary of the state.
1824    pub description: Option<String>,
1825    /// Display information of a serverless direct VPC egress connection.
1826    #[serde(rename = "directVpcEgressConnection")]
1827    pub direct_vpc_egress_connection: Option<DirectVpcEgressConnectionInfo>,
1828    /// Display information of the final state "drop" and reason.
1829    pub drop: Option<DropInfo>,
1830    /// Display information of the source and destination under analysis. The endpoint information in an intermediate state may differ with the initial input, as it might be modified by state like NAT, or Connection Proxy.
1831    pub endpoint: Option<EndpointInfo>,
1832    /// Display information of a Compute Engine firewall rule.
1833    pub firewall: Option<FirewallInfo>,
1834    /// Display information of the final state "forward" and reason.
1835    pub forward: Option<ForwardInfo>,
1836    /// Display information of a Compute Engine forwarding rule.
1837    #[serde(rename = "forwardingRule")]
1838    pub forwarding_rule: Option<ForwardingRuleInfo>,
1839    /// Display information of a Google Kubernetes Engine cluster master.
1840    #[serde(rename = "gkeMaster")]
1841    pub gke_master: Option<GKEMasterInfo>,
1842    /// Display information of a Google service
1843    #[serde(rename = "googleService")]
1844    pub google_service: Option<GoogleServiceInfo>,
1845    /// Display information of a hybrid subnet.
1846    #[serde(rename = "hybridSubnet")]
1847    pub hybrid_subnet: Option<HybridSubnetInfo>,
1848    /// Display information of a Compute Engine instance.
1849    pub instance: Option<InstanceInfo>,
1850    /// Display information of an interconnect attachment.
1851    #[serde(rename = "interconnectAttachment")]
1852    pub interconnect_attachment: Option<InterconnectAttachmentInfo>,
1853    /// Display information of the load balancers. Deprecated in favor of the `load_balancer_backend_info` field, not used in new tests.
1854    #[serde(rename = "loadBalancer")]
1855    pub load_balancer: Option<LoadBalancerInfo>,
1856    /// Display information of a specific load balancer backend.
1857    #[serde(rename = "loadBalancerBackendInfo")]
1858    pub load_balancer_backend_info: Option<LoadBalancerBackendInfo>,
1859    /// Display information of a NAT.
1860    pub nat: Option<NatInfo>,
1861    /// Display information of a Google Cloud network.
1862    pub network: Option<NetworkInfo>,
1863    /// Project ID that contains the configuration this step is validating.
1864    #[serde(rename = "projectId")]
1865    pub project_id: Option<String>,
1866    /// Display information of a ProxyConnection.
1867    #[serde(rename = "proxyConnection")]
1868    pub proxy_connection: Option<ProxyConnectionInfo>,
1869    /// Display information of a Redis Cluster.
1870    #[serde(rename = "redisCluster")]
1871    pub redis_cluster: Option<RedisClusterInfo>,
1872    /// Display information of a Redis Instance.
1873    #[serde(rename = "redisInstance")]
1874    pub redis_instance: Option<RedisInstanceInfo>,
1875    /// Display information of a Compute Engine route.
1876    pub route: Option<RouteInfo>,
1877    /// Display information of a serverless public (external) connection.
1878    #[serde(rename = "serverlessExternalConnection")]
1879    pub serverless_external_connection: Option<ServerlessExternalConnectionInfo>,
1880    /// Display information of a Serverless network endpoint group backend. Used only for return traces.
1881    #[serde(rename = "serverlessNeg")]
1882    pub serverless_neg: Option<ServerlessNegInfo>,
1883    /// Each step is in one of the pre-defined states.
1884    pub state: Option<String>,
1885    /// Display information of a Storage Bucket. Used only for return traces.
1886    #[serde(rename = "storageBucket")]
1887    pub storage_bucket: Option<StorageBucketInfo>,
1888    /// Display information of a VPC connector.
1889    #[serde(rename = "vpcConnector")]
1890    pub vpc_connector: Option<VpcConnectorInfo>,
1891    /// Display information of a Compute Engine VPN gateway.
1892    #[serde(rename = "vpnGateway")]
1893    pub vpn_gateway: Option<VpnGatewayInfo>,
1894    /// Display information of a Compute Engine VPN tunnel.
1895    #[serde(rename = "vpnTunnel")]
1896    pub vpn_tunnel: Option<VpnTunnelInfo>,
1897}
1898
1899impl common::Part for Step {}
1900
1901/// For display only. Metadata associated with Storage Bucket.
1902///
1903/// This type is not used in any activity, and only used as *part* of another schema.
1904///
1905#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1906#[serde_with::serde_as]
1907#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1908pub struct StorageBucketInfo {
1909    /// Cloud Storage Bucket name.
1910    pub bucket: Option<String>,
1911}
1912
1913impl common::Part for StorageBucketInfo {}
1914
1915/// Request message for `TestIamPermissions` method.
1916///
1917/// # Activities
1918///
1919/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1920/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1921///
1922/// * [locations global connectivity tests test iam permissions projects](ProjectLocationGlobalConnectivityTestTestIamPermissionCall) (request)
1923#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1924#[serde_with::serde_as]
1925#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1926pub struct TestIamPermissionsRequest {
1927    /// The set of permissions to check for the `resource`. Permissions with wildcards (such as `*` or `storage.*`) are not allowed. For more information see [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
1928    pub permissions: Option<Vec<String>>,
1929}
1930
1931impl common::RequestValue for TestIamPermissionsRequest {}
1932
1933/// Response message for `TestIamPermissions` method.
1934///
1935/// # Activities
1936///
1937/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1938/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1939///
1940/// * [locations global connectivity tests test iam permissions projects](ProjectLocationGlobalConnectivityTestTestIamPermissionCall) (response)
1941#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1942#[serde_with::serde_as]
1943#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1944pub struct TestIamPermissionsResponse {
1945    /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed.
1946    pub permissions: Option<Vec<String>>,
1947}
1948
1949impl common::ResponseResult for TestIamPermissionsResponse {}
1950
1951/// Trace represents one simulated packet forwarding path. * Each trace contains multiple ordered steps. * Each step is in a particular state with associated configuration. * State is categorized as final or non-final states. * Each final state has a reason associated. * Each trace must end with a final state (the last step). ``` |---------------------Trace----------------------| Step1(State) Step2(State) --- StepN(State(final)) ```
1952///
1953/// This type is not used in any activity, and only used as *part* of another schema.
1954///
1955#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1956#[serde_with::serde_as]
1957#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1958pub struct Trace {
1959    /// Derived from the source and destination endpoints definition specified by user request, and validated by the data plane model. If there are multiple traces starting from different source locations, then the endpoint_info may be different between traces.
1960    #[serde(rename = "endpointInfo")]
1961    pub endpoint_info: Option<EndpointInfo>,
1962    /// ID of trace. For forward traces, this ID is unique for each trace. For return traces, it matches ID of associated forward trace. A single forward trace can be associated with none, one or more than one return trace.
1963    #[serde(rename = "forwardTraceId")]
1964    pub forward_trace_id: Option<i32>,
1965    /// A trace of a test contains multiple steps from the initial state to the final state (delivered, dropped, forwarded, or aborted). The steps are ordered by the processing sequence within the simulated network state machine. It is critical to preserve the order of the steps and avoid reordering or sorting them.
1966    pub steps: Option<Vec<Step>>,
1967}
1968
1969impl common::Part for Trace {}
1970
1971/// For display only. Metadata associated with a VPC connector.
1972///
1973/// This type is not used in any activity, and only used as *part* of another schema.
1974///
1975#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1976#[serde_with::serde_as]
1977#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1978pub struct VpcConnectorInfo {
1979    /// Name of a VPC connector.
1980    #[serde(rename = "displayName")]
1981    pub display_name: Option<String>,
1982    /// Location in which the VPC connector is deployed.
1983    pub location: Option<String>,
1984    /// URI of a VPC connector.
1985    pub uri: Option<String>,
1986}
1987
1988impl common::Part for VpcConnectorInfo {}
1989
1990/// A configuration to generate VPC Flow Logs.
1991///
1992/// # Activities
1993///
1994/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1995/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1996///
1997/// * [locations vpc flow logs configs create organizations](OrganizationLocationVpcFlowLogsConfigCreateCall) (request)
1998/// * [locations vpc flow logs configs get organizations](OrganizationLocationVpcFlowLogsConfigGetCall) (response)
1999/// * [locations vpc flow logs configs patch organizations](OrganizationLocationVpcFlowLogsConfigPatchCall) (request)
2000/// * [locations vpc flow logs configs create projects](ProjectLocationVpcFlowLogsConfigCreateCall) (request)
2001/// * [locations vpc flow logs configs get projects](ProjectLocationVpcFlowLogsConfigGetCall) (response)
2002/// * [locations vpc flow logs configs patch projects](ProjectLocationVpcFlowLogsConfigPatchCall) (request)
2003#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2004#[serde_with::serde_as]
2005#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2006pub struct VpcFlowLogsConfig {
2007    /// Optional. The aggregation interval for the logs. Default value is INTERVAL_5_SEC.
2008    #[serde(rename = "aggregationInterval")]
2009    pub aggregation_interval: Option<String>,
2010    /// Output only. The time the config was created.
2011    #[serde(rename = "createTime")]
2012    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2013    /// Optional. Determines whether to include cross project annotations in the logs. This field is available only for organization configurations. If not specified in org configs will be set to CROSS_PROJECT_METADATA_ENABLED.
2014    #[serde(rename = "crossProjectMetadata")]
2015    pub cross_project_metadata: Option<String>,
2016    /// Optional. The user-supplied description of the VPC Flow Logs configuration. Maximum of 512 characters.
2017    pub description: Option<String>,
2018    /// Optional. Export filter used to define which VPC Flow Logs should be logged.
2019    #[serde(rename = "filterExpr")]
2020    pub filter_expr: Option<String>,
2021    /// Optional. The value of the field must be in (0, 1]. The sampling rate of VPC Flow Logs where 1.0 means all collected logs are reported. Setting the sampling rate to 0.0 is not allowed. If you want to disable VPC Flow Logs, use the state field instead. Default value is 1.0.
2022    #[serde(rename = "flowSampling")]
2023    pub flow_sampling: Option<f32>,
2024    /// Traffic will be logged from the Interconnect Attachment. Format: projects/{project_id}/regions/{region}/interconnectAttachments/{name}
2025    #[serde(rename = "interconnectAttachment")]
2026    pub interconnect_attachment: Option<String>,
2027    /// Optional. Resource labels to represent user-provided metadata.
2028    pub labels: Option<HashMap<String, String>>,
2029    /// Optional. Configures whether all, none or a subset of metadata fields should be added to the reported VPC flow logs. Default value is INCLUDE_ALL_METADATA.
2030    pub metadata: Option<String>,
2031    /// Optional. Custom metadata fields to include in the reported VPC flow logs. Can only be specified if "metadata" was set to CUSTOM_METADATA.
2032    #[serde(rename = "metadataFields")]
2033    pub metadata_fields: Option<Vec<String>>,
2034    /// Identifier. Unique name of the configuration. The name can have one of the following forms: - For project-level configurations: `projects/{project_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}` - For organization-level configurations: `organizations/{organization_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}`
2035    pub name: Option<String>,
2036    /// Traffic will be logged from VMs, VPN tunnels and Interconnect Attachments within the network. Format: projects/{project_id}/global/networks/{name}
2037    pub network: Option<String>,
2038    /// Optional. The state of the VPC Flow Log configuration. Default value is ENABLED. When creating a new configuration, it must be enabled. Setting state=DISABLED will pause the log generation for this config.
2039    pub state: Option<String>,
2040    /// Traffic will be logged from VMs within the subnetwork. Format: projects/{project_id}/regions/{region}/subnetworks/{name}
2041    pub subnet: Option<String>,
2042    /// Output only. Describes the state of the configured target resource for diagnostic purposes.
2043    #[serde(rename = "targetResourceState")]
2044    pub target_resource_state: Option<String>,
2045    /// Output only. The time the config was updated.
2046    #[serde(rename = "updateTime")]
2047    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2048    /// Traffic will be logged from the VPN Tunnel. Format: projects/{project_id}/regions/{region}/vpnTunnels/{name}
2049    #[serde(rename = "vpnTunnel")]
2050    pub vpn_tunnel: Option<String>,
2051}
2052
2053impl common::RequestValue for VpcFlowLogsConfig {}
2054impl common::ResponseResult for VpcFlowLogsConfig {}
2055
2056/// For display only. Metadata associated with a Compute Engine VPN gateway.
2057///
2058/// This type is not used in any activity, and only used as *part* of another schema.
2059///
2060#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2061#[serde_with::serde_as]
2062#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2063pub struct VpnGatewayInfo {
2064    /// Name of a VPN gateway.
2065    #[serde(rename = "displayName")]
2066    pub display_name: Option<String>,
2067    /// IP address of the VPN gateway.
2068    #[serde(rename = "ipAddress")]
2069    pub ip_address: Option<String>,
2070    /// URI of a Compute Engine network where the VPN gateway is configured.
2071    #[serde(rename = "networkUri")]
2072    pub network_uri: Option<String>,
2073    /// Name of a Google Cloud region where this VPN gateway is configured.
2074    pub region: Option<String>,
2075    /// URI of a VPN gateway.
2076    pub uri: Option<String>,
2077    /// A VPN tunnel that is associated with this VPN gateway. There may be multiple VPN tunnels configured on a VPN gateway, and only the one relevant to the test is displayed.
2078    #[serde(rename = "vpnTunnelUri")]
2079    pub vpn_tunnel_uri: Option<String>,
2080}
2081
2082impl common::Part for VpnGatewayInfo {}
2083
2084/// For display only. Metadata associated with a Compute Engine VPN tunnel.
2085///
2086/// This type is not used in any activity, and only used as *part* of another schema.
2087///
2088#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2089#[serde_with::serde_as]
2090#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2091pub struct VpnTunnelInfo {
2092    /// Name of a VPN tunnel.
2093    #[serde(rename = "displayName")]
2094    pub display_name: Option<String>,
2095    /// URI of a Compute Engine network where the VPN tunnel is configured.
2096    #[serde(rename = "networkUri")]
2097    pub network_uri: Option<String>,
2098    /// Name of a Google Cloud region where this VPN tunnel is configured.
2099    pub region: Option<String>,
2100    /// URI of a VPN gateway at remote end of the tunnel.
2101    #[serde(rename = "remoteGateway")]
2102    pub remote_gateway: Option<String>,
2103    /// Remote VPN gateway's IP address.
2104    #[serde(rename = "remoteGatewayIp")]
2105    pub remote_gateway_ip: Option<String>,
2106    /// Type of the routing policy.
2107    #[serde(rename = "routingType")]
2108    pub routing_type: Option<String>,
2109    /// URI of the VPN gateway at local end of the tunnel.
2110    #[serde(rename = "sourceGateway")]
2111    pub source_gateway: Option<String>,
2112    /// Local VPN gateway's IP address.
2113    #[serde(rename = "sourceGatewayIp")]
2114    pub source_gateway_ip: Option<String>,
2115    /// URI of a VPN tunnel.
2116    pub uri: Option<String>,
2117}
2118
2119impl common::Part for VpnTunnelInfo {}
2120
2121// ###################
2122// MethodBuilders ###
2123// #################
2124
2125/// A builder providing access to all methods supported on *organization* resources.
2126/// It is not used directly, but through the [`NetworkManagement`] hub.
2127///
2128/// # Example
2129///
2130/// Instantiate a resource builder
2131///
2132/// ```test_harness,no_run
2133/// extern crate hyper;
2134/// extern crate hyper_rustls;
2135/// extern crate google_networkmanagement1 as networkmanagement1;
2136///
2137/// # async fn dox() {
2138/// use networkmanagement1::{NetworkManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2139///
2140/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2141/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2142///     .with_native_roots()
2143///     .unwrap()
2144///     .https_only()
2145///     .enable_http2()
2146///     .build();
2147///
2148/// let executor = hyper_util::rt::TokioExecutor::new();
2149/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2150///     secret,
2151///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2152///     yup_oauth2::client::CustomHyperClientBuilder::from(
2153///         hyper_util::client::legacy::Client::builder(executor).build(connector),
2154///     ),
2155/// ).build().await.unwrap();
2156///
2157/// let client = hyper_util::client::legacy::Client::builder(
2158///     hyper_util::rt::TokioExecutor::new()
2159/// )
2160/// .build(
2161///     hyper_rustls::HttpsConnectorBuilder::new()
2162///         .with_native_roots()
2163///         .unwrap()
2164///         .https_or_http()
2165///         .enable_http2()
2166///         .build()
2167/// );
2168/// let mut hub = NetworkManagement::new(client, auth);
2169/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2170/// // like `locations_get(...)`, `locations_list(...)`, `locations_operations_cancel(...)`, `locations_operations_delete(...)`, `locations_operations_get(...)`, `locations_operations_list(...)`, `locations_vpc_flow_logs_configs_create(...)`, `locations_vpc_flow_logs_configs_delete(...)`, `locations_vpc_flow_logs_configs_get(...)`, `locations_vpc_flow_logs_configs_list(...)` and `locations_vpc_flow_logs_configs_patch(...)`
2171/// // to build up your call.
2172/// let rb = hub.organizations();
2173/// # }
2174/// ```
2175pub struct OrganizationMethods<'a, C>
2176where
2177    C: 'a,
2178{
2179    hub: &'a NetworkManagement<C>,
2180}
2181
2182impl<'a, C> common::MethodsBuilder for OrganizationMethods<'a, C> {}
2183
2184impl<'a, C> OrganizationMethods<'a, C> {
2185    /// Create a builder to help you perform the following task:
2186    ///
2187    /// 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`.
2188    ///
2189    /// # Arguments
2190    ///
2191    /// * `request` - No description provided.
2192    /// * `name` - The name of the operation resource to be cancelled.
2193    pub fn locations_operations_cancel(
2194        &self,
2195        request: CancelOperationRequest,
2196        name: &str,
2197    ) -> OrganizationLocationOperationCancelCall<'a, C> {
2198        OrganizationLocationOperationCancelCall {
2199            hub: self.hub,
2200            _request: request,
2201            _name: name.to_string(),
2202            _delegate: Default::default(),
2203            _additional_params: Default::default(),
2204            _scopes: Default::default(),
2205        }
2206    }
2207
2208    /// Create a builder to help you perform the following task:
2209    ///
2210    /// Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
2211    ///
2212    /// # Arguments
2213    ///
2214    /// * `name` - The name of the operation resource to be deleted.
2215    pub fn locations_operations_delete(
2216        &self,
2217        name: &str,
2218    ) -> OrganizationLocationOperationDeleteCall<'a, C> {
2219        OrganizationLocationOperationDeleteCall {
2220            hub: self.hub,
2221            _name: name.to_string(),
2222            _delegate: Default::default(),
2223            _additional_params: Default::default(),
2224            _scopes: Default::default(),
2225        }
2226    }
2227
2228    /// Create a builder to help you perform the following task:
2229    ///
2230    /// 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.
2231    ///
2232    /// # Arguments
2233    ///
2234    /// * `name` - The name of the operation resource.
2235    pub fn locations_operations_get(
2236        &self,
2237        name: &str,
2238    ) -> OrganizationLocationOperationGetCall<'a, C> {
2239        OrganizationLocationOperationGetCall {
2240            hub: self.hub,
2241            _name: name.to_string(),
2242            _delegate: Default::default(),
2243            _additional_params: Default::default(),
2244            _scopes: Default::default(),
2245        }
2246    }
2247
2248    /// Create a builder to help you perform the following task:
2249    ///
2250    /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
2251    ///
2252    /// # Arguments
2253    ///
2254    /// * `name` - The name of the operation's parent resource.
2255    pub fn locations_operations_list(
2256        &self,
2257        name: &str,
2258    ) -> OrganizationLocationOperationListCall<'a, C> {
2259        OrganizationLocationOperationListCall {
2260            hub: self.hub,
2261            _name: name.to_string(),
2262            _return_partial_success: Default::default(),
2263            _page_token: Default::default(),
2264            _page_size: Default::default(),
2265            _filter: Default::default(),
2266            _delegate: Default::default(),
2267            _additional_params: Default::default(),
2268            _scopes: Default::default(),
2269        }
2270    }
2271
2272    /// Create a builder to help you perform the following task:
2273    ///
2274    /// Creates a new `VpcFlowLogsConfig`. If a configuration with the exact same settings already exists (even if the ID is different), the creation fails. Notes: 1. Creating a configuration with `state=DISABLED` will fail 2. The following fields are not considered as settings for the purpose of the check mentioned above, therefore - creating another configuration with the same fields but different values for the following fields will fail as well: * name * create_time * update_time * labels * description
2275    ///
2276    /// # Arguments
2277    ///
2278    /// * `request` - No description provided.
2279    /// * `parent` - Required. The parent resource of the VpcFlowLogsConfig to create, in one of the following formats: - For project-level resources: `projects/{project_id}/locations/global` - For organization-level resources: `organizations/{organization_id}/locations/global`
2280    pub fn locations_vpc_flow_logs_configs_create(
2281        &self,
2282        request: VpcFlowLogsConfig,
2283        parent: &str,
2284    ) -> OrganizationLocationVpcFlowLogsConfigCreateCall<'a, C> {
2285        OrganizationLocationVpcFlowLogsConfigCreateCall {
2286            hub: self.hub,
2287            _request: request,
2288            _parent: parent.to_string(),
2289            _vpc_flow_logs_config_id: Default::default(),
2290            _delegate: Default::default(),
2291            _additional_params: Default::default(),
2292            _scopes: Default::default(),
2293        }
2294    }
2295
2296    /// Create a builder to help you perform the following task:
2297    ///
2298    /// Deletes a specific `VpcFlowLogsConfig`.
2299    ///
2300    /// # Arguments
2301    ///
2302    /// * `name` - Required. The resource name of the VpcFlowLogsConfig, in one of the following formats: - For a project-level resource: `projects/{project_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}` - For an organization-level resource: `organizations/{organization_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}`
2303    pub fn locations_vpc_flow_logs_configs_delete(
2304        &self,
2305        name: &str,
2306    ) -> OrganizationLocationVpcFlowLogsConfigDeleteCall<'a, C> {
2307        OrganizationLocationVpcFlowLogsConfigDeleteCall {
2308            hub: self.hub,
2309            _name: name.to_string(),
2310            _delegate: Default::default(),
2311            _additional_params: Default::default(),
2312            _scopes: Default::default(),
2313        }
2314    }
2315
2316    /// Create a builder to help you perform the following task:
2317    ///
2318    /// Gets the details of a specific `VpcFlowLogsConfig`.
2319    ///
2320    /// # Arguments
2321    ///
2322    /// * `name` - Required. The resource name of the VpcFlowLogsConfig, in one of the following formats: - For project-level resources: `projects/{project_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}` - For organization-level resources: `organizations/{organization_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}`
2323    pub fn locations_vpc_flow_logs_configs_get(
2324        &self,
2325        name: &str,
2326    ) -> OrganizationLocationVpcFlowLogsConfigGetCall<'a, C> {
2327        OrganizationLocationVpcFlowLogsConfigGetCall {
2328            hub: self.hub,
2329            _name: name.to_string(),
2330            _delegate: Default::default(),
2331            _additional_params: Default::default(),
2332            _scopes: Default::default(),
2333        }
2334    }
2335
2336    /// Create a builder to help you perform the following task:
2337    ///
2338    /// Lists all `VpcFlowLogsConfigs` in a given organization.
2339    ///
2340    /// # Arguments
2341    ///
2342    /// * `parent` - Required. The parent resource of the VpcFlowLogsConfig, in one of the following formats: - For project-level resources: `projects/{project_id}/locations/global` - For organization-level resources: `organizations/{organization_id}/locations/global`
2343    pub fn locations_vpc_flow_logs_configs_list(
2344        &self,
2345        parent: &str,
2346    ) -> OrganizationLocationVpcFlowLogsConfigListCall<'a, C> {
2347        OrganizationLocationVpcFlowLogsConfigListCall {
2348            hub: self.hub,
2349            _parent: parent.to_string(),
2350            _page_token: Default::default(),
2351            _page_size: Default::default(),
2352            _order_by: Default::default(),
2353            _filter: Default::default(),
2354            _delegate: Default::default(),
2355            _additional_params: Default::default(),
2356            _scopes: Default::default(),
2357        }
2358    }
2359
2360    /// Create a builder to help you perform the following task:
2361    ///
2362    /// Updates an existing `VpcFlowLogsConfig`. If a configuration with the exact same settings already exists (even if the ID is different), the creation fails. Notes: 1. Updating a configuration with `state=DISABLED` will fail 2. The following fields are not considered as settings for the purpose of the check mentioned above, therefore - updating another configuration with the same fields but different values for the following fields will fail as well: * name * create_time * update_time * labels * description
2363    ///
2364    /// # Arguments
2365    ///
2366    /// * `request` - No description provided.
2367    /// * `name` - Identifier. Unique name of the configuration. The name can have one of the following forms: - For project-level configurations: `projects/{project_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}` - For organization-level configurations: `organizations/{organization_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}`
2368    pub fn locations_vpc_flow_logs_configs_patch(
2369        &self,
2370        request: VpcFlowLogsConfig,
2371        name: &str,
2372    ) -> OrganizationLocationVpcFlowLogsConfigPatchCall<'a, C> {
2373        OrganizationLocationVpcFlowLogsConfigPatchCall {
2374            hub: self.hub,
2375            _request: request,
2376            _name: name.to_string(),
2377            _update_mask: Default::default(),
2378            _delegate: Default::default(),
2379            _additional_params: Default::default(),
2380            _scopes: Default::default(),
2381        }
2382    }
2383
2384    /// Create a builder to help you perform the following task:
2385    ///
2386    /// Gets information about a location.
2387    ///
2388    /// # Arguments
2389    ///
2390    /// * `name` - Resource name for the location.
2391    pub fn locations_get(&self, name: &str) -> OrganizationLocationGetCall<'a, C> {
2392        OrganizationLocationGetCall {
2393            hub: self.hub,
2394            _name: name.to_string(),
2395            _delegate: Default::default(),
2396            _additional_params: Default::default(),
2397            _scopes: Default::default(),
2398        }
2399    }
2400
2401    /// Create a builder to help you perform the following task:
2402    ///
2403    /// Lists information about the supported locations for this service.
2404    ///
2405    /// # Arguments
2406    ///
2407    /// * `name` - The resource that owns the locations collection, if applicable.
2408    pub fn locations_list(&self, name: &str) -> OrganizationLocationListCall<'a, C> {
2409        OrganizationLocationListCall {
2410            hub: self.hub,
2411            _name: name.to_string(),
2412            _page_token: Default::default(),
2413            _page_size: Default::default(),
2414            _filter: Default::default(),
2415            _extra_location_types: Default::default(),
2416            _delegate: Default::default(),
2417            _additional_params: Default::default(),
2418            _scopes: Default::default(),
2419        }
2420    }
2421}
2422
2423/// A builder providing access to all methods supported on *project* resources.
2424/// It is not used directly, but through the [`NetworkManagement`] hub.
2425///
2426/// # Example
2427///
2428/// Instantiate a resource builder
2429///
2430/// ```test_harness,no_run
2431/// extern crate hyper;
2432/// extern crate hyper_rustls;
2433/// extern crate google_networkmanagement1 as networkmanagement1;
2434///
2435/// # async fn dox() {
2436/// use networkmanagement1::{NetworkManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2437///
2438/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2439/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2440///     .with_native_roots()
2441///     .unwrap()
2442///     .https_only()
2443///     .enable_http2()
2444///     .build();
2445///
2446/// let executor = hyper_util::rt::TokioExecutor::new();
2447/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2448///     secret,
2449///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2450///     yup_oauth2::client::CustomHyperClientBuilder::from(
2451///         hyper_util::client::legacy::Client::builder(executor).build(connector),
2452///     ),
2453/// ).build().await.unwrap();
2454///
2455/// let client = hyper_util::client::legacy::Client::builder(
2456///     hyper_util::rt::TokioExecutor::new()
2457/// )
2458/// .build(
2459///     hyper_rustls::HttpsConnectorBuilder::new()
2460///         .with_native_roots()
2461///         .unwrap()
2462///         .https_or_http()
2463///         .enable_http2()
2464///         .build()
2465/// );
2466/// let mut hub = NetworkManagement::new(client, auth);
2467/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2468/// // like `locations_get(...)`, `locations_global_connectivity_tests_create(...)`, `locations_global_connectivity_tests_delete(...)`, `locations_global_connectivity_tests_get(...)`, `locations_global_connectivity_tests_get_iam_policy(...)`, `locations_global_connectivity_tests_list(...)`, `locations_global_connectivity_tests_patch(...)`, `locations_global_connectivity_tests_rerun(...)`, `locations_global_connectivity_tests_set_iam_policy(...)`, `locations_global_connectivity_tests_test_iam_permissions(...)`, `locations_global_operations_cancel(...)`, `locations_global_operations_delete(...)`, `locations_global_operations_get(...)`, `locations_global_operations_list(...)`, `locations_list(...)`, `locations_vpc_flow_logs_configs_create(...)`, `locations_vpc_flow_logs_configs_delete(...)`, `locations_vpc_flow_logs_configs_get(...)`, `locations_vpc_flow_logs_configs_list(...)`, `locations_vpc_flow_logs_configs_patch(...)`, `locations_vpc_flow_logs_configs_query_org_vpc_flow_logs_configs(...)` and `locations_vpc_flow_logs_configs_show_effective_flow_logs_configs(...)`
2469/// // to build up your call.
2470/// let rb = hub.projects();
2471/// # }
2472/// ```
2473pub struct ProjectMethods<'a, C>
2474where
2475    C: 'a,
2476{
2477    hub: &'a NetworkManagement<C>,
2478}
2479
2480impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
2481
2482impl<'a, C> ProjectMethods<'a, C> {
2483    /// Create a builder to help you perform the following task:
2484    ///
2485    /// Creates a new Connectivity Test. After you create a test, the reachability analysis is performed as part of the long running operation, which completes when the analysis completes. If the endpoint specifications in `ConnectivityTest` are invalid (for example, containing non-existent resources in the network, or you don't have read permissions to the network configurations of listed projects), then the reachability result returns a value of `UNKNOWN`. If the endpoint specifications in `ConnectivityTest` are incomplete, the reachability result returns a value of AMBIGUOUS. For more information, see the Connectivity Test documentation.
2486    ///
2487    /// # Arguments
2488    ///
2489    /// * `request` - No description provided.
2490    /// * `parent` - Required. The parent resource of the Connectivity Test to create: `projects/{project_id}/locations/global`
2491    pub fn locations_global_connectivity_tests_create(
2492        &self,
2493        request: ConnectivityTest,
2494        parent: &str,
2495    ) -> ProjectLocationGlobalConnectivityTestCreateCall<'a, C> {
2496        ProjectLocationGlobalConnectivityTestCreateCall {
2497            hub: self.hub,
2498            _request: request,
2499            _parent: parent.to_string(),
2500            _test_id: Default::default(),
2501            _delegate: Default::default(),
2502            _additional_params: Default::default(),
2503            _scopes: Default::default(),
2504        }
2505    }
2506
2507    /// Create a builder to help you perform the following task:
2508    ///
2509    /// Deletes a specific `ConnectivityTest`.
2510    ///
2511    /// # Arguments
2512    ///
2513    /// * `name` - Required. Connectivity Test resource name using the form: `projects/{project_id}/locations/global/connectivityTests/{test_id}`
2514    pub fn locations_global_connectivity_tests_delete(
2515        &self,
2516        name: &str,
2517    ) -> ProjectLocationGlobalConnectivityTestDeleteCall<'a, C> {
2518        ProjectLocationGlobalConnectivityTestDeleteCall {
2519            hub: self.hub,
2520            _name: name.to_string(),
2521            _delegate: Default::default(),
2522            _additional_params: Default::default(),
2523            _scopes: Default::default(),
2524        }
2525    }
2526
2527    /// Create a builder to help you perform the following task:
2528    ///
2529    /// Gets the details of a specific Connectivity Test.
2530    ///
2531    /// # Arguments
2532    ///
2533    /// * `name` - Required. `ConnectivityTest` resource name using the form: `projects/{project_id}/locations/global/connectivityTests/{test_id}`
2534    pub fn locations_global_connectivity_tests_get(
2535        &self,
2536        name: &str,
2537    ) -> ProjectLocationGlobalConnectivityTestGetCall<'a, C> {
2538        ProjectLocationGlobalConnectivityTestGetCall {
2539            hub: self.hub,
2540            _name: name.to_string(),
2541            _delegate: Default::default(),
2542            _additional_params: Default::default(),
2543            _scopes: Default::default(),
2544        }
2545    }
2546
2547    /// Create a builder to help you perform the following task:
2548    ///
2549    /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
2550    ///
2551    /// # Arguments
2552    ///
2553    /// * `resource` - REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
2554    pub fn locations_global_connectivity_tests_get_iam_policy(
2555        &self,
2556        resource: &str,
2557    ) -> ProjectLocationGlobalConnectivityTestGetIamPolicyCall<'a, C> {
2558        ProjectLocationGlobalConnectivityTestGetIamPolicyCall {
2559            hub: self.hub,
2560            _resource: resource.to_string(),
2561            _options_requested_policy_version: Default::default(),
2562            _delegate: Default::default(),
2563            _additional_params: Default::default(),
2564            _scopes: Default::default(),
2565        }
2566    }
2567
2568    /// Create a builder to help you perform the following task:
2569    ///
2570    /// Lists all Connectivity Tests owned by a project.
2571    ///
2572    /// # Arguments
2573    ///
2574    /// * `parent` - Required. The parent resource of the Connectivity Tests: `projects/{project_id}/locations/global`
2575    pub fn locations_global_connectivity_tests_list(
2576        &self,
2577        parent: &str,
2578    ) -> ProjectLocationGlobalConnectivityTestListCall<'a, C> {
2579        ProjectLocationGlobalConnectivityTestListCall {
2580            hub: self.hub,
2581            _parent: parent.to_string(),
2582            _page_token: Default::default(),
2583            _page_size: Default::default(),
2584            _order_by: Default::default(),
2585            _filter: Default::default(),
2586            _delegate: Default::default(),
2587            _additional_params: Default::default(),
2588            _scopes: Default::default(),
2589        }
2590    }
2591
2592    /// Create a builder to help you perform the following task:
2593    ///
2594    /// Updates the configuration of an existing `ConnectivityTest`. After you update a test, the reachability analysis is performed as part of the long running operation, which completes when the analysis completes. The Reachability state in the test resource is updated with the new result. If the endpoint specifications in `ConnectivityTest` are invalid (for example, they contain non-existent resources in the network, or the user does not have read permissions to the network configurations of listed projects), then the reachability result returns a value of UNKNOWN. If the endpoint specifications in `ConnectivityTest` are incomplete, the reachability result returns a value of `AMBIGUOUS`. See the documentation in `ConnectivityTest` for more details.
2595    ///
2596    /// # Arguments
2597    ///
2598    /// * `request` - No description provided.
2599    /// * `name` - Identifier. Unique name of the resource using the form: `projects/{project_id}/locations/global/connectivityTests/{test_id}`
2600    pub fn locations_global_connectivity_tests_patch(
2601        &self,
2602        request: ConnectivityTest,
2603        name: &str,
2604    ) -> ProjectLocationGlobalConnectivityTestPatchCall<'a, C> {
2605        ProjectLocationGlobalConnectivityTestPatchCall {
2606            hub: self.hub,
2607            _request: request,
2608            _name: name.to_string(),
2609            _update_mask: Default::default(),
2610            _delegate: Default::default(),
2611            _additional_params: Default::default(),
2612            _scopes: Default::default(),
2613        }
2614    }
2615
2616    /// Create a builder to help you perform the following task:
2617    ///
2618    /// Rerun an existing `ConnectivityTest`. After the user triggers the rerun, the reachability analysis is performed as part of the long running operation, which completes when the analysis completes. Even though the test configuration remains the same, the reachability result may change due to underlying network configuration changes. If the endpoint specifications in `ConnectivityTest` become invalid (for example, specified resources are deleted in the network, or you lost read permissions to the network configurations of listed projects), then the reachability result returns a value of `UNKNOWN`.
2619    ///
2620    /// # Arguments
2621    ///
2622    /// * `request` - No description provided.
2623    /// * `name` - Required. Connectivity Test resource name using the form: `projects/{project_id}/locations/global/connectivityTests/{test_id}`
2624    pub fn locations_global_connectivity_tests_rerun(
2625        &self,
2626        request: RerunConnectivityTestRequest,
2627        name: &str,
2628    ) -> ProjectLocationGlobalConnectivityTestRerunCall<'a, C> {
2629        ProjectLocationGlobalConnectivityTestRerunCall {
2630            hub: self.hub,
2631            _request: request,
2632            _name: name.to_string(),
2633            _delegate: Default::default(),
2634            _additional_params: Default::default(),
2635            _scopes: Default::default(),
2636        }
2637    }
2638
2639    /// Create a builder to help you perform the following task:
2640    ///
2641    /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
2642    ///
2643    /// # Arguments
2644    ///
2645    /// * `request` - No description provided.
2646    /// * `resource` - REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
2647    pub fn locations_global_connectivity_tests_set_iam_policy(
2648        &self,
2649        request: SetIamPolicyRequest,
2650        resource: &str,
2651    ) -> ProjectLocationGlobalConnectivityTestSetIamPolicyCall<'a, C> {
2652        ProjectLocationGlobalConnectivityTestSetIamPolicyCall {
2653            hub: self.hub,
2654            _request: request,
2655            _resource: resource.to_string(),
2656            _delegate: Default::default(),
2657            _additional_params: Default::default(),
2658            _scopes: Default::default(),
2659        }
2660    }
2661
2662    /// Create a builder to help you perform the following task:
2663    ///
2664    /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
2665    ///
2666    /// # Arguments
2667    ///
2668    /// * `request` - No description provided.
2669    /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
2670    pub fn locations_global_connectivity_tests_test_iam_permissions(
2671        &self,
2672        request: TestIamPermissionsRequest,
2673        resource: &str,
2674    ) -> ProjectLocationGlobalConnectivityTestTestIamPermissionCall<'a, C> {
2675        ProjectLocationGlobalConnectivityTestTestIamPermissionCall {
2676            hub: self.hub,
2677            _request: request,
2678            _resource: resource.to_string(),
2679            _delegate: Default::default(),
2680            _additional_params: Default::default(),
2681            _scopes: Default::default(),
2682        }
2683    }
2684
2685    /// Create a builder to help you perform the following task:
2686    ///
2687    /// 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`.
2688    ///
2689    /// # Arguments
2690    ///
2691    /// * `request` - No description provided.
2692    /// * `name` - The name of the operation resource to be cancelled.
2693    pub fn locations_global_operations_cancel(
2694        &self,
2695        request: CancelOperationRequest,
2696        name: &str,
2697    ) -> ProjectLocationGlobalOperationCancelCall<'a, C> {
2698        ProjectLocationGlobalOperationCancelCall {
2699            hub: self.hub,
2700            _request: request,
2701            _name: name.to_string(),
2702            _delegate: Default::default(),
2703            _additional_params: Default::default(),
2704            _scopes: Default::default(),
2705        }
2706    }
2707
2708    /// Create a builder to help you perform the following task:
2709    ///
2710    /// Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
2711    ///
2712    /// # Arguments
2713    ///
2714    /// * `name` - The name of the operation resource to be deleted.
2715    pub fn locations_global_operations_delete(
2716        &self,
2717        name: &str,
2718    ) -> ProjectLocationGlobalOperationDeleteCall<'a, C> {
2719        ProjectLocationGlobalOperationDeleteCall {
2720            hub: self.hub,
2721            _name: name.to_string(),
2722            _delegate: Default::default(),
2723            _additional_params: Default::default(),
2724            _scopes: Default::default(),
2725        }
2726    }
2727
2728    /// Create a builder to help you perform the following task:
2729    ///
2730    /// 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.
2731    ///
2732    /// # Arguments
2733    ///
2734    /// * `name` - The name of the operation resource.
2735    pub fn locations_global_operations_get(
2736        &self,
2737        name: &str,
2738    ) -> ProjectLocationGlobalOperationGetCall<'a, C> {
2739        ProjectLocationGlobalOperationGetCall {
2740            hub: self.hub,
2741            _name: name.to_string(),
2742            _delegate: Default::default(),
2743            _additional_params: Default::default(),
2744            _scopes: Default::default(),
2745        }
2746    }
2747
2748    /// Create a builder to help you perform the following task:
2749    ///
2750    /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
2751    ///
2752    /// # Arguments
2753    ///
2754    /// * `name` - The name of the operation's parent resource.
2755    pub fn locations_global_operations_list(
2756        &self,
2757        name: &str,
2758    ) -> ProjectLocationGlobalOperationListCall<'a, C> {
2759        ProjectLocationGlobalOperationListCall {
2760            hub: self.hub,
2761            _name: name.to_string(),
2762            _return_partial_success: Default::default(),
2763            _page_token: Default::default(),
2764            _page_size: Default::default(),
2765            _filter: Default::default(),
2766            _delegate: Default::default(),
2767            _additional_params: Default::default(),
2768            _scopes: Default::default(),
2769        }
2770    }
2771
2772    /// Create a builder to help you perform the following task:
2773    ///
2774    /// Creates a new `VpcFlowLogsConfig`. If a configuration with the exact same settings already exists (even if the ID is different), the creation fails. Notes: 1. Creating a configuration with `state=DISABLED` will fail 2. The following fields are not considered as settings for the purpose of the check mentioned above, therefore - creating another configuration with the same fields but different values for the following fields will fail as well: * name * create_time * update_time * labels * description
2775    ///
2776    /// # Arguments
2777    ///
2778    /// * `request` - No description provided.
2779    /// * `parent` - Required. The parent resource of the VpcFlowLogsConfig to create, in one of the following formats: - For project-level resources: `projects/{project_id}/locations/global` - For organization-level resources: `organizations/{organization_id}/locations/global`
2780    pub fn locations_vpc_flow_logs_configs_create(
2781        &self,
2782        request: VpcFlowLogsConfig,
2783        parent: &str,
2784    ) -> ProjectLocationVpcFlowLogsConfigCreateCall<'a, C> {
2785        ProjectLocationVpcFlowLogsConfigCreateCall {
2786            hub: self.hub,
2787            _request: request,
2788            _parent: parent.to_string(),
2789            _vpc_flow_logs_config_id: Default::default(),
2790            _delegate: Default::default(),
2791            _additional_params: Default::default(),
2792            _scopes: Default::default(),
2793        }
2794    }
2795
2796    /// Create a builder to help you perform the following task:
2797    ///
2798    /// Deletes a specific `VpcFlowLogsConfig`.
2799    ///
2800    /// # Arguments
2801    ///
2802    /// * `name` - Required. The resource name of the VpcFlowLogsConfig, in one of the following formats: - For a project-level resource: `projects/{project_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}` - For an organization-level resource: `organizations/{organization_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}`
2803    pub fn locations_vpc_flow_logs_configs_delete(
2804        &self,
2805        name: &str,
2806    ) -> ProjectLocationVpcFlowLogsConfigDeleteCall<'a, C> {
2807        ProjectLocationVpcFlowLogsConfigDeleteCall {
2808            hub: self.hub,
2809            _name: name.to_string(),
2810            _delegate: Default::default(),
2811            _additional_params: Default::default(),
2812            _scopes: Default::default(),
2813        }
2814    }
2815
2816    /// Create a builder to help you perform the following task:
2817    ///
2818    /// Gets the details of a specific `VpcFlowLogsConfig`.
2819    ///
2820    /// # Arguments
2821    ///
2822    /// * `name` - Required. The resource name of the VpcFlowLogsConfig, in one of the following formats: - For project-level resources: `projects/{project_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}` - For organization-level resources: `organizations/{organization_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}`
2823    pub fn locations_vpc_flow_logs_configs_get(
2824        &self,
2825        name: &str,
2826    ) -> ProjectLocationVpcFlowLogsConfigGetCall<'a, C> {
2827        ProjectLocationVpcFlowLogsConfigGetCall {
2828            hub: self.hub,
2829            _name: name.to_string(),
2830            _delegate: Default::default(),
2831            _additional_params: Default::default(),
2832            _scopes: Default::default(),
2833        }
2834    }
2835
2836    /// Create a builder to help you perform the following task:
2837    ///
2838    /// Lists all `VpcFlowLogsConfigs` in a given project.
2839    ///
2840    /// # Arguments
2841    ///
2842    /// * `parent` - Required. The parent resource of the VpcFlowLogsConfig, in one of the following formats: - For project-level resources: `projects/{project_id}/locations/global` - For organization-level resources: `organizations/{organization_id}/locations/global`
2843    pub fn locations_vpc_flow_logs_configs_list(
2844        &self,
2845        parent: &str,
2846    ) -> ProjectLocationVpcFlowLogsConfigListCall<'a, C> {
2847        ProjectLocationVpcFlowLogsConfigListCall {
2848            hub: self.hub,
2849            _parent: parent.to_string(),
2850            _page_token: Default::default(),
2851            _page_size: Default::default(),
2852            _order_by: Default::default(),
2853            _filter: Default::default(),
2854            _delegate: Default::default(),
2855            _additional_params: Default::default(),
2856            _scopes: Default::default(),
2857        }
2858    }
2859
2860    /// Create a builder to help you perform the following task:
2861    ///
2862    /// Updates an existing `VpcFlowLogsConfig`. If a configuration with the exact same settings already exists (even if the ID is different), the creation fails. Notes: 1. Updating a configuration with `state=DISABLED` will fail. 2. The following fields are not considered as settings for the purpose of the check mentioned above, therefore - updating another configuration with the same fields but different values for the following fields will fail as well: * name * create_time * update_time * labels * description
2863    ///
2864    /// # Arguments
2865    ///
2866    /// * `request` - No description provided.
2867    /// * `name` - Identifier. Unique name of the configuration. The name can have one of the following forms: - For project-level configurations: `projects/{project_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}` - For organization-level configurations: `organizations/{organization_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}`
2868    pub fn locations_vpc_flow_logs_configs_patch(
2869        &self,
2870        request: VpcFlowLogsConfig,
2871        name: &str,
2872    ) -> ProjectLocationVpcFlowLogsConfigPatchCall<'a, C> {
2873        ProjectLocationVpcFlowLogsConfigPatchCall {
2874            hub: self.hub,
2875            _request: request,
2876            _name: name.to_string(),
2877            _update_mask: Default::default(),
2878            _delegate: Default::default(),
2879            _additional_params: Default::default(),
2880            _scopes: Default::default(),
2881        }
2882    }
2883
2884    /// Create a builder to help you perform the following task:
2885    ///
2886    /// QueryOrgVpcFlowLogsConfigs returns a list of all organization-level VPC Flow Logs configurations applicable to the specified project.
2887    ///
2888    /// # Arguments
2889    ///
2890    /// * `parent` - Required. The parent resource of the VpcFlowLogsConfig, specified in the following format: `projects/{project_id}/locations/global`
2891    pub fn locations_vpc_flow_logs_configs_query_org_vpc_flow_logs_configs(
2892        &self,
2893        parent: &str,
2894    ) -> ProjectLocationVpcFlowLogsConfigQueryOrgVpcFlowLogsConfigCall<'a, C> {
2895        ProjectLocationVpcFlowLogsConfigQueryOrgVpcFlowLogsConfigCall {
2896            hub: self.hub,
2897            _parent: parent.to_string(),
2898            _page_token: Default::default(),
2899            _page_size: Default::default(),
2900            _filter: Default::default(),
2901            _delegate: Default::default(),
2902            _additional_params: Default::default(),
2903            _scopes: Default::default(),
2904        }
2905    }
2906
2907    /// Create a builder to help you perform the following task:
2908    ///
2909    /// ShowEffectiveFlowLogsConfigs returns a list of all VPC Flow Logs configurations applicable to a specified resource.
2910    ///
2911    /// # Arguments
2912    ///
2913    /// * `parent` - Required. The parent resource of the VpcFlowLogsConfig, specified in the following format: `projects/{project_id}/locations/global`
2914    pub fn locations_vpc_flow_logs_configs_show_effective_flow_logs_configs(
2915        &self,
2916        parent: &str,
2917    ) -> ProjectLocationVpcFlowLogsConfigShowEffectiveFlowLogsConfigCall<'a, C> {
2918        ProjectLocationVpcFlowLogsConfigShowEffectiveFlowLogsConfigCall {
2919            hub: self.hub,
2920            _parent: parent.to_string(),
2921            _resource: Default::default(),
2922            _page_token: Default::default(),
2923            _page_size: Default::default(),
2924            _filter: Default::default(),
2925            _delegate: Default::default(),
2926            _additional_params: Default::default(),
2927            _scopes: Default::default(),
2928        }
2929    }
2930
2931    /// Create a builder to help you perform the following task:
2932    ///
2933    /// Gets information about a location.
2934    ///
2935    /// # Arguments
2936    ///
2937    /// * `name` - Resource name for the location.
2938    pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, C> {
2939        ProjectLocationGetCall {
2940            hub: self.hub,
2941            _name: name.to_string(),
2942            _delegate: Default::default(),
2943            _additional_params: Default::default(),
2944            _scopes: Default::default(),
2945        }
2946    }
2947
2948    /// Create a builder to help you perform the following task:
2949    ///
2950    /// Lists information about the supported locations for this service.
2951    ///
2952    /// # Arguments
2953    ///
2954    /// * `name` - The resource that owns the locations collection, if applicable.
2955    pub fn locations_list(&self, name: &str) -> ProjectLocationListCall<'a, C> {
2956        ProjectLocationListCall {
2957            hub: self.hub,
2958            _name: name.to_string(),
2959            _page_token: Default::default(),
2960            _page_size: Default::default(),
2961            _filter: Default::default(),
2962            _extra_location_types: Default::default(),
2963            _delegate: Default::default(),
2964            _additional_params: Default::default(),
2965            _scopes: Default::default(),
2966        }
2967    }
2968}
2969
2970// ###################
2971// CallBuilders   ###
2972// #################
2973
2974/// 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`.
2975///
2976/// A builder for the *locations.operations.cancel* method supported by a *organization* resource.
2977/// It is not used directly, but through a [`OrganizationMethods`] instance.
2978///
2979/// # Example
2980///
2981/// Instantiate a resource method builder
2982///
2983/// ```test_harness,no_run
2984/// # extern crate hyper;
2985/// # extern crate hyper_rustls;
2986/// # extern crate google_networkmanagement1 as networkmanagement1;
2987/// use networkmanagement1::api::CancelOperationRequest;
2988/// # async fn dox() {
2989/// # use networkmanagement1::{NetworkManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2990///
2991/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2992/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2993/// #     .with_native_roots()
2994/// #     .unwrap()
2995/// #     .https_only()
2996/// #     .enable_http2()
2997/// #     .build();
2998///
2999/// # let executor = hyper_util::rt::TokioExecutor::new();
3000/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3001/// #     secret,
3002/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3003/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3004/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3005/// #     ),
3006/// # ).build().await.unwrap();
3007///
3008/// # let client = hyper_util::client::legacy::Client::builder(
3009/// #     hyper_util::rt::TokioExecutor::new()
3010/// # )
3011/// # .build(
3012/// #     hyper_rustls::HttpsConnectorBuilder::new()
3013/// #         .with_native_roots()
3014/// #         .unwrap()
3015/// #         .https_or_http()
3016/// #         .enable_http2()
3017/// #         .build()
3018/// # );
3019/// # let mut hub = NetworkManagement::new(client, auth);
3020/// // As the method needs a request, you would usually fill it with the desired information
3021/// // into the respective structure. Some of the parts shown here might not be applicable !
3022/// // Values shown here are possibly random and not representative !
3023/// let mut req = CancelOperationRequest::default();
3024///
3025/// // You can configure optional parameters by calling the respective setters at will, and
3026/// // execute the final call using `doit()`.
3027/// // Values shown here are possibly random and not representative !
3028/// let result = hub.organizations().locations_operations_cancel(req, "name")
3029///              .doit().await;
3030/// # }
3031/// ```
3032pub struct OrganizationLocationOperationCancelCall<'a, C>
3033where
3034    C: 'a,
3035{
3036    hub: &'a NetworkManagement<C>,
3037    _request: CancelOperationRequest,
3038    _name: String,
3039    _delegate: Option<&'a mut dyn common::Delegate>,
3040    _additional_params: HashMap<String, String>,
3041    _scopes: BTreeSet<String>,
3042}
3043
3044impl<'a, C> common::CallBuilder for OrganizationLocationOperationCancelCall<'a, C> {}
3045
3046impl<'a, C> OrganizationLocationOperationCancelCall<'a, C>
3047where
3048    C: common::Connector,
3049{
3050    /// Perform the operation you have build so far.
3051    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
3052        use std::borrow::Cow;
3053        use std::io::{Read, Seek};
3054
3055        use common::{url::Params, ToParts};
3056        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3057
3058        let mut dd = common::DefaultDelegate;
3059        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3060        dlg.begin(common::MethodInfo {
3061            id: "networkmanagement.organizations.locations.operations.cancel",
3062            http_method: hyper::Method::POST,
3063        });
3064
3065        for &field in ["alt", "name"].iter() {
3066            if self._additional_params.contains_key(field) {
3067                dlg.finished(false);
3068                return Err(common::Error::FieldClash(field));
3069            }
3070        }
3071
3072        let mut params = Params::with_capacity(4 + self._additional_params.len());
3073        params.push("name", self._name);
3074
3075        params.extend(self._additional_params.iter());
3076
3077        params.push("alt", "json");
3078        let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
3079        if self._scopes.is_empty() {
3080            self._scopes
3081                .insert(Scope::CloudPlatform.as_ref().to_string());
3082        }
3083
3084        #[allow(clippy::single_element_loop)]
3085        for &(find_this, param_name) in [("{+name}", "name")].iter() {
3086            url = params.uri_replacement(url, param_name, find_this, true);
3087        }
3088        {
3089            let to_remove = ["name"];
3090            params.remove_params(&to_remove);
3091        }
3092
3093        let url = params.parse_with_url(&url);
3094
3095        let mut json_mime_type = mime::APPLICATION_JSON;
3096        let mut request_value_reader = {
3097            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3098            common::remove_json_null_values(&mut value);
3099            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3100            serde_json::to_writer(&mut dst, &value).unwrap();
3101            dst
3102        };
3103        let request_size = request_value_reader
3104            .seek(std::io::SeekFrom::End(0))
3105            .unwrap();
3106        request_value_reader
3107            .seek(std::io::SeekFrom::Start(0))
3108            .unwrap();
3109
3110        loop {
3111            let token = match self
3112                .hub
3113                .auth
3114                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3115                .await
3116            {
3117                Ok(token) => token,
3118                Err(e) => match dlg.token(e) {
3119                    Ok(token) => token,
3120                    Err(e) => {
3121                        dlg.finished(false);
3122                        return Err(common::Error::MissingToken(e));
3123                    }
3124                },
3125            };
3126            request_value_reader
3127                .seek(std::io::SeekFrom::Start(0))
3128                .unwrap();
3129            let mut req_result = {
3130                let client = &self.hub.client;
3131                dlg.pre_request();
3132                let mut req_builder = hyper::Request::builder()
3133                    .method(hyper::Method::POST)
3134                    .uri(url.as_str())
3135                    .header(USER_AGENT, self.hub._user_agent.clone());
3136
3137                if let Some(token) = token.as_ref() {
3138                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3139                }
3140
3141                let request = req_builder
3142                    .header(CONTENT_TYPE, json_mime_type.to_string())
3143                    .header(CONTENT_LENGTH, request_size as u64)
3144                    .body(common::to_body(
3145                        request_value_reader.get_ref().clone().into(),
3146                    ));
3147
3148                client.request(request.unwrap()).await
3149            };
3150
3151            match req_result {
3152                Err(err) => {
3153                    if let common::Retry::After(d) = dlg.http_error(&err) {
3154                        sleep(d).await;
3155                        continue;
3156                    }
3157                    dlg.finished(false);
3158                    return Err(common::Error::HttpError(err));
3159                }
3160                Ok(res) => {
3161                    let (mut parts, body) = res.into_parts();
3162                    let mut body = common::Body::new(body);
3163                    if !parts.status.is_success() {
3164                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3165                        let error = serde_json::from_str(&common::to_string(&bytes));
3166                        let response = common::to_response(parts, bytes.into());
3167
3168                        if let common::Retry::After(d) =
3169                            dlg.http_failure(&response, error.as_ref().ok())
3170                        {
3171                            sleep(d).await;
3172                            continue;
3173                        }
3174
3175                        dlg.finished(false);
3176
3177                        return Err(match error {
3178                            Ok(value) => common::Error::BadRequest(value),
3179                            _ => common::Error::Failure(response),
3180                        });
3181                    }
3182                    let response = {
3183                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3184                        let encoded = common::to_string(&bytes);
3185                        match serde_json::from_str(&encoded) {
3186                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3187                            Err(error) => {
3188                                dlg.response_json_decode_error(&encoded, &error);
3189                                return Err(common::Error::JsonDecodeError(
3190                                    encoded.to_string(),
3191                                    error,
3192                                ));
3193                            }
3194                        }
3195                    };
3196
3197                    dlg.finished(true);
3198                    return Ok(response);
3199                }
3200            }
3201        }
3202    }
3203
3204    ///
3205    /// Sets the *request* property to the given value.
3206    ///
3207    /// Even though the property as already been set when instantiating this call,
3208    /// we provide this method for API completeness.
3209    pub fn request(
3210        mut self,
3211        new_value: CancelOperationRequest,
3212    ) -> OrganizationLocationOperationCancelCall<'a, C> {
3213        self._request = new_value;
3214        self
3215    }
3216    /// The name of the operation resource to be cancelled.
3217    ///
3218    /// Sets the *name* path property to the given value.
3219    ///
3220    /// Even though the property as already been set when instantiating this call,
3221    /// we provide this method for API completeness.
3222    pub fn name(mut self, new_value: &str) -> OrganizationLocationOperationCancelCall<'a, C> {
3223        self._name = new_value.to_string();
3224        self
3225    }
3226    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3227    /// while executing the actual API request.
3228    ///
3229    /// ````text
3230    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3231    /// ````
3232    ///
3233    /// Sets the *delegate* property to the given value.
3234    pub fn delegate(
3235        mut self,
3236        new_value: &'a mut dyn common::Delegate,
3237    ) -> OrganizationLocationOperationCancelCall<'a, C> {
3238        self._delegate = Some(new_value);
3239        self
3240    }
3241
3242    /// Set any additional parameter of the query string used in the request.
3243    /// It should be used to set parameters which are not yet available through their own
3244    /// setters.
3245    ///
3246    /// Please note that this method must not be used to set any of the known parameters
3247    /// which have their own setter method. If done anyway, the request will fail.
3248    ///
3249    /// # Additional Parameters
3250    ///
3251    /// * *$.xgafv* (query-string) - V1 error format.
3252    /// * *access_token* (query-string) - OAuth access token.
3253    /// * *alt* (query-string) - Data format for response.
3254    /// * *callback* (query-string) - JSONP
3255    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3256    /// * *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.
3257    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3258    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3259    /// * *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.
3260    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3261    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3262    pub fn param<T>(mut self, name: T, value: T) -> OrganizationLocationOperationCancelCall<'a, C>
3263    where
3264        T: AsRef<str>,
3265    {
3266        self._additional_params
3267            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3268        self
3269    }
3270
3271    /// Identifies the authorization scope for the method you are building.
3272    ///
3273    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3274    /// [`Scope::CloudPlatform`].
3275    ///
3276    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3277    /// tokens for more than one scope.
3278    ///
3279    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3280    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3281    /// sufficient, a read-write scope will do as well.
3282    pub fn add_scope<St>(mut self, scope: St) -> OrganizationLocationOperationCancelCall<'a, C>
3283    where
3284        St: AsRef<str>,
3285    {
3286        self._scopes.insert(String::from(scope.as_ref()));
3287        self
3288    }
3289    /// Identifies the authorization scope(s) for the method you are building.
3290    ///
3291    /// See [`Self::add_scope()`] for details.
3292    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrganizationLocationOperationCancelCall<'a, C>
3293    where
3294        I: IntoIterator<Item = St>,
3295        St: AsRef<str>,
3296    {
3297        self._scopes
3298            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3299        self
3300    }
3301
3302    /// Removes all scopes, and no default scope will be used either.
3303    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3304    /// for details).
3305    pub fn clear_scopes(mut self) -> OrganizationLocationOperationCancelCall<'a, C> {
3306        self._scopes.clear();
3307        self
3308    }
3309}
3310
3311/// Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
3312///
3313/// A builder for the *locations.operations.delete* method supported by a *organization* resource.
3314/// It is not used directly, but through a [`OrganizationMethods`] instance.
3315///
3316/// # Example
3317///
3318/// Instantiate a resource method builder
3319///
3320/// ```test_harness,no_run
3321/// # extern crate hyper;
3322/// # extern crate hyper_rustls;
3323/// # extern crate google_networkmanagement1 as networkmanagement1;
3324/// # async fn dox() {
3325/// # use networkmanagement1::{NetworkManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3326///
3327/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3328/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3329/// #     .with_native_roots()
3330/// #     .unwrap()
3331/// #     .https_only()
3332/// #     .enable_http2()
3333/// #     .build();
3334///
3335/// # let executor = hyper_util::rt::TokioExecutor::new();
3336/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3337/// #     secret,
3338/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3339/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3340/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3341/// #     ),
3342/// # ).build().await.unwrap();
3343///
3344/// # let client = hyper_util::client::legacy::Client::builder(
3345/// #     hyper_util::rt::TokioExecutor::new()
3346/// # )
3347/// # .build(
3348/// #     hyper_rustls::HttpsConnectorBuilder::new()
3349/// #         .with_native_roots()
3350/// #         .unwrap()
3351/// #         .https_or_http()
3352/// #         .enable_http2()
3353/// #         .build()
3354/// # );
3355/// # let mut hub = NetworkManagement::new(client, auth);
3356/// // You can configure optional parameters by calling the respective setters at will, and
3357/// // execute the final call using `doit()`.
3358/// // Values shown here are possibly random and not representative !
3359/// let result = hub.organizations().locations_operations_delete("name")
3360///              .doit().await;
3361/// # }
3362/// ```
3363pub struct OrganizationLocationOperationDeleteCall<'a, C>
3364where
3365    C: 'a,
3366{
3367    hub: &'a NetworkManagement<C>,
3368    _name: String,
3369    _delegate: Option<&'a mut dyn common::Delegate>,
3370    _additional_params: HashMap<String, String>,
3371    _scopes: BTreeSet<String>,
3372}
3373
3374impl<'a, C> common::CallBuilder for OrganizationLocationOperationDeleteCall<'a, C> {}
3375
3376impl<'a, C> OrganizationLocationOperationDeleteCall<'a, C>
3377where
3378    C: common::Connector,
3379{
3380    /// Perform the operation you have build so far.
3381    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
3382        use std::borrow::Cow;
3383        use std::io::{Read, Seek};
3384
3385        use common::{url::Params, ToParts};
3386        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3387
3388        let mut dd = common::DefaultDelegate;
3389        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3390        dlg.begin(common::MethodInfo {
3391            id: "networkmanagement.organizations.locations.operations.delete",
3392            http_method: hyper::Method::DELETE,
3393        });
3394
3395        for &field in ["alt", "name"].iter() {
3396            if self._additional_params.contains_key(field) {
3397                dlg.finished(false);
3398                return Err(common::Error::FieldClash(field));
3399            }
3400        }
3401
3402        let mut params = Params::with_capacity(3 + self._additional_params.len());
3403        params.push("name", self._name);
3404
3405        params.extend(self._additional_params.iter());
3406
3407        params.push("alt", "json");
3408        let mut url = self.hub._base_url.clone() + "v1/{+name}";
3409        if self._scopes.is_empty() {
3410            self._scopes
3411                .insert(Scope::CloudPlatform.as_ref().to_string());
3412        }
3413
3414        #[allow(clippy::single_element_loop)]
3415        for &(find_this, param_name) in [("{+name}", "name")].iter() {
3416            url = params.uri_replacement(url, param_name, find_this, true);
3417        }
3418        {
3419            let to_remove = ["name"];
3420            params.remove_params(&to_remove);
3421        }
3422
3423        let url = params.parse_with_url(&url);
3424
3425        loop {
3426            let token = match self
3427                .hub
3428                .auth
3429                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3430                .await
3431            {
3432                Ok(token) => token,
3433                Err(e) => match dlg.token(e) {
3434                    Ok(token) => token,
3435                    Err(e) => {
3436                        dlg.finished(false);
3437                        return Err(common::Error::MissingToken(e));
3438                    }
3439                },
3440            };
3441            let mut req_result = {
3442                let client = &self.hub.client;
3443                dlg.pre_request();
3444                let mut req_builder = hyper::Request::builder()
3445                    .method(hyper::Method::DELETE)
3446                    .uri(url.as_str())
3447                    .header(USER_AGENT, self.hub._user_agent.clone());
3448
3449                if let Some(token) = token.as_ref() {
3450                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3451                }
3452
3453                let request = req_builder
3454                    .header(CONTENT_LENGTH, 0_u64)
3455                    .body(common::to_body::<String>(None));
3456
3457                client.request(request.unwrap()).await
3458            };
3459
3460            match req_result {
3461                Err(err) => {
3462                    if let common::Retry::After(d) = dlg.http_error(&err) {
3463                        sleep(d).await;
3464                        continue;
3465                    }
3466                    dlg.finished(false);
3467                    return Err(common::Error::HttpError(err));
3468                }
3469                Ok(res) => {
3470                    let (mut parts, body) = res.into_parts();
3471                    let mut body = common::Body::new(body);
3472                    if !parts.status.is_success() {
3473                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3474                        let error = serde_json::from_str(&common::to_string(&bytes));
3475                        let response = common::to_response(parts, bytes.into());
3476
3477                        if let common::Retry::After(d) =
3478                            dlg.http_failure(&response, error.as_ref().ok())
3479                        {
3480                            sleep(d).await;
3481                            continue;
3482                        }
3483
3484                        dlg.finished(false);
3485
3486                        return Err(match error {
3487                            Ok(value) => common::Error::BadRequest(value),
3488                            _ => common::Error::Failure(response),
3489                        });
3490                    }
3491                    let response = {
3492                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3493                        let encoded = common::to_string(&bytes);
3494                        match serde_json::from_str(&encoded) {
3495                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3496                            Err(error) => {
3497                                dlg.response_json_decode_error(&encoded, &error);
3498                                return Err(common::Error::JsonDecodeError(
3499                                    encoded.to_string(),
3500                                    error,
3501                                ));
3502                            }
3503                        }
3504                    };
3505
3506                    dlg.finished(true);
3507                    return Ok(response);
3508                }
3509            }
3510        }
3511    }
3512
3513    /// The name of the operation resource to be deleted.
3514    ///
3515    /// Sets the *name* path property to the given value.
3516    ///
3517    /// Even though the property as already been set when instantiating this call,
3518    /// we provide this method for API completeness.
3519    pub fn name(mut self, new_value: &str) -> OrganizationLocationOperationDeleteCall<'a, C> {
3520        self._name = new_value.to_string();
3521        self
3522    }
3523    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3524    /// while executing the actual API request.
3525    ///
3526    /// ````text
3527    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3528    /// ````
3529    ///
3530    /// Sets the *delegate* property to the given value.
3531    pub fn delegate(
3532        mut self,
3533        new_value: &'a mut dyn common::Delegate,
3534    ) -> OrganizationLocationOperationDeleteCall<'a, C> {
3535        self._delegate = Some(new_value);
3536        self
3537    }
3538
3539    /// Set any additional parameter of the query string used in the request.
3540    /// It should be used to set parameters which are not yet available through their own
3541    /// setters.
3542    ///
3543    /// Please note that this method must not be used to set any of the known parameters
3544    /// which have their own setter method. If done anyway, the request will fail.
3545    ///
3546    /// # Additional Parameters
3547    ///
3548    /// * *$.xgafv* (query-string) - V1 error format.
3549    /// * *access_token* (query-string) - OAuth access token.
3550    /// * *alt* (query-string) - Data format for response.
3551    /// * *callback* (query-string) - JSONP
3552    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3553    /// * *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.
3554    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3555    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3556    /// * *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.
3557    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3558    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3559    pub fn param<T>(mut self, name: T, value: T) -> OrganizationLocationOperationDeleteCall<'a, C>
3560    where
3561        T: AsRef<str>,
3562    {
3563        self._additional_params
3564            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3565        self
3566    }
3567
3568    /// Identifies the authorization scope for the method you are building.
3569    ///
3570    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3571    /// [`Scope::CloudPlatform`].
3572    ///
3573    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3574    /// tokens for more than one scope.
3575    ///
3576    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3577    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3578    /// sufficient, a read-write scope will do as well.
3579    pub fn add_scope<St>(mut self, scope: St) -> OrganizationLocationOperationDeleteCall<'a, C>
3580    where
3581        St: AsRef<str>,
3582    {
3583        self._scopes.insert(String::from(scope.as_ref()));
3584        self
3585    }
3586    /// Identifies the authorization scope(s) for the method you are building.
3587    ///
3588    /// See [`Self::add_scope()`] for details.
3589    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrganizationLocationOperationDeleteCall<'a, C>
3590    where
3591        I: IntoIterator<Item = St>,
3592        St: AsRef<str>,
3593    {
3594        self._scopes
3595            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3596        self
3597    }
3598
3599    /// Removes all scopes, and no default scope will be used either.
3600    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3601    /// for details).
3602    pub fn clear_scopes(mut self) -> OrganizationLocationOperationDeleteCall<'a, C> {
3603        self._scopes.clear();
3604        self
3605    }
3606}
3607
3608/// 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.
3609///
3610/// A builder for the *locations.operations.get* method supported by a *organization* resource.
3611/// It is not used directly, but through a [`OrganizationMethods`] instance.
3612///
3613/// # Example
3614///
3615/// Instantiate a resource method builder
3616///
3617/// ```test_harness,no_run
3618/// # extern crate hyper;
3619/// # extern crate hyper_rustls;
3620/// # extern crate google_networkmanagement1 as networkmanagement1;
3621/// # async fn dox() {
3622/// # use networkmanagement1::{NetworkManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3623///
3624/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3625/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3626/// #     .with_native_roots()
3627/// #     .unwrap()
3628/// #     .https_only()
3629/// #     .enable_http2()
3630/// #     .build();
3631///
3632/// # let executor = hyper_util::rt::TokioExecutor::new();
3633/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3634/// #     secret,
3635/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3636/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3637/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3638/// #     ),
3639/// # ).build().await.unwrap();
3640///
3641/// # let client = hyper_util::client::legacy::Client::builder(
3642/// #     hyper_util::rt::TokioExecutor::new()
3643/// # )
3644/// # .build(
3645/// #     hyper_rustls::HttpsConnectorBuilder::new()
3646/// #         .with_native_roots()
3647/// #         .unwrap()
3648/// #         .https_or_http()
3649/// #         .enable_http2()
3650/// #         .build()
3651/// # );
3652/// # let mut hub = NetworkManagement::new(client, auth);
3653/// // You can configure optional parameters by calling the respective setters at will, and
3654/// // execute the final call using `doit()`.
3655/// // Values shown here are possibly random and not representative !
3656/// let result = hub.organizations().locations_operations_get("name")
3657///              .doit().await;
3658/// # }
3659/// ```
3660pub struct OrganizationLocationOperationGetCall<'a, C>
3661where
3662    C: 'a,
3663{
3664    hub: &'a NetworkManagement<C>,
3665    _name: String,
3666    _delegate: Option<&'a mut dyn common::Delegate>,
3667    _additional_params: HashMap<String, String>,
3668    _scopes: BTreeSet<String>,
3669}
3670
3671impl<'a, C> common::CallBuilder for OrganizationLocationOperationGetCall<'a, C> {}
3672
3673impl<'a, C> OrganizationLocationOperationGetCall<'a, C>
3674where
3675    C: common::Connector,
3676{
3677    /// Perform the operation you have build so far.
3678    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
3679        use std::borrow::Cow;
3680        use std::io::{Read, Seek};
3681
3682        use common::{url::Params, ToParts};
3683        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3684
3685        let mut dd = common::DefaultDelegate;
3686        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3687        dlg.begin(common::MethodInfo {
3688            id: "networkmanagement.organizations.locations.operations.get",
3689            http_method: hyper::Method::GET,
3690        });
3691
3692        for &field in ["alt", "name"].iter() {
3693            if self._additional_params.contains_key(field) {
3694                dlg.finished(false);
3695                return Err(common::Error::FieldClash(field));
3696            }
3697        }
3698
3699        let mut params = Params::with_capacity(3 + self._additional_params.len());
3700        params.push("name", self._name);
3701
3702        params.extend(self._additional_params.iter());
3703
3704        params.push("alt", "json");
3705        let mut url = self.hub._base_url.clone() + "v1/{+name}";
3706        if self._scopes.is_empty() {
3707            self._scopes
3708                .insert(Scope::CloudPlatform.as_ref().to_string());
3709        }
3710
3711        #[allow(clippy::single_element_loop)]
3712        for &(find_this, param_name) in [("{+name}", "name")].iter() {
3713            url = params.uri_replacement(url, param_name, find_this, true);
3714        }
3715        {
3716            let to_remove = ["name"];
3717            params.remove_params(&to_remove);
3718        }
3719
3720        let url = params.parse_with_url(&url);
3721
3722        loop {
3723            let token = match self
3724                .hub
3725                .auth
3726                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3727                .await
3728            {
3729                Ok(token) => token,
3730                Err(e) => match dlg.token(e) {
3731                    Ok(token) => token,
3732                    Err(e) => {
3733                        dlg.finished(false);
3734                        return Err(common::Error::MissingToken(e));
3735                    }
3736                },
3737            };
3738            let mut req_result = {
3739                let client = &self.hub.client;
3740                dlg.pre_request();
3741                let mut req_builder = hyper::Request::builder()
3742                    .method(hyper::Method::GET)
3743                    .uri(url.as_str())
3744                    .header(USER_AGENT, self.hub._user_agent.clone());
3745
3746                if let Some(token) = token.as_ref() {
3747                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3748                }
3749
3750                let request = req_builder
3751                    .header(CONTENT_LENGTH, 0_u64)
3752                    .body(common::to_body::<String>(None));
3753
3754                client.request(request.unwrap()).await
3755            };
3756
3757            match req_result {
3758                Err(err) => {
3759                    if let common::Retry::After(d) = dlg.http_error(&err) {
3760                        sleep(d).await;
3761                        continue;
3762                    }
3763                    dlg.finished(false);
3764                    return Err(common::Error::HttpError(err));
3765                }
3766                Ok(res) => {
3767                    let (mut parts, body) = res.into_parts();
3768                    let mut body = common::Body::new(body);
3769                    if !parts.status.is_success() {
3770                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3771                        let error = serde_json::from_str(&common::to_string(&bytes));
3772                        let response = common::to_response(parts, bytes.into());
3773
3774                        if let common::Retry::After(d) =
3775                            dlg.http_failure(&response, error.as_ref().ok())
3776                        {
3777                            sleep(d).await;
3778                            continue;
3779                        }
3780
3781                        dlg.finished(false);
3782
3783                        return Err(match error {
3784                            Ok(value) => common::Error::BadRequest(value),
3785                            _ => common::Error::Failure(response),
3786                        });
3787                    }
3788                    let response = {
3789                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3790                        let encoded = common::to_string(&bytes);
3791                        match serde_json::from_str(&encoded) {
3792                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3793                            Err(error) => {
3794                                dlg.response_json_decode_error(&encoded, &error);
3795                                return Err(common::Error::JsonDecodeError(
3796                                    encoded.to_string(),
3797                                    error,
3798                                ));
3799                            }
3800                        }
3801                    };
3802
3803                    dlg.finished(true);
3804                    return Ok(response);
3805                }
3806            }
3807        }
3808    }
3809
3810    /// The name of the operation resource.
3811    ///
3812    /// Sets the *name* path property to the given value.
3813    ///
3814    /// Even though the property as already been set when instantiating this call,
3815    /// we provide this method for API completeness.
3816    pub fn name(mut self, new_value: &str) -> OrganizationLocationOperationGetCall<'a, C> {
3817        self._name = new_value.to_string();
3818        self
3819    }
3820    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3821    /// while executing the actual API request.
3822    ///
3823    /// ````text
3824    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3825    /// ````
3826    ///
3827    /// Sets the *delegate* property to the given value.
3828    pub fn delegate(
3829        mut self,
3830        new_value: &'a mut dyn common::Delegate,
3831    ) -> OrganizationLocationOperationGetCall<'a, C> {
3832        self._delegate = Some(new_value);
3833        self
3834    }
3835
3836    /// Set any additional parameter of the query string used in the request.
3837    /// It should be used to set parameters which are not yet available through their own
3838    /// setters.
3839    ///
3840    /// Please note that this method must not be used to set any of the known parameters
3841    /// which have their own setter method. If done anyway, the request will fail.
3842    ///
3843    /// # Additional Parameters
3844    ///
3845    /// * *$.xgafv* (query-string) - V1 error format.
3846    /// * *access_token* (query-string) - OAuth access token.
3847    /// * *alt* (query-string) - Data format for response.
3848    /// * *callback* (query-string) - JSONP
3849    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3850    /// * *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.
3851    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3852    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3853    /// * *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.
3854    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3855    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3856    pub fn param<T>(mut self, name: T, value: T) -> OrganizationLocationOperationGetCall<'a, C>
3857    where
3858        T: AsRef<str>,
3859    {
3860        self._additional_params
3861            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3862        self
3863    }
3864
3865    /// Identifies the authorization scope for the method you are building.
3866    ///
3867    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3868    /// [`Scope::CloudPlatform`].
3869    ///
3870    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3871    /// tokens for more than one scope.
3872    ///
3873    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3874    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3875    /// sufficient, a read-write scope will do as well.
3876    pub fn add_scope<St>(mut self, scope: St) -> OrganizationLocationOperationGetCall<'a, C>
3877    where
3878        St: AsRef<str>,
3879    {
3880        self._scopes.insert(String::from(scope.as_ref()));
3881        self
3882    }
3883    /// Identifies the authorization scope(s) for the method you are building.
3884    ///
3885    /// See [`Self::add_scope()`] for details.
3886    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrganizationLocationOperationGetCall<'a, C>
3887    where
3888        I: IntoIterator<Item = St>,
3889        St: AsRef<str>,
3890    {
3891        self._scopes
3892            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3893        self
3894    }
3895
3896    /// Removes all scopes, and no default scope will be used either.
3897    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3898    /// for details).
3899    pub fn clear_scopes(mut self) -> OrganizationLocationOperationGetCall<'a, C> {
3900        self._scopes.clear();
3901        self
3902    }
3903}
3904
3905/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
3906///
3907/// A builder for the *locations.operations.list* method supported by a *organization* resource.
3908/// It is not used directly, but through a [`OrganizationMethods`] instance.
3909///
3910/// # Example
3911///
3912/// Instantiate a resource method builder
3913///
3914/// ```test_harness,no_run
3915/// # extern crate hyper;
3916/// # extern crate hyper_rustls;
3917/// # extern crate google_networkmanagement1 as networkmanagement1;
3918/// # async fn dox() {
3919/// # use networkmanagement1::{NetworkManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3920///
3921/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3922/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3923/// #     .with_native_roots()
3924/// #     .unwrap()
3925/// #     .https_only()
3926/// #     .enable_http2()
3927/// #     .build();
3928///
3929/// # let executor = hyper_util::rt::TokioExecutor::new();
3930/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3931/// #     secret,
3932/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3933/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3934/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3935/// #     ),
3936/// # ).build().await.unwrap();
3937///
3938/// # let client = hyper_util::client::legacy::Client::builder(
3939/// #     hyper_util::rt::TokioExecutor::new()
3940/// # )
3941/// # .build(
3942/// #     hyper_rustls::HttpsConnectorBuilder::new()
3943/// #         .with_native_roots()
3944/// #         .unwrap()
3945/// #         .https_or_http()
3946/// #         .enable_http2()
3947/// #         .build()
3948/// # );
3949/// # let mut hub = NetworkManagement::new(client, auth);
3950/// // You can configure optional parameters by calling the respective setters at will, and
3951/// // execute the final call using `doit()`.
3952/// // Values shown here are possibly random and not representative !
3953/// let result = hub.organizations().locations_operations_list("name")
3954///              .return_partial_success(true)
3955///              .page_token("duo")
3956///              .page_size(-55)
3957///              .filter("gubergren")
3958///              .doit().await;
3959/// # }
3960/// ```
3961pub struct OrganizationLocationOperationListCall<'a, C>
3962where
3963    C: 'a,
3964{
3965    hub: &'a NetworkManagement<C>,
3966    _name: String,
3967    _return_partial_success: Option<bool>,
3968    _page_token: Option<String>,
3969    _page_size: Option<i32>,
3970    _filter: Option<String>,
3971    _delegate: Option<&'a mut dyn common::Delegate>,
3972    _additional_params: HashMap<String, String>,
3973    _scopes: BTreeSet<String>,
3974}
3975
3976impl<'a, C> common::CallBuilder for OrganizationLocationOperationListCall<'a, C> {}
3977
3978impl<'a, C> OrganizationLocationOperationListCall<'a, C>
3979where
3980    C: common::Connector,
3981{
3982    /// Perform the operation you have build so far.
3983    pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
3984        use std::borrow::Cow;
3985        use std::io::{Read, Seek};
3986
3987        use common::{url::Params, ToParts};
3988        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3989
3990        let mut dd = common::DefaultDelegate;
3991        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3992        dlg.begin(common::MethodInfo {
3993            id: "networkmanagement.organizations.locations.operations.list",
3994            http_method: hyper::Method::GET,
3995        });
3996
3997        for &field in [
3998            "alt",
3999            "name",
4000            "returnPartialSuccess",
4001            "pageToken",
4002            "pageSize",
4003            "filter",
4004        ]
4005        .iter()
4006        {
4007            if self._additional_params.contains_key(field) {
4008                dlg.finished(false);
4009                return Err(common::Error::FieldClash(field));
4010            }
4011        }
4012
4013        let mut params = Params::with_capacity(7 + self._additional_params.len());
4014        params.push("name", self._name);
4015        if let Some(value) = self._return_partial_success.as_ref() {
4016            params.push("returnPartialSuccess", value.to_string());
4017        }
4018        if let Some(value) = self._page_token.as_ref() {
4019            params.push("pageToken", value);
4020        }
4021        if let Some(value) = self._page_size.as_ref() {
4022            params.push("pageSize", value.to_string());
4023        }
4024        if let Some(value) = self._filter.as_ref() {
4025            params.push("filter", value);
4026        }
4027
4028        params.extend(self._additional_params.iter());
4029
4030        params.push("alt", "json");
4031        let mut url = self.hub._base_url.clone() + "v1/{+name}/operations";
4032        if self._scopes.is_empty() {
4033            self._scopes
4034                .insert(Scope::CloudPlatform.as_ref().to_string());
4035        }
4036
4037        #[allow(clippy::single_element_loop)]
4038        for &(find_this, param_name) in [("{+name}", "name")].iter() {
4039            url = params.uri_replacement(url, param_name, find_this, true);
4040        }
4041        {
4042            let to_remove = ["name"];
4043            params.remove_params(&to_remove);
4044        }
4045
4046        let url = params.parse_with_url(&url);
4047
4048        loop {
4049            let token = match self
4050                .hub
4051                .auth
4052                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4053                .await
4054            {
4055                Ok(token) => token,
4056                Err(e) => match dlg.token(e) {
4057                    Ok(token) => token,
4058                    Err(e) => {
4059                        dlg.finished(false);
4060                        return Err(common::Error::MissingToken(e));
4061                    }
4062                },
4063            };
4064            let mut req_result = {
4065                let client = &self.hub.client;
4066                dlg.pre_request();
4067                let mut req_builder = hyper::Request::builder()
4068                    .method(hyper::Method::GET)
4069                    .uri(url.as_str())
4070                    .header(USER_AGENT, self.hub._user_agent.clone());
4071
4072                if let Some(token) = token.as_ref() {
4073                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4074                }
4075
4076                let request = req_builder
4077                    .header(CONTENT_LENGTH, 0_u64)
4078                    .body(common::to_body::<String>(None));
4079
4080                client.request(request.unwrap()).await
4081            };
4082
4083            match req_result {
4084                Err(err) => {
4085                    if let common::Retry::After(d) = dlg.http_error(&err) {
4086                        sleep(d).await;
4087                        continue;
4088                    }
4089                    dlg.finished(false);
4090                    return Err(common::Error::HttpError(err));
4091                }
4092                Ok(res) => {
4093                    let (mut parts, body) = res.into_parts();
4094                    let mut body = common::Body::new(body);
4095                    if !parts.status.is_success() {
4096                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4097                        let error = serde_json::from_str(&common::to_string(&bytes));
4098                        let response = common::to_response(parts, bytes.into());
4099
4100                        if let common::Retry::After(d) =
4101                            dlg.http_failure(&response, error.as_ref().ok())
4102                        {
4103                            sleep(d).await;
4104                            continue;
4105                        }
4106
4107                        dlg.finished(false);
4108
4109                        return Err(match error {
4110                            Ok(value) => common::Error::BadRequest(value),
4111                            _ => common::Error::Failure(response),
4112                        });
4113                    }
4114                    let response = {
4115                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4116                        let encoded = common::to_string(&bytes);
4117                        match serde_json::from_str(&encoded) {
4118                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4119                            Err(error) => {
4120                                dlg.response_json_decode_error(&encoded, &error);
4121                                return Err(common::Error::JsonDecodeError(
4122                                    encoded.to_string(),
4123                                    error,
4124                                ));
4125                            }
4126                        }
4127                    };
4128
4129                    dlg.finished(true);
4130                    return Ok(response);
4131                }
4132            }
4133        }
4134    }
4135
4136    /// The name of the operation's parent resource.
4137    ///
4138    /// Sets the *name* path property to the given value.
4139    ///
4140    /// Even though the property as already been set when instantiating this call,
4141    /// we provide this method for API completeness.
4142    pub fn name(mut self, new_value: &str) -> OrganizationLocationOperationListCall<'a, C> {
4143        self._name = new_value.to_string();
4144        self
4145    }
4146    /// 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.
4147    ///
4148    /// Sets the *return partial success* query property to the given value.
4149    pub fn return_partial_success(
4150        mut self,
4151        new_value: bool,
4152    ) -> OrganizationLocationOperationListCall<'a, C> {
4153        self._return_partial_success = Some(new_value);
4154        self
4155    }
4156    /// The standard list page token.
4157    ///
4158    /// Sets the *page token* query property to the given value.
4159    pub fn page_token(mut self, new_value: &str) -> OrganizationLocationOperationListCall<'a, C> {
4160        self._page_token = Some(new_value.to_string());
4161        self
4162    }
4163    /// The standard list page size.
4164    ///
4165    /// Sets the *page size* query property to the given value.
4166    pub fn page_size(mut self, new_value: i32) -> OrganizationLocationOperationListCall<'a, C> {
4167        self._page_size = Some(new_value);
4168        self
4169    }
4170    /// The standard list filter.
4171    ///
4172    /// Sets the *filter* query property to the given value.
4173    pub fn filter(mut self, new_value: &str) -> OrganizationLocationOperationListCall<'a, C> {
4174        self._filter = Some(new_value.to_string());
4175        self
4176    }
4177    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4178    /// while executing the actual API request.
4179    ///
4180    /// ````text
4181    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4182    /// ````
4183    ///
4184    /// Sets the *delegate* property to the given value.
4185    pub fn delegate(
4186        mut self,
4187        new_value: &'a mut dyn common::Delegate,
4188    ) -> OrganizationLocationOperationListCall<'a, C> {
4189        self._delegate = Some(new_value);
4190        self
4191    }
4192
4193    /// Set any additional parameter of the query string used in the request.
4194    /// It should be used to set parameters which are not yet available through their own
4195    /// setters.
4196    ///
4197    /// Please note that this method must not be used to set any of the known parameters
4198    /// which have their own setter method. If done anyway, the request will fail.
4199    ///
4200    /// # Additional Parameters
4201    ///
4202    /// * *$.xgafv* (query-string) - V1 error format.
4203    /// * *access_token* (query-string) - OAuth access token.
4204    /// * *alt* (query-string) - Data format for response.
4205    /// * *callback* (query-string) - JSONP
4206    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4207    /// * *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.
4208    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4209    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4210    /// * *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.
4211    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4212    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4213    pub fn param<T>(mut self, name: T, value: T) -> OrganizationLocationOperationListCall<'a, C>
4214    where
4215        T: AsRef<str>,
4216    {
4217        self._additional_params
4218            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4219        self
4220    }
4221
4222    /// Identifies the authorization scope for the method you are building.
4223    ///
4224    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4225    /// [`Scope::CloudPlatform`].
4226    ///
4227    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4228    /// tokens for more than one scope.
4229    ///
4230    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4231    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4232    /// sufficient, a read-write scope will do as well.
4233    pub fn add_scope<St>(mut self, scope: St) -> OrganizationLocationOperationListCall<'a, C>
4234    where
4235        St: AsRef<str>,
4236    {
4237        self._scopes.insert(String::from(scope.as_ref()));
4238        self
4239    }
4240    /// Identifies the authorization scope(s) for the method you are building.
4241    ///
4242    /// See [`Self::add_scope()`] for details.
4243    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrganizationLocationOperationListCall<'a, C>
4244    where
4245        I: IntoIterator<Item = St>,
4246        St: AsRef<str>,
4247    {
4248        self._scopes
4249            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4250        self
4251    }
4252
4253    /// Removes all scopes, and no default scope will be used either.
4254    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4255    /// for details).
4256    pub fn clear_scopes(mut self) -> OrganizationLocationOperationListCall<'a, C> {
4257        self._scopes.clear();
4258        self
4259    }
4260}
4261
4262/// Creates a new `VpcFlowLogsConfig`. If a configuration with the exact same settings already exists (even if the ID is different), the creation fails. Notes: 1. Creating a configuration with `state=DISABLED` will fail 2. The following fields are not considered as settings for the purpose of the check mentioned above, therefore - creating another configuration with the same fields but different values for the following fields will fail as well: * name * create_time * update_time * labels * description
4263///
4264/// A builder for the *locations.vpcFlowLogsConfigs.create* method supported by a *organization* resource.
4265/// It is not used directly, but through a [`OrganizationMethods`] instance.
4266///
4267/// # Example
4268///
4269/// Instantiate a resource method builder
4270///
4271/// ```test_harness,no_run
4272/// # extern crate hyper;
4273/// # extern crate hyper_rustls;
4274/// # extern crate google_networkmanagement1 as networkmanagement1;
4275/// use networkmanagement1::api::VpcFlowLogsConfig;
4276/// # async fn dox() {
4277/// # use networkmanagement1::{NetworkManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4278///
4279/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4280/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4281/// #     .with_native_roots()
4282/// #     .unwrap()
4283/// #     .https_only()
4284/// #     .enable_http2()
4285/// #     .build();
4286///
4287/// # let executor = hyper_util::rt::TokioExecutor::new();
4288/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4289/// #     secret,
4290/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4291/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4292/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4293/// #     ),
4294/// # ).build().await.unwrap();
4295///
4296/// # let client = hyper_util::client::legacy::Client::builder(
4297/// #     hyper_util::rt::TokioExecutor::new()
4298/// # )
4299/// # .build(
4300/// #     hyper_rustls::HttpsConnectorBuilder::new()
4301/// #         .with_native_roots()
4302/// #         .unwrap()
4303/// #         .https_or_http()
4304/// #         .enable_http2()
4305/// #         .build()
4306/// # );
4307/// # let mut hub = NetworkManagement::new(client, auth);
4308/// // As the method needs a request, you would usually fill it with the desired information
4309/// // into the respective structure. Some of the parts shown here might not be applicable !
4310/// // Values shown here are possibly random and not representative !
4311/// let mut req = VpcFlowLogsConfig::default();
4312///
4313/// // You can configure optional parameters by calling the respective setters at will, and
4314/// // execute the final call using `doit()`.
4315/// // Values shown here are possibly random and not representative !
4316/// let result = hub.organizations().locations_vpc_flow_logs_configs_create(req, "parent")
4317///              .vpc_flow_logs_config_id("gubergren")
4318///              .doit().await;
4319/// # }
4320/// ```
4321pub struct OrganizationLocationVpcFlowLogsConfigCreateCall<'a, C>
4322where
4323    C: 'a,
4324{
4325    hub: &'a NetworkManagement<C>,
4326    _request: VpcFlowLogsConfig,
4327    _parent: String,
4328    _vpc_flow_logs_config_id: Option<String>,
4329    _delegate: Option<&'a mut dyn common::Delegate>,
4330    _additional_params: HashMap<String, String>,
4331    _scopes: BTreeSet<String>,
4332}
4333
4334impl<'a, C> common::CallBuilder for OrganizationLocationVpcFlowLogsConfigCreateCall<'a, C> {}
4335
4336impl<'a, C> OrganizationLocationVpcFlowLogsConfigCreateCall<'a, C>
4337where
4338    C: common::Connector,
4339{
4340    /// Perform the operation you have build so far.
4341    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
4342        use std::borrow::Cow;
4343        use std::io::{Read, Seek};
4344
4345        use common::{url::Params, ToParts};
4346        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4347
4348        let mut dd = common::DefaultDelegate;
4349        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4350        dlg.begin(common::MethodInfo {
4351            id: "networkmanagement.organizations.locations.vpcFlowLogsConfigs.create",
4352            http_method: hyper::Method::POST,
4353        });
4354
4355        for &field in ["alt", "parent", "vpcFlowLogsConfigId"].iter() {
4356            if self._additional_params.contains_key(field) {
4357                dlg.finished(false);
4358                return Err(common::Error::FieldClash(field));
4359            }
4360        }
4361
4362        let mut params = Params::with_capacity(5 + self._additional_params.len());
4363        params.push("parent", self._parent);
4364        if let Some(value) = self._vpc_flow_logs_config_id.as_ref() {
4365            params.push("vpcFlowLogsConfigId", value);
4366        }
4367
4368        params.extend(self._additional_params.iter());
4369
4370        params.push("alt", "json");
4371        let mut url = self.hub._base_url.clone() + "v1/{+parent}/vpcFlowLogsConfigs";
4372        if self._scopes.is_empty() {
4373            self._scopes
4374                .insert(Scope::CloudPlatform.as_ref().to_string());
4375        }
4376
4377        #[allow(clippy::single_element_loop)]
4378        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4379            url = params.uri_replacement(url, param_name, find_this, true);
4380        }
4381        {
4382            let to_remove = ["parent"];
4383            params.remove_params(&to_remove);
4384        }
4385
4386        let url = params.parse_with_url(&url);
4387
4388        let mut json_mime_type = mime::APPLICATION_JSON;
4389        let mut request_value_reader = {
4390            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4391            common::remove_json_null_values(&mut value);
4392            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4393            serde_json::to_writer(&mut dst, &value).unwrap();
4394            dst
4395        };
4396        let request_size = request_value_reader
4397            .seek(std::io::SeekFrom::End(0))
4398            .unwrap();
4399        request_value_reader
4400            .seek(std::io::SeekFrom::Start(0))
4401            .unwrap();
4402
4403        loop {
4404            let token = match self
4405                .hub
4406                .auth
4407                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4408                .await
4409            {
4410                Ok(token) => token,
4411                Err(e) => match dlg.token(e) {
4412                    Ok(token) => token,
4413                    Err(e) => {
4414                        dlg.finished(false);
4415                        return Err(common::Error::MissingToken(e));
4416                    }
4417                },
4418            };
4419            request_value_reader
4420                .seek(std::io::SeekFrom::Start(0))
4421                .unwrap();
4422            let mut req_result = {
4423                let client = &self.hub.client;
4424                dlg.pre_request();
4425                let mut req_builder = hyper::Request::builder()
4426                    .method(hyper::Method::POST)
4427                    .uri(url.as_str())
4428                    .header(USER_AGENT, self.hub._user_agent.clone());
4429
4430                if let Some(token) = token.as_ref() {
4431                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4432                }
4433
4434                let request = req_builder
4435                    .header(CONTENT_TYPE, json_mime_type.to_string())
4436                    .header(CONTENT_LENGTH, request_size as u64)
4437                    .body(common::to_body(
4438                        request_value_reader.get_ref().clone().into(),
4439                    ));
4440
4441                client.request(request.unwrap()).await
4442            };
4443
4444            match req_result {
4445                Err(err) => {
4446                    if let common::Retry::After(d) = dlg.http_error(&err) {
4447                        sleep(d).await;
4448                        continue;
4449                    }
4450                    dlg.finished(false);
4451                    return Err(common::Error::HttpError(err));
4452                }
4453                Ok(res) => {
4454                    let (mut parts, body) = res.into_parts();
4455                    let mut body = common::Body::new(body);
4456                    if !parts.status.is_success() {
4457                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4458                        let error = serde_json::from_str(&common::to_string(&bytes));
4459                        let response = common::to_response(parts, bytes.into());
4460
4461                        if let common::Retry::After(d) =
4462                            dlg.http_failure(&response, error.as_ref().ok())
4463                        {
4464                            sleep(d).await;
4465                            continue;
4466                        }
4467
4468                        dlg.finished(false);
4469
4470                        return Err(match error {
4471                            Ok(value) => common::Error::BadRequest(value),
4472                            _ => common::Error::Failure(response),
4473                        });
4474                    }
4475                    let response = {
4476                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4477                        let encoded = common::to_string(&bytes);
4478                        match serde_json::from_str(&encoded) {
4479                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4480                            Err(error) => {
4481                                dlg.response_json_decode_error(&encoded, &error);
4482                                return Err(common::Error::JsonDecodeError(
4483                                    encoded.to_string(),
4484                                    error,
4485                                ));
4486                            }
4487                        }
4488                    };
4489
4490                    dlg.finished(true);
4491                    return Ok(response);
4492                }
4493            }
4494        }
4495    }
4496
4497    ///
4498    /// Sets the *request* property to the given value.
4499    ///
4500    /// Even though the property as already been set when instantiating this call,
4501    /// we provide this method for API completeness.
4502    pub fn request(
4503        mut self,
4504        new_value: VpcFlowLogsConfig,
4505    ) -> OrganizationLocationVpcFlowLogsConfigCreateCall<'a, C> {
4506        self._request = new_value;
4507        self
4508    }
4509    /// Required. The parent resource of the VpcFlowLogsConfig to create, in one of the following formats: - For project-level resources: `projects/{project_id}/locations/global` - For organization-level resources: `organizations/{organization_id}/locations/global`
4510    ///
4511    /// Sets the *parent* path property to the given value.
4512    ///
4513    /// Even though the property as already been set when instantiating this call,
4514    /// we provide this method for API completeness.
4515    pub fn parent(
4516        mut self,
4517        new_value: &str,
4518    ) -> OrganizationLocationVpcFlowLogsConfigCreateCall<'a, C> {
4519        self._parent = new_value.to_string();
4520        self
4521    }
4522    /// Required. ID of the `VpcFlowLogsConfig`.
4523    ///
4524    /// Sets the *vpc flow logs config id* query property to the given value.
4525    pub fn vpc_flow_logs_config_id(
4526        mut self,
4527        new_value: &str,
4528    ) -> OrganizationLocationVpcFlowLogsConfigCreateCall<'a, C> {
4529        self._vpc_flow_logs_config_id = Some(new_value.to_string());
4530        self
4531    }
4532    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4533    /// while executing the actual API request.
4534    ///
4535    /// ````text
4536    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4537    /// ````
4538    ///
4539    /// Sets the *delegate* property to the given value.
4540    pub fn delegate(
4541        mut self,
4542        new_value: &'a mut dyn common::Delegate,
4543    ) -> OrganizationLocationVpcFlowLogsConfigCreateCall<'a, C> {
4544        self._delegate = Some(new_value);
4545        self
4546    }
4547
4548    /// Set any additional parameter of the query string used in the request.
4549    /// It should be used to set parameters which are not yet available through their own
4550    /// setters.
4551    ///
4552    /// Please note that this method must not be used to set any of the known parameters
4553    /// which have their own setter method. If done anyway, the request will fail.
4554    ///
4555    /// # Additional Parameters
4556    ///
4557    /// * *$.xgafv* (query-string) - V1 error format.
4558    /// * *access_token* (query-string) - OAuth access token.
4559    /// * *alt* (query-string) - Data format for response.
4560    /// * *callback* (query-string) - JSONP
4561    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4562    /// * *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.
4563    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4564    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4565    /// * *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.
4566    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4567    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4568    pub fn param<T>(
4569        mut self,
4570        name: T,
4571        value: T,
4572    ) -> OrganizationLocationVpcFlowLogsConfigCreateCall<'a, C>
4573    where
4574        T: AsRef<str>,
4575    {
4576        self._additional_params
4577            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4578        self
4579    }
4580
4581    /// Identifies the authorization scope for the method you are building.
4582    ///
4583    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4584    /// [`Scope::CloudPlatform`].
4585    ///
4586    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4587    /// tokens for more than one scope.
4588    ///
4589    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4590    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4591    /// sufficient, a read-write scope will do as well.
4592    pub fn add_scope<St>(
4593        mut self,
4594        scope: St,
4595    ) -> OrganizationLocationVpcFlowLogsConfigCreateCall<'a, C>
4596    where
4597        St: AsRef<str>,
4598    {
4599        self._scopes.insert(String::from(scope.as_ref()));
4600        self
4601    }
4602    /// Identifies the authorization scope(s) for the method you are building.
4603    ///
4604    /// See [`Self::add_scope()`] for details.
4605    pub fn add_scopes<I, St>(
4606        mut self,
4607        scopes: I,
4608    ) -> OrganizationLocationVpcFlowLogsConfigCreateCall<'a, C>
4609    where
4610        I: IntoIterator<Item = St>,
4611        St: AsRef<str>,
4612    {
4613        self._scopes
4614            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4615        self
4616    }
4617
4618    /// Removes all scopes, and no default scope will be used either.
4619    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4620    /// for details).
4621    pub fn clear_scopes(mut self) -> OrganizationLocationVpcFlowLogsConfigCreateCall<'a, C> {
4622        self._scopes.clear();
4623        self
4624    }
4625}
4626
4627/// Deletes a specific `VpcFlowLogsConfig`.
4628///
4629/// A builder for the *locations.vpcFlowLogsConfigs.delete* method supported by a *organization* resource.
4630/// It is not used directly, but through a [`OrganizationMethods`] instance.
4631///
4632/// # Example
4633///
4634/// Instantiate a resource method builder
4635///
4636/// ```test_harness,no_run
4637/// # extern crate hyper;
4638/// # extern crate hyper_rustls;
4639/// # extern crate google_networkmanagement1 as networkmanagement1;
4640/// # async fn dox() {
4641/// # use networkmanagement1::{NetworkManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4642///
4643/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4644/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4645/// #     .with_native_roots()
4646/// #     .unwrap()
4647/// #     .https_only()
4648/// #     .enable_http2()
4649/// #     .build();
4650///
4651/// # let executor = hyper_util::rt::TokioExecutor::new();
4652/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4653/// #     secret,
4654/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4655/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4656/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4657/// #     ),
4658/// # ).build().await.unwrap();
4659///
4660/// # let client = hyper_util::client::legacy::Client::builder(
4661/// #     hyper_util::rt::TokioExecutor::new()
4662/// # )
4663/// # .build(
4664/// #     hyper_rustls::HttpsConnectorBuilder::new()
4665/// #         .with_native_roots()
4666/// #         .unwrap()
4667/// #         .https_or_http()
4668/// #         .enable_http2()
4669/// #         .build()
4670/// # );
4671/// # let mut hub = NetworkManagement::new(client, auth);
4672/// // You can configure optional parameters by calling the respective setters at will, and
4673/// // execute the final call using `doit()`.
4674/// // Values shown here are possibly random and not representative !
4675/// let result = hub.organizations().locations_vpc_flow_logs_configs_delete("name")
4676///              .doit().await;
4677/// # }
4678/// ```
4679pub struct OrganizationLocationVpcFlowLogsConfigDeleteCall<'a, C>
4680where
4681    C: 'a,
4682{
4683    hub: &'a NetworkManagement<C>,
4684    _name: String,
4685    _delegate: Option<&'a mut dyn common::Delegate>,
4686    _additional_params: HashMap<String, String>,
4687    _scopes: BTreeSet<String>,
4688}
4689
4690impl<'a, C> common::CallBuilder for OrganizationLocationVpcFlowLogsConfigDeleteCall<'a, C> {}
4691
4692impl<'a, C> OrganizationLocationVpcFlowLogsConfigDeleteCall<'a, C>
4693where
4694    C: common::Connector,
4695{
4696    /// Perform the operation you have build so far.
4697    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
4698        use std::borrow::Cow;
4699        use std::io::{Read, Seek};
4700
4701        use common::{url::Params, ToParts};
4702        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4703
4704        let mut dd = common::DefaultDelegate;
4705        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4706        dlg.begin(common::MethodInfo {
4707            id: "networkmanagement.organizations.locations.vpcFlowLogsConfigs.delete",
4708            http_method: hyper::Method::DELETE,
4709        });
4710
4711        for &field in ["alt", "name"].iter() {
4712            if self._additional_params.contains_key(field) {
4713                dlg.finished(false);
4714                return Err(common::Error::FieldClash(field));
4715            }
4716        }
4717
4718        let mut params = Params::with_capacity(3 + self._additional_params.len());
4719        params.push("name", self._name);
4720
4721        params.extend(self._additional_params.iter());
4722
4723        params.push("alt", "json");
4724        let mut url = self.hub._base_url.clone() + "v1/{+name}";
4725        if self._scopes.is_empty() {
4726            self._scopes
4727                .insert(Scope::CloudPlatform.as_ref().to_string());
4728        }
4729
4730        #[allow(clippy::single_element_loop)]
4731        for &(find_this, param_name) in [("{+name}", "name")].iter() {
4732            url = params.uri_replacement(url, param_name, find_this, true);
4733        }
4734        {
4735            let to_remove = ["name"];
4736            params.remove_params(&to_remove);
4737        }
4738
4739        let url = params.parse_with_url(&url);
4740
4741        loop {
4742            let token = match self
4743                .hub
4744                .auth
4745                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4746                .await
4747            {
4748                Ok(token) => token,
4749                Err(e) => match dlg.token(e) {
4750                    Ok(token) => token,
4751                    Err(e) => {
4752                        dlg.finished(false);
4753                        return Err(common::Error::MissingToken(e));
4754                    }
4755                },
4756            };
4757            let mut req_result = {
4758                let client = &self.hub.client;
4759                dlg.pre_request();
4760                let mut req_builder = hyper::Request::builder()
4761                    .method(hyper::Method::DELETE)
4762                    .uri(url.as_str())
4763                    .header(USER_AGENT, self.hub._user_agent.clone());
4764
4765                if let Some(token) = token.as_ref() {
4766                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4767                }
4768
4769                let request = req_builder
4770                    .header(CONTENT_LENGTH, 0_u64)
4771                    .body(common::to_body::<String>(None));
4772
4773                client.request(request.unwrap()).await
4774            };
4775
4776            match req_result {
4777                Err(err) => {
4778                    if let common::Retry::After(d) = dlg.http_error(&err) {
4779                        sleep(d).await;
4780                        continue;
4781                    }
4782                    dlg.finished(false);
4783                    return Err(common::Error::HttpError(err));
4784                }
4785                Ok(res) => {
4786                    let (mut parts, body) = res.into_parts();
4787                    let mut body = common::Body::new(body);
4788                    if !parts.status.is_success() {
4789                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4790                        let error = serde_json::from_str(&common::to_string(&bytes));
4791                        let response = common::to_response(parts, bytes.into());
4792
4793                        if let common::Retry::After(d) =
4794                            dlg.http_failure(&response, error.as_ref().ok())
4795                        {
4796                            sleep(d).await;
4797                            continue;
4798                        }
4799
4800                        dlg.finished(false);
4801
4802                        return Err(match error {
4803                            Ok(value) => common::Error::BadRequest(value),
4804                            _ => common::Error::Failure(response),
4805                        });
4806                    }
4807                    let response = {
4808                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4809                        let encoded = common::to_string(&bytes);
4810                        match serde_json::from_str(&encoded) {
4811                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4812                            Err(error) => {
4813                                dlg.response_json_decode_error(&encoded, &error);
4814                                return Err(common::Error::JsonDecodeError(
4815                                    encoded.to_string(),
4816                                    error,
4817                                ));
4818                            }
4819                        }
4820                    };
4821
4822                    dlg.finished(true);
4823                    return Ok(response);
4824                }
4825            }
4826        }
4827    }
4828
4829    /// Required. The resource name of the VpcFlowLogsConfig, in one of the following formats: - For a project-level resource: `projects/{project_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}` - For an organization-level resource: `organizations/{organization_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}`
4830    ///
4831    /// Sets the *name* path property to the given value.
4832    ///
4833    /// Even though the property as already been set when instantiating this call,
4834    /// we provide this method for API completeness.
4835    pub fn name(
4836        mut self,
4837        new_value: &str,
4838    ) -> OrganizationLocationVpcFlowLogsConfigDeleteCall<'a, C> {
4839        self._name = new_value.to_string();
4840        self
4841    }
4842    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4843    /// while executing the actual API request.
4844    ///
4845    /// ````text
4846    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4847    /// ````
4848    ///
4849    /// Sets the *delegate* property to the given value.
4850    pub fn delegate(
4851        mut self,
4852        new_value: &'a mut dyn common::Delegate,
4853    ) -> OrganizationLocationVpcFlowLogsConfigDeleteCall<'a, C> {
4854        self._delegate = Some(new_value);
4855        self
4856    }
4857
4858    /// Set any additional parameter of the query string used in the request.
4859    /// It should be used to set parameters which are not yet available through their own
4860    /// setters.
4861    ///
4862    /// Please note that this method must not be used to set any of the known parameters
4863    /// which have their own setter method. If done anyway, the request will fail.
4864    ///
4865    /// # Additional Parameters
4866    ///
4867    /// * *$.xgafv* (query-string) - V1 error format.
4868    /// * *access_token* (query-string) - OAuth access token.
4869    /// * *alt* (query-string) - Data format for response.
4870    /// * *callback* (query-string) - JSONP
4871    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4872    /// * *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.
4873    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4874    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4875    /// * *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.
4876    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4877    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4878    pub fn param<T>(
4879        mut self,
4880        name: T,
4881        value: T,
4882    ) -> OrganizationLocationVpcFlowLogsConfigDeleteCall<'a, C>
4883    where
4884        T: AsRef<str>,
4885    {
4886        self._additional_params
4887            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4888        self
4889    }
4890
4891    /// Identifies the authorization scope for the method you are building.
4892    ///
4893    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4894    /// [`Scope::CloudPlatform`].
4895    ///
4896    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4897    /// tokens for more than one scope.
4898    ///
4899    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4900    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4901    /// sufficient, a read-write scope will do as well.
4902    pub fn add_scope<St>(
4903        mut self,
4904        scope: St,
4905    ) -> OrganizationLocationVpcFlowLogsConfigDeleteCall<'a, C>
4906    where
4907        St: AsRef<str>,
4908    {
4909        self._scopes.insert(String::from(scope.as_ref()));
4910        self
4911    }
4912    /// Identifies the authorization scope(s) for the method you are building.
4913    ///
4914    /// See [`Self::add_scope()`] for details.
4915    pub fn add_scopes<I, St>(
4916        mut self,
4917        scopes: I,
4918    ) -> OrganizationLocationVpcFlowLogsConfigDeleteCall<'a, C>
4919    where
4920        I: IntoIterator<Item = St>,
4921        St: AsRef<str>,
4922    {
4923        self._scopes
4924            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4925        self
4926    }
4927
4928    /// Removes all scopes, and no default scope will be used either.
4929    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4930    /// for details).
4931    pub fn clear_scopes(mut self) -> OrganizationLocationVpcFlowLogsConfigDeleteCall<'a, C> {
4932        self._scopes.clear();
4933        self
4934    }
4935}
4936
4937/// Gets the details of a specific `VpcFlowLogsConfig`.
4938///
4939/// A builder for the *locations.vpcFlowLogsConfigs.get* method supported by a *organization* resource.
4940/// It is not used directly, but through a [`OrganizationMethods`] instance.
4941///
4942/// # Example
4943///
4944/// Instantiate a resource method builder
4945///
4946/// ```test_harness,no_run
4947/// # extern crate hyper;
4948/// # extern crate hyper_rustls;
4949/// # extern crate google_networkmanagement1 as networkmanagement1;
4950/// # async fn dox() {
4951/// # use networkmanagement1::{NetworkManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4952///
4953/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4954/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4955/// #     .with_native_roots()
4956/// #     .unwrap()
4957/// #     .https_only()
4958/// #     .enable_http2()
4959/// #     .build();
4960///
4961/// # let executor = hyper_util::rt::TokioExecutor::new();
4962/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4963/// #     secret,
4964/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4965/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4966/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4967/// #     ),
4968/// # ).build().await.unwrap();
4969///
4970/// # let client = hyper_util::client::legacy::Client::builder(
4971/// #     hyper_util::rt::TokioExecutor::new()
4972/// # )
4973/// # .build(
4974/// #     hyper_rustls::HttpsConnectorBuilder::new()
4975/// #         .with_native_roots()
4976/// #         .unwrap()
4977/// #         .https_or_http()
4978/// #         .enable_http2()
4979/// #         .build()
4980/// # );
4981/// # let mut hub = NetworkManagement::new(client, auth);
4982/// // You can configure optional parameters by calling the respective setters at will, and
4983/// // execute the final call using `doit()`.
4984/// // Values shown here are possibly random and not representative !
4985/// let result = hub.organizations().locations_vpc_flow_logs_configs_get("name")
4986///              .doit().await;
4987/// # }
4988/// ```
4989pub struct OrganizationLocationVpcFlowLogsConfigGetCall<'a, C>
4990where
4991    C: 'a,
4992{
4993    hub: &'a NetworkManagement<C>,
4994    _name: String,
4995    _delegate: Option<&'a mut dyn common::Delegate>,
4996    _additional_params: HashMap<String, String>,
4997    _scopes: BTreeSet<String>,
4998}
4999
5000impl<'a, C> common::CallBuilder for OrganizationLocationVpcFlowLogsConfigGetCall<'a, C> {}
5001
5002impl<'a, C> OrganizationLocationVpcFlowLogsConfigGetCall<'a, C>
5003where
5004    C: common::Connector,
5005{
5006    /// Perform the operation you have build so far.
5007    pub async fn doit(mut self) -> common::Result<(common::Response, VpcFlowLogsConfig)> {
5008        use std::borrow::Cow;
5009        use std::io::{Read, Seek};
5010
5011        use common::{url::Params, ToParts};
5012        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5013
5014        let mut dd = common::DefaultDelegate;
5015        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5016        dlg.begin(common::MethodInfo {
5017            id: "networkmanagement.organizations.locations.vpcFlowLogsConfigs.get",
5018            http_method: hyper::Method::GET,
5019        });
5020
5021        for &field in ["alt", "name"].iter() {
5022            if self._additional_params.contains_key(field) {
5023                dlg.finished(false);
5024                return Err(common::Error::FieldClash(field));
5025            }
5026        }
5027
5028        let mut params = Params::with_capacity(3 + self._additional_params.len());
5029        params.push("name", self._name);
5030
5031        params.extend(self._additional_params.iter());
5032
5033        params.push("alt", "json");
5034        let mut url = self.hub._base_url.clone() + "v1/{+name}";
5035        if self._scopes.is_empty() {
5036            self._scopes
5037                .insert(Scope::CloudPlatform.as_ref().to_string());
5038        }
5039
5040        #[allow(clippy::single_element_loop)]
5041        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5042            url = params.uri_replacement(url, param_name, find_this, true);
5043        }
5044        {
5045            let to_remove = ["name"];
5046            params.remove_params(&to_remove);
5047        }
5048
5049        let url = params.parse_with_url(&url);
5050
5051        loop {
5052            let token = match self
5053                .hub
5054                .auth
5055                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5056                .await
5057            {
5058                Ok(token) => token,
5059                Err(e) => match dlg.token(e) {
5060                    Ok(token) => token,
5061                    Err(e) => {
5062                        dlg.finished(false);
5063                        return Err(common::Error::MissingToken(e));
5064                    }
5065                },
5066            };
5067            let mut req_result = {
5068                let client = &self.hub.client;
5069                dlg.pre_request();
5070                let mut req_builder = hyper::Request::builder()
5071                    .method(hyper::Method::GET)
5072                    .uri(url.as_str())
5073                    .header(USER_AGENT, self.hub._user_agent.clone());
5074
5075                if let Some(token) = token.as_ref() {
5076                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5077                }
5078
5079                let request = req_builder
5080                    .header(CONTENT_LENGTH, 0_u64)
5081                    .body(common::to_body::<String>(None));
5082
5083                client.request(request.unwrap()).await
5084            };
5085
5086            match req_result {
5087                Err(err) => {
5088                    if let common::Retry::After(d) = dlg.http_error(&err) {
5089                        sleep(d).await;
5090                        continue;
5091                    }
5092                    dlg.finished(false);
5093                    return Err(common::Error::HttpError(err));
5094                }
5095                Ok(res) => {
5096                    let (mut parts, body) = res.into_parts();
5097                    let mut body = common::Body::new(body);
5098                    if !parts.status.is_success() {
5099                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5100                        let error = serde_json::from_str(&common::to_string(&bytes));
5101                        let response = common::to_response(parts, bytes.into());
5102
5103                        if let common::Retry::After(d) =
5104                            dlg.http_failure(&response, error.as_ref().ok())
5105                        {
5106                            sleep(d).await;
5107                            continue;
5108                        }
5109
5110                        dlg.finished(false);
5111
5112                        return Err(match error {
5113                            Ok(value) => common::Error::BadRequest(value),
5114                            _ => common::Error::Failure(response),
5115                        });
5116                    }
5117                    let response = {
5118                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5119                        let encoded = common::to_string(&bytes);
5120                        match serde_json::from_str(&encoded) {
5121                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5122                            Err(error) => {
5123                                dlg.response_json_decode_error(&encoded, &error);
5124                                return Err(common::Error::JsonDecodeError(
5125                                    encoded.to_string(),
5126                                    error,
5127                                ));
5128                            }
5129                        }
5130                    };
5131
5132                    dlg.finished(true);
5133                    return Ok(response);
5134                }
5135            }
5136        }
5137    }
5138
5139    /// Required. The resource name of the VpcFlowLogsConfig, in one of the following formats: - For project-level resources: `projects/{project_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}` - For organization-level resources: `organizations/{organization_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}`
5140    ///
5141    /// Sets the *name* path property to the given value.
5142    ///
5143    /// Even though the property as already been set when instantiating this call,
5144    /// we provide this method for API completeness.
5145    pub fn name(mut self, new_value: &str) -> OrganizationLocationVpcFlowLogsConfigGetCall<'a, C> {
5146        self._name = new_value.to_string();
5147        self
5148    }
5149    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5150    /// while executing the actual API request.
5151    ///
5152    /// ````text
5153    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5154    /// ````
5155    ///
5156    /// Sets the *delegate* property to the given value.
5157    pub fn delegate(
5158        mut self,
5159        new_value: &'a mut dyn common::Delegate,
5160    ) -> OrganizationLocationVpcFlowLogsConfigGetCall<'a, C> {
5161        self._delegate = Some(new_value);
5162        self
5163    }
5164
5165    /// Set any additional parameter of the query string used in the request.
5166    /// It should be used to set parameters which are not yet available through their own
5167    /// setters.
5168    ///
5169    /// Please note that this method must not be used to set any of the known parameters
5170    /// which have their own setter method. If done anyway, the request will fail.
5171    ///
5172    /// # Additional Parameters
5173    ///
5174    /// * *$.xgafv* (query-string) - V1 error format.
5175    /// * *access_token* (query-string) - OAuth access token.
5176    /// * *alt* (query-string) - Data format for response.
5177    /// * *callback* (query-string) - JSONP
5178    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5179    /// * *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.
5180    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5181    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5182    /// * *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.
5183    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5184    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5185    pub fn param<T>(
5186        mut self,
5187        name: T,
5188        value: T,
5189    ) -> OrganizationLocationVpcFlowLogsConfigGetCall<'a, C>
5190    where
5191        T: AsRef<str>,
5192    {
5193        self._additional_params
5194            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5195        self
5196    }
5197
5198    /// Identifies the authorization scope for the method you are building.
5199    ///
5200    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5201    /// [`Scope::CloudPlatform`].
5202    ///
5203    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5204    /// tokens for more than one scope.
5205    ///
5206    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5207    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5208    /// sufficient, a read-write scope will do as well.
5209    pub fn add_scope<St>(mut self, scope: St) -> OrganizationLocationVpcFlowLogsConfigGetCall<'a, C>
5210    where
5211        St: AsRef<str>,
5212    {
5213        self._scopes.insert(String::from(scope.as_ref()));
5214        self
5215    }
5216    /// Identifies the authorization scope(s) for the method you are building.
5217    ///
5218    /// See [`Self::add_scope()`] for details.
5219    pub fn add_scopes<I, St>(
5220        mut self,
5221        scopes: I,
5222    ) -> OrganizationLocationVpcFlowLogsConfigGetCall<'a, C>
5223    where
5224        I: IntoIterator<Item = St>,
5225        St: AsRef<str>,
5226    {
5227        self._scopes
5228            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5229        self
5230    }
5231
5232    /// Removes all scopes, and no default scope will be used either.
5233    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5234    /// for details).
5235    pub fn clear_scopes(mut self) -> OrganizationLocationVpcFlowLogsConfigGetCall<'a, C> {
5236        self._scopes.clear();
5237        self
5238    }
5239}
5240
5241/// Lists all `VpcFlowLogsConfigs` in a given organization.
5242///
5243/// A builder for the *locations.vpcFlowLogsConfigs.list* method supported by a *organization* resource.
5244/// It is not used directly, but through a [`OrganizationMethods`] instance.
5245///
5246/// # Example
5247///
5248/// Instantiate a resource method builder
5249///
5250/// ```test_harness,no_run
5251/// # extern crate hyper;
5252/// # extern crate hyper_rustls;
5253/// # extern crate google_networkmanagement1 as networkmanagement1;
5254/// # async fn dox() {
5255/// # use networkmanagement1::{NetworkManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5256///
5257/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5258/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5259/// #     .with_native_roots()
5260/// #     .unwrap()
5261/// #     .https_only()
5262/// #     .enable_http2()
5263/// #     .build();
5264///
5265/// # let executor = hyper_util::rt::TokioExecutor::new();
5266/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5267/// #     secret,
5268/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5269/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5270/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5271/// #     ),
5272/// # ).build().await.unwrap();
5273///
5274/// # let client = hyper_util::client::legacy::Client::builder(
5275/// #     hyper_util::rt::TokioExecutor::new()
5276/// # )
5277/// # .build(
5278/// #     hyper_rustls::HttpsConnectorBuilder::new()
5279/// #         .with_native_roots()
5280/// #         .unwrap()
5281/// #         .https_or_http()
5282/// #         .enable_http2()
5283/// #         .build()
5284/// # );
5285/// # let mut hub = NetworkManagement::new(client, auth);
5286/// // You can configure optional parameters by calling the respective setters at will, and
5287/// // execute the final call using `doit()`.
5288/// // Values shown here are possibly random and not representative !
5289/// let result = hub.organizations().locations_vpc_flow_logs_configs_list("parent")
5290///              .page_token("ipsum")
5291///              .page_size(-88)
5292///              .order_by("amet")
5293///              .filter("duo")
5294///              .doit().await;
5295/// # }
5296/// ```
5297pub struct OrganizationLocationVpcFlowLogsConfigListCall<'a, C>
5298where
5299    C: 'a,
5300{
5301    hub: &'a NetworkManagement<C>,
5302    _parent: String,
5303    _page_token: Option<String>,
5304    _page_size: Option<i32>,
5305    _order_by: Option<String>,
5306    _filter: Option<String>,
5307    _delegate: Option<&'a mut dyn common::Delegate>,
5308    _additional_params: HashMap<String, String>,
5309    _scopes: BTreeSet<String>,
5310}
5311
5312impl<'a, C> common::CallBuilder for OrganizationLocationVpcFlowLogsConfigListCall<'a, C> {}
5313
5314impl<'a, C> OrganizationLocationVpcFlowLogsConfigListCall<'a, C>
5315where
5316    C: common::Connector,
5317{
5318    /// Perform the operation you have build so far.
5319    pub async fn doit(
5320        mut self,
5321    ) -> common::Result<(common::Response, ListVpcFlowLogsConfigsResponse)> {
5322        use std::borrow::Cow;
5323        use std::io::{Read, Seek};
5324
5325        use common::{url::Params, ToParts};
5326        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5327
5328        let mut dd = common::DefaultDelegate;
5329        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5330        dlg.begin(common::MethodInfo {
5331            id: "networkmanagement.organizations.locations.vpcFlowLogsConfigs.list",
5332            http_method: hyper::Method::GET,
5333        });
5334
5335        for &field in [
5336            "alt",
5337            "parent",
5338            "pageToken",
5339            "pageSize",
5340            "orderBy",
5341            "filter",
5342        ]
5343        .iter()
5344        {
5345            if self._additional_params.contains_key(field) {
5346                dlg.finished(false);
5347                return Err(common::Error::FieldClash(field));
5348            }
5349        }
5350
5351        let mut params = Params::with_capacity(7 + self._additional_params.len());
5352        params.push("parent", self._parent);
5353        if let Some(value) = self._page_token.as_ref() {
5354            params.push("pageToken", value);
5355        }
5356        if let Some(value) = self._page_size.as_ref() {
5357            params.push("pageSize", value.to_string());
5358        }
5359        if let Some(value) = self._order_by.as_ref() {
5360            params.push("orderBy", value);
5361        }
5362        if let Some(value) = self._filter.as_ref() {
5363            params.push("filter", value);
5364        }
5365
5366        params.extend(self._additional_params.iter());
5367
5368        params.push("alt", "json");
5369        let mut url = self.hub._base_url.clone() + "v1/{+parent}/vpcFlowLogsConfigs";
5370        if self._scopes.is_empty() {
5371            self._scopes
5372                .insert(Scope::CloudPlatform.as_ref().to_string());
5373        }
5374
5375        #[allow(clippy::single_element_loop)]
5376        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5377            url = params.uri_replacement(url, param_name, find_this, true);
5378        }
5379        {
5380            let to_remove = ["parent"];
5381            params.remove_params(&to_remove);
5382        }
5383
5384        let url = params.parse_with_url(&url);
5385
5386        loop {
5387            let token = match self
5388                .hub
5389                .auth
5390                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5391                .await
5392            {
5393                Ok(token) => token,
5394                Err(e) => match dlg.token(e) {
5395                    Ok(token) => token,
5396                    Err(e) => {
5397                        dlg.finished(false);
5398                        return Err(common::Error::MissingToken(e));
5399                    }
5400                },
5401            };
5402            let mut req_result = {
5403                let client = &self.hub.client;
5404                dlg.pre_request();
5405                let mut req_builder = hyper::Request::builder()
5406                    .method(hyper::Method::GET)
5407                    .uri(url.as_str())
5408                    .header(USER_AGENT, self.hub._user_agent.clone());
5409
5410                if let Some(token) = token.as_ref() {
5411                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5412                }
5413
5414                let request = req_builder
5415                    .header(CONTENT_LENGTH, 0_u64)
5416                    .body(common::to_body::<String>(None));
5417
5418                client.request(request.unwrap()).await
5419            };
5420
5421            match req_result {
5422                Err(err) => {
5423                    if let common::Retry::After(d) = dlg.http_error(&err) {
5424                        sleep(d).await;
5425                        continue;
5426                    }
5427                    dlg.finished(false);
5428                    return Err(common::Error::HttpError(err));
5429                }
5430                Ok(res) => {
5431                    let (mut parts, body) = res.into_parts();
5432                    let mut body = common::Body::new(body);
5433                    if !parts.status.is_success() {
5434                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5435                        let error = serde_json::from_str(&common::to_string(&bytes));
5436                        let response = common::to_response(parts, bytes.into());
5437
5438                        if let common::Retry::After(d) =
5439                            dlg.http_failure(&response, error.as_ref().ok())
5440                        {
5441                            sleep(d).await;
5442                            continue;
5443                        }
5444
5445                        dlg.finished(false);
5446
5447                        return Err(match error {
5448                            Ok(value) => common::Error::BadRequest(value),
5449                            _ => common::Error::Failure(response),
5450                        });
5451                    }
5452                    let response = {
5453                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5454                        let encoded = common::to_string(&bytes);
5455                        match serde_json::from_str(&encoded) {
5456                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5457                            Err(error) => {
5458                                dlg.response_json_decode_error(&encoded, &error);
5459                                return Err(common::Error::JsonDecodeError(
5460                                    encoded.to_string(),
5461                                    error,
5462                                ));
5463                            }
5464                        }
5465                    };
5466
5467                    dlg.finished(true);
5468                    return Ok(response);
5469                }
5470            }
5471        }
5472    }
5473
5474    /// Required. The parent resource of the VpcFlowLogsConfig, in one of the following formats: - For project-level resources: `projects/{project_id}/locations/global` - For organization-level resources: `organizations/{organization_id}/locations/global`
5475    ///
5476    /// Sets the *parent* path property to the given value.
5477    ///
5478    /// Even though the property as already been set when instantiating this call,
5479    /// we provide this method for API completeness.
5480    pub fn parent(
5481        mut self,
5482        new_value: &str,
5483    ) -> OrganizationLocationVpcFlowLogsConfigListCall<'a, C> {
5484        self._parent = new_value.to_string();
5485        self
5486    }
5487    /// Optional. Page token from an earlier query, as returned in `next_page_token`.
5488    ///
5489    /// Sets the *page token* query property to the given value.
5490    pub fn page_token(
5491        mut self,
5492        new_value: &str,
5493    ) -> OrganizationLocationVpcFlowLogsConfigListCall<'a, C> {
5494        self._page_token = Some(new_value.to_string());
5495        self
5496    }
5497    /// Optional. Number of `VpcFlowLogsConfigs` to return.
5498    ///
5499    /// Sets the *page size* query property to the given value.
5500    pub fn page_size(
5501        mut self,
5502        new_value: i32,
5503    ) -> OrganizationLocationVpcFlowLogsConfigListCall<'a, C> {
5504        self._page_size = Some(new_value);
5505        self
5506    }
5507    /// Optional. Field to use to sort the list.
5508    ///
5509    /// Sets the *order by* query property to the given value.
5510    pub fn order_by(
5511        mut self,
5512        new_value: &str,
5513    ) -> OrganizationLocationVpcFlowLogsConfigListCall<'a, C> {
5514        self._order_by = Some(new_value.to_string());
5515        self
5516    }
5517    /// Optional. Lists the `VpcFlowLogsConfigs` that match the filter expression. A filter expression must use the supported [CEL logic operators] (https://cloud.google.com/vpc/docs/about-flow-logs-records#supported_cel_logic_operators).
5518    ///
5519    /// Sets the *filter* query property to the given value.
5520    pub fn filter(
5521        mut self,
5522        new_value: &str,
5523    ) -> OrganizationLocationVpcFlowLogsConfigListCall<'a, C> {
5524        self._filter = Some(new_value.to_string());
5525        self
5526    }
5527    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5528    /// while executing the actual API request.
5529    ///
5530    /// ````text
5531    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5532    /// ````
5533    ///
5534    /// Sets the *delegate* property to the given value.
5535    pub fn delegate(
5536        mut self,
5537        new_value: &'a mut dyn common::Delegate,
5538    ) -> OrganizationLocationVpcFlowLogsConfigListCall<'a, C> {
5539        self._delegate = Some(new_value);
5540        self
5541    }
5542
5543    /// Set any additional parameter of the query string used in the request.
5544    /// It should be used to set parameters which are not yet available through their own
5545    /// setters.
5546    ///
5547    /// Please note that this method must not be used to set any of the known parameters
5548    /// which have their own setter method. If done anyway, the request will fail.
5549    ///
5550    /// # Additional Parameters
5551    ///
5552    /// * *$.xgafv* (query-string) - V1 error format.
5553    /// * *access_token* (query-string) - OAuth access token.
5554    /// * *alt* (query-string) - Data format for response.
5555    /// * *callback* (query-string) - JSONP
5556    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5557    /// * *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.
5558    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5559    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5560    /// * *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.
5561    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5562    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5563    pub fn param<T>(
5564        mut self,
5565        name: T,
5566        value: T,
5567    ) -> OrganizationLocationVpcFlowLogsConfigListCall<'a, C>
5568    where
5569        T: AsRef<str>,
5570    {
5571        self._additional_params
5572            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5573        self
5574    }
5575
5576    /// Identifies the authorization scope for the method you are building.
5577    ///
5578    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5579    /// [`Scope::CloudPlatform`].
5580    ///
5581    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5582    /// tokens for more than one scope.
5583    ///
5584    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5585    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5586    /// sufficient, a read-write scope will do as well.
5587    pub fn add_scope<St>(
5588        mut self,
5589        scope: St,
5590    ) -> OrganizationLocationVpcFlowLogsConfigListCall<'a, C>
5591    where
5592        St: AsRef<str>,
5593    {
5594        self._scopes.insert(String::from(scope.as_ref()));
5595        self
5596    }
5597    /// Identifies the authorization scope(s) for the method you are building.
5598    ///
5599    /// See [`Self::add_scope()`] for details.
5600    pub fn add_scopes<I, St>(
5601        mut self,
5602        scopes: I,
5603    ) -> OrganizationLocationVpcFlowLogsConfigListCall<'a, C>
5604    where
5605        I: IntoIterator<Item = St>,
5606        St: AsRef<str>,
5607    {
5608        self._scopes
5609            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5610        self
5611    }
5612
5613    /// Removes all scopes, and no default scope will be used either.
5614    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5615    /// for details).
5616    pub fn clear_scopes(mut self) -> OrganizationLocationVpcFlowLogsConfigListCall<'a, C> {
5617        self._scopes.clear();
5618        self
5619    }
5620}
5621
5622/// Updates an existing `VpcFlowLogsConfig`. If a configuration with the exact same settings already exists (even if the ID is different), the creation fails. Notes: 1. Updating a configuration with `state=DISABLED` will fail 2. The following fields are not considered as settings for the purpose of the check mentioned above, therefore - updating another configuration with the same fields but different values for the following fields will fail as well: * name * create_time * update_time * labels * description
5623///
5624/// A builder for the *locations.vpcFlowLogsConfigs.patch* method supported by a *organization* resource.
5625/// It is not used directly, but through a [`OrganizationMethods`] instance.
5626///
5627/// # Example
5628///
5629/// Instantiate a resource method builder
5630///
5631/// ```test_harness,no_run
5632/// # extern crate hyper;
5633/// # extern crate hyper_rustls;
5634/// # extern crate google_networkmanagement1 as networkmanagement1;
5635/// use networkmanagement1::api::VpcFlowLogsConfig;
5636/// # async fn dox() {
5637/// # use networkmanagement1::{NetworkManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5638///
5639/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5640/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5641/// #     .with_native_roots()
5642/// #     .unwrap()
5643/// #     .https_only()
5644/// #     .enable_http2()
5645/// #     .build();
5646///
5647/// # let executor = hyper_util::rt::TokioExecutor::new();
5648/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5649/// #     secret,
5650/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5651/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5652/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5653/// #     ),
5654/// # ).build().await.unwrap();
5655///
5656/// # let client = hyper_util::client::legacy::Client::builder(
5657/// #     hyper_util::rt::TokioExecutor::new()
5658/// # )
5659/// # .build(
5660/// #     hyper_rustls::HttpsConnectorBuilder::new()
5661/// #         .with_native_roots()
5662/// #         .unwrap()
5663/// #         .https_or_http()
5664/// #         .enable_http2()
5665/// #         .build()
5666/// # );
5667/// # let mut hub = NetworkManagement::new(client, auth);
5668/// // As the method needs a request, you would usually fill it with the desired information
5669/// // into the respective structure. Some of the parts shown here might not be applicable !
5670/// // Values shown here are possibly random and not representative !
5671/// let mut req = VpcFlowLogsConfig::default();
5672///
5673/// // You can configure optional parameters by calling the respective setters at will, and
5674/// // execute the final call using `doit()`.
5675/// // Values shown here are possibly random and not representative !
5676/// let result = hub.organizations().locations_vpc_flow_logs_configs_patch(req, "name")
5677///              .update_mask(FieldMask::new::<&str>(&[]))
5678///              .doit().await;
5679/// # }
5680/// ```
5681pub struct OrganizationLocationVpcFlowLogsConfigPatchCall<'a, C>
5682where
5683    C: 'a,
5684{
5685    hub: &'a NetworkManagement<C>,
5686    _request: VpcFlowLogsConfig,
5687    _name: String,
5688    _update_mask: Option<common::FieldMask>,
5689    _delegate: Option<&'a mut dyn common::Delegate>,
5690    _additional_params: HashMap<String, String>,
5691    _scopes: BTreeSet<String>,
5692}
5693
5694impl<'a, C> common::CallBuilder for OrganizationLocationVpcFlowLogsConfigPatchCall<'a, C> {}
5695
5696impl<'a, C> OrganizationLocationVpcFlowLogsConfigPatchCall<'a, C>
5697where
5698    C: common::Connector,
5699{
5700    /// Perform the operation you have build so far.
5701    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5702        use std::borrow::Cow;
5703        use std::io::{Read, Seek};
5704
5705        use common::{url::Params, ToParts};
5706        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5707
5708        let mut dd = common::DefaultDelegate;
5709        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5710        dlg.begin(common::MethodInfo {
5711            id: "networkmanagement.organizations.locations.vpcFlowLogsConfigs.patch",
5712            http_method: hyper::Method::PATCH,
5713        });
5714
5715        for &field in ["alt", "name", "updateMask"].iter() {
5716            if self._additional_params.contains_key(field) {
5717                dlg.finished(false);
5718                return Err(common::Error::FieldClash(field));
5719            }
5720        }
5721
5722        let mut params = Params::with_capacity(5 + self._additional_params.len());
5723        params.push("name", self._name);
5724        if let Some(value) = self._update_mask.as_ref() {
5725            params.push("updateMask", value.to_string());
5726        }
5727
5728        params.extend(self._additional_params.iter());
5729
5730        params.push("alt", "json");
5731        let mut url = self.hub._base_url.clone() + "v1/{+name}";
5732        if self._scopes.is_empty() {
5733            self._scopes
5734                .insert(Scope::CloudPlatform.as_ref().to_string());
5735        }
5736
5737        #[allow(clippy::single_element_loop)]
5738        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5739            url = params.uri_replacement(url, param_name, find_this, true);
5740        }
5741        {
5742            let to_remove = ["name"];
5743            params.remove_params(&to_remove);
5744        }
5745
5746        let url = params.parse_with_url(&url);
5747
5748        let mut json_mime_type = mime::APPLICATION_JSON;
5749        let mut request_value_reader = {
5750            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5751            common::remove_json_null_values(&mut value);
5752            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5753            serde_json::to_writer(&mut dst, &value).unwrap();
5754            dst
5755        };
5756        let request_size = request_value_reader
5757            .seek(std::io::SeekFrom::End(0))
5758            .unwrap();
5759        request_value_reader
5760            .seek(std::io::SeekFrom::Start(0))
5761            .unwrap();
5762
5763        loop {
5764            let token = match self
5765                .hub
5766                .auth
5767                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5768                .await
5769            {
5770                Ok(token) => token,
5771                Err(e) => match dlg.token(e) {
5772                    Ok(token) => token,
5773                    Err(e) => {
5774                        dlg.finished(false);
5775                        return Err(common::Error::MissingToken(e));
5776                    }
5777                },
5778            };
5779            request_value_reader
5780                .seek(std::io::SeekFrom::Start(0))
5781                .unwrap();
5782            let mut req_result = {
5783                let client = &self.hub.client;
5784                dlg.pre_request();
5785                let mut req_builder = hyper::Request::builder()
5786                    .method(hyper::Method::PATCH)
5787                    .uri(url.as_str())
5788                    .header(USER_AGENT, self.hub._user_agent.clone());
5789
5790                if let Some(token) = token.as_ref() {
5791                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5792                }
5793
5794                let request = req_builder
5795                    .header(CONTENT_TYPE, json_mime_type.to_string())
5796                    .header(CONTENT_LENGTH, request_size as u64)
5797                    .body(common::to_body(
5798                        request_value_reader.get_ref().clone().into(),
5799                    ));
5800
5801                client.request(request.unwrap()).await
5802            };
5803
5804            match req_result {
5805                Err(err) => {
5806                    if let common::Retry::After(d) = dlg.http_error(&err) {
5807                        sleep(d).await;
5808                        continue;
5809                    }
5810                    dlg.finished(false);
5811                    return Err(common::Error::HttpError(err));
5812                }
5813                Ok(res) => {
5814                    let (mut parts, body) = res.into_parts();
5815                    let mut body = common::Body::new(body);
5816                    if !parts.status.is_success() {
5817                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5818                        let error = serde_json::from_str(&common::to_string(&bytes));
5819                        let response = common::to_response(parts, bytes.into());
5820
5821                        if let common::Retry::After(d) =
5822                            dlg.http_failure(&response, error.as_ref().ok())
5823                        {
5824                            sleep(d).await;
5825                            continue;
5826                        }
5827
5828                        dlg.finished(false);
5829
5830                        return Err(match error {
5831                            Ok(value) => common::Error::BadRequest(value),
5832                            _ => common::Error::Failure(response),
5833                        });
5834                    }
5835                    let response = {
5836                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5837                        let encoded = common::to_string(&bytes);
5838                        match serde_json::from_str(&encoded) {
5839                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5840                            Err(error) => {
5841                                dlg.response_json_decode_error(&encoded, &error);
5842                                return Err(common::Error::JsonDecodeError(
5843                                    encoded.to_string(),
5844                                    error,
5845                                ));
5846                            }
5847                        }
5848                    };
5849
5850                    dlg.finished(true);
5851                    return Ok(response);
5852                }
5853            }
5854        }
5855    }
5856
5857    ///
5858    /// Sets the *request* property to the given value.
5859    ///
5860    /// Even though the property as already been set when instantiating this call,
5861    /// we provide this method for API completeness.
5862    pub fn request(
5863        mut self,
5864        new_value: VpcFlowLogsConfig,
5865    ) -> OrganizationLocationVpcFlowLogsConfigPatchCall<'a, C> {
5866        self._request = new_value;
5867        self
5868    }
5869    /// Identifier. Unique name of the configuration. The name can have one of the following forms: - For project-level configurations: `projects/{project_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}` - For organization-level configurations: `organizations/{organization_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}`
5870    ///
5871    /// Sets the *name* path property to the given value.
5872    ///
5873    /// Even though the property as already been set when instantiating this call,
5874    /// we provide this method for API completeness.
5875    pub fn name(
5876        mut self,
5877        new_value: &str,
5878    ) -> OrganizationLocationVpcFlowLogsConfigPatchCall<'a, C> {
5879        self._name = new_value.to_string();
5880        self
5881    }
5882    /// Required. Mask of fields to update. At least one path must be supplied in this field. For example, to change the state of the configuration to ENABLED, specify `update_mask` = `"state"`, and the `vpc_flow_logs_config` would be: `vpc_flow_logs_config = { name = "projects/my-project/locations/global/vpcFlowLogsConfigs/my-config" state = "ENABLED" }`
5883    ///
5884    /// Sets the *update mask* query property to the given value.
5885    pub fn update_mask(
5886        mut self,
5887        new_value: common::FieldMask,
5888    ) -> OrganizationLocationVpcFlowLogsConfigPatchCall<'a, C> {
5889        self._update_mask = Some(new_value);
5890        self
5891    }
5892    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5893    /// while executing the actual API request.
5894    ///
5895    /// ````text
5896    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5897    /// ````
5898    ///
5899    /// Sets the *delegate* property to the given value.
5900    pub fn delegate(
5901        mut self,
5902        new_value: &'a mut dyn common::Delegate,
5903    ) -> OrganizationLocationVpcFlowLogsConfigPatchCall<'a, C> {
5904        self._delegate = Some(new_value);
5905        self
5906    }
5907
5908    /// Set any additional parameter of the query string used in the request.
5909    /// It should be used to set parameters which are not yet available through their own
5910    /// setters.
5911    ///
5912    /// Please note that this method must not be used to set any of the known parameters
5913    /// which have their own setter method. If done anyway, the request will fail.
5914    ///
5915    /// # Additional Parameters
5916    ///
5917    /// * *$.xgafv* (query-string) - V1 error format.
5918    /// * *access_token* (query-string) - OAuth access token.
5919    /// * *alt* (query-string) - Data format for response.
5920    /// * *callback* (query-string) - JSONP
5921    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5922    /// * *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.
5923    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5924    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5925    /// * *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.
5926    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5927    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5928    pub fn param<T>(
5929        mut self,
5930        name: T,
5931        value: T,
5932    ) -> OrganizationLocationVpcFlowLogsConfigPatchCall<'a, C>
5933    where
5934        T: AsRef<str>,
5935    {
5936        self._additional_params
5937            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5938        self
5939    }
5940
5941    /// Identifies the authorization scope for the method you are building.
5942    ///
5943    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5944    /// [`Scope::CloudPlatform`].
5945    ///
5946    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5947    /// tokens for more than one scope.
5948    ///
5949    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5950    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5951    /// sufficient, a read-write scope will do as well.
5952    pub fn add_scope<St>(
5953        mut self,
5954        scope: St,
5955    ) -> OrganizationLocationVpcFlowLogsConfigPatchCall<'a, C>
5956    where
5957        St: AsRef<str>,
5958    {
5959        self._scopes.insert(String::from(scope.as_ref()));
5960        self
5961    }
5962    /// Identifies the authorization scope(s) for the method you are building.
5963    ///
5964    /// See [`Self::add_scope()`] for details.
5965    pub fn add_scopes<I, St>(
5966        mut self,
5967        scopes: I,
5968    ) -> OrganizationLocationVpcFlowLogsConfigPatchCall<'a, C>
5969    where
5970        I: IntoIterator<Item = St>,
5971        St: AsRef<str>,
5972    {
5973        self._scopes
5974            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5975        self
5976    }
5977
5978    /// Removes all scopes, and no default scope will be used either.
5979    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5980    /// for details).
5981    pub fn clear_scopes(mut self) -> OrganizationLocationVpcFlowLogsConfigPatchCall<'a, C> {
5982        self._scopes.clear();
5983        self
5984    }
5985}
5986
5987/// Gets information about a location.
5988///
5989/// A builder for the *locations.get* method supported by a *organization* resource.
5990/// It is not used directly, but through a [`OrganizationMethods`] instance.
5991///
5992/// # Example
5993///
5994/// Instantiate a resource method builder
5995///
5996/// ```test_harness,no_run
5997/// # extern crate hyper;
5998/// # extern crate hyper_rustls;
5999/// # extern crate google_networkmanagement1 as networkmanagement1;
6000/// # async fn dox() {
6001/// # use networkmanagement1::{NetworkManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6002///
6003/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6004/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6005/// #     .with_native_roots()
6006/// #     .unwrap()
6007/// #     .https_only()
6008/// #     .enable_http2()
6009/// #     .build();
6010///
6011/// # let executor = hyper_util::rt::TokioExecutor::new();
6012/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6013/// #     secret,
6014/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6015/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6016/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6017/// #     ),
6018/// # ).build().await.unwrap();
6019///
6020/// # let client = hyper_util::client::legacy::Client::builder(
6021/// #     hyper_util::rt::TokioExecutor::new()
6022/// # )
6023/// # .build(
6024/// #     hyper_rustls::HttpsConnectorBuilder::new()
6025/// #         .with_native_roots()
6026/// #         .unwrap()
6027/// #         .https_or_http()
6028/// #         .enable_http2()
6029/// #         .build()
6030/// # );
6031/// # let mut hub = NetworkManagement::new(client, auth);
6032/// // You can configure optional parameters by calling the respective setters at will, and
6033/// // execute the final call using `doit()`.
6034/// // Values shown here are possibly random and not representative !
6035/// let result = hub.organizations().locations_get("name")
6036///              .doit().await;
6037/// # }
6038/// ```
6039pub struct OrganizationLocationGetCall<'a, C>
6040where
6041    C: 'a,
6042{
6043    hub: &'a NetworkManagement<C>,
6044    _name: String,
6045    _delegate: Option<&'a mut dyn common::Delegate>,
6046    _additional_params: HashMap<String, String>,
6047    _scopes: BTreeSet<String>,
6048}
6049
6050impl<'a, C> common::CallBuilder for OrganizationLocationGetCall<'a, C> {}
6051
6052impl<'a, C> OrganizationLocationGetCall<'a, C>
6053where
6054    C: common::Connector,
6055{
6056    /// Perform the operation you have build so far.
6057    pub async fn doit(mut self) -> common::Result<(common::Response, Location)> {
6058        use std::borrow::Cow;
6059        use std::io::{Read, Seek};
6060
6061        use common::{url::Params, ToParts};
6062        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6063
6064        let mut dd = common::DefaultDelegate;
6065        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6066        dlg.begin(common::MethodInfo {
6067            id: "networkmanagement.organizations.locations.get",
6068            http_method: hyper::Method::GET,
6069        });
6070
6071        for &field in ["alt", "name"].iter() {
6072            if self._additional_params.contains_key(field) {
6073                dlg.finished(false);
6074                return Err(common::Error::FieldClash(field));
6075            }
6076        }
6077
6078        let mut params = Params::with_capacity(3 + self._additional_params.len());
6079        params.push("name", self._name);
6080
6081        params.extend(self._additional_params.iter());
6082
6083        params.push("alt", "json");
6084        let mut url = self.hub._base_url.clone() + "v1/{+name}";
6085        if self._scopes.is_empty() {
6086            self._scopes
6087                .insert(Scope::CloudPlatform.as_ref().to_string());
6088        }
6089
6090        #[allow(clippy::single_element_loop)]
6091        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6092            url = params.uri_replacement(url, param_name, find_this, true);
6093        }
6094        {
6095            let to_remove = ["name"];
6096            params.remove_params(&to_remove);
6097        }
6098
6099        let url = params.parse_with_url(&url);
6100
6101        loop {
6102            let token = match self
6103                .hub
6104                .auth
6105                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6106                .await
6107            {
6108                Ok(token) => token,
6109                Err(e) => match dlg.token(e) {
6110                    Ok(token) => token,
6111                    Err(e) => {
6112                        dlg.finished(false);
6113                        return Err(common::Error::MissingToken(e));
6114                    }
6115                },
6116            };
6117            let mut req_result = {
6118                let client = &self.hub.client;
6119                dlg.pre_request();
6120                let mut req_builder = hyper::Request::builder()
6121                    .method(hyper::Method::GET)
6122                    .uri(url.as_str())
6123                    .header(USER_AGENT, self.hub._user_agent.clone());
6124
6125                if let Some(token) = token.as_ref() {
6126                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6127                }
6128
6129                let request = req_builder
6130                    .header(CONTENT_LENGTH, 0_u64)
6131                    .body(common::to_body::<String>(None));
6132
6133                client.request(request.unwrap()).await
6134            };
6135
6136            match req_result {
6137                Err(err) => {
6138                    if let common::Retry::After(d) = dlg.http_error(&err) {
6139                        sleep(d).await;
6140                        continue;
6141                    }
6142                    dlg.finished(false);
6143                    return Err(common::Error::HttpError(err));
6144                }
6145                Ok(res) => {
6146                    let (mut parts, body) = res.into_parts();
6147                    let mut body = common::Body::new(body);
6148                    if !parts.status.is_success() {
6149                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6150                        let error = serde_json::from_str(&common::to_string(&bytes));
6151                        let response = common::to_response(parts, bytes.into());
6152
6153                        if let common::Retry::After(d) =
6154                            dlg.http_failure(&response, error.as_ref().ok())
6155                        {
6156                            sleep(d).await;
6157                            continue;
6158                        }
6159
6160                        dlg.finished(false);
6161
6162                        return Err(match error {
6163                            Ok(value) => common::Error::BadRequest(value),
6164                            _ => common::Error::Failure(response),
6165                        });
6166                    }
6167                    let response = {
6168                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6169                        let encoded = common::to_string(&bytes);
6170                        match serde_json::from_str(&encoded) {
6171                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6172                            Err(error) => {
6173                                dlg.response_json_decode_error(&encoded, &error);
6174                                return Err(common::Error::JsonDecodeError(
6175                                    encoded.to_string(),
6176                                    error,
6177                                ));
6178                            }
6179                        }
6180                    };
6181
6182                    dlg.finished(true);
6183                    return Ok(response);
6184                }
6185            }
6186        }
6187    }
6188
6189    /// Resource name for the location.
6190    ///
6191    /// Sets the *name* path property to the given value.
6192    ///
6193    /// Even though the property as already been set when instantiating this call,
6194    /// we provide this method for API completeness.
6195    pub fn name(mut self, new_value: &str) -> OrganizationLocationGetCall<'a, C> {
6196        self._name = new_value.to_string();
6197        self
6198    }
6199    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6200    /// while executing the actual API request.
6201    ///
6202    /// ````text
6203    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6204    /// ````
6205    ///
6206    /// Sets the *delegate* property to the given value.
6207    pub fn delegate(
6208        mut self,
6209        new_value: &'a mut dyn common::Delegate,
6210    ) -> OrganizationLocationGetCall<'a, C> {
6211        self._delegate = Some(new_value);
6212        self
6213    }
6214
6215    /// Set any additional parameter of the query string used in the request.
6216    /// It should be used to set parameters which are not yet available through their own
6217    /// setters.
6218    ///
6219    /// Please note that this method must not be used to set any of the known parameters
6220    /// which have their own setter method. If done anyway, the request will fail.
6221    ///
6222    /// # Additional Parameters
6223    ///
6224    /// * *$.xgafv* (query-string) - V1 error format.
6225    /// * *access_token* (query-string) - OAuth access token.
6226    /// * *alt* (query-string) - Data format for response.
6227    /// * *callback* (query-string) - JSONP
6228    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6229    /// * *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.
6230    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6231    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6232    /// * *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.
6233    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6234    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6235    pub fn param<T>(mut self, name: T, value: T) -> OrganizationLocationGetCall<'a, C>
6236    where
6237        T: AsRef<str>,
6238    {
6239        self._additional_params
6240            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6241        self
6242    }
6243
6244    /// Identifies the authorization scope for the method you are building.
6245    ///
6246    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6247    /// [`Scope::CloudPlatform`].
6248    ///
6249    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6250    /// tokens for more than one scope.
6251    ///
6252    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6253    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6254    /// sufficient, a read-write scope will do as well.
6255    pub fn add_scope<St>(mut self, scope: St) -> OrganizationLocationGetCall<'a, C>
6256    where
6257        St: AsRef<str>,
6258    {
6259        self._scopes.insert(String::from(scope.as_ref()));
6260        self
6261    }
6262    /// Identifies the authorization scope(s) for the method you are building.
6263    ///
6264    /// See [`Self::add_scope()`] for details.
6265    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrganizationLocationGetCall<'a, C>
6266    where
6267        I: IntoIterator<Item = St>,
6268        St: AsRef<str>,
6269    {
6270        self._scopes
6271            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6272        self
6273    }
6274
6275    /// Removes all scopes, and no default scope will be used either.
6276    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6277    /// for details).
6278    pub fn clear_scopes(mut self) -> OrganizationLocationGetCall<'a, C> {
6279        self._scopes.clear();
6280        self
6281    }
6282}
6283
6284/// Lists information about the supported locations for this service.
6285///
6286/// A builder for the *locations.list* method supported by a *organization* resource.
6287/// It is not used directly, but through a [`OrganizationMethods`] instance.
6288///
6289/// # Example
6290///
6291/// Instantiate a resource method builder
6292///
6293/// ```test_harness,no_run
6294/// # extern crate hyper;
6295/// # extern crate hyper_rustls;
6296/// # extern crate google_networkmanagement1 as networkmanagement1;
6297/// # async fn dox() {
6298/// # use networkmanagement1::{NetworkManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6299///
6300/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6301/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6302/// #     .with_native_roots()
6303/// #     .unwrap()
6304/// #     .https_only()
6305/// #     .enable_http2()
6306/// #     .build();
6307///
6308/// # let executor = hyper_util::rt::TokioExecutor::new();
6309/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6310/// #     secret,
6311/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6312/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6313/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6314/// #     ),
6315/// # ).build().await.unwrap();
6316///
6317/// # let client = hyper_util::client::legacy::Client::builder(
6318/// #     hyper_util::rt::TokioExecutor::new()
6319/// # )
6320/// # .build(
6321/// #     hyper_rustls::HttpsConnectorBuilder::new()
6322/// #         .with_native_roots()
6323/// #         .unwrap()
6324/// #         .https_or_http()
6325/// #         .enable_http2()
6326/// #         .build()
6327/// # );
6328/// # let mut hub = NetworkManagement::new(client, auth);
6329/// // You can configure optional parameters by calling the respective setters at will, and
6330/// // execute the final call using `doit()`.
6331/// // Values shown here are possibly random and not representative !
6332/// let result = hub.organizations().locations_list("name")
6333///              .page_token("gubergren")
6334///              .page_size(-16)
6335///              .filter("est")
6336///              .add_extra_location_types("ipsum")
6337///              .doit().await;
6338/// # }
6339/// ```
6340pub struct OrganizationLocationListCall<'a, C>
6341where
6342    C: 'a,
6343{
6344    hub: &'a NetworkManagement<C>,
6345    _name: String,
6346    _page_token: Option<String>,
6347    _page_size: Option<i32>,
6348    _filter: Option<String>,
6349    _extra_location_types: Vec<String>,
6350    _delegate: Option<&'a mut dyn common::Delegate>,
6351    _additional_params: HashMap<String, String>,
6352    _scopes: BTreeSet<String>,
6353}
6354
6355impl<'a, C> common::CallBuilder for OrganizationLocationListCall<'a, C> {}
6356
6357impl<'a, C> OrganizationLocationListCall<'a, C>
6358where
6359    C: common::Connector,
6360{
6361    /// Perform the operation you have build so far.
6362    pub async fn doit(mut self) -> common::Result<(common::Response, ListLocationsResponse)> {
6363        use std::borrow::Cow;
6364        use std::io::{Read, Seek};
6365
6366        use common::{url::Params, ToParts};
6367        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6368
6369        let mut dd = common::DefaultDelegate;
6370        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6371        dlg.begin(common::MethodInfo {
6372            id: "networkmanagement.organizations.locations.list",
6373            http_method: hyper::Method::GET,
6374        });
6375
6376        for &field in [
6377            "alt",
6378            "name",
6379            "pageToken",
6380            "pageSize",
6381            "filter",
6382            "extraLocationTypes",
6383        ]
6384        .iter()
6385        {
6386            if self._additional_params.contains_key(field) {
6387                dlg.finished(false);
6388                return Err(common::Error::FieldClash(field));
6389            }
6390        }
6391
6392        let mut params = Params::with_capacity(7 + self._additional_params.len());
6393        params.push("name", self._name);
6394        if let Some(value) = self._page_token.as_ref() {
6395            params.push("pageToken", value);
6396        }
6397        if let Some(value) = self._page_size.as_ref() {
6398            params.push("pageSize", value.to_string());
6399        }
6400        if let Some(value) = self._filter.as_ref() {
6401            params.push("filter", value);
6402        }
6403        if !self._extra_location_types.is_empty() {
6404            for f in self._extra_location_types.iter() {
6405                params.push("extraLocationTypes", f);
6406            }
6407        }
6408
6409        params.extend(self._additional_params.iter());
6410
6411        params.push("alt", "json");
6412        let mut url = self.hub._base_url.clone() + "v1/{+name}/locations";
6413        if self._scopes.is_empty() {
6414            self._scopes
6415                .insert(Scope::CloudPlatform.as_ref().to_string());
6416        }
6417
6418        #[allow(clippy::single_element_loop)]
6419        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6420            url = params.uri_replacement(url, param_name, find_this, true);
6421        }
6422        {
6423            let to_remove = ["name"];
6424            params.remove_params(&to_remove);
6425        }
6426
6427        let url = params.parse_with_url(&url);
6428
6429        loop {
6430            let token = match self
6431                .hub
6432                .auth
6433                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6434                .await
6435            {
6436                Ok(token) => token,
6437                Err(e) => match dlg.token(e) {
6438                    Ok(token) => token,
6439                    Err(e) => {
6440                        dlg.finished(false);
6441                        return Err(common::Error::MissingToken(e));
6442                    }
6443                },
6444            };
6445            let mut req_result = {
6446                let client = &self.hub.client;
6447                dlg.pre_request();
6448                let mut req_builder = hyper::Request::builder()
6449                    .method(hyper::Method::GET)
6450                    .uri(url.as_str())
6451                    .header(USER_AGENT, self.hub._user_agent.clone());
6452
6453                if let Some(token) = token.as_ref() {
6454                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6455                }
6456
6457                let request = req_builder
6458                    .header(CONTENT_LENGTH, 0_u64)
6459                    .body(common::to_body::<String>(None));
6460
6461                client.request(request.unwrap()).await
6462            };
6463
6464            match req_result {
6465                Err(err) => {
6466                    if let common::Retry::After(d) = dlg.http_error(&err) {
6467                        sleep(d).await;
6468                        continue;
6469                    }
6470                    dlg.finished(false);
6471                    return Err(common::Error::HttpError(err));
6472                }
6473                Ok(res) => {
6474                    let (mut parts, body) = res.into_parts();
6475                    let mut body = common::Body::new(body);
6476                    if !parts.status.is_success() {
6477                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6478                        let error = serde_json::from_str(&common::to_string(&bytes));
6479                        let response = common::to_response(parts, bytes.into());
6480
6481                        if let common::Retry::After(d) =
6482                            dlg.http_failure(&response, error.as_ref().ok())
6483                        {
6484                            sleep(d).await;
6485                            continue;
6486                        }
6487
6488                        dlg.finished(false);
6489
6490                        return Err(match error {
6491                            Ok(value) => common::Error::BadRequest(value),
6492                            _ => common::Error::Failure(response),
6493                        });
6494                    }
6495                    let response = {
6496                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6497                        let encoded = common::to_string(&bytes);
6498                        match serde_json::from_str(&encoded) {
6499                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6500                            Err(error) => {
6501                                dlg.response_json_decode_error(&encoded, &error);
6502                                return Err(common::Error::JsonDecodeError(
6503                                    encoded.to_string(),
6504                                    error,
6505                                ));
6506                            }
6507                        }
6508                    };
6509
6510                    dlg.finished(true);
6511                    return Ok(response);
6512                }
6513            }
6514        }
6515    }
6516
6517    /// The resource that owns the locations collection, if applicable.
6518    ///
6519    /// Sets the *name* path property to the given value.
6520    ///
6521    /// Even though the property as already been set when instantiating this call,
6522    /// we provide this method for API completeness.
6523    pub fn name(mut self, new_value: &str) -> OrganizationLocationListCall<'a, C> {
6524        self._name = new_value.to_string();
6525        self
6526    }
6527    /// A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.
6528    ///
6529    /// Sets the *page token* query property to the given value.
6530    pub fn page_token(mut self, new_value: &str) -> OrganizationLocationListCall<'a, C> {
6531        self._page_token = Some(new_value.to_string());
6532        self
6533    }
6534    /// The maximum number of results to return. If not set, the service selects a default.
6535    ///
6536    /// Sets the *page size* query property to the given value.
6537    pub fn page_size(mut self, new_value: i32) -> OrganizationLocationListCall<'a, C> {
6538        self._page_size = Some(new_value);
6539        self
6540    }
6541    /// A filter to narrow down results to a preferred subset. The filtering language accepts strings like `"displayName=tokyo"`, and is documented in more detail in [AIP-160](https://google.aip.dev/160).
6542    ///
6543    /// Sets the *filter* query property to the given value.
6544    pub fn filter(mut self, new_value: &str) -> OrganizationLocationListCall<'a, C> {
6545        self._filter = Some(new_value.to_string());
6546        self
6547    }
6548    /// Optional. Do not use this field. It is unsupported and is ignored unless explicitly documented otherwise. This is primarily for internal usage.
6549    ///
6550    /// Append the given value to the *extra location types* query property.
6551    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
6552    pub fn add_extra_location_types(
6553        mut self,
6554        new_value: &str,
6555    ) -> OrganizationLocationListCall<'a, C> {
6556        self._extra_location_types.push(new_value.to_string());
6557        self
6558    }
6559    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6560    /// while executing the actual API request.
6561    ///
6562    /// ````text
6563    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6564    /// ````
6565    ///
6566    /// Sets the *delegate* property to the given value.
6567    pub fn delegate(
6568        mut self,
6569        new_value: &'a mut dyn common::Delegate,
6570    ) -> OrganizationLocationListCall<'a, C> {
6571        self._delegate = Some(new_value);
6572        self
6573    }
6574
6575    /// Set any additional parameter of the query string used in the request.
6576    /// It should be used to set parameters which are not yet available through their own
6577    /// setters.
6578    ///
6579    /// Please note that this method must not be used to set any of the known parameters
6580    /// which have their own setter method. If done anyway, the request will fail.
6581    ///
6582    /// # Additional Parameters
6583    ///
6584    /// * *$.xgafv* (query-string) - V1 error format.
6585    /// * *access_token* (query-string) - OAuth access token.
6586    /// * *alt* (query-string) - Data format for response.
6587    /// * *callback* (query-string) - JSONP
6588    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6589    /// * *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.
6590    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6591    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6592    /// * *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.
6593    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6594    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6595    pub fn param<T>(mut self, name: T, value: T) -> OrganizationLocationListCall<'a, C>
6596    where
6597        T: AsRef<str>,
6598    {
6599        self._additional_params
6600            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6601        self
6602    }
6603
6604    /// Identifies the authorization scope for the method you are building.
6605    ///
6606    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6607    /// [`Scope::CloudPlatform`].
6608    ///
6609    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6610    /// tokens for more than one scope.
6611    ///
6612    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6613    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6614    /// sufficient, a read-write scope will do as well.
6615    pub fn add_scope<St>(mut self, scope: St) -> OrganizationLocationListCall<'a, C>
6616    where
6617        St: AsRef<str>,
6618    {
6619        self._scopes.insert(String::from(scope.as_ref()));
6620        self
6621    }
6622    /// Identifies the authorization scope(s) for the method you are building.
6623    ///
6624    /// See [`Self::add_scope()`] for details.
6625    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrganizationLocationListCall<'a, C>
6626    where
6627        I: IntoIterator<Item = St>,
6628        St: AsRef<str>,
6629    {
6630        self._scopes
6631            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6632        self
6633    }
6634
6635    /// Removes all scopes, and no default scope will be used either.
6636    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6637    /// for details).
6638    pub fn clear_scopes(mut self) -> OrganizationLocationListCall<'a, C> {
6639        self._scopes.clear();
6640        self
6641    }
6642}
6643
6644/// Creates a new Connectivity Test. After you create a test, the reachability analysis is performed as part of the long running operation, which completes when the analysis completes. If the endpoint specifications in `ConnectivityTest` are invalid (for example, containing non-existent resources in the network, or you don't have read permissions to the network configurations of listed projects), then the reachability result returns a value of `UNKNOWN`. If the endpoint specifications in `ConnectivityTest` are incomplete, the reachability result returns a value of AMBIGUOUS. For more information, see the Connectivity Test documentation.
6645///
6646/// A builder for the *locations.global.connectivityTests.create* method supported by a *project* resource.
6647/// It is not used directly, but through a [`ProjectMethods`] instance.
6648///
6649/// # Example
6650///
6651/// Instantiate a resource method builder
6652///
6653/// ```test_harness,no_run
6654/// # extern crate hyper;
6655/// # extern crate hyper_rustls;
6656/// # extern crate google_networkmanagement1 as networkmanagement1;
6657/// use networkmanagement1::api::ConnectivityTest;
6658/// # async fn dox() {
6659/// # use networkmanagement1::{NetworkManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6660///
6661/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6662/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6663/// #     .with_native_roots()
6664/// #     .unwrap()
6665/// #     .https_only()
6666/// #     .enable_http2()
6667/// #     .build();
6668///
6669/// # let executor = hyper_util::rt::TokioExecutor::new();
6670/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6671/// #     secret,
6672/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6673/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6674/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6675/// #     ),
6676/// # ).build().await.unwrap();
6677///
6678/// # let client = hyper_util::client::legacy::Client::builder(
6679/// #     hyper_util::rt::TokioExecutor::new()
6680/// # )
6681/// # .build(
6682/// #     hyper_rustls::HttpsConnectorBuilder::new()
6683/// #         .with_native_roots()
6684/// #         .unwrap()
6685/// #         .https_or_http()
6686/// #         .enable_http2()
6687/// #         .build()
6688/// # );
6689/// # let mut hub = NetworkManagement::new(client, auth);
6690/// // As the method needs a request, you would usually fill it with the desired information
6691/// // into the respective structure. Some of the parts shown here might not be applicable !
6692/// // Values shown here are possibly random and not representative !
6693/// let mut req = ConnectivityTest::default();
6694///
6695/// // You can configure optional parameters by calling the respective setters at will, and
6696/// // execute the final call using `doit()`.
6697/// // Values shown here are possibly random and not representative !
6698/// let result = hub.projects().locations_global_connectivity_tests_create(req, "parent")
6699///              .test_id("est")
6700///              .doit().await;
6701/// # }
6702/// ```
6703pub struct ProjectLocationGlobalConnectivityTestCreateCall<'a, C>
6704where
6705    C: 'a,
6706{
6707    hub: &'a NetworkManagement<C>,
6708    _request: ConnectivityTest,
6709    _parent: String,
6710    _test_id: Option<String>,
6711    _delegate: Option<&'a mut dyn common::Delegate>,
6712    _additional_params: HashMap<String, String>,
6713    _scopes: BTreeSet<String>,
6714}
6715
6716impl<'a, C> common::CallBuilder for ProjectLocationGlobalConnectivityTestCreateCall<'a, C> {}
6717
6718impl<'a, C> ProjectLocationGlobalConnectivityTestCreateCall<'a, C>
6719where
6720    C: common::Connector,
6721{
6722    /// Perform the operation you have build so far.
6723    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6724        use std::borrow::Cow;
6725        use std::io::{Read, Seek};
6726
6727        use common::{url::Params, ToParts};
6728        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6729
6730        let mut dd = common::DefaultDelegate;
6731        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6732        dlg.begin(common::MethodInfo {
6733            id: "networkmanagement.projects.locations.global.connectivityTests.create",
6734            http_method: hyper::Method::POST,
6735        });
6736
6737        for &field in ["alt", "parent", "testId"].iter() {
6738            if self._additional_params.contains_key(field) {
6739                dlg.finished(false);
6740                return Err(common::Error::FieldClash(field));
6741            }
6742        }
6743
6744        let mut params = Params::with_capacity(5 + self._additional_params.len());
6745        params.push("parent", self._parent);
6746        if let Some(value) = self._test_id.as_ref() {
6747            params.push("testId", value);
6748        }
6749
6750        params.extend(self._additional_params.iter());
6751
6752        params.push("alt", "json");
6753        let mut url = self.hub._base_url.clone() + "v1/{+parent}/connectivityTests";
6754        if self._scopes.is_empty() {
6755            self._scopes
6756                .insert(Scope::CloudPlatform.as_ref().to_string());
6757        }
6758
6759        #[allow(clippy::single_element_loop)]
6760        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6761            url = params.uri_replacement(url, param_name, find_this, true);
6762        }
6763        {
6764            let to_remove = ["parent"];
6765            params.remove_params(&to_remove);
6766        }
6767
6768        let url = params.parse_with_url(&url);
6769
6770        let mut json_mime_type = mime::APPLICATION_JSON;
6771        let mut request_value_reader = {
6772            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6773            common::remove_json_null_values(&mut value);
6774            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6775            serde_json::to_writer(&mut dst, &value).unwrap();
6776            dst
6777        };
6778        let request_size = request_value_reader
6779            .seek(std::io::SeekFrom::End(0))
6780            .unwrap();
6781        request_value_reader
6782            .seek(std::io::SeekFrom::Start(0))
6783            .unwrap();
6784
6785        loop {
6786            let token = match self
6787                .hub
6788                .auth
6789                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6790                .await
6791            {
6792                Ok(token) => token,
6793                Err(e) => match dlg.token(e) {
6794                    Ok(token) => token,
6795                    Err(e) => {
6796                        dlg.finished(false);
6797                        return Err(common::Error::MissingToken(e));
6798                    }
6799                },
6800            };
6801            request_value_reader
6802                .seek(std::io::SeekFrom::Start(0))
6803                .unwrap();
6804            let mut req_result = {
6805                let client = &self.hub.client;
6806                dlg.pre_request();
6807                let mut req_builder = hyper::Request::builder()
6808                    .method(hyper::Method::POST)
6809                    .uri(url.as_str())
6810                    .header(USER_AGENT, self.hub._user_agent.clone());
6811
6812                if let Some(token) = token.as_ref() {
6813                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6814                }
6815
6816                let request = req_builder
6817                    .header(CONTENT_TYPE, json_mime_type.to_string())
6818                    .header(CONTENT_LENGTH, request_size as u64)
6819                    .body(common::to_body(
6820                        request_value_reader.get_ref().clone().into(),
6821                    ));
6822
6823                client.request(request.unwrap()).await
6824            };
6825
6826            match req_result {
6827                Err(err) => {
6828                    if let common::Retry::After(d) = dlg.http_error(&err) {
6829                        sleep(d).await;
6830                        continue;
6831                    }
6832                    dlg.finished(false);
6833                    return Err(common::Error::HttpError(err));
6834                }
6835                Ok(res) => {
6836                    let (mut parts, body) = res.into_parts();
6837                    let mut body = common::Body::new(body);
6838                    if !parts.status.is_success() {
6839                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6840                        let error = serde_json::from_str(&common::to_string(&bytes));
6841                        let response = common::to_response(parts, bytes.into());
6842
6843                        if let common::Retry::After(d) =
6844                            dlg.http_failure(&response, error.as_ref().ok())
6845                        {
6846                            sleep(d).await;
6847                            continue;
6848                        }
6849
6850                        dlg.finished(false);
6851
6852                        return Err(match error {
6853                            Ok(value) => common::Error::BadRequest(value),
6854                            _ => common::Error::Failure(response),
6855                        });
6856                    }
6857                    let response = {
6858                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6859                        let encoded = common::to_string(&bytes);
6860                        match serde_json::from_str(&encoded) {
6861                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6862                            Err(error) => {
6863                                dlg.response_json_decode_error(&encoded, &error);
6864                                return Err(common::Error::JsonDecodeError(
6865                                    encoded.to_string(),
6866                                    error,
6867                                ));
6868                            }
6869                        }
6870                    };
6871
6872                    dlg.finished(true);
6873                    return Ok(response);
6874                }
6875            }
6876        }
6877    }
6878
6879    ///
6880    /// Sets the *request* property to the given value.
6881    ///
6882    /// Even though the property as already been set when instantiating this call,
6883    /// we provide this method for API completeness.
6884    pub fn request(
6885        mut self,
6886        new_value: ConnectivityTest,
6887    ) -> ProjectLocationGlobalConnectivityTestCreateCall<'a, C> {
6888        self._request = new_value;
6889        self
6890    }
6891    /// Required. The parent resource of the Connectivity Test to create: `projects/{project_id}/locations/global`
6892    ///
6893    /// Sets the *parent* path property to the given value.
6894    ///
6895    /// Even though the property as already been set when instantiating this call,
6896    /// we provide this method for API completeness.
6897    pub fn parent(
6898        mut self,
6899        new_value: &str,
6900    ) -> ProjectLocationGlobalConnectivityTestCreateCall<'a, C> {
6901        self._parent = new_value.to_string();
6902        self
6903    }
6904    /// Required. The logical name of the Connectivity Test in your project with the following restrictions: * Must contain only lowercase letters, numbers, and hyphens. * Must start with a letter. * Must be between 1-40 characters. * Must end with a number or a letter. * Must be unique within the customer project
6905    ///
6906    /// Sets the *test id* query property to the given value.
6907    pub fn test_id(
6908        mut self,
6909        new_value: &str,
6910    ) -> ProjectLocationGlobalConnectivityTestCreateCall<'a, C> {
6911        self._test_id = Some(new_value.to_string());
6912        self
6913    }
6914    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6915    /// while executing the actual API request.
6916    ///
6917    /// ````text
6918    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6919    /// ````
6920    ///
6921    /// Sets the *delegate* property to the given value.
6922    pub fn delegate(
6923        mut self,
6924        new_value: &'a mut dyn common::Delegate,
6925    ) -> ProjectLocationGlobalConnectivityTestCreateCall<'a, C> {
6926        self._delegate = Some(new_value);
6927        self
6928    }
6929
6930    /// Set any additional parameter of the query string used in the request.
6931    /// It should be used to set parameters which are not yet available through their own
6932    /// setters.
6933    ///
6934    /// Please note that this method must not be used to set any of the known parameters
6935    /// which have their own setter method. If done anyway, the request will fail.
6936    ///
6937    /// # Additional Parameters
6938    ///
6939    /// * *$.xgafv* (query-string) - V1 error format.
6940    /// * *access_token* (query-string) - OAuth access token.
6941    /// * *alt* (query-string) - Data format for response.
6942    /// * *callback* (query-string) - JSONP
6943    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6944    /// * *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.
6945    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6946    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6947    /// * *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.
6948    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6949    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6950    pub fn param<T>(
6951        mut self,
6952        name: T,
6953        value: T,
6954    ) -> ProjectLocationGlobalConnectivityTestCreateCall<'a, C>
6955    where
6956        T: AsRef<str>,
6957    {
6958        self._additional_params
6959            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6960        self
6961    }
6962
6963    /// Identifies the authorization scope for the method you are building.
6964    ///
6965    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6966    /// [`Scope::CloudPlatform`].
6967    ///
6968    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6969    /// tokens for more than one scope.
6970    ///
6971    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6972    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6973    /// sufficient, a read-write scope will do as well.
6974    pub fn add_scope<St>(
6975        mut self,
6976        scope: St,
6977    ) -> ProjectLocationGlobalConnectivityTestCreateCall<'a, C>
6978    where
6979        St: AsRef<str>,
6980    {
6981        self._scopes.insert(String::from(scope.as_ref()));
6982        self
6983    }
6984    /// Identifies the authorization scope(s) for the method you are building.
6985    ///
6986    /// See [`Self::add_scope()`] for details.
6987    pub fn add_scopes<I, St>(
6988        mut self,
6989        scopes: I,
6990    ) -> ProjectLocationGlobalConnectivityTestCreateCall<'a, C>
6991    where
6992        I: IntoIterator<Item = St>,
6993        St: AsRef<str>,
6994    {
6995        self._scopes
6996            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6997        self
6998    }
6999
7000    /// Removes all scopes, and no default scope will be used either.
7001    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7002    /// for details).
7003    pub fn clear_scopes(mut self) -> ProjectLocationGlobalConnectivityTestCreateCall<'a, C> {
7004        self._scopes.clear();
7005        self
7006    }
7007}
7008
7009/// Deletes a specific `ConnectivityTest`.
7010///
7011/// A builder for the *locations.global.connectivityTests.delete* method supported by a *project* resource.
7012/// It is not used directly, but through a [`ProjectMethods`] instance.
7013///
7014/// # Example
7015///
7016/// Instantiate a resource method builder
7017///
7018/// ```test_harness,no_run
7019/// # extern crate hyper;
7020/// # extern crate hyper_rustls;
7021/// # extern crate google_networkmanagement1 as networkmanagement1;
7022/// # async fn dox() {
7023/// # use networkmanagement1::{NetworkManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7024///
7025/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7026/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7027/// #     .with_native_roots()
7028/// #     .unwrap()
7029/// #     .https_only()
7030/// #     .enable_http2()
7031/// #     .build();
7032///
7033/// # let executor = hyper_util::rt::TokioExecutor::new();
7034/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7035/// #     secret,
7036/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7037/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7038/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7039/// #     ),
7040/// # ).build().await.unwrap();
7041///
7042/// # let client = hyper_util::client::legacy::Client::builder(
7043/// #     hyper_util::rt::TokioExecutor::new()
7044/// # )
7045/// # .build(
7046/// #     hyper_rustls::HttpsConnectorBuilder::new()
7047/// #         .with_native_roots()
7048/// #         .unwrap()
7049/// #         .https_or_http()
7050/// #         .enable_http2()
7051/// #         .build()
7052/// # );
7053/// # let mut hub = NetworkManagement::new(client, auth);
7054/// // You can configure optional parameters by calling the respective setters at will, and
7055/// // execute the final call using `doit()`.
7056/// // Values shown here are possibly random and not representative !
7057/// let result = hub.projects().locations_global_connectivity_tests_delete("name")
7058///              .doit().await;
7059/// # }
7060/// ```
7061pub struct ProjectLocationGlobalConnectivityTestDeleteCall<'a, C>
7062where
7063    C: 'a,
7064{
7065    hub: &'a NetworkManagement<C>,
7066    _name: String,
7067    _delegate: Option<&'a mut dyn common::Delegate>,
7068    _additional_params: HashMap<String, String>,
7069    _scopes: BTreeSet<String>,
7070}
7071
7072impl<'a, C> common::CallBuilder for ProjectLocationGlobalConnectivityTestDeleteCall<'a, C> {}
7073
7074impl<'a, C> ProjectLocationGlobalConnectivityTestDeleteCall<'a, C>
7075where
7076    C: common::Connector,
7077{
7078    /// Perform the operation you have build so far.
7079    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
7080        use std::borrow::Cow;
7081        use std::io::{Read, Seek};
7082
7083        use common::{url::Params, ToParts};
7084        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7085
7086        let mut dd = common::DefaultDelegate;
7087        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7088        dlg.begin(common::MethodInfo {
7089            id: "networkmanagement.projects.locations.global.connectivityTests.delete",
7090            http_method: hyper::Method::DELETE,
7091        });
7092
7093        for &field in ["alt", "name"].iter() {
7094            if self._additional_params.contains_key(field) {
7095                dlg.finished(false);
7096                return Err(common::Error::FieldClash(field));
7097            }
7098        }
7099
7100        let mut params = Params::with_capacity(3 + self._additional_params.len());
7101        params.push("name", self._name);
7102
7103        params.extend(self._additional_params.iter());
7104
7105        params.push("alt", "json");
7106        let mut url = self.hub._base_url.clone() + "v1/{+name}";
7107        if self._scopes.is_empty() {
7108            self._scopes
7109                .insert(Scope::CloudPlatform.as_ref().to_string());
7110        }
7111
7112        #[allow(clippy::single_element_loop)]
7113        for &(find_this, param_name) in [("{+name}", "name")].iter() {
7114            url = params.uri_replacement(url, param_name, find_this, true);
7115        }
7116        {
7117            let to_remove = ["name"];
7118            params.remove_params(&to_remove);
7119        }
7120
7121        let url = params.parse_with_url(&url);
7122
7123        loop {
7124            let token = match self
7125                .hub
7126                .auth
7127                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7128                .await
7129            {
7130                Ok(token) => token,
7131                Err(e) => match dlg.token(e) {
7132                    Ok(token) => token,
7133                    Err(e) => {
7134                        dlg.finished(false);
7135                        return Err(common::Error::MissingToken(e));
7136                    }
7137                },
7138            };
7139            let mut req_result = {
7140                let client = &self.hub.client;
7141                dlg.pre_request();
7142                let mut req_builder = hyper::Request::builder()
7143                    .method(hyper::Method::DELETE)
7144                    .uri(url.as_str())
7145                    .header(USER_AGENT, self.hub._user_agent.clone());
7146
7147                if let Some(token) = token.as_ref() {
7148                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7149                }
7150
7151                let request = req_builder
7152                    .header(CONTENT_LENGTH, 0_u64)
7153                    .body(common::to_body::<String>(None));
7154
7155                client.request(request.unwrap()).await
7156            };
7157
7158            match req_result {
7159                Err(err) => {
7160                    if let common::Retry::After(d) = dlg.http_error(&err) {
7161                        sleep(d).await;
7162                        continue;
7163                    }
7164                    dlg.finished(false);
7165                    return Err(common::Error::HttpError(err));
7166                }
7167                Ok(res) => {
7168                    let (mut parts, body) = res.into_parts();
7169                    let mut body = common::Body::new(body);
7170                    if !parts.status.is_success() {
7171                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7172                        let error = serde_json::from_str(&common::to_string(&bytes));
7173                        let response = common::to_response(parts, bytes.into());
7174
7175                        if let common::Retry::After(d) =
7176                            dlg.http_failure(&response, error.as_ref().ok())
7177                        {
7178                            sleep(d).await;
7179                            continue;
7180                        }
7181
7182                        dlg.finished(false);
7183
7184                        return Err(match error {
7185                            Ok(value) => common::Error::BadRequest(value),
7186                            _ => common::Error::Failure(response),
7187                        });
7188                    }
7189                    let response = {
7190                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7191                        let encoded = common::to_string(&bytes);
7192                        match serde_json::from_str(&encoded) {
7193                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7194                            Err(error) => {
7195                                dlg.response_json_decode_error(&encoded, &error);
7196                                return Err(common::Error::JsonDecodeError(
7197                                    encoded.to_string(),
7198                                    error,
7199                                ));
7200                            }
7201                        }
7202                    };
7203
7204                    dlg.finished(true);
7205                    return Ok(response);
7206                }
7207            }
7208        }
7209    }
7210
7211    /// Required. Connectivity Test resource name using the form: `projects/{project_id}/locations/global/connectivityTests/{test_id}`
7212    ///
7213    /// Sets the *name* path property to the given value.
7214    ///
7215    /// Even though the property as already been set when instantiating this call,
7216    /// we provide this method for API completeness.
7217    pub fn name(
7218        mut self,
7219        new_value: &str,
7220    ) -> ProjectLocationGlobalConnectivityTestDeleteCall<'a, C> {
7221        self._name = new_value.to_string();
7222        self
7223    }
7224    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7225    /// while executing the actual API request.
7226    ///
7227    /// ````text
7228    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7229    /// ````
7230    ///
7231    /// Sets the *delegate* property to the given value.
7232    pub fn delegate(
7233        mut self,
7234        new_value: &'a mut dyn common::Delegate,
7235    ) -> ProjectLocationGlobalConnectivityTestDeleteCall<'a, C> {
7236        self._delegate = Some(new_value);
7237        self
7238    }
7239
7240    /// Set any additional parameter of the query string used in the request.
7241    /// It should be used to set parameters which are not yet available through their own
7242    /// setters.
7243    ///
7244    /// Please note that this method must not be used to set any of the known parameters
7245    /// which have their own setter method. If done anyway, the request will fail.
7246    ///
7247    /// # Additional Parameters
7248    ///
7249    /// * *$.xgafv* (query-string) - V1 error format.
7250    /// * *access_token* (query-string) - OAuth access token.
7251    /// * *alt* (query-string) - Data format for response.
7252    /// * *callback* (query-string) - JSONP
7253    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7254    /// * *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.
7255    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7256    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7257    /// * *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.
7258    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7259    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7260    pub fn param<T>(
7261        mut self,
7262        name: T,
7263        value: T,
7264    ) -> ProjectLocationGlobalConnectivityTestDeleteCall<'a, C>
7265    where
7266        T: AsRef<str>,
7267    {
7268        self._additional_params
7269            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7270        self
7271    }
7272
7273    /// Identifies the authorization scope for the method you are building.
7274    ///
7275    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7276    /// [`Scope::CloudPlatform`].
7277    ///
7278    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7279    /// tokens for more than one scope.
7280    ///
7281    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7282    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7283    /// sufficient, a read-write scope will do as well.
7284    pub fn add_scope<St>(
7285        mut self,
7286        scope: St,
7287    ) -> ProjectLocationGlobalConnectivityTestDeleteCall<'a, C>
7288    where
7289        St: AsRef<str>,
7290    {
7291        self._scopes.insert(String::from(scope.as_ref()));
7292        self
7293    }
7294    /// Identifies the authorization scope(s) for the method you are building.
7295    ///
7296    /// See [`Self::add_scope()`] for details.
7297    pub fn add_scopes<I, St>(
7298        mut self,
7299        scopes: I,
7300    ) -> ProjectLocationGlobalConnectivityTestDeleteCall<'a, C>
7301    where
7302        I: IntoIterator<Item = St>,
7303        St: AsRef<str>,
7304    {
7305        self._scopes
7306            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7307        self
7308    }
7309
7310    /// Removes all scopes, and no default scope will be used either.
7311    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7312    /// for details).
7313    pub fn clear_scopes(mut self) -> ProjectLocationGlobalConnectivityTestDeleteCall<'a, C> {
7314        self._scopes.clear();
7315        self
7316    }
7317}
7318
7319/// Gets the details of a specific Connectivity Test.
7320///
7321/// A builder for the *locations.global.connectivityTests.get* method supported by a *project* resource.
7322/// It is not used directly, but through a [`ProjectMethods`] instance.
7323///
7324/// # Example
7325///
7326/// Instantiate a resource method builder
7327///
7328/// ```test_harness,no_run
7329/// # extern crate hyper;
7330/// # extern crate hyper_rustls;
7331/// # extern crate google_networkmanagement1 as networkmanagement1;
7332/// # async fn dox() {
7333/// # use networkmanagement1::{NetworkManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7334///
7335/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7336/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7337/// #     .with_native_roots()
7338/// #     .unwrap()
7339/// #     .https_only()
7340/// #     .enable_http2()
7341/// #     .build();
7342///
7343/// # let executor = hyper_util::rt::TokioExecutor::new();
7344/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7345/// #     secret,
7346/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7347/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7348/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7349/// #     ),
7350/// # ).build().await.unwrap();
7351///
7352/// # let client = hyper_util::client::legacy::Client::builder(
7353/// #     hyper_util::rt::TokioExecutor::new()
7354/// # )
7355/// # .build(
7356/// #     hyper_rustls::HttpsConnectorBuilder::new()
7357/// #         .with_native_roots()
7358/// #         .unwrap()
7359/// #         .https_or_http()
7360/// #         .enable_http2()
7361/// #         .build()
7362/// # );
7363/// # let mut hub = NetworkManagement::new(client, auth);
7364/// // You can configure optional parameters by calling the respective setters at will, and
7365/// // execute the final call using `doit()`.
7366/// // Values shown here are possibly random and not representative !
7367/// let result = hub.projects().locations_global_connectivity_tests_get("name")
7368///              .doit().await;
7369/// # }
7370/// ```
7371pub struct ProjectLocationGlobalConnectivityTestGetCall<'a, C>
7372where
7373    C: 'a,
7374{
7375    hub: &'a NetworkManagement<C>,
7376    _name: String,
7377    _delegate: Option<&'a mut dyn common::Delegate>,
7378    _additional_params: HashMap<String, String>,
7379    _scopes: BTreeSet<String>,
7380}
7381
7382impl<'a, C> common::CallBuilder for ProjectLocationGlobalConnectivityTestGetCall<'a, C> {}
7383
7384impl<'a, C> ProjectLocationGlobalConnectivityTestGetCall<'a, C>
7385where
7386    C: common::Connector,
7387{
7388    /// Perform the operation you have build so far.
7389    pub async fn doit(mut self) -> common::Result<(common::Response, ConnectivityTest)> {
7390        use std::borrow::Cow;
7391        use std::io::{Read, Seek};
7392
7393        use common::{url::Params, ToParts};
7394        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7395
7396        let mut dd = common::DefaultDelegate;
7397        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7398        dlg.begin(common::MethodInfo {
7399            id: "networkmanagement.projects.locations.global.connectivityTests.get",
7400            http_method: hyper::Method::GET,
7401        });
7402
7403        for &field in ["alt", "name"].iter() {
7404            if self._additional_params.contains_key(field) {
7405                dlg.finished(false);
7406                return Err(common::Error::FieldClash(field));
7407            }
7408        }
7409
7410        let mut params = Params::with_capacity(3 + self._additional_params.len());
7411        params.push("name", self._name);
7412
7413        params.extend(self._additional_params.iter());
7414
7415        params.push("alt", "json");
7416        let mut url = self.hub._base_url.clone() + "v1/{+name}";
7417        if self._scopes.is_empty() {
7418            self._scopes
7419                .insert(Scope::CloudPlatform.as_ref().to_string());
7420        }
7421
7422        #[allow(clippy::single_element_loop)]
7423        for &(find_this, param_name) in [("{+name}", "name")].iter() {
7424            url = params.uri_replacement(url, param_name, find_this, true);
7425        }
7426        {
7427            let to_remove = ["name"];
7428            params.remove_params(&to_remove);
7429        }
7430
7431        let url = params.parse_with_url(&url);
7432
7433        loop {
7434            let token = match self
7435                .hub
7436                .auth
7437                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7438                .await
7439            {
7440                Ok(token) => token,
7441                Err(e) => match dlg.token(e) {
7442                    Ok(token) => token,
7443                    Err(e) => {
7444                        dlg.finished(false);
7445                        return Err(common::Error::MissingToken(e));
7446                    }
7447                },
7448            };
7449            let mut req_result = {
7450                let client = &self.hub.client;
7451                dlg.pre_request();
7452                let mut req_builder = hyper::Request::builder()
7453                    .method(hyper::Method::GET)
7454                    .uri(url.as_str())
7455                    .header(USER_AGENT, self.hub._user_agent.clone());
7456
7457                if let Some(token) = token.as_ref() {
7458                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7459                }
7460
7461                let request = req_builder
7462                    .header(CONTENT_LENGTH, 0_u64)
7463                    .body(common::to_body::<String>(None));
7464
7465                client.request(request.unwrap()).await
7466            };
7467
7468            match req_result {
7469                Err(err) => {
7470                    if let common::Retry::After(d) = dlg.http_error(&err) {
7471                        sleep(d).await;
7472                        continue;
7473                    }
7474                    dlg.finished(false);
7475                    return Err(common::Error::HttpError(err));
7476                }
7477                Ok(res) => {
7478                    let (mut parts, body) = res.into_parts();
7479                    let mut body = common::Body::new(body);
7480                    if !parts.status.is_success() {
7481                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7482                        let error = serde_json::from_str(&common::to_string(&bytes));
7483                        let response = common::to_response(parts, bytes.into());
7484
7485                        if let common::Retry::After(d) =
7486                            dlg.http_failure(&response, error.as_ref().ok())
7487                        {
7488                            sleep(d).await;
7489                            continue;
7490                        }
7491
7492                        dlg.finished(false);
7493
7494                        return Err(match error {
7495                            Ok(value) => common::Error::BadRequest(value),
7496                            _ => common::Error::Failure(response),
7497                        });
7498                    }
7499                    let response = {
7500                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7501                        let encoded = common::to_string(&bytes);
7502                        match serde_json::from_str(&encoded) {
7503                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7504                            Err(error) => {
7505                                dlg.response_json_decode_error(&encoded, &error);
7506                                return Err(common::Error::JsonDecodeError(
7507                                    encoded.to_string(),
7508                                    error,
7509                                ));
7510                            }
7511                        }
7512                    };
7513
7514                    dlg.finished(true);
7515                    return Ok(response);
7516                }
7517            }
7518        }
7519    }
7520
7521    /// Required. `ConnectivityTest` resource name using the form: `projects/{project_id}/locations/global/connectivityTests/{test_id}`
7522    ///
7523    /// Sets the *name* path property to the given value.
7524    ///
7525    /// Even though the property as already been set when instantiating this call,
7526    /// we provide this method for API completeness.
7527    pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalConnectivityTestGetCall<'a, C> {
7528        self._name = new_value.to_string();
7529        self
7530    }
7531    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7532    /// while executing the actual API request.
7533    ///
7534    /// ````text
7535    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7536    /// ````
7537    ///
7538    /// Sets the *delegate* property to the given value.
7539    pub fn delegate(
7540        mut self,
7541        new_value: &'a mut dyn common::Delegate,
7542    ) -> ProjectLocationGlobalConnectivityTestGetCall<'a, C> {
7543        self._delegate = Some(new_value);
7544        self
7545    }
7546
7547    /// Set any additional parameter of the query string used in the request.
7548    /// It should be used to set parameters which are not yet available through their own
7549    /// setters.
7550    ///
7551    /// Please note that this method must not be used to set any of the known parameters
7552    /// which have their own setter method. If done anyway, the request will fail.
7553    ///
7554    /// # Additional Parameters
7555    ///
7556    /// * *$.xgafv* (query-string) - V1 error format.
7557    /// * *access_token* (query-string) - OAuth access token.
7558    /// * *alt* (query-string) - Data format for response.
7559    /// * *callback* (query-string) - JSONP
7560    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7561    /// * *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.
7562    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7563    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7564    /// * *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.
7565    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7566    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7567    pub fn param<T>(
7568        mut self,
7569        name: T,
7570        value: T,
7571    ) -> ProjectLocationGlobalConnectivityTestGetCall<'a, C>
7572    where
7573        T: AsRef<str>,
7574    {
7575        self._additional_params
7576            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7577        self
7578    }
7579
7580    /// Identifies the authorization scope for the method you are building.
7581    ///
7582    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7583    /// [`Scope::CloudPlatform`].
7584    ///
7585    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7586    /// tokens for more than one scope.
7587    ///
7588    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7589    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7590    /// sufficient, a read-write scope will do as well.
7591    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalConnectivityTestGetCall<'a, C>
7592    where
7593        St: AsRef<str>,
7594    {
7595        self._scopes.insert(String::from(scope.as_ref()));
7596        self
7597    }
7598    /// Identifies the authorization scope(s) for the method you are building.
7599    ///
7600    /// See [`Self::add_scope()`] for details.
7601    pub fn add_scopes<I, St>(
7602        mut self,
7603        scopes: I,
7604    ) -> ProjectLocationGlobalConnectivityTestGetCall<'a, C>
7605    where
7606        I: IntoIterator<Item = St>,
7607        St: AsRef<str>,
7608    {
7609        self._scopes
7610            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7611        self
7612    }
7613
7614    /// Removes all scopes, and no default scope will be used either.
7615    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7616    /// for details).
7617    pub fn clear_scopes(mut self) -> ProjectLocationGlobalConnectivityTestGetCall<'a, C> {
7618        self._scopes.clear();
7619        self
7620    }
7621}
7622
7623/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
7624///
7625/// A builder for the *locations.global.connectivityTests.getIamPolicy* method supported by a *project* resource.
7626/// It is not used directly, but through a [`ProjectMethods`] instance.
7627///
7628/// # Example
7629///
7630/// Instantiate a resource method builder
7631///
7632/// ```test_harness,no_run
7633/// # extern crate hyper;
7634/// # extern crate hyper_rustls;
7635/// # extern crate google_networkmanagement1 as networkmanagement1;
7636/// # async fn dox() {
7637/// # use networkmanagement1::{NetworkManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7638///
7639/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7640/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7641/// #     .with_native_roots()
7642/// #     .unwrap()
7643/// #     .https_only()
7644/// #     .enable_http2()
7645/// #     .build();
7646///
7647/// # let executor = hyper_util::rt::TokioExecutor::new();
7648/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7649/// #     secret,
7650/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7651/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7652/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7653/// #     ),
7654/// # ).build().await.unwrap();
7655///
7656/// # let client = hyper_util::client::legacy::Client::builder(
7657/// #     hyper_util::rt::TokioExecutor::new()
7658/// # )
7659/// # .build(
7660/// #     hyper_rustls::HttpsConnectorBuilder::new()
7661/// #         .with_native_roots()
7662/// #         .unwrap()
7663/// #         .https_or_http()
7664/// #         .enable_http2()
7665/// #         .build()
7666/// # );
7667/// # let mut hub = NetworkManagement::new(client, auth);
7668/// // You can configure optional parameters by calling the respective setters at will, and
7669/// // execute the final call using `doit()`.
7670/// // Values shown here are possibly random and not representative !
7671/// let result = hub.projects().locations_global_connectivity_tests_get_iam_policy("resource")
7672///              .options_requested_policy_version(-56)
7673///              .doit().await;
7674/// # }
7675/// ```
7676pub struct ProjectLocationGlobalConnectivityTestGetIamPolicyCall<'a, C>
7677where
7678    C: 'a,
7679{
7680    hub: &'a NetworkManagement<C>,
7681    _resource: String,
7682    _options_requested_policy_version: Option<i32>,
7683    _delegate: Option<&'a mut dyn common::Delegate>,
7684    _additional_params: HashMap<String, String>,
7685    _scopes: BTreeSet<String>,
7686}
7687
7688impl<'a, C> common::CallBuilder for ProjectLocationGlobalConnectivityTestGetIamPolicyCall<'a, C> {}
7689
7690impl<'a, C> ProjectLocationGlobalConnectivityTestGetIamPolicyCall<'a, C>
7691where
7692    C: common::Connector,
7693{
7694    /// Perform the operation you have build so far.
7695    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
7696        use std::borrow::Cow;
7697        use std::io::{Read, Seek};
7698
7699        use common::{url::Params, ToParts};
7700        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7701
7702        let mut dd = common::DefaultDelegate;
7703        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7704        dlg.begin(common::MethodInfo {
7705            id: "networkmanagement.projects.locations.global.connectivityTests.getIamPolicy",
7706            http_method: hyper::Method::GET,
7707        });
7708
7709        for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
7710            if self._additional_params.contains_key(field) {
7711                dlg.finished(false);
7712                return Err(common::Error::FieldClash(field));
7713            }
7714        }
7715
7716        let mut params = Params::with_capacity(4 + self._additional_params.len());
7717        params.push("resource", self._resource);
7718        if let Some(value) = self._options_requested_policy_version.as_ref() {
7719            params.push("options.requestedPolicyVersion", value.to_string());
7720        }
7721
7722        params.extend(self._additional_params.iter());
7723
7724        params.push("alt", "json");
7725        let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
7726        if self._scopes.is_empty() {
7727            self._scopes
7728                .insert(Scope::CloudPlatform.as_ref().to_string());
7729        }
7730
7731        #[allow(clippy::single_element_loop)]
7732        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
7733            url = params.uri_replacement(url, param_name, find_this, true);
7734        }
7735        {
7736            let to_remove = ["resource"];
7737            params.remove_params(&to_remove);
7738        }
7739
7740        let url = params.parse_with_url(&url);
7741
7742        loop {
7743            let token = match self
7744                .hub
7745                .auth
7746                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7747                .await
7748            {
7749                Ok(token) => token,
7750                Err(e) => match dlg.token(e) {
7751                    Ok(token) => token,
7752                    Err(e) => {
7753                        dlg.finished(false);
7754                        return Err(common::Error::MissingToken(e));
7755                    }
7756                },
7757            };
7758            let mut req_result = {
7759                let client = &self.hub.client;
7760                dlg.pre_request();
7761                let mut req_builder = hyper::Request::builder()
7762                    .method(hyper::Method::GET)
7763                    .uri(url.as_str())
7764                    .header(USER_AGENT, self.hub._user_agent.clone());
7765
7766                if let Some(token) = token.as_ref() {
7767                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7768                }
7769
7770                let request = req_builder
7771                    .header(CONTENT_LENGTH, 0_u64)
7772                    .body(common::to_body::<String>(None));
7773
7774                client.request(request.unwrap()).await
7775            };
7776
7777            match req_result {
7778                Err(err) => {
7779                    if let common::Retry::After(d) = dlg.http_error(&err) {
7780                        sleep(d).await;
7781                        continue;
7782                    }
7783                    dlg.finished(false);
7784                    return Err(common::Error::HttpError(err));
7785                }
7786                Ok(res) => {
7787                    let (mut parts, body) = res.into_parts();
7788                    let mut body = common::Body::new(body);
7789                    if !parts.status.is_success() {
7790                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7791                        let error = serde_json::from_str(&common::to_string(&bytes));
7792                        let response = common::to_response(parts, bytes.into());
7793
7794                        if let common::Retry::After(d) =
7795                            dlg.http_failure(&response, error.as_ref().ok())
7796                        {
7797                            sleep(d).await;
7798                            continue;
7799                        }
7800
7801                        dlg.finished(false);
7802
7803                        return Err(match error {
7804                            Ok(value) => common::Error::BadRequest(value),
7805                            _ => common::Error::Failure(response),
7806                        });
7807                    }
7808                    let response = {
7809                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7810                        let encoded = common::to_string(&bytes);
7811                        match serde_json::from_str(&encoded) {
7812                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7813                            Err(error) => {
7814                                dlg.response_json_decode_error(&encoded, &error);
7815                                return Err(common::Error::JsonDecodeError(
7816                                    encoded.to_string(),
7817                                    error,
7818                                ));
7819                            }
7820                        }
7821                    };
7822
7823                    dlg.finished(true);
7824                    return Ok(response);
7825                }
7826            }
7827        }
7828    }
7829
7830    /// REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
7831    ///
7832    /// Sets the *resource* path property to the given value.
7833    ///
7834    /// Even though the property as already been set when instantiating this call,
7835    /// we provide this method for API completeness.
7836    pub fn resource(
7837        mut self,
7838        new_value: &str,
7839    ) -> ProjectLocationGlobalConnectivityTestGetIamPolicyCall<'a, C> {
7840        self._resource = new_value.to_string();
7841        self
7842    }
7843    /// Optional. The maximum policy version that will be used to format the policy. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. Requests for policies with any conditional role bindings must specify version 3. Policies with no conditional role bindings may specify any valid value or leave the field unset. The policy in the response might use the policy version that you specified, or it might use a lower policy version. For example, if you specify version 3, but the policy has no conditional role bindings, the response uses version 1. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
7844    ///
7845    /// Sets the *options.requested policy version* query property to the given value.
7846    pub fn options_requested_policy_version(
7847        mut self,
7848        new_value: i32,
7849    ) -> ProjectLocationGlobalConnectivityTestGetIamPolicyCall<'a, C> {
7850        self._options_requested_policy_version = Some(new_value);
7851        self
7852    }
7853    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7854    /// while executing the actual API request.
7855    ///
7856    /// ````text
7857    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7858    /// ````
7859    ///
7860    /// Sets the *delegate* property to the given value.
7861    pub fn delegate(
7862        mut self,
7863        new_value: &'a mut dyn common::Delegate,
7864    ) -> ProjectLocationGlobalConnectivityTestGetIamPolicyCall<'a, C> {
7865        self._delegate = Some(new_value);
7866        self
7867    }
7868
7869    /// Set any additional parameter of the query string used in the request.
7870    /// It should be used to set parameters which are not yet available through their own
7871    /// setters.
7872    ///
7873    /// Please note that this method must not be used to set any of the known parameters
7874    /// which have their own setter method. If done anyway, the request will fail.
7875    ///
7876    /// # Additional Parameters
7877    ///
7878    /// * *$.xgafv* (query-string) - V1 error format.
7879    /// * *access_token* (query-string) - OAuth access token.
7880    /// * *alt* (query-string) - Data format for response.
7881    /// * *callback* (query-string) - JSONP
7882    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7883    /// * *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.
7884    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7885    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7886    /// * *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.
7887    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7888    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7889    pub fn param<T>(
7890        mut self,
7891        name: T,
7892        value: T,
7893    ) -> ProjectLocationGlobalConnectivityTestGetIamPolicyCall<'a, C>
7894    where
7895        T: AsRef<str>,
7896    {
7897        self._additional_params
7898            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7899        self
7900    }
7901
7902    /// Identifies the authorization scope for the method you are building.
7903    ///
7904    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7905    /// [`Scope::CloudPlatform`].
7906    ///
7907    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7908    /// tokens for more than one scope.
7909    ///
7910    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7911    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7912    /// sufficient, a read-write scope will do as well.
7913    pub fn add_scope<St>(
7914        mut self,
7915        scope: St,
7916    ) -> ProjectLocationGlobalConnectivityTestGetIamPolicyCall<'a, C>
7917    where
7918        St: AsRef<str>,
7919    {
7920        self._scopes.insert(String::from(scope.as_ref()));
7921        self
7922    }
7923    /// Identifies the authorization scope(s) for the method you are building.
7924    ///
7925    /// See [`Self::add_scope()`] for details.
7926    pub fn add_scopes<I, St>(
7927        mut self,
7928        scopes: I,
7929    ) -> ProjectLocationGlobalConnectivityTestGetIamPolicyCall<'a, C>
7930    where
7931        I: IntoIterator<Item = St>,
7932        St: AsRef<str>,
7933    {
7934        self._scopes
7935            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7936        self
7937    }
7938
7939    /// Removes all scopes, and no default scope will be used either.
7940    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7941    /// for details).
7942    pub fn clear_scopes(mut self) -> ProjectLocationGlobalConnectivityTestGetIamPolicyCall<'a, C> {
7943        self._scopes.clear();
7944        self
7945    }
7946}
7947
7948/// Lists all Connectivity Tests owned by a project.
7949///
7950/// A builder for the *locations.global.connectivityTests.list* method supported by a *project* resource.
7951/// It is not used directly, but through a [`ProjectMethods`] instance.
7952///
7953/// # Example
7954///
7955/// Instantiate a resource method builder
7956///
7957/// ```test_harness,no_run
7958/// # extern crate hyper;
7959/// # extern crate hyper_rustls;
7960/// # extern crate google_networkmanagement1 as networkmanagement1;
7961/// # async fn dox() {
7962/// # use networkmanagement1::{NetworkManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7963///
7964/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7965/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7966/// #     .with_native_roots()
7967/// #     .unwrap()
7968/// #     .https_only()
7969/// #     .enable_http2()
7970/// #     .build();
7971///
7972/// # let executor = hyper_util::rt::TokioExecutor::new();
7973/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7974/// #     secret,
7975/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7976/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7977/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7978/// #     ),
7979/// # ).build().await.unwrap();
7980///
7981/// # let client = hyper_util::client::legacy::Client::builder(
7982/// #     hyper_util::rt::TokioExecutor::new()
7983/// # )
7984/// # .build(
7985/// #     hyper_rustls::HttpsConnectorBuilder::new()
7986/// #         .with_native_roots()
7987/// #         .unwrap()
7988/// #         .https_or_http()
7989/// #         .enable_http2()
7990/// #         .build()
7991/// # );
7992/// # let mut hub = NetworkManagement::new(client, auth);
7993/// // You can configure optional parameters by calling the respective setters at will, and
7994/// // execute the final call using `doit()`.
7995/// // Values shown here are possibly random and not representative !
7996/// let result = hub.projects().locations_global_connectivity_tests_list("parent")
7997///              .page_token("labore")
7998///              .page_size(-43)
7999///              .order_by("duo")
8000///              .filter("sed")
8001///              .doit().await;
8002/// # }
8003/// ```
8004pub struct ProjectLocationGlobalConnectivityTestListCall<'a, C>
8005where
8006    C: 'a,
8007{
8008    hub: &'a NetworkManagement<C>,
8009    _parent: String,
8010    _page_token: Option<String>,
8011    _page_size: Option<i32>,
8012    _order_by: Option<String>,
8013    _filter: Option<String>,
8014    _delegate: Option<&'a mut dyn common::Delegate>,
8015    _additional_params: HashMap<String, String>,
8016    _scopes: BTreeSet<String>,
8017}
8018
8019impl<'a, C> common::CallBuilder for ProjectLocationGlobalConnectivityTestListCall<'a, C> {}
8020
8021impl<'a, C> ProjectLocationGlobalConnectivityTestListCall<'a, C>
8022where
8023    C: common::Connector,
8024{
8025    /// Perform the operation you have build so far.
8026    pub async fn doit(
8027        mut self,
8028    ) -> common::Result<(common::Response, ListConnectivityTestsResponse)> {
8029        use std::borrow::Cow;
8030        use std::io::{Read, Seek};
8031
8032        use common::{url::Params, ToParts};
8033        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8034
8035        let mut dd = common::DefaultDelegate;
8036        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8037        dlg.begin(common::MethodInfo {
8038            id: "networkmanagement.projects.locations.global.connectivityTests.list",
8039            http_method: hyper::Method::GET,
8040        });
8041
8042        for &field in [
8043            "alt",
8044            "parent",
8045            "pageToken",
8046            "pageSize",
8047            "orderBy",
8048            "filter",
8049        ]
8050        .iter()
8051        {
8052            if self._additional_params.contains_key(field) {
8053                dlg.finished(false);
8054                return Err(common::Error::FieldClash(field));
8055            }
8056        }
8057
8058        let mut params = Params::with_capacity(7 + self._additional_params.len());
8059        params.push("parent", self._parent);
8060        if let Some(value) = self._page_token.as_ref() {
8061            params.push("pageToken", value);
8062        }
8063        if let Some(value) = self._page_size.as_ref() {
8064            params.push("pageSize", value.to_string());
8065        }
8066        if let Some(value) = self._order_by.as_ref() {
8067            params.push("orderBy", value);
8068        }
8069        if let Some(value) = self._filter.as_ref() {
8070            params.push("filter", value);
8071        }
8072
8073        params.extend(self._additional_params.iter());
8074
8075        params.push("alt", "json");
8076        let mut url = self.hub._base_url.clone() + "v1/{+parent}/connectivityTests";
8077        if self._scopes.is_empty() {
8078            self._scopes
8079                .insert(Scope::CloudPlatform.as_ref().to_string());
8080        }
8081
8082        #[allow(clippy::single_element_loop)]
8083        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8084            url = params.uri_replacement(url, param_name, find_this, true);
8085        }
8086        {
8087            let to_remove = ["parent"];
8088            params.remove_params(&to_remove);
8089        }
8090
8091        let url = params.parse_with_url(&url);
8092
8093        loop {
8094            let token = match self
8095                .hub
8096                .auth
8097                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8098                .await
8099            {
8100                Ok(token) => token,
8101                Err(e) => match dlg.token(e) {
8102                    Ok(token) => token,
8103                    Err(e) => {
8104                        dlg.finished(false);
8105                        return Err(common::Error::MissingToken(e));
8106                    }
8107                },
8108            };
8109            let mut req_result = {
8110                let client = &self.hub.client;
8111                dlg.pre_request();
8112                let mut req_builder = hyper::Request::builder()
8113                    .method(hyper::Method::GET)
8114                    .uri(url.as_str())
8115                    .header(USER_AGENT, self.hub._user_agent.clone());
8116
8117                if let Some(token) = token.as_ref() {
8118                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8119                }
8120
8121                let request = req_builder
8122                    .header(CONTENT_LENGTH, 0_u64)
8123                    .body(common::to_body::<String>(None));
8124
8125                client.request(request.unwrap()).await
8126            };
8127
8128            match req_result {
8129                Err(err) => {
8130                    if let common::Retry::After(d) = dlg.http_error(&err) {
8131                        sleep(d).await;
8132                        continue;
8133                    }
8134                    dlg.finished(false);
8135                    return Err(common::Error::HttpError(err));
8136                }
8137                Ok(res) => {
8138                    let (mut parts, body) = res.into_parts();
8139                    let mut body = common::Body::new(body);
8140                    if !parts.status.is_success() {
8141                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8142                        let error = serde_json::from_str(&common::to_string(&bytes));
8143                        let response = common::to_response(parts, bytes.into());
8144
8145                        if let common::Retry::After(d) =
8146                            dlg.http_failure(&response, error.as_ref().ok())
8147                        {
8148                            sleep(d).await;
8149                            continue;
8150                        }
8151
8152                        dlg.finished(false);
8153
8154                        return Err(match error {
8155                            Ok(value) => common::Error::BadRequest(value),
8156                            _ => common::Error::Failure(response),
8157                        });
8158                    }
8159                    let response = {
8160                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8161                        let encoded = common::to_string(&bytes);
8162                        match serde_json::from_str(&encoded) {
8163                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8164                            Err(error) => {
8165                                dlg.response_json_decode_error(&encoded, &error);
8166                                return Err(common::Error::JsonDecodeError(
8167                                    encoded.to_string(),
8168                                    error,
8169                                ));
8170                            }
8171                        }
8172                    };
8173
8174                    dlg.finished(true);
8175                    return Ok(response);
8176                }
8177            }
8178        }
8179    }
8180
8181    /// Required. The parent resource of the Connectivity Tests: `projects/{project_id}/locations/global`
8182    ///
8183    /// Sets the *parent* path property to the given value.
8184    ///
8185    /// Even though the property as already been set when instantiating this call,
8186    /// we provide this method for API completeness.
8187    pub fn parent(
8188        mut self,
8189        new_value: &str,
8190    ) -> ProjectLocationGlobalConnectivityTestListCall<'a, C> {
8191        self._parent = new_value.to_string();
8192        self
8193    }
8194    /// Page token from an earlier query, as returned in `next_page_token`.
8195    ///
8196    /// Sets the *page token* query property to the given value.
8197    pub fn page_token(
8198        mut self,
8199        new_value: &str,
8200    ) -> ProjectLocationGlobalConnectivityTestListCall<'a, C> {
8201        self._page_token = Some(new_value.to_string());
8202        self
8203    }
8204    /// Number of `ConnectivityTests` to return.
8205    ///
8206    /// Sets the *page size* query property to the given value.
8207    pub fn page_size(
8208        mut self,
8209        new_value: i32,
8210    ) -> ProjectLocationGlobalConnectivityTestListCall<'a, C> {
8211        self._page_size = Some(new_value);
8212        self
8213    }
8214    /// Field to use to sort the list.
8215    ///
8216    /// Sets the *order by* query property to the given value.
8217    pub fn order_by(
8218        mut self,
8219        new_value: &str,
8220    ) -> ProjectLocationGlobalConnectivityTestListCall<'a, C> {
8221        self._order_by = Some(new_value.to_string());
8222        self
8223    }
8224    /// Lists the `ConnectivityTests` that match the filter expression. A filter expression filters the resources listed in the response. The expression must be of the form ` ` where operators: `<`, `>`, `<=`, `>=`, `!=`, `=`, `:` are supported (colon `:` represents a HAS operator which is roughly synonymous with equality). can refer to a proto or JSON field, or a synthetic field. Field names can be camelCase or snake_case. Examples: - Filter by name: name = "projects/proj-1/locations/global/connectivityTests/test-1 - Filter by labels: - Resources that have a key called `foo` labels.foo:* - Resources that have a key called `foo` whose value is `bar` labels.foo = bar
8225    ///
8226    /// Sets the *filter* query property to the given value.
8227    pub fn filter(
8228        mut self,
8229        new_value: &str,
8230    ) -> ProjectLocationGlobalConnectivityTestListCall<'a, C> {
8231        self._filter = Some(new_value.to_string());
8232        self
8233    }
8234    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8235    /// while executing the actual API request.
8236    ///
8237    /// ````text
8238    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8239    /// ````
8240    ///
8241    /// Sets the *delegate* property to the given value.
8242    pub fn delegate(
8243        mut self,
8244        new_value: &'a mut dyn common::Delegate,
8245    ) -> ProjectLocationGlobalConnectivityTestListCall<'a, C> {
8246        self._delegate = Some(new_value);
8247        self
8248    }
8249
8250    /// Set any additional parameter of the query string used in the request.
8251    /// It should be used to set parameters which are not yet available through their own
8252    /// setters.
8253    ///
8254    /// Please note that this method must not be used to set any of the known parameters
8255    /// which have their own setter method. If done anyway, the request will fail.
8256    ///
8257    /// # Additional Parameters
8258    ///
8259    /// * *$.xgafv* (query-string) - V1 error format.
8260    /// * *access_token* (query-string) - OAuth access token.
8261    /// * *alt* (query-string) - Data format for response.
8262    /// * *callback* (query-string) - JSONP
8263    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8264    /// * *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.
8265    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8266    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8267    /// * *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.
8268    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8269    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8270    pub fn param<T>(
8271        mut self,
8272        name: T,
8273        value: T,
8274    ) -> ProjectLocationGlobalConnectivityTestListCall<'a, C>
8275    where
8276        T: AsRef<str>,
8277    {
8278        self._additional_params
8279            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8280        self
8281    }
8282
8283    /// Identifies the authorization scope for the method you are building.
8284    ///
8285    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8286    /// [`Scope::CloudPlatform`].
8287    ///
8288    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8289    /// tokens for more than one scope.
8290    ///
8291    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8292    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8293    /// sufficient, a read-write scope will do as well.
8294    pub fn add_scope<St>(
8295        mut self,
8296        scope: St,
8297    ) -> ProjectLocationGlobalConnectivityTestListCall<'a, C>
8298    where
8299        St: AsRef<str>,
8300    {
8301        self._scopes.insert(String::from(scope.as_ref()));
8302        self
8303    }
8304    /// Identifies the authorization scope(s) for the method you are building.
8305    ///
8306    /// See [`Self::add_scope()`] for details.
8307    pub fn add_scopes<I, St>(
8308        mut self,
8309        scopes: I,
8310    ) -> ProjectLocationGlobalConnectivityTestListCall<'a, C>
8311    where
8312        I: IntoIterator<Item = St>,
8313        St: AsRef<str>,
8314    {
8315        self._scopes
8316            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8317        self
8318    }
8319
8320    /// Removes all scopes, and no default scope will be used either.
8321    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8322    /// for details).
8323    pub fn clear_scopes(mut self) -> ProjectLocationGlobalConnectivityTestListCall<'a, C> {
8324        self._scopes.clear();
8325        self
8326    }
8327}
8328
8329/// Updates the configuration of an existing `ConnectivityTest`. After you update a test, the reachability analysis is performed as part of the long running operation, which completes when the analysis completes. The Reachability state in the test resource is updated with the new result. If the endpoint specifications in `ConnectivityTest` are invalid (for example, they contain non-existent resources in the network, or the user does not have read permissions to the network configurations of listed projects), then the reachability result returns a value of UNKNOWN. If the endpoint specifications in `ConnectivityTest` are incomplete, the reachability result returns a value of `AMBIGUOUS`. See the documentation in `ConnectivityTest` for more details.
8330///
8331/// A builder for the *locations.global.connectivityTests.patch* method supported by a *project* resource.
8332/// It is not used directly, but through a [`ProjectMethods`] instance.
8333///
8334/// # Example
8335///
8336/// Instantiate a resource method builder
8337///
8338/// ```test_harness,no_run
8339/// # extern crate hyper;
8340/// # extern crate hyper_rustls;
8341/// # extern crate google_networkmanagement1 as networkmanagement1;
8342/// use networkmanagement1::api::ConnectivityTest;
8343/// # async fn dox() {
8344/// # use networkmanagement1::{NetworkManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8345///
8346/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8347/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8348/// #     .with_native_roots()
8349/// #     .unwrap()
8350/// #     .https_only()
8351/// #     .enable_http2()
8352/// #     .build();
8353///
8354/// # let executor = hyper_util::rt::TokioExecutor::new();
8355/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8356/// #     secret,
8357/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8358/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8359/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8360/// #     ),
8361/// # ).build().await.unwrap();
8362///
8363/// # let client = hyper_util::client::legacy::Client::builder(
8364/// #     hyper_util::rt::TokioExecutor::new()
8365/// # )
8366/// # .build(
8367/// #     hyper_rustls::HttpsConnectorBuilder::new()
8368/// #         .with_native_roots()
8369/// #         .unwrap()
8370/// #         .https_or_http()
8371/// #         .enable_http2()
8372/// #         .build()
8373/// # );
8374/// # let mut hub = NetworkManagement::new(client, auth);
8375/// // As the method needs a request, you would usually fill it with the desired information
8376/// // into the respective structure. Some of the parts shown here might not be applicable !
8377/// // Values shown here are possibly random and not representative !
8378/// let mut req = ConnectivityTest::default();
8379///
8380/// // You can configure optional parameters by calling the respective setters at will, and
8381/// // execute the final call using `doit()`.
8382/// // Values shown here are possibly random and not representative !
8383/// let result = hub.projects().locations_global_connectivity_tests_patch(req, "name")
8384///              .update_mask(FieldMask::new::<&str>(&[]))
8385///              .doit().await;
8386/// # }
8387/// ```
8388pub struct ProjectLocationGlobalConnectivityTestPatchCall<'a, C>
8389where
8390    C: 'a,
8391{
8392    hub: &'a NetworkManagement<C>,
8393    _request: ConnectivityTest,
8394    _name: String,
8395    _update_mask: Option<common::FieldMask>,
8396    _delegate: Option<&'a mut dyn common::Delegate>,
8397    _additional_params: HashMap<String, String>,
8398    _scopes: BTreeSet<String>,
8399}
8400
8401impl<'a, C> common::CallBuilder for ProjectLocationGlobalConnectivityTestPatchCall<'a, C> {}
8402
8403impl<'a, C> ProjectLocationGlobalConnectivityTestPatchCall<'a, C>
8404where
8405    C: common::Connector,
8406{
8407    /// Perform the operation you have build so far.
8408    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8409        use std::borrow::Cow;
8410        use std::io::{Read, Seek};
8411
8412        use common::{url::Params, ToParts};
8413        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8414
8415        let mut dd = common::DefaultDelegate;
8416        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8417        dlg.begin(common::MethodInfo {
8418            id: "networkmanagement.projects.locations.global.connectivityTests.patch",
8419            http_method: hyper::Method::PATCH,
8420        });
8421
8422        for &field in ["alt", "name", "updateMask"].iter() {
8423            if self._additional_params.contains_key(field) {
8424                dlg.finished(false);
8425                return Err(common::Error::FieldClash(field));
8426            }
8427        }
8428
8429        let mut params = Params::with_capacity(5 + self._additional_params.len());
8430        params.push("name", self._name);
8431        if let Some(value) = self._update_mask.as_ref() {
8432            params.push("updateMask", value.to_string());
8433        }
8434
8435        params.extend(self._additional_params.iter());
8436
8437        params.push("alt", "json");
8438        let mut url = self.hub._base_url.clone() + "v1/{+name}";
8439        if self._scopes.is_empty() {
8440            self._scopes
8441                .insert(Scope::CloudPlatform.as_ref().to_string());
8442        }
8443
8444        #[allow(clippy::single_element_loop)]
8445        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8446            url = params.uri_replacement(url, param_name, find_this, true);
8447        }
8448        {
8449            let to_remove = ["name"];
8450            params.remove_params(&to_remove);
8451        }
8452
8453        let url = params.parse_with_url(&url);
8454
8455        let mut json_mime_type = mime::APPLICATION_JSON;
8456        let mut request_value_reader = {
8457            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8458            common::remove_json_null_values(&mut value);
8459            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8460            serde_json::to_writer(&mut dst, &value).unwrap();
8461            dst
8462        };
8463        let request_size = request_value_reader
8464            .seek(std::io::SeekFrom::End(0))
8465            .unwrap();
8466        request_value_reader
8467            .seek(std::io::SeekFrom::Start(0))
8468            .unwrap();
8469
8470        loop {
8471            let token = match self
8472                .hub
8473                .auth
8474                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8475                .await
8476            {
8477                Ok(token) => token,
8478                Err(e) => match dlg.token(e) {
8479                    Ok(token) => token,
8480                    Err(e) => {
8481                        dlg.finished(false);
8482                        return Err(common::Error::MissingToken(e));
8483                    }
8484                },
8485            };
8486            request_value_reader
8487                .seek(std::io::SeekFrom::Start(0))
8488                .unwrap();
8489            let mut req_result = {
8490                let client = &self.hub.client;
8491                dlg.pre_request();
8492                let mut req_builder = hyper::Request::builder()
8493                    .method(hyper::Method::PATCH)
8494                    .uri(url.as_str())
8495                    .header(USER_AGENT, self.hub._user_agent.clone());
8496
8497                if let Some(token) = token.as_ref() {
8498                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8499                }
8500
8501                let request = req_builder
8502                    .header(CONTENT_TYPE, json_mime_type.to_string())
8503                    .header(CONTENT_LENGTH, request_size as u64)
8504                    .body(common::to_body(
8505                        request_value_reader.get_ref().clone().into(),
8506                    ));
8507
8508                client.request(request.unwrap()).await
8509            };
8510
8511            match req_result {
8512                Err(err) => {
8513                    if let common::Retry::After(d) = dlg.http_error(&err) {
8514                        sleep(d).await;
8515                        continue;
8516                    }
8517                    dlg.finished(false);
8518                    return Err(common::Error::HttpError(err));
8519                }
8520                Ok(res) => {
8521                    let (mut parts, body) = res.into_parts();
8522                    let mut body = common::Body::new(body);
8523                    if !parts.status.is_success() {
8524                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8525                        let error = serde_json::from_str(&common::to_string(&bytes));
8526                        let response = common::to_response(parts, bytes.into());
8527
8528                        if let common::Retry::After(d) =
8529                            dlg.http_failure(&response, error.as_ref().ok())
8530                        {
8531                            sleep(d).await;
8532                            continue;
8533                        }
8534
8535                        dlg.finished(false);
8536
8537                        return Err(match error {
8538                            Ok(value) => common::Error::BadRequest(value),
8539                            _ => common::Error::Failure(response),
8540                        });
8541                    }
8542                    let response = {
8543                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8544                        let encoded = common::to_string(&bytes);
8545                        match serde_json::from_str(&encoded) {
8546                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8547                            Err(error) => {
8548                                dlg.response_json_decode_error(&encoded, &error);
8549                                return Err(common::Error::JsonDecodeError(
8550                                    encoded.to_string(),
8551                                    error,
8552                                ));
8553                            }
8554                        }
8555                    };
8556
8557                    dlg.finished(true);
8558                    return Ok(response);
8559                }
8560            }
8561        }
8562    }
8563
8564    ///
8565    /// Sets the *request* property to the given value.
8566    ///
8567    /// Even though the property as already been set when instantiating this call,
8568    /// we provide this method for API completeness.
8569    pub fn request(
8570        mut self,
8571        new_value: ConnectivityTest,
8572    ) -> ProjectLocationGlobalConnectivityTestPatchCall<'a, C> {
8573        self._request = new_value;
8574        self
8575    }
8576    /// Identifier. Unique name of the resource using the form: `projects/{project_id}/locations/global/connectivityTests/{test_id}`
8577    ///
8578    /// Sets the *name* path property to the given value.
8579    ///
8580    /// Even though the property as already been set when instantiating this call,
8581    /// we provide this method for API completeness.
8582    pub fn name(
8583        mut self,
8584        new_value: &str,
8585    ) -> ProjectLocationGlobalConnectivityTestPatchCall<'a, C> {
8586        self._name = new_value.to_string();
8587        self
8588    }
8589    /// Required. Mask of fields to update. At least one path must be supplied in this field.
8590    ///
8591    /// Sets the *update mask* query property to the given value.
8592    pub fn update_mask(
8593        mut self,
8594        new_value: common::FieldMask,
8595    ) -> ProjectLocationGlobalConnectivityTestPatchCall<'a, C> {
8596        self._update_mask = Some(new_value);
8597        self
8598    }
8599    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8600    /// while executing the actual API request.
8601    ///
8602    /// ````text
8603    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8604    /// ````
8605    ///
8606    /// Sets the *delegate* property to the given value.
8607    pub fn delegate(
8608        mut self,
8609        new_value: &'a mut dyn common::Delegate,
8610    ) -> ProjectLocationGlobalConnectivityTestPatchCall<'a, C> {
8611        self._delegate = Some(new_value);
8612        self
8613    }
8614
8615    /// Set any additional parameter of the query string used in the request.
8616    /// It should be used to set parameters which are not yet available through their own
8617    /// setters.
8618    ///
8619    /// Please note that this method must not be used to set any of the known parameters
8620    /// which have their own setter method. If done anyway, the request will fail.
8621    ///
8622    /// # Additional Parameters
8623    ///
8624    /// * *$.xgafv* (query-string) - V1 error format.
8625    /// * *access_token* (query-string) - OAuth access token.
8626    /// * *alt* (query-string) - Data format for response.
8627    /// * *callback* (query-string) - JSONP
8628    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8629    /// * *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.
8630    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8631    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8632    /// * *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.
8633    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8634    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8635    pub fn param<T>(
8636        mut self,
8637        name: T,
8638        value: T,
8639    ) -> ProjectLocationGlobalConnectivityTestPatchCall<'a, C>
8640    where
8641        T: AsRef<str>,
8642    {
8643        self._additional_params
8644            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8645        self
8646    }
8647
8648    /// Identifies the authorization scope for the method you are building.
8649    ///
8650    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8651    /// [`Scope::CloudPlatform`].
8652    ///
8653    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8654    /// tokens for more than one scope.
8655    ///
8656    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8657    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8658    /// sufficient, a read-write scope will do as well.
8659    pub fn add_scope<St>(
8660        mut self,
8661        scope: St,
8662    ) -> ProjectLocationGlobalConnectivityTestPatchCall<'a, C>
8663    where
8664        St: AsRef<str>,
8665    {
8666        self._scopes.insert(String::from(scope.as_ref()));
8667        self
8668    }
8669    /// Identifies the authorization scope(s) for the method you are building.
8670    ///
8671    /// See [`Self::add_scope()`] for details.
8672    pub fn add_scopes<I, St>(
8673        mut self,
8674        scopes: I,
8675    ) -> ProjectLocationGlobalConnectivityTestPatchCall<'a, C>
8676    where
8677        I: IntoIterator<Item = St>,
8678        St: AsRef<str>,
8679    {
8680        self._scopes
8681            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8682        self
8683    }
8684
8685    /// Removes all scopes, and no default scope will be used either.
8686    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8687    /// for details).
8688    pub fn clear_scopes(mut self) -> ProjectLocationGlobalConnectivityTestPatchCall<'a, C> {
8689        self._scopes.clear();
8690        self
8691    }
8692}
8693
8694/// Rerun an existing `ConnectivityTest`. After the user triggers the rerun, the reachability analysis is performed as part of the long running operation, which completes when the analysis completes. Even though the test configuration remains the same, the reachability result may change due to underlying network configuration changes. If the endpoint specifications in `ConnectivityTest` become invalid (for example, specified resources are deleted in the network, or you lost read permissions to the network configurations of listed projects), then the reachability result returns a value of `UNKNOWN`.
8695///
8696/// A builder for the *locations.global.connectivityTests.rerun* method supported by a *project* resource.
8697/// It is not used directly, but through a [`ProjectMethods`] instance.
8698///
8699/// # Example
8700///
8701/// Instantiate a resource method builder
8702///
8703/// ```test_harness,no_run
8704/// # extern crate hyper;
8705/// # extern crate hyper_rustls;
8706/// # extern crate google_networkmanagement1 as networkmanagement1;
8707/// use networkmanagement1::api::RerunConnectivityTestRequest;
8708/// # async fn dox() {
8709/// # use networkmanagement1::{NetworkManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8710///
8711/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8712/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8713/// #     .with_native_roots()
8714/// #     .unwrap()
8715/// #     .https_only()
8716/// #     .enable_http2()
8717/// #     .build();
8718///
8719/// # let executor = hyper_util::rt::TokioExecutor::new();
8720/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8721/// #     secret,
8722/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8723/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8724/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8725/// #     ),
8726/// # ).build().await.unwrap();
8727///
8728/// # let client = hyper_util::client::legacy::Client::builder(
8729/// #     hyper_util::rt::TokioExecutor::new()
8730/// # )
8731/// # .build(
8732/// #     hyper_rustls::HttpsConnectorBuilder::new()
8733/// #         .with_native_roots()
8734/// #         .unwrap()
8735/// #         .https_or_http()
8736/// #         .enable_http2()
8737/// #         .build()
8738/// # );
8739/// # let mut hub = NetworkManagement::new(client, auth);
8740/// // As the method needs a request, you would usually fill it with the desired information
8741/// // into the respective structure. Some of the parts shown here might not be applicable !
8742/// // Values shown here are possibly random and not representative !
8743/// let mut req = RerunConnectivityTestRequest::default();
8744///
8745/// // You can configure optional parameters by calling the respective setters at will, and
8746/// // execute the final call using `doit()`.
8747/// // Values shown here are possibly random and not representative !
8748/// let result = hub.projects().locations_global_connectivity_tests_rerun(req, "name")
8749///              .doit().await;
8750/// # }
8751/// ```
8752pub struct ProjectLocationGlobalConnectivityTestRerunCall<'a, C>
8753where
8754    C: 'a,
8755{
8756    hub: &'a NetworkManagement<C>,
8757    _request: RerunConnectivityTestRequest,
8758    _name: String,
8759    _delegate: Option<&'a mut dyn common::Delegate>,
8760    _additional_params: HashMap<String, String>,
8761    _scopes: BTreeSet<String>,
8762}
8763
8764impl<'a, C> common::CallBuilder for ProjectLocationGlobalConnectivityTestRerunCall<'a, C> {}
8765
8766impl<'a, C> ProjectLocationGlobalConnectivityTestRerunCall<'a, C>
8767where
8768    C: common::Connector,
8769{
8770    /// Perform the operation you have build so far.
8771    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8772        use std::borrow::Cow;
8773        use std::io::{Read, Seek};
8774
8775        use common::{url::Params, ToParts};
8776        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8777
8778        let mut dd = common::DefaultDelegate;
8779        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8780        dlg.begin(common::MethodInfo {
8781            id: "networkmanagement.projects.locations.global.connectivityTests.rerun",
8782            http_method: hyper::Method::POST,
8783        });
8784
8785        for &field in ["alt", "name"].iter() {
8786            if self._additional_params.contains_key(field) {
8787                dlg.finished(false);
8788                return Err(common::Error::FieldClash(field));
8789            }
8790        }
8791
8792        let mut params = Params::with_capacity(4 + self._additional_params.len());
8793        params.push("name", self._name);
8794
8795        params.extend(self._additional_params.iter());
8796
8797        params.push("alt", "json");
8798        let mut url = self.hub._base_url.clone() + "v1/{+name}:rerun";
8799        if self._scopes.is_empty() {
8800            self._scopes
8801                .insert(Scope::CloudPlatform.as_ref().to_string());
8802        }
8803
8804        #[allow(clippy::single_element_loop)]
8805        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8806            url = params.uri_replacement(url, param_name, find_this, true);
8807        }
8808        {
8809            let to_remove = ["name"];
8810            params.remove_params(&to_remove);
8811        }
8812
8813        let url = params.parse_with_url(&url);
8814
8815        let mut json_mime_type = mime::APPLICATION_JSON;
8816        let mut request_value_reader = {
8817            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8818            common::remove_json_null_values(&mut value);
8819            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8820            serde_json::to_writer(&mut dst, &value).unwrap();
8821            dst
8822        };
8823        let request_size = request_value_reader
8824            .seek(std::io::SeekFrom::End(0))
8825            .unwrap();
8826        request_value_reader
8827            .seek(std::io::SeekFrom::Start(0))
8828            .unwrap();
8829
8830        loop {
8831            let token = match self
8832                .hub
8833                .auth
8834                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8835                .await
8836            {
8837                Ok(token) => token,
8838                Err(e) => match dlg.token(e) {
8839                    Ok(token) => token,
8840                    Err(e) => {
8841                        dlg.finished(false);
8842                        return Err(common::Error::MissingToken(e));
8843                    }
8844                },
8845            };
8846            request_value_reader
8847                .seek(std::io::SeekFrom::Start(0))
8848                .unwrap();
8849            let mut req_result = {
8850                let client = &self.hub.client;
8851                dlg.pre_request();
8852                let mut req_builder = hyper::Request::builder()
8853                    .method(hyper::Method::POST)
8854                    .uri(url.as_str())
8855                    .header(USER_AGENT, self.hub._user_agent.clone());
8856
8857                if let Some(token) = token.as_ref() {
8858                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8859                }
8860
8861                let request = req_builder
8862                    .header(CONTENT_TYPE, json_mime_type.to_string())
8863                    .header(CONTENT_LENGTH, request_size as u64)
8864                    .body(common::to_body(
8865                        request_value_reader.get_ref().clone().into(),
8866                    ));
8867
8868                client.request(request.unwrap()).await
8869            };
8870
8871            match req_result {
8872                Err(err) => {
8873                    if let common::Retry::After(d) = dlg.http_error(&err) {
8874                        sleep(d).await;
8875                        continue;
8876                    }
8877                    dlg.finished(false);
8878                    return Err(common::Error::HttpError(err));
8879                }
8880                Ok(res) => {
8881                    let (mut parts, body) = res.into_parts();
8882                    let mut body = common::Body::new(body);
8883                    if !parts.status.is_success() {
8884                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8885                        let error = serde_json::from_str(&common::to_string(&bytes));
8886                        let response = common::to_response(parts, bytes.into());
8887
8888                        if let common::Retry::After(d) =
8889                            dlg.http_failure(&response, error.as_ref().ok())
8890                        {
8891                            sleep(d).await;
8892                            continue;
8893                        }
8894
8895                        dlg.finished(false);
8896
8897                        return Err(match error {
8898                            Ok(value) => common::Error::BadRequest(value),
8899                            _ => common::Error::Failure(response),
8900                        });
8901                    }
8902                    let response = {
8903                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8904                        let encoded = common::to_string(&bytes);
8905                        match serde_json::from_str(&encoded) {
8906                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8907                            Err(error) => {
8908                                dlg.response_json_decode_error(&encoded, &error);
8909                                return Err(common::Error::JsonDecodeError(
8910                                    encoded.to_string(),
8911                                    error,
8912                                ));
8913                            }
8914                        }
8915                    };
8916
8917                    dlg.finished(true);
8918                    return Ok(response);
8919                }
8920            }
8921        }
8922    }
8923
8924    ///
8925    /// Sets the *request* property to the given value.
8926    ///
8927    /// Even though the property as already been set when instantiating this call,
8928    /// we provide this method for API completeness.
8929    pub fn request(
8930        mut self,
8931        new_value: RerunConnectivityTestRequest,
8932    ) -> ProjectLocationGlobalConnectivityTestRerunCall<'a, C> {
8933        self._request = new_value;
8934        self
8935    }
8936    /// Required. Connectivity Test resource name using the form: `projects/{project_id}/locations/global/connectivityTests/{test_id}`
8937    ///
8938    /// Sets the *name* path property to the given value.
8939    ///
8940    /// Even though the property as already been set when instantiating this call,
8941    /// we provide this method for API completeness.
8942    pub fn name(
8943        mut self,
8944        new_value: &str,
8945    ) -> ProjectLocationGlobalConnectivityTestRerunCall<'a, C> {
8946        self._name = new_value.to_string();
8947        self
8948    }
8949    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8950    /// while executing the actual API request.
8951    ///
8952    /// ````text
8953    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8954    /// ````
8955    ///
8956    /// Sets the *delegate* property to the given value.
8957    pub fn delegate(
8958        mut self,
8959        new_value: &'a mut dyn common::Delegate,
8960    ) -> ProjectLocationGlobalConnectivityTestRerunCall<'a, C> {
8961        self._delegate = Some(new_value);
8962        self
8963    }
8964
8965    /// Set any additional parameter of the query string used in the request.
8966    /// It should be used to set parameters which are not yet available through their own
8967    /// setters.
8968    ///
8969    /// Please note that this method must not be used to set any of the known parameters
8970    /// which have their own setter method. If done anyway, the request will fail.
8971    ///
8972    /// # Additional Parameters
8973    ///
8974    /// * *$.xgafv* (query-string) - V1 error format.
8975    /// * *access_token* (query-string) - OAuth access token.
8976    /// * *alt* (query-string) - Data format for response.
8977    /// * *callback* (query-string) - JSONP
8978    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8979    /// * *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.
8980    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8981    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8982    /// * *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.
8983    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8984    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8985    pub fn param<T>(
8986        mut self,
8987        name: T,
8988        value: T,
8989    ) -> ProjectLocationGlobalConnectivityTestRerunCall<'a, C>
8990    where
8991        T: AsRef<str>,
8992    {
8993        self._additional_params
8994            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8995        self
8996    }
8997
8998    /// Identifies the authorization scope for the method you are building.
8999    ///
9000    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9001    /// [`Scope::CloudPlatform`].
9002    ///
9003    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9004    /// tokens for more than one scope.
9005    ///
9006    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9007    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9008    /// sufficient, a read-write scope will do as well.
9009    pub fn add_scope<St>(
9010        mut self,
9011        scope: St,
9012    ) -> ProjectLocationGlobalConnectivityTestRerunCall<'a, C>
9013    where
9014        St: AsRef<str>,
9015    {
9016        self._scopes.insert(String::from(scope.as_ref()));
9017        self
9018    }
9019    /// Identifies the authorization scope(s) for the method you are building.
9020    ///
9021    /// See [`Self::add_scope()`] for details.
9022    pub fn add_scopes<I, St>(
9023        mut self,
9024        scopes: I,
9025    ) -> ProjectLocationGlobalConnectivityTestRerunCall<'a, C>
9026    where
9027        I: IntoIterator<Item = St>,
9028        St: AsRef<str>,
9029    {
9030        self._scopes
9031            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9032        self
9033    }
9034
9035    /// Removes all scopes, and no default scope will be used either.
9036    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9037    /// for details).
9038    pub fn clear_scopes(mut self) -> ProjectLocationGlobalConnectivityTestRerunCall<'a, C> {
9039        self._scopes.clear();
9040        self
9041    }
9042}
9043
9044/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
9045///
9046/// A builder for the *locations.global.connectivityTests.setIamPolicy* method supported by a *project* resource.
9047/// It is not used directly, but through a [`ProjectMethods`] instance.
9048///
9049/// # Example
9050///
9051/// Instantiate a resource method builder
9052///
9053/// ```test_harness,no_run
9054/// # extern crate hyper;
9055/// # extern crate hyper_rustls;
9056/// # extern crate google_networkmanagement1 as networkmanagement1;
9057/// use networkmanagement1::api::SetIamPolicyRequest;
9058/// # async fn dox() {
9059/// # use networkmanagement1::{NetworkManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9060///
9061/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9062/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9063/// #     .with_native_roots()
9064/// #     .unwrap()
9065/// #     .https_only()
9066/// #     .enable_http2()
9067/// #     .build();
9068///
9069/// # let executor = hyper_util::rt::TokioExecutor::new();
9070/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9071/// #     secret,
9072/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9073/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9074/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9075/// #     ),
9076/// # ).build().await.unwrap();
9077///
9078/// # let client = hyper_util::client::legacy::Client::builder(
9079/// #     hyper_util::rt::TokioExecutor::new()
9080/// # )
9081/// # .build(
9082/// #     hyper_rustls::HttpsConnectorBuilder::new()
9083/// #         .with_native_roots()
9084/// #         .unwrap()
9085/// #         .https_or_http()
9086/// #         .enable_http2()
9087/// #         .build()
9088/// # );
9089/// # let mut hub = NetworkManagement::new(client, auth);
9090/// // As the method needs a request, you would usually fill it with the desired information
9091/// // into the respective structure. Some of the parts shown here might not be applicable !
9092/// // Values shown here are possibly random and not representative !
9093/// let mut req = SetIamPolicyRequest::default();
9094///
9095/// // You can configure optional parameters by calling the respective setters at will, and
9096/// // execute the final call using `doit()`.
9097/// // Values shown here are possibly random and not representative !
9098/// let result = hub.projects().locations_global_connectivity_tests_set_iam_policy(req, "resource")
9099///              .doit().await;
9100/// # }
9101/// ```
9102pub struct ProjectLocationGlobalConnectivityTestSetIamPolicyCall<'a, C>
9103where
9104    C: 'a,
9105{
9106    hub: &'a NetworkManagement<C>,
9107    _request: SetIamPolicyRequest,
9108    _resource: String,
9109    _delegate: Option<&'a mut dyn common::Delegate>,
9110    _additional_params: HashMap<String, String>,
9111    _scopes: BTreeSet<String>,
9112}
9113
9114impl<'a, C> common::CallBuilder for ProjectLocationGlobalConnectivityTestSetIamPolicyCall<'a, C> {}
9115
9116impl<'a, C> ProjectLocationGlobalConnectivityTestSetIamPolicyCall<'a, C>
9117where
9118    C: common::Connector,
9119{
9120    /// Perform the operation you have build so far.
9121    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
9122        use std::borrow::Cow;
9123        use std::io::{Read, Seek};
9124
9125        use common::{url::Params, ToParts};
9126        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9127
9128        let mut dd = common::DefaultDelegate;
9129        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9130        dlg.begin(common::MethodInfo {
9131            id: "networkmanagement.projects.locations.global.connectivityTests.setIamPolicy",
9132            http_method: hyper::Method::POST,
9133        });
9134
9135        for &field in ["alt", "resource"].iter() {
9136            if self._additional_params.contains_key(field) {
9137                dlg.finished(false);
9138                return Err(common::Error::FieldClash(field));
9139            }
9140        }
9141
9142        let mut params = Params::with_capacity(4 + self._additional_params.len());
9143        params.push("resource", self._resource);
9144
9145        params.extend(self._additional_params.iter());
9146
9147        params.push("alt", "json");
9148        let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
9149        if self._scopes.is_empty() {
9150            self._scopes
9151                .insert(Scope::CloudPlatform.as_ref().to_string());
9152        }
9153
9154        #[allow(clippy::single_element_loop)]
9155        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
9156            url = params.uri_replacement(url, param_name, find_this, true);
9157        }
9158        {
9159            let to_remove = ["resource"];
9160            params.remove_params(&to_remove);
9161        }
9162
9163        let url = params.parse_with_url(&url);
9164
9165        let mut json_mime_type = mime::APPLICATION_JSON;
9166        let mut request_value_reader = {
9167            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9168            common::remove_json_null_values(&mut value);
9169            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9170            serde_json::to_writer(&mut dst, &value).unwrap();
9171            dst
9172        };
9173        let request_size = request_value_reader
9174            .seek(std::io::SeekFrom::End(0))
9175            .unwrap();
9176        request_value_reader
9177            .seek(std::io::SeekFrom::Start(0))
9178            .unwrap();
9179
9180        loop {
9181            let token = match self
9182                .hub
9183                .auth
9184                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9185                .await
9186            {
9187                Ok(token) => token,
9188                Err(e) => match dlg.token(e) {
9189                    Ok(token) => token,
9190                    Err(e) => {
9191                        dlg.finished(false);
9192                        return Err(common::Error::MissingToken(e));
9193                    }
9194                },
9195            };
9196            request_value_reader
9197                .seek(std::io::SeekFrom::Start(0))
9198                .unwrap();
9199            let mut req_result = {
9200                let client = &self.hub.client;
9201                dlg.pre_request();
9202                let mut req_builder = hyper::Request::builder()
9203                    .method(hyper::Method::POST)
9204                    .uri(url.as_str())
9205                    .header(USER_AGENT, self.hub._user_agent.clone());
9206
9207                if let Some(token) = token.as_ref() {
9208                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9209                }
9210
9211                let request = req_builder
9212                    .header(CONTENT_TYPE, json_mime_type.to_string())
9213                    .header(CONTENT_LENGTH, request_size as u64)
9214                    .body(common::to_body(
9215                        request_value_reader.get_ref().clone().into(),
9216                    ));
9217
9218                client.request(request.unwrap()).await
9219            };
9220
9221            match req_result {
9222                Err(err) => {
9223                    if let common::Retry::After(d) = dlg.http_error(&err) {
9224                        sleep(d).await;
9225                        continue;
9226                    }
9227                    dlg.finished(false);
9228                    return Err(common::Error::HttpError(err));
9229                }
9230                Ok(res) => {
9231                    let (mut parts, body) = res.into_parts();
9232                    let mut body = common::Body::new(body);
9233                    if !parts.status.is_success() {
9234                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9235                        let error = serde_json::from_str(&common::to_string(&bytes));
9236                        let response = common::to_response(parts, bytes.into());
9237
9238                        if let common::Retry::After(d) =
9239                            dlg.http_failure(&response, error.as_ref().ok())
9240                        {
9241                            sleep(d).await;
9242                            continue;
9243                        }
9244
9245                        dlg.finished(false);
9246
9247                        return Err(match error {
9248                            Ok(value) => common::Error::BadRequest(value),
9249                            _ => common::Error::Failure(response),
9250                        });
9251                    }
9252                    let response = {
9253                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9254                        let encoded = common::to_string(&bytes);
9255                        match serde_json::from_str(&encoded) {
9256                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9257                            Err(error) => {
9258                                dlg.response_json_decode_error(&encoded, &error);
9259                                return Err(common::Error::JsonDecodeError(
9260                                    encoded.to_string(),
9261                                    error,
9262                                ));
9263                            }
9264                        }
9265                    };
9266
9267                    dlg.finished(true);
9268                    return Ok(response);
9269                }
9270            }
9271        }
9272    }
9273
9274    ///
9275    /// Sets the *request* property to the given value.
9276    ///
9277    /// Even though the property as already been set when instantiating this call,
9278    /// we provide this method for API completeness.
9279    pub fn request(
9280        mut self,
9281        new_value: SetIamPolicyRequest,
9282    ) -> ProjectLocationGlobalConnectivityTestSetIamPolicyCall<'a, C> {
9283        self._request = new_value;
9284        self
9285    }
9286    /// REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
9287    ///
9288    /// Sets the *resource* path property to the given value.
9289    ///
9290    /// Even though the property as already been set when instantiating this call,
9291    /// we provide this method for API completeness.
9292    pub fn resource(
9293        mut self,
9294        new_value: &str,
9295    ) -> ProjectLocationGlobalConnectivityTestSetIamPolicyCall<'a, C> {
9296        self._resource = new_value.to_string();
9297        self
9298    }
9299    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9300    /// while executing the actual API request.
9301    ///
9302    /// ````text
9303    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9304    /// ````
9305    ///
9306    /// Sets the *delegate* property to the given value.
9307    pub fn delegate(
9308        mut self,
9309        new_value: &'a mut dyn common::Delegate,
9310    ) -> ProjectLocationGlobalConnectivityTestSetIamPolicyCall<'a, C> {
9311        self._delegate = Some(new_value);
9312        self
9313    }
9314
9315    /// Set any additional parameter of the query string used in the request.
9316    /// It should be used to set parameters which are not yet available through their own
9317    /// setters.
9318    ///
9319    /// Please note that this method must not be used to set any of the known parameters
9320    /// which have their own setter method. If done anyway, the request will fail.
9321    ///
9322    /// # Additional Parameters
9323    ///
9324    /// * *$.xgafv* (query-string) - V1 error format.
9325    /// * *access_token* (query-string) - OAuth access token.
9326    /// * *alt* (query-string) - Data format for response.
9327    /// * *callback* (query-string) - JSONP
9328    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9329    /// * *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.
9330    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9331    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9332    /// * *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.
9333    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9334    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9335    pub fn param<T>(
9336        mut self,
9337        name: T,
9338        value: T,
9339    ) -> ProjectLocationGlobalConnectivityTestSetIamPolicyCall<'a, C>
9340    where
9341        T: AsRef<str>,
9342    {
9343        self._additional_params
9344            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9345        self
9346    }
9347
9348    /// Identifies the authorization scope for the method you are building.
9349    ///
9350    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9351    /// [`Scope::CloudPlatform`].
9352    ///
9353    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9354    /// tokens for more than one scope.
9355    ///
9356    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9357    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9358    /// sufficient, a read-write scope will do as well.
9359    pub fn add_scope<St>(
9360        mut self,
9361        scope: St,
9362    ) -> ProjectLocationGlobalConnectivityTestSetIamPolicyCall<'a, C>
9363    where
9364        St: AsRef<str>,
9365    {
9366        self._scopes.insert(String::from(scope.as_ref()));
9367        self
9368    }
9369    /// Identifies the authorization scope(s) for the method you are building.
9370    ///
9371    /// See [`Self::add_scope()`] for details.
9372    pub fn add_scopes<I, St>(
9373        mut self,
9374        scopes: I,
9375    ) -> ProjectLocationGlobalConnectivityTestSetIamPolicyCall<'a, C>
9376    where
9377        I: IntoIterator<Item = St>,
9378        St: AsRef<str>,
9379    {
9380        self._scopes
9381            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9382        self
9383    }
9384
9385    /// Removes all scopes, and no default scope will be used either.
9386    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9387    /// for details).
9388    pub fn clear_scopes(mut self) -> ProjectLocationGlobalConnectivityTestSetIamPolicyCall<'a, C> {
9389        self._scopes.clear();
9390        self
9391    }
9392}
9393
9394/// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
9395///
9396/// A builder for the *locations.global.connectivityTests.testIamPermissions* method supported by a *project* resource.
9397/// It is not used directly, but through a [`ProjectMethods`] instance.
9398///
9399/// # Example
9400///
9401/// Instantiate a resource method builder
9402///
9403/// ```test_harness,no_run
9404/// # extern crate hyper;
9405/// # extern crate hyper_rustls;
9406/// # extern crate google_networkmanagement1 as networkmanagement1;
9407/// use networkmanagement1::api::TestIamPermissionsRequest;
9408/// # async fn dox() {
9409/// # use networkmanagement1::{NetworkManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9410///
9411/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9412/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9413/// #     .with_native_roots()
9414/// #     .unwrap()
9415/// #     .https_only()
9416/// #     .enable_http2()
9417/// #     .build();
9418///
9419/// # let executor = hyper_util::rt::TokioExecutor::new();
9420/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9421/// #     secret,
9422/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9423/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9424/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9425/// #     ),
9426/// # ).build().await.unwrap();
9427///
9428/// # let client = hyper_util::client::legacy::Client::builder(
9429/// #     hyper_util::rt::TokioExecutor::new()
9430/// # )
9431/// # .build(
9432/// #     hyper_rustls::HttpsConnectorBuilder::new()
9433/// #         .with_native_roots()
9434/// #         .unwrap()
9435/// #         .https_or_http()
9436/// #         .enable_http2()
9437/// #         .build()
9438/// # );
9439/// # let mut hub = NetworkManagement::new(client, auth);
9440/// // As the method needs a request, you would usually fill it with the desired information
9441/// // into the respective structure. Some of the parts shown here might not be applicable !
9442/// // Values shown here are possibly random and not representative !
9443/// let mut req = TestIamPermissionsRequest::default();
9444///
9445/// // You can configure optional parameters by calling the respective setters at will, and
9446/// // execute the final call using `doit()`.
9447/// // Values shown here are possibly random and not representative !
9448/// let result = hub.projects().locations_global_connectivity_tests_test_iam_permissions(req, "resource")
9449///              .doit().await;
9450/// # }
9451/// ```
9452pub struct ProjectLocationGlobalConnectivityTestTestIamPermissionCall<'a, C>
9453where
9454    C: 'a,
9455{
9456    hub: &'a NetworkManagement<C>,
9457    _request: TestIamPermissionsRequest,
9458    _resource: String,
9459    _delegate: Option<&'a mut dyn common::Delegate>,
9460    _additional_params: HashMap<String, String>,
9461    _scopes: BTreeSet<String>,
9462}
9463
9464impl<'a, C> common::CallBuilder
9465    for ProjectLocationGlobalConnectivityTestTestIamPermissionCall<'a, C>
9466{
9467}
9468
9469impl<'a, C> ProjectLocationGlobalConnectivityTestTestIamPermissionCall<'a, C>
9470where
9471    C: common::Connector,
9472{
9473    /// Perform the operation you have build so far.
9474    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
9475        use std::borrow::Cow;
9476        use std::io::{Read, Seek};
9477
9478        use common::{url::Params, ToParts};
9479        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9480
9481        let mut dd = common::DefaultDelegate;
9482        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9483        dlg.begin(common::MethodInfo {
9484            id: "networkmanagement.projects.locations.global.connectivityTests.testIamPermissions",
9485            http_method: hyper::Method::POST,
9486        });
9487
9488        for &field in ["alt", "resource"].iter() {
9489            if self._additional_params.contains_key(field) {
9490                dlg.finished(false);
9491                return Err(common::Error::FieldClash(field));
9492            }
9493        }
9494
9495        let mut params = Params::with_capacity(4 + self._additional_params.len());
9496        params.push("resource", self._resource);
9497
9498        params.extend(self._additional_params.iter());
9499
9500        params.push("alt", "json");
9501        let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
9502        if self._scopes.is_empty() {
9503            self._scopes
9504                .insert(Scope::CloudPlatform.as_ref().to_string());
9505        }
9506
9507        #[allow(clippy::single_element_loop)]
9508        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
9509            url = params.uri_replacement(url, param_name, find_this, true);
9510        }
9511        {
9512            let to_remove = ["resource"];
9513            params.remove_params(&to_remove);
9514        }
9515
9516        let url = params.parse_with_url(&url);
9517
9518        let mut json_mime_type = mime::APPLICATION_JSON;
9519        let mut request_value_reader = {
9520            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9521            common::remove_json_null_values(&mut value);
9522            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9523            serde_json::to_writer(&mut dst, &value).unwrap();
9524            dst
9525        };
9526        let request_size = request_value_reader
9527            .seek(std::io::SeekFrom::End(0))
9528            .unwrap();
9529        request_value_reader
9530            .seek(std::io::SeekFrom::Start(0))
9531            .unwrap();
9532
9533        loop {
9534            let token = match self
9535                .hub
9536                .auth
9537                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9538                .await
9539            {
9540                Ok(token) => token,
9541                Err(e) => match dlg.token(e) {
9542                    Ok(token) => token,
9543                    Err(e) => {
9544                        dlg.finished(false);
9545                        return Err(common::Error::MissingToken(e));
9546                    }
9547                },
9548            };
9549            request_value_reader
9550                .seek(std::io::SeekFrom::Start(0))
9551                .unwrap();
9552            let mut req_result = {
9553                let client = &self.hub.client;
9554                dlg.pre_request();
9555                let mut req_builder = hyper::Request::builder()
9556                    .method(hyper::Method::POST)
9557                    .uri(url.as_str())
9558                    .header(USER_AGENT, self.hub._user_agent.clone());
9559
9560                if let Some(token) = token.as_ref() {
9561                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9562                }
9563
9564                let request = req_builder
9565                    .header(CONTENT_TYPE, json_mime_type.to_string())
9566                    .header(CONTENT_LENGTH, request_size as u64)
9567                    .body(common::to_body(
9568                        request_value_reader.get_ref().clone().into(),
9569                    ));
9570
9571                client.request(request.unwrap()).await
9572            };
9573
9574            match req_result {
9575                Err(err) => {
9576                    if let common::Retry::After(d) = dlg.http_error(&err) {
9577                        sleep(d).await;
9578                        continue;
9579                    }
9580                    dlg.finished(false);
9581                    return Err(common::Error::HttpError(err));
9582                }
9583                Ok(res) => {
9584                    let (mut parts, body) = res.into_parts();
9585                    let mut body = common::Body::new(body);
9586                    if !parts.status.is_success() {
9587                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9588                        let error = serde_json::from_str(&common::to_string(&bytes));
9589                        let response = common::to_response(parts, bytes.into());
9590
9591                        if let common::Retry::After(d) =
9592                            dlg.http_failure(&response, error.as_ref().ok())
9593                        {
9594                            sleep(d).await;
9595                            continue;
9596                        }
9597
9598                        dlg.finished(false);
9599
9600                        return Err(match error {
9601                            Ok(value) => common::Error::BadRequest(value),
9602                            _ => common::Error::Failure(response),
9603                        });
9604                    }
9605                    let response = {
9606                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9607                        let encoded = common::to_string(&bytes);
9608                        match serde_json::from_str(&encoded) {
9609                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9610                            Err(error) => {
9611                                dlg.response_json_decode_error(&encoded, &error);
9612                                return Err(common::Error::JsonDecodeError(
9613                                    encoded.to_string(),
9614                                    error,
9615                                ));
9616                            }
9617                        }
9618                    };
9619
9620                    dlg.finished(true);
9621                    return Ok(response);
9622                }
9623            }
9624        }
9625    }
9626
9627    ///
9628    /// Sets the *request* property to the given value.
9629    ///
9630    /// Even though the property as already been set when instantiating this call,
9631    /// we provide this method for API completeness.
9632    pub fn request(
9633        mut self,
9634        new_value: TestIamPermissionsRequest,
9635    ) -> ProjectLocationGlobalConnectivityTestTestIamPermissionCall<'a, C> {
9636        self._request = new_value;
9637        self
9638    }
9639    /// REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
9640    ///
9641    /// Sets the *resource* path property to the given value.
9642    ///
9643    /// Even though the property as already been set when instantiating this call,
9644    /// we provide this method for API completeness.
9645    pub fn resource(
9646        mut self,
9647        new_value: &str,
9648    ) -> ProjectLocationGlobalConnectivityTestTestIamPermissionCall<'a, C> {
9649        self._resource = new_value.to_string();
9650        self
9651    }
9652    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9653    /// while executing the actual API request.
9654    ///
9655    /// ````text
9656    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9657    /// ````
9658    ///
9659    /// Sets the *delegate* property to the given value.
9660    pub fn delegate(
9661        mut self,
9662        new_value: &'a mut dyn common::Delegate,
9663    ) -> ProjectLocationGlobalConnectivityTestTestIamPermissionCall<'a, C> {
9664        self._delegate = Some(new_value);
9665        self
9666    }
9667
9668    /// Set any additional parameter of the query string used in the request.
9669    /// It should be used to set parameters which are not yet available through their own
9670    /// setters.
9671    ///
9672    /// Please note that this method must not be used to set any of the known parameters
9673    /// which have their own setter method. If done anyway, the request will fail.
9674    ///
9675    /// # Additional Parameters
9676    ///
9677    /// * *$.xgafv* (query-string) - V1 error format.
9678    /// * *access_token* (query-string) - OAuth access token.
9679    /// * *alt* (query-string) - Data format for response.
9680    /// * *callback* (query-string) - JSONP
9681    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9682    /// * *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.
9683    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9684    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9685    /// * *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.
9686    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9687    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9688    pub fn param<T>(
9689        mut self,
9690        name: T,
9691        value: T,
9692    ) -> ProjectLocationGlobalConnectivityTestTestIamPermissionCall<'a, C>
9693    where
9694        T: AsRef<str>,
9695    {
9696        self._additional_params
9697            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9698        self
9699    }
9700
9701    /// Identifies the authorization scope for the method you are building.
9702    ///
9703    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9704    /// [`Scope::CloudPlatform`].
9705    ///
9706    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9707    /// tokens for more than one scope.
9708    ///
9709    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9710    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9711    /// sufficient, a read-write scope will do as well.
9712    pub fn add_scope<St>(
9713        mut self,
9714        scope: St,
9715    ) -> ProjectLocationGlobalConnectivityTestTestIamPermissionCall<'a, C>
9716    where
9717        St: AsRef<str>,
9718    {
9719        self._scopes.insert(String::from(scope.as_ref()));
9720        self
9721    }
9722    /// Identifies the authorization scope(s) for the method you are building.
9723    ///
9724    /// See [`Self::add_scope()`] for details.
9725    pub fn add_scopes<I, St>(
9726        mut self,
9727        scopes: I,
9728    ) -> ProjectLocationGlobalConnectivityTestTestIamPermissionCall<'a, C>
9729    where
9730        I: IntoIterator<Item = St>,
9731        St: AsRef<str>,
9732    {
9733        self._scopes
9734            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9735        self
9736    }
9737
9738    /// Removes all scopes, and no default scope will be used either.
9739    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9740    /// for details).
9741    pub fn clear_scopes(
9742        mut self,
9743    ) -> ProjectLocationGlobalConnectivityTestTestIamPermissionCall<'a, C> {
9744        self._scopes.clear();
9745        self
9746    }
9747}
9748
9749/// 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`.
9750///
9751/// A builder for the *locations.global.operations.cancel* method supported by a *project* resource.
9752/// It is not used directly, but through a [`ProjectMethods`] instance.
9753///
9754/// # Example
9755///
9756/// Instantiate a resource method builder
9757///
9758/// ```test_harness,no_run
9759/// # extern crate hyper;
9760/// # extern crate hyper_rustls;
9761/// # extern crate google_networkmanagement1 as networkmanagement1;
9762/// use networkmanagement1::api::CancelOperationRequest;
9763/// # async fn dox() {
9764/// # use networkmanagement1::{NetworkManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9765///
9766/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9767/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9768/// #     .with_native_roots()
9769/// #     .unwrap()
9770/// #     .https_only()
9771/// #     .enable_http2()
9772/// #     .build();
9773///
9774/// # let executor = hyper_util::rt::TokioExecutor::new();
9775/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9776/// #     secret,
9777/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9778/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9779/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9780/// #     ),
9781/// # ).build().await.unwrap();
9782///
9783/// # let client = hyper_util::client::legacy::Client::builder(
9784/// #     hyper_util::rt::TokioExecutor::new()
9785/// # )
9786/// # .build(
9787/// #     hyper_rustls::HttpsConnectorBuilder::new()
9788/// #         .with_native_roots()
9789/// #         .unwrap()
9790/// #         .https_or_http()
9791/// #         .enable_http2()
9792/// #         .build()
9793/// # );
9794/// # let mut hub = NetworkManagement::new(client, auth);
9795/// // As the method needs a request, you would usually fill it with the desired information
9796/// // into the respective structure. Some of the parts shown here might not be applicable !
9797/// // Values shown here are possibly random and not representative !
9798/// let mut req = CancelOperationRequest::default();
9799///
9800/// // You can configure optional parameters by calling the respective setters at will, and
9801/// // execute the final call using `doit()`.
9802/// // Values shown here are possibly random and not representative !
9803/// let result = hub.projects().locations_global_operations_cancel(req, "name")
9804///              .doit().await;
9805/// # }
9806/// ```
9807pub struct ProjectLocationGlobalOperationCancelCall<'a, C>
9808where
9809    C: 'a,
9810{
9811    hub: &'a NetworkManagement<C>,
9812    _request: CancelOperationRequest,
9813    _name: String,
9814    _delegate: Option<&'a mut dyn common::Delegate>,
9815    _additional_params: HashMap<String, String>,
9816    _scopes: BTreeSet<String>,
9817}
9818
9819impl<'a, C> common::CallBuilder for ProjectLocationGlobalOperationCancelCall<'a, C> {}
9820
9821impl<'a, C> ProjectLocationGlobalOperationCancelCall<'a, C>
9822where
9823    C: common::Connector,
9824{
9825    /// Perform the operation you have build so far.
9826    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
9827        use std::borrow::Cow;
9828        use std::io::{Read, Seek};
9829
9830        use common::{url::Params, ToParts};
9831        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9832
9833        let mut dd = common::DefaultDelegate;
9834        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9835        dlg.begin(common::MethodInfo {
9836            id: "networkmanagement.projects.locations.global.operations.cancel",
9837            http_method: hyper::Method::POST,
9838        });
9839
9840        for &field in ["alt", "name"].iter() {
9841            if self._additional_params.contains_key(field) {
9842                dlg.finished(false);
9843                return Err(common::Error::FieldClash(field));
9844            }
9845        }
9846
9847        let mut params = Params::with_capacity(4 + self._additional_params.len());
9848        params.push("name", self._name);
9849
9850        params.extend(self._additional_params.iter());
9851
9852        params.push("alt", "json");
9853        let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
9854        if self._scopes.is_empty() {
9855            self._scopes
9856                .insert(Scope::CloudPlatform.as_ref().to_string());
9857        }
9858
9859        #[allow(clippy::single_element_loop)]
9860        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9861            url = params.uri_replacement(url, param_name, find_this, true);
9862        }
9863        {
9864            let to_remove = ["name"];
9865            params.remove_params(&to_remove);
9866        }
9867
9868        let url = params.parse_with_url(&url);
9869
9870        let mut json_mime_type = mime::APPLICATION_JSON;
9871        let mut request_value_reader = {
9872            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9873            common::remove_json_null_values(&mut value);
9874            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9875            serde_json::to_writer(&mut dst, &value).unwrap();
9876            dst
9877        };
9878        let request_size = request_value_reader
9879            .seek(std::io::SeekFrom::End(0))
9880            .unwrap();
9881        request_value_reader
9882            .seek(std::io::SeekFrom::Start(0))
9883            .unwrap();
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            request_value_reader
9902                .seek(std::io::SeekFrom::Start(0))
9903                .unwrap();
9904            let mut req_result = {
9905                let client = &self.hub.client;
9906                dlg.pre_request();
9907                let mut req_builder = hyper::Request::builder()
9908                    .method(hyper::Method::POST)
9909                    .uri(url.as_str())
9910                    .header(USER_AGENT, self.hub._user_agent.clone());
9911
9912                if let Some(token) = token.as_ref() {
9913                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9914                }
9915
9916                let request = req_builder
9917                    .header(CONTENT_TYPE, json_mime_type.to_string())
9918                    .header(CONTENT_LENGTH, request_size as u64)
9919                    .body(common::to_body(
9920                        request_value_reader.get_ref().clone().into(),
9921                    ));
9922
9923                client.request(request.unwrap()).await
9924            };
9925
9926            match req_result {
9927                Err(err) => {
9928                    if let common::Retry::After(d) = dlg.http_error(&err) {
9929                        sleep(d).await;
9930                        continue;
9931                    }
9932                    dlg.finished(false);
9933                    return Err(common::Error::HttpError(err));
9934                }
9935                Ok(res) => {
9936                    let (mut parts, body) = res.into_parts();
9937                    let mut body = common::Body::new(body);
9938                    if !parts.status.is_success() {
9939                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9940                        let error = serde_json::from_str(&common::to_string(&bytes));
9941                        let response = common::to_response(parts, bytes.into());
9942
9943                        if let common::Retry::After(d) =
9944                            dlg.http_failure(&response, error.as_ref().ok())
9945                        {
9946                            sleep(d).await;
9947                            continue;
9948                        }
9949
9950                        dlg.finished(false);
9951
9952                        return Err(match error {
9953                            Ok(value) => common::Error::BadRequest(value),
9954                            _ => common::Error::Failure(response),
9955                        });
9956                    }
9957                    let response = {
9958                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9959                        let encoded = common::to_string(&bytes);
9960                        match serde_json::from_str(&encoded) {
9961                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9962                            Err(error) => {
9963                                dlg.response_json_decode_error(&encoded, &error);
9964                                return Err(common::Error::JsonDecodeError(
9965                                    encoded.to_string(),
9966                                    error,
9967                                ));
9968                            }
9969                        }
9970                    };
9971
9972                    dlg.finished(true);
9973                    return Ok(response);
9974                }
9975            }
9976        }
9977    }
9978
9979    ///
9980    /// Sets the *request* property to the given value.
9981    ///
9982    /// Even though the property as already been set when instantiating this call,
9983    /// we provide this method for API completeness.
9984    pub fn request(
9985        mut self,
9986        new_value: CancelOperationRequest,
9987    ) -> ProjectLocationGlobalOperationCancelCall<'a, C> {
9988        self._request = new_value;
9989        self
9990    }
9991    /// The name of the operation resource to be cancelled.
9992    ///
9993    /// Sets the *name* path property to the given value.
9994    ///
9995    /// Even though the property as already been set when instantiating this call,
9996    /// we provide this method for API completeness.
9997    pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalOperationCancelCall<'a, C> {
9998        self._name = new_value.to_string();
9999        self
10000    }
10001    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10002    /// while executing the actual API request.
10003    ///
10004    /// ````text
10005    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10006    /// ````
10007    ///
10008    /// Sets the *delegate* property to the given value.
10009    pub fn delegate(
10010        mut self,
10011        new_value: &'a mut dyn common::Delegate,
10012    ) -> ProjectLocationGlobalOperationCancelCall<'a, C> {
10013        self._delegate = Some(new_value);
10014        self
10015    }
10016
10017    /// Set any additional parameter of the query string used in the request.
10018    /// It should be used to set parameters which are not yet available through their own
10019    /// setters.
10020    ///
10021    /// Please note that this method must not be used to set any of the known parameters
10022    /// which have their own setter method. If done anyway, the request will fail.
10023    ///
10024    /// # Additional Parameters
10025    ///
10026    /// * *$.xgafv* (query-string) - V1 error format.
10027    /// * *access_token* (query-string) - OAuth access token.
10028    /// * *alt* (query-string) - Data format for response.
10029    /// * *callback* (query-string) - JSONP
10030    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10031    /// * *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.
10032    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10033    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10034    /// * *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.
10035    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10036    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10037    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalOperationCancelCall<'a, C>
10038    where
10039        T: AsRef<str>,
10040    {
10041        self._additional_params
10042            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10043        self
10044    }
10045
10046    /// Identifies the authorization scope for the method you are building.
10047    ///
10048    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10049    /// [`Scope::CloudPlatform`].
10050    ///
10051    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10052    /// tokens for more than one scope.
10053    ///
10054    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10055    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10056    /// sufficient, a read-write scope will do as well.
10057    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalOperationCancelCall<'a, C>
10058    where
10059        St: AsRef<str>,
10060    {
10061        self._scopes.insert(String::from(scope.as_ref()));
10062        self
10063    }
10064    /// Identifies the authorization scope(s) for the method you are building.
10065    ///
10066    /// See [`Self::add_scope()`] for details.
10067    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalOperationCancelCall<'a, C>
10068    where
10069        I: IntoIterator<Item = St>,
10070        St: AsRef<str>,
10071    {
10072        self._scopes
10073            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10074        self
10075    }
10076
10077    /// Removes all scopes, and no default scope will be used either.
10078    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10079    /// for details).
10080    pub fn clear_scopes(mut self) -> ProjectLocationGlobalOperationCancelCall<'a, C> {
10081        self._scopes.clear();
10082        self
10083    }
10084}
10085
10086/// Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
10087///
10088/// A builder for the *locations.global.operations.delete* method supported by a *project* resource.
10089/// It is not used directly, but through a [`ProjectMethods`] instance.
10090///
10091/// # Example
10092///
10093/// Instantiate a resource method builder
10094///
10095/// ```test_harness,no_run
10096/// # extern crate hyper;
10097/// # extern crate hyper_rustls;
10098/// # extern crate google_networkmanagement1 as networkmanagement1;
10099/// # async fn dox() {
10100/// # use networkmanagement1::{NetworkManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10101///
10102/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10103/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10104/// #     .with_native_roots()
10105/// #     .unwrap()
10106/// #     .https_only()
10107/// #     .enable_http2()
10108/// #     .build();
10109///
10110/// # let executor = hyper_util::rt::TokioExecutor::new();
10111/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10112/// #     secret,
10113/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10114/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10115/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10116/// #     ),
10117/// # ).build().await.unwrap();
10118///
10119/// # let client = hyper_util::client::legacy::Client::builder(
10120/// #     hyper_util::rt::TokioExecutor::new()
10121/// # )
10122/// # .build(
10123/// #     hyper_rustls::HttpsConnectorBuilder::new()
10124/// #         .with_native_roots()
10125/// #         .unwrap()
10126/// #         .https_or_http()
10127/// #         .enable_http2()
10128/// #         .build()
10129/// # );
10130/// # let mut hub = NetworkManagement::new(client, auth);
10131/// // You can configure optional parameters by calling the respective setters at will, and
10132/// // execute the final call using `doit()`.
10133/// // Values shown here are possibly random and not representative !
10134/// let result = hub.projects().locations_global_operations_delete("name")
10135///              .doit().await;
10136/// # }
10137/// ```
10138pub struct ProjectLocationGlobalOperationDeleteCall<'a, C>
10139where
10140    C: 'a,
10141{
10142    hub: &'a NetworkManagement<C>,
10143    _name: String,
10144    _delegate: Option<&'a mut dyn common::Delegate>,
10145    _additional_params: HashMap<String, String>,
10146    _scopes: BTreeSet<String>,
10147}
10148
10149impl<'a, C> common::CallBuilder for ProjectLocationGlobalOperationDeleteCall<'a, C> {}
10150
10151impl<'a, C> ProjectLocationGlobalOperationDeleteCall<'a, C>
10152where
10153    C: common::Connector,
10154{
10155    /// Perform the operation you have build so far.
10156    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
10157        use std::borrow::Cow;
10158        use std::io::{Read, Seek};
10159
10160        use common::{url::Params, ToParts};
10161        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10162
10163        let mut dd = common::DefaultDelegate;
10164        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10165        dlg.begin(common::MethodInfo {
10166            id: "networkmanagement.projects.locations.global.operations.delete",
10167            http_method: hyper::Method::DELETE,
10168        });
10169
10170        for &field in ["alt", "name"].iter() {
10171            if self._additional_params.contains_key(field) {
10172                dlg.finished(false);
10173                return Err(common::Error::FieldClash(field));
10174            }
10175        }
10176
10177        let mut params = Params::with_capacity(3 + self._additional_params.len());
10178        params.push("name", self._name);
10179
10180        params.extend(self._additional_params.iter());
10181
10182        params.push("alt", "json");
10183        let mut url = self.hub._base_url.clone() + "v1/{+name}";
10184        if self._scopes.is_empty() {
10185            self._scopes
10186                .insert(Scope::CloudPlatform.as_ref().to_string());
10187        }
10188
10189        #[allow(clippy::single_element_loop)]
10190        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10191            url = params.uri_replacement(url, param_name, find_this, true);
10192        }
10193        {
10194            let to_remove = ["name"];
10195            params.remove_params(&to_remove);
10196        }
10197
10198        let url = params.parse_with_url(&url);
10199
10200        loop {
10201            let token = match self
10202                .hub
10203                .auth
10204                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10205                .await
10206            {
10207                Ok(token) => token,
10208                Err(e) => match dlg.token(e) {
10209                    Ok(token) => token,
10210                    Err(e) => {
10211                        dlg.finished(false);
10212                        return Err(common::Error::MissingToken(e));
10213                    }
10214                },
10215            };
10216            let mut req_result = {
10217                let client = &self.hub.client;
10218                dlg.pre_request();
10219                let mut req_builder = hyper::Request::builder()
10220                    .method(hyper::Method::DELETE)
10221                    .uri(url.as_str())
10222                    .header(USER_AGENT, self.hub._user_agent.clone());
10223
10224                if let Some(token) = token.as_ref() {
10225                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10226                }
10227
10228                let request = req_builder
10229                    .header(CONTENT_LENGTH, 0_u64)
10230                    .body(common::to_body::<String>(None));
10231
10232                client.request(request.unwrap()).await
10233            };
10234
10235            match req_result {
10236                Err(err) => {
10237                    if let common::Retry::After(d) = dlg.http_error(&err) {
10238                        sleep(d).await;
10239                        continue;
10240                    }
10241                    dlg.finished(false);
10242                    return Err(common::Error::HttpError(err));
10243                }
10244                Ok(res) => {
10245                    let (mut parts, body) = res.into_parts();
10246                    let mut body = common::Body::new(body);
10247                    if !parts.status.is_success() {
10248                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10249                        let error = serde_json::from_str(&common::to_string(&bytes));
10250                        let response = common::to_response(parts, bytes.into());
10251
10252                        if let common::Retry::After(d) =
10253                            dlg.http_failure(&response, error.as_ref().ok())
10254                        {
10255                            sleep(d).await;
10256                            continue;
10257                        }
10258
10259                        dlg.finished(false);
10260
10261                        return Err(match error {
10262                            Ok(value) => common::Error::BadRequest(value),
10263                            _ => common::Error::Failure(response),
10264                        });
10265                    }
10266                    let response = {
10267                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10268                        let encoded = common::to_string(&bytes);
10269                        match serde_json::from_str(&encoded) {
10270                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10271                            Err(error) => {
10272                                dlg.response_json_decode_error(&encoded, &error);
10273                                return Err(common::Error::JsonDecodeError(
10274                                    encoded.to_string(),
10275                                    error,
10276                                ));
10277                            }
10278                        }
10279                    };
10280
10281                    dlg.finished(true);
10282                    return Ok(response);
10283                }
10284            }
10285        }
10286    }
10287
10288    /// The name of the operation resource to be deleted.
10289    ///
10290    /// Sets the *name* path property to the given value.
10291    ///
10292    /// Even though the property as already been set when instantiating this call,
10293    /// we provide this method for API completeness.
10294    pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalOperationDeleteCall<'a, C> {
10295        self._name = new_value.to_string();
10296        self
10297    }
10298    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10299    /// while executing the actual API request.
10300    ///
10301    /// ````text
10302    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10303    /// ````
10304    ///
10305    /// Sets the *delegate* property to the given value.
10306    pub fn delegate(
10307        mut self,
10308        new_value: &'a mut dyn common::Delegate,
10309    ) -> ProjectLocationGlobalOperationDeleteCall<'a, C> {
10310        self._delegate = Some(new_value);
10311        self
10312    }
10313
10314    /// Set any additional parameter of the query string used in the request.
10315    /// It should be used to set parameters which are not yet available through their own
10316    /// setters.
10317    ///
10318    /// Please note that this method must not be used to set any of the known parameters
10319    /// which have their own setter method. If done anyway, the request will fail.
10320    ///
10321    /// # Additional Parameters
10322    ///
10323    /// * *$.xgafv* (query-string) - V1 error format.
10324    /// * *access_token* (query-string) - OAuth access token.
10325    /// * *alt* (query-string) - Data format for response.
10326    /// * *callback* (query-string) - JSONP
10327    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10328    /// * *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.
10329    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10330    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10331    /// * *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.
10332    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10333    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10334    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalOperationDeleteCall<'a, C>
10335    where
10336        T: AsRef<str>,
10337    {
10338        self._additional_params
10339            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10340        self
10341    }
10342
10343    /// Identifies the authorization scope for the method you are building.
10344    ///
10345    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10346    /// [`Scope::CloudPlatform`].
10347    ///
10348    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10349    /// tokens for more than one scope.
10350    ///
10351    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10352    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10353    /// sufficient, a read-write scope will do as well.
10354    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalOperationDeleteCall<'a, C>
10355    where
10356        St: AsRef<str>,
10357    {
10358        self._scopes.insert(String::from(scope.as_ref()));
10359        self
10360    }
10361    /// Identifies the authorization scope(s) for the method you are building.
10362    ///
10363    /// See [`Self::add_scope()`] for details.
10364    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalOperationDeleteCall<'a, C>
10365    where
10366        I: IntoIterator<Item = St>,
10367        St: AsRef<str>,
10368    {
10369        self._scopes
10370            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10371        self
10372    }
10373
10374    /// Removes all scopes, and no default scope will be used either.
10375    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10376    /// for details).
10377    pub fn clear_scopes(mut self) -> ProjectLocationGlobalOperationDeleteCall<'a, C> {
10378        self._scopes.clear();
10379        self
10380    }
10381}
10382
10383/// 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.
10384///
10385/// A builder for the *locations.global.operations.get* method supported by a *project* resource.
10386/// It is not used directly, but through a [`ProjectMethods`] instance.
10387///
10388/// # Example
10389///
10390/// Instantiate a resource method builder
10391///
10392/// ```test_harness,no_run
10393/// # extern crate hyper;
10394/// # extern crate hyper_rustls;
10395/// # extern crate google_networkmanagement1 as networkmanagement1;
10396/// # async fn dox() {
10397/// # use networkmanagement1::{NetworkManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10398///
10399/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10400/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10401/// #     .with_native_roots()
10402/// #     .unwrap()
10403/// #     .https_only()
10404/// #     .enable_http2()
10405/// #     .build();
10406///
10407/// # let executor = hyper_util::rt::TokioExecutor::new();
10408/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10409/// #     secret,
10410/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10411/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10412/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10413/// #     ),
10414/// # ).build().await.unwrap();
10415///
10416/// # let client = hyper_util::client::legacy::Client::builder(
10417/// #     hyper_util::rt::TokioExecutor::new()
10418/// # )
10419/// # .build(
10420/// #     hyper_rustls::HttpsConnectorBuilder::new()
10421/// #         .with_native_roots()
10422/// #         .unwrap()
10423/// #         .https_or_http()
10424/// #         .enable_http2()
10425/// #         .build()
10426/// # );
10427/// # let mut hub = NetworkManagement::new(client, auth);
10428/// // You can configure optional parameters by calling the respective setters at will, and
10429/// // execute the final call using `doit()`.
10430/// // Values shown here are possibly random and not representative !
10431/// let result = hub.projects().locations_global_operations_get("name")
10432///              .doit().await;
10433/// # }
10434/// ```
10435pub struct ProjectLocationGlobalOperationGetCall<'a, C>
10436where
10437    C: 'a,
10438{
10439    hub: &'a NetworkManagement<C>,
10440    _name: String,
10441    _delegate: Option<&'a mut dyn common::Delegate>,
10442    _additional_params: HashMap<String, String>,
10443    _scopes: BTreeSet<String>,
10444}
10445
10446impl<'a, C> common::CallBuilder for ProjectLocationGlobalOperationGetCall<'a, C> {}
10447
10448impl<'a, C> ProjectLocationGlobalOperationGetCall<'a, C>
10449where
10450    C: common::Connector,
10451{
10452    /// Perform the operation you have build so far.
10453    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
10454        use std::borrow::Cow;
10455        use std::io::{Read, Seek};
10456
10457        use common::{url::Params, ToParts};
10458        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10459
10460        let mut dd = common::DefaultDelegate;
10461        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10462        dlg.begin(common::MethodInfo {
10463            id: "networkmanagement.projects.locations.global.operations.get",
10464            http_method: hyper::Method::GET,
10465        });
10466
10467        for &field in ["alt", "name"].iter() {
10468            if self._additional_params.contains_key(field) {
10469                dlg.finished(false);
10470                return Err(common::Error::FieldClash(field));
10471            }
10472        }
10473
10474        let mut params = Params::with_capacity(3 + self._additional_params.len());
10475        params.push("name", self._name);
10476
10477        params.extend(self._additional_params.iter());
10478
10479        params.push("alt", "json");
10480        let mut url = self.hub._base_url.clone() + "v1/{+name}";
10481        if self._scopes.is_empty() {
10482            self._scopes
10483                .insert(Scope::CloudPlatform.as_ref().to_string());
10484        }
10485
10486        #[allow(clippy::single_element_loop)]
10487        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10488            url = params.uri_replacement(url, param_name, find_this, true);
10489        }
10490        {
10491            let to_remove = ["name"];
10492            params.remove_params(&to_remove);
10493        }
10494
10495        let url = params.parse_with_url(&url);
10496
10497        loop {
10498            let token = match self
10499                .hub
10500                .auth
10501                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10502                .await
10503            {
10504                Ok(token) => token,
10505                Err(e) => match dlg.token(e) {
10506                    Ok(token) => token,
10507                    Err(e) => {
10508                        dlg.finished(false);
10509                        return Err(common::Error::MissingToken(e));
10510                    }
10511                },
10512            };
10513            let mut req_result = {
10514                let client = &self.hub.client;
10515                dlg.pre_request();
10516                let mut req_builder = hyper::Request::builder()
10517                    .method(hyper::Method::GET)
10518                    .uri(url.as_str())
10519                    .header(USER_AGENT, self.hub._user_agent.clone());
10520
10521                if let Some(token) = token.as_ref() {
10522                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10523                }
10524
10525                let request = req_builder
10526                    .header(CONTENT_LENGTH, 0_u64)
10527                    .body(common::to_body::<String>(None));
10528
10529                client.request(request.unwrap()).await
10530            };
10531
10532            match req_result {
10533                Err(err) => {
10534                    if let common::Retry::After(d) = dlg.http_error(&err) {
10535                        sleep(d).await;
10536                        continue;
10537                    }
10538                    dlg.finished(false);
10539                    return Err(common::Error::HttpError(err));
10540                }
10541                Ok(res) => {
10542                    let (mut parts, body) = res.into_parts();
10543                    let mut body = common::Body::new(body);
10544                    if !parts.status.is_success() {
10545                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10546                        let error = serde_json::from_str(&common::to_string(&bytes));
10547                        let response = common::to_response(parts, bytes.into());
10548
10549                        if let common::Retry::After(d) =
10550                            dlg.http_failure(&response, error.as_ref().ok())
10551                        {
10552                            sleep(d).await;
10553                            continue;
10554                        }
10555
10556                        dlg.finished(false);
10557
10558                        return Err(match error {
10559                            Ok(value) => common::Error::BadRequest(value),
10560                            _ => common::Error::Failure(response),
10561                        });
10562                    }
10563                    let response = {
10564                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10565                        let encoded = common::to_string(&bytes);
10566                        match serde_json::from_str(&encoded) {
10567                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10568                            Err(error) => {
10569                                dlg.response_json_decode_error(&encoded, &error);
10570                                return Err(common::Error::JsonDecodeError(
10571                                    encoded.to_string(),
10572                                    error,
10573                                ));
10574                            }
10575                        }
10576                    };
10577
10578                    dlg.finished(true);
10579                    return Ok(response);
10580                }
10581            }
10582        }
10583    }
10584
10585    /// The name of the operation resource.
10586    ///
10587    /// Sets the *name* path property to the given value.
10588    ///
10589    /// Even though the property as already been set when instantiating this call,
10590    /// we provide this method for API completeness.
10591    pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalOperationGetCall<'a, C> {
10592        self._name = new_value.to_string();
10593        self
10594    }
10595    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10596    /// while executing the actual API request.
10597    ///
10598    /// ````text
10599    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10600    /// ````
10601    ///
10602    /// Sets the *delegate* property to the given value.
10603    pub fn delegate(
10604        mut self,
10605        new_value: &'a mut dyn common::Delegate,
10606    ) -> ProjectLocationGlobalOperationGetCall<'a, C> {
10607        self._delegate = Some(new_value);
10608        self
10609    }
10610
10611    /// Set any additional parameter of the query string used in the request.
10612    /// It should be used to set parameters which are not yet available through their own
10613    /// setters.
10614    ///
10615    /// Please note that this method must not be used to set any of the known parameters
10616    /// which have their own setter method. If done anyway, the request will fail.
10617    ///
10618    /// # Additional Parameters
10619    ///
10620    /// * *$.xgafv* (query-string) - V1 error format.
10621    /// * *access_token* (query-string) - OAuth access token.
10622    /// * *alt* (query-string) - Data format for response.
10623    /// * *callback* (query-string) - JSONP
10624    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10625    /// * *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.
10626    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10627    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10628    /// * *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.
10629    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10630    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10631    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalOperationGetCall<'a, C>
10632    where
10633        T: AsRef<str>,
10634    {
10635        self._additional_params
10636            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10637        self
10638    }
10639
10640    /// Identifies the authorization scope for the method you are building.
10641    ///
10642    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10643    /// [`Scope::CloudPlatform`].
10644    ///
10645    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10646    /// tokens for more than one scope.
10647    ///
10648    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10649    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10650    /// sufficient, a read-write scope will do as well.
10651    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalOperationGetCall<'a, C>
10652    where
10653        St: AsRef<str>,
10654    {
10655        self._scopes.insert(String::from(scope.as_ref()));
10656        self
10657    }
10658    /// Identifies the authorization scope(s) for the method you are building.
10659    ///
10660    /// See [`Self::add_scope()`] for details.
10661    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalOperationGetCall<'a, C>
10662    where
10663        I: IntoIterator<Item = St>,
10664        St: AsRef<str>,
10665    {
10666        self._scopes
10667            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10668        self
10669    }
10670
10671    /// Removes all scopes, and no default scope will be used either.
10672    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10673    /// for details).
10674    pub fn clear_scopes(mut self) -> ProjectLocationGlobalOperationGetCall<'a, C> {
10675        self._scopes.clear();
10676        self
10677    }
10678}
10679
10680/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
10681///
10682/// A builder for the *locations.global.operations.list* method supported by a *project* resource.
10683/// It is not used directly, but through a [`ProjectMethods`] instance.
10684///
10685/// # Example
10686///
10687/// Instantiate a resource method builder
10688///
10689/// ```test_harness,no_run
10690/// # extern crate hyper;
10691/// # extern crate hyper_rustls;
10692/// # extern crate google_networkmanagement1 as networkmanagement1;
10693/// # async fn dox() {
10694/// # use networkmanagement1::{NetworkManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10695///
10696/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10697/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10698/// #     .with_native_roots()
10699/// #     .unwrap()
10700/// #     .https_only()
10701/// #     .enable_http2()
10702/// #     .build();
10703///
10704/// # let executor = hyper_util::rt::TokioExecutor::new();
10705/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10706/// #     secret,
10707/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10708/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10709/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10710/// #     ),
10711/// # ).build().await.unwrap();
10712///
10713/// # let client = hyper_util::client::legacy::Client::builder(
10714/// #     hyper_util::rt::TokioExecutor::new()
10715/// # )
10716/// # .build(
10717/// #     hyper_rustls::HttpsConnectorBuilder::new()
10718/// #         .with_native_roots()
10719/// #         .unwrap()
10720/// #         .https_or_http()
10721/// #         .enable_http2()
10722/// #         .build()
10723/// # );
10724/// # let mut hub = NetworkManagement::new(client, auth);
10725/// // You can configure optional parameters by calling the respective setters at will, and
10726/// // execute the final call using `doit()`.
10727/// // Values shown here are possibly random and not representative !
10728/// let result = hub.projects().locations_global_operations_list("name")
10729///              .return_partial_success(false)
10730///              .page_token("duo")
10731///              .page_size(-34)
10732///              .filter("et")
10733///              .doit().await;
10734/// # }
10735/// ```
10736pub struct ProjectLocationGlobalOperationListCall<'a, C>
10737where
10738    C: 'a,
10739{
10740    hub: &'a NetworkManagement<C>,
10741    _name: String,
10742    _return_partial_success: Option<bool>,
10743    _page_token: Option<String>,
10744    _page_size: Option<i32>,
10745    _filter: Option<String>,
10746    _delegate: Option<&'a mut dyn common::Delegate>,
10747    _additional_params: HashMap<String, String>,
10748    _scopes: BTreeSet<String>,
10749}
10750
10751impl<'a, C> common::CallBuilder for ProjectLocationGlobalOperationListCall<'a, C> {}
10752
10753impl<'a, C> ProjectLocationGlobalOperationListCall<'a, C>
10754where
10755    C: common::Connector,
10756{
10757    /// Perform the operation you have build so far.
10758    pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
10759        use std::borrow::Cow;
10760        use std::io::{Read, Seek};
10761
10762        use common::{url::Params, ToParts};
10763        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10764
10765        let mut dd = common::DefaultDelegate;
10766        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10767        dlg.begin(common::MethodInfo {
10768            id: "networkmanagement.projects.locations.global.operations.list",
10769            http_method: hyper::Method::GET,
10770        });
10771
10772        for &field in [
10773            "alt",
10774            "name",
10775            "returnPartialSuccess",
10776            "pageToken",
10777            "pageSize",
10778            "filter",
10779        ]
10780        .iter()
10781        {
10782            if self._additional_params.contains_key(field) {
10783                dlg.finished(false);
10784                return Err(common::Error::FieldClash(field));
10785            }
10786        }
10787
10788        let mut params = Params::with_capacity(7 + self._additional_params.len());
10789        params.push("name", self._name);
10790        if let Some(value) = self._return_partial_success.as_ref() {
10791            params.push("returnPartialSuccess", value.to_string());
10792        }
10793        if let Some(value) = self._page_token.as_ref() {
10794            params.push("pageToken", value);
10795        }
10796        if let Some(value) = self._page_size.as_ref() {
10797            params.push("pageSize", value.to_string());
10798        }
10799        if let Some(value) = self._filter.as_ref() {
10800            params.push("filter", value);
10801        }
10802
10803        params.extend(self._additional_params.iter());
10804
10805        params.push("alt", "json");
10806        let mut url = self.hub._base_url.clone() + "v1/{+name}/operations";
10807        if self._scopes.is_empty() {
10808            self._scopes
10809                .insert(Scope::CloudPlatform.as_ref().to_string());
10810        }
10811
10812        #[allow(clippy::single_element_loop)]
10813        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10814            url = params.uri_replacement(url, param_name, find_this, true);
10815        }
10816        {
10817            let to_remove = ["name"];
10818            params.remove_params(&to_remove);
10819        }
10820
10821        let url = params.parse_with_url(&url);
10822
10823        loop {
10824            let token = match self
10825                .hub
10826                .auth
10827                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10828                .await
10829            {
10830                Ok(token) => token,
10831                Err(e) => match dlg.token(e) {
10832                    Ok(token) => token,
10833                    Err(e) => {
10834                        dlg.finished(false);
10835                        return Err(common::Error::MissingToken(e));
10836                    }
10837                },
10838            };
10839            let mut req_result = {
10840                let client = &self.hub.client;
10841                dlg.pre_request();
10842                let mut req_builder = hyper::Request::builder()
10843                    .method(hyper::Method::GET)
10844                    .uri(url.as_str())
10845                    .header(USER_AGENT, self.hub._user_agent.clone());
10846
10847                if let Some(token) = token.as_ref() {
10848                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10849                }
10850
10851                let request = req_builder
10852                    .header(CONTENT_LENGTH, 0_u64)
10853                    .body(common::to_body::<String>(None));
10854
10855                client.request(request.unwrap()).await
10856            };
10857
10858            match req_result {
10859                Err(err) => {
10860                    if let common::Retry::After(d) = dlg.http_error(&err) {
10861                        sleep(d).await;
10862                        continue;
10863                    }
10864                    dlg.finished(false);
10865                    return Err(common::Error::HttpError(err));
10866                }
10867                Ok(res) => {
10868                    let (mut parts, body) = res.into_parts();
10869                    let mut body = common::Body::new(body);
10870                    if !parts.status.is_success() {
10871                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10872                        let error = serde_json::from_str(&common::to_string(&bytes));
10873                        let response = common::to_response(parts, bytes.into());
10874
10875                        if let common::Retry::After(d) =
10876                            dlg.http_failure(&response, error.as_ref().ok())
10877                        {
10878                            sleep(d).await;
10879                            continue;
10880                        }
10881
10882                        dlg.finished(false);
10883
10884                        return Err(match error {
10885                            Ok(value) => common::Error::BadRequest(value),
10886                            _ => common::Error::Failure(response),
10887                        });
10888                    }
10889                    let response = {
10890                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10891                        let encoded = common::to_string(&bytes);
10892                        match serde_json::from_str(&encoded) {
10893                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10894                            Err(error) => {
10895                                dlg.response_json_decode_error(&encoded, &error);
10896                                return Err(common::Error::JsonDecodeError(
10897                                    encoded.to_string(),
10898                                    error,
10899                                ));
10900                            }
10901                        }
10902                    };
10903
10904                    dlg.finished(true);
10905                    return Ok(response);
10906                }
10907            }
10908        }
10909    }
10910
10911    /// The name of the operation's parent resource.
10912    ///
10913    /// Sets the *name* path property to the given value.
10914    ///
10915    /// Even though the property as already been set when instantiating this call,
10916    /// we provide this method for API completeness.
10917    pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalOperationListCall<'a, C> {
10918        self._name = new_value.to_string();
10919        self
10920    }
10921    /// 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.
10922    ///
10923    /// Sets the *return partial success* query property to the given value.
10924    pub fn return_partial_success(
10925        mut self,
10926        new_value: bool,
10927    ) -> ProjectLocationGlobalOperationListCall<'a, C> {
10928        self._return_partial_success = Some(new_value);
10929        self
10930    }
10931    /// The standard list page token.
10932    ///
10933    /// Sets the *page token* query property to the given value.
10934    pub fn page_token(mut self, new_value: &str) -> ProjectLocationGlobalOperationListCall<'a, C> {
10935        self._page_token = Some(new_value.to_string());
10936        self
10937    }
10938    /// The standard list page size.
10939    ///
10940    /// Sets the *page size* query property to the given value.
10941    pub fn page_size(mut self, new_value: i32) -> ProjectLocationGlobalOperationListCall<'a, C> {
10942        self._page_size = Some(new_value);
10943        self
10944    }
10945    /// The standard list filter.
10946    ///
10947    /// Sets the *filter* query property to the given value.
10948    pub fn filter(mut self, new_value: &str) -> ProjectLocationGlobalOperationListCall<'a, C> {
10949        self._filter = Some(new_value.to_string());
10950        self
10951    }
10952    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10953    /// while executing the actual API request.
10954    ///
10955    /// ````text
10956    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10957    /// ````
10958    ///
10959    /// Sets the *delegate* property to the given value.
10960    pub fn delegate(
10961        mut self,
10962        new_value: &'a mut dyn common::Delegate,
10963    ) -> ProjectLocationGlobalOperationListCall<'a, C> {
10964        self._delegate = Some(new_value);
10965        self
10966    }
10967
10968    /// Set any additional parameter of the query string used in the request.
10969    /// It should be used to set parameters which are not yet available through their own
10970    /// setters.
10971    ///
10972    /// Please note that this method must not be used to set any of the known parameters
10973    /// which have their own setter method. If done anyway, the request will fail.
10974    ///
10975    /// # Additional Parameters
10976    ///
10977    /// * *$.xgafv* (query-string) - V1 error format.
10978    /// * *access_token* (query-string) - OAuth access token.
10979    /// * *alt* (query-string) - Data format for response.
10980    /// * *callback* (query-string) - JSONP
10981    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10982    /// * *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.
10983    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10984    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10985    /// * *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.
10986    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10987    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10988    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalOperationListCall<'a, C>
10989    where
10990        T: AsRef<str>,
10991    {
10992        self._additional_params
10993            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10994        self
10995    }
10996
10997    /// Identifies the authorization scope for the method you are building.
10998    ///
10999    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11000    /// [`Scope::CloudPlatform`].
11001    ///
11002    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11003    /// tokens for more than one scope.
11004    ///
11005    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11006    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11007    /// sufficient, a read-write scope will do as well.
11008    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalOperationListCall<'a, C>
11009    where
11010        St: AsRef<str>,
11011    {
11012        self._scopes.insert(String::from(scope.as_ref()));
11013        self
11014    }
11015    /// Identifies the authorization scope(s) for the method you are building.
11016    ///
11017    /// See [`Self::add_scope()`] for details.
11018    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalOperationListCall<'a, C>
11019    where
11020        I: IntoIterator<Item = St>,
11021        St: AsRef<str>,
11022    {
11023        self._scopes
11024            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11025        self
11026    }
11027
11028    /// Removes all scopes, and no default scope will be used either.
11029    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11030    /// for details).
11031    pub fn clear_scopes(mut self) -> ProjectLocationGlobalOperationListCall<'a, C> {
11032        self._scopes.clear();
11033        self
11034    }
11035}
11036
11037/// Creates a new `VpcFlowLogsConfig`. If a configuration with the exact same settings already exists (even if the ID is different), the creation fails. Notes: 1. Creating a configuration with `state=DISABLED` will fail 2. The following fields are not considered as settings for the purpose of the check mentioned above, therefore - creating another configuration with the same fields but different values for the following fields will fail as well: * name * create_time * update_time * labels * description
11038///
11039/// A builder for the *locations.vpcFlowLogsConfigs.create* method supported by a *project* resource.
11040/// It is not used directly, but through a [`ProjectMethods`] instance.
11041///
11042/// # Example
11043///
11044/// Instantiate a resource method builder
11045///
11046/// ```test_harness,no_run
11047/// # extern crate hyper;
11048/// # extern crate hyper_rustls;
11049/// # extern crate google_networkmanagement1 as networkmanagement1;
11050/// use networkmanagement1::api::VpcFlowLogsConfig;
11051/// # async fn dox() {
11052/// # use networkmanagement1::{NetworkManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11053///
11054/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11055/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11056/// #     .with_native_roots()
11057/// #     .unwrap()
11058/// #     .https_only()
11059/// #     .enable_http2()
11060/// #     .build();
11061///
11062/// # let executor = hyper_util::rt::TokioExecutor::new();
11063/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11064/// #     secret,
11065/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11066/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11067/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11068/// #     ),
11069/// # ).build().await.unwrap();
11070///
11071/// # let client = hyper_util::client::legacy::Client::builder(
11072/// #     hyper_util::rt::TokioExecutor::new()
11073/// # )
11074/// # .build(
11075/// #     hyper_rustls::HttpsConnectorBuilder::new()
11076/// #         .with_native_roots()
11077/// #         .unwrap()
11078/// #         .https_or_http()
11079/// #         .enable_http2()
11080/// #         .build()
11081/// # );
11082/// # let mut hub = NetworkManagement::new(client, auth);
11083/// // As the method needs a request, you would usually fill it with the desired information
11084/// // into the respective structure. Some of the parts shown here might not be applicable !
11085/// // Values shown here are possibly random and not representative !
11086/// let mut req = VpcFlowLogsConfig::default();
11087///
11088/// // You can configure optional parameters by calling the respective setters at will, and
11089/// // execute the final call using `doit()`.
11090/// // Values shown here are possibly random and not representative !
11091/// let result = hub.projects().locations_vpc_flow_logs_configs_create(req, "parent")
11092///              .vpc_flow_logs_config_id("amet.")
11093///              .doit().await;
11094/// # }
11095/// ```
11096pub struct ProjectLocationVpcFlowLogsConfigCreateCall<'a, C>
11097where
11098    C: 'a,
11099{
11100    hub: &'a NetworkManagement<C>,
11101    _request: VpcFlowLogsConfig,
11102    _parent: String,
11103    _vpc_flow_logs_config_id: Option<String>,
11104    _delegate: Option<&'a mut dyn common::Delegate>,
11105    _additional_params: HashMap<String, String>,
11106    _scopes: BTreeSet<String>,
11107}
11108
11109impl<'a, C> common::CallBuilder for ProjectLocationVpcFlowLogsConfigCreateCall<'a, C> {}
11110
11111impl<'a, C> ProjectLocationVpcFlowLogsConfigCreateCall<'a, C>
11112where
11113    C: common::Connector,
11114{
11115    /// Perform the operation you have build so far.
11116    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
11117        use std::borrow::Cow;
11118        use std::io::{Read, Seek};
11119
11120        use common::{url::Params, ToParts};
11121        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11122
11123        let mut dd = common::DefaultDelegate;
11124        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11125        dlg.begin(common::MethodInfo {
11126            id: "networkmanagement.projects.locations.vpcFlowLogsConfigs.create",
11127            http_method: hyper::Method::POST,
11128        });
11129
11130        for &field in ["alt", "parent", "vpcFlowLogsConfigId"].iter() {
11131            if self._additional_params.contains_key(field) {
11132                dlg.finished(false);
11133                return Err(common::Error::FieldClash(field));
11134            }
11135        }
11136
11137        let mut params = Params::with_capacity(5 + self._additional_params.len());
11138        params.push("parent", self._parent);
11139        if let Some(value) = self._vpc_flow_logs_config_id.as_ref() {
11140            params.push("vpcFlowLogsConfigId", value);
11141        }
11142
11143        params.extend(self._additional_params.iter());
11144
11145        params.push("alt", "json");
11146        let mut url = self.hub._base_url.clone() + "v1/{+parent}/vpcFlowLogsConfigs";
11147        if self._scopes.is_empty() {
11148            self._scopes
11149                .insert(Scope::CloudPlatform.as_ref().to_string());
11150        }
11151
11152        #[allow(clippy::single_element_loop)]
11153        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
11154            url = params.uri_replacement(url, param_name, find_this, true);
11155        }
11156        {
11157            let to_remove = ["parent"];
11158            params.remove_params(&to_remove);
11159        }
11160
11161        let url = params.parse_with_url(&url);
11162
11163        let mut json_mime_type = mime::APPLICATION_JSON;
11164        let mut request_value_reader = {
11165            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11166            common::remove_json_null_values(&mut value);
11167            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11168            serde_json::to_writer(&mut dst, &value).unwrap();
11169            dst
11170        };
11171        let request_size = request_value_reader
11172            .seek(std::io::SeekFrom::End(0))
11173            .unwrap();
11174        request_value_reader
11175            .seek(std::io::SeekFrom::Start(0))
11176            .unwrap();
11177
11178        loop {
11179            let token = match self
11180                .hub
11181                .auth
11182                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11183                .await
11184            {
11185                Ok(token) => token,
11186                Err(e) => match dlg.token(e) {
11187                    Ok(token) => token,
11188                    Err(e) => {
11189                        dlg.finished(false);
11190                        return Err(common::Error::MissingToken(e));
11191                    }
11192                },
11193            };
11194            request_value_reader
11195                .seek(std::io::SeekFrom::Start(0))
11196                .unwrap();
11197            let mut req_result = {
11198                let client = &self.hub.client;
11199                dlg.pre_request();
11200                let mut req_builder = hyper::Request::builder()
11201                    .method(hyper::Method::POST)
11202                    .uri(url.as_str())
11203                    .header(USER_AGENT, self.hub._user_agent.clone());
11204
11205                if let Some(token) = token.as_ref() {
11206                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11207                }
11208
11209                let request = req_builder
11210                    .header(CONTENT_TYPE, json_mime_type.to_string())
11211                    .header(CONTENT_LENGTH, request_size as u64)
11212                    .body(common::to_body(
11213                        request_value_reader.get_ref().clone().into(),
11214                    ));
11215
11216                client.request(request.unwrap()).await
11217            };
11218
11219            match req_result {
11220                Err(err) => {
11221                    if let common::Retry::After(d) = dlg.http_error(&err) {
11222                        sleep(d).await;
11223                        continue;
11224                    }
11225                    dlg.finished(false);
11226                    return Err(common::Error::HttpError(err));
11227                }
11228                Ok(res) => {
11229                    let (mut parts, body) = res.into_parts();
11230                    let mut body = common::Body::new(body);
11231                    if !parts.status.is_success() {
11232                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11233                        let error = serde_json::from_str(&common::to_string(&bytes));
11234                        let response = common::to_response(parts, bytes.into());
11235
11236                        if let common::Retry::After(d) =
11237                            dlg.http_failure(&response, error.as_ref().ok())
11238                        {
11239                            sleep(d).await;
11240                            continue;
11241                        }
11242
11243                        dlg.finished(false);
11244
11245                        return Err(match error {
11246                            Ok(value) => common::Error::BadRequest(value),
11247                            _ => common::Error::Failure(response),
11248                        });
11249                    }
11250                    let response = {
11251                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11252                        let encoded = common::to_string(&bytes);
11253                        match serde_json::from_str(&encoded) {
11254                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11255                            Err(error) => {
11256                                dlg.response_json_decode_error(&encoded, &error);
11257                                return Err(common::Error::JsonDecodeError(
11258                                    encoded.to_string(),
11259                                    error,
11260                                ));
11261                            }
11262                        }
11263                    };
11264
11265                    dlg.finished(true);
11266                    return Ok(response);
11267                }
11268            }
11269        }
11270    }
11271
11272    ///
11273    /// Sets the *request* property to the given value.
11274    ///
11275    /// Even though the property as already been set when instantiating this call,
11276    /// we provide this method for API completeness.
11277    pub fn request(
11278        mut self,
11279        new_value: VpcFlowLogsConfig,
11280    ) -> ProjectLocationVpcFlowLogsConfigCreateCall<'a, C> {
11281        self._request = new_value;
11282        self
11283    }
11284    /// Required. The parent resource of the VpcFlowLogsConfig to create, in one of the following formats: - For project-level resources: `projects/{project_id}/locations/global` - For organization-level resources: `organizations/{organization_id}/locations/global`
11285    ///
11286    /// Sets the *parent* path property to the given value.
11287    ///
11288    /// Even though the property as already been set when instantiating this call,
11289    /// we provide this method for API completeness.
11290    pub fn parent(mut self, new_value: &str) -> ProjectLocationVpcFlowLogsConfigCreateCall<'a, C> {
11291        self._parent = new_value.to_string();
11292        self
11293    }
11294    /// Required. ID of the `VpcFlowLogsConfig`.
11295    ///
11296    /// Sets the *vpc flow logs config id* query property to the given value.
11297    pub fn vpc_flow_logs_config_id(
11298        mut self,
11299        new_value: &str,
11300    ) -> ProjectLocationVpcFlowLogsConfigCreateCall<'a, C> {
11301        self._vpc_flow_logs_config_id = Some(new_value.to_string());
11302        self
11303    }
11304    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11305    /// while executing the actual API request.
11306    ///
11307    /// ````text
11308    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11309    /// ````
11310    ///
11311    /// Sets the *delegate* property to the given value.
11312    pub fn delegate(
11313        mut self,
11314        new_value: &'a mut dyn common::Delegate,
11315    ) -> ProjectLocationVpcFlowLogsConfigCreateCall<'a, C> {
11316        self._delegate = Some(new_value);
11317        self
11318    }
11319
11320    /// Set any additional parameter of the query string used in the request.
11321    /// It should be used to set parameters which are not yet available through their own
11322    /// setters.
11323    ///
11324    /// Please note that this method must not be used to set any of the known parameters
11325    /// which have their own setter method. If done anyway, the request will fail.
11326    ///
11327    /// # Additional Parameters
11328    ///
11329    /// * *$.xgafv* (query-string) - V1 error format.
11330    /// * *access_token* (query-string) - OAuth access token.
11331    /// * *alt* (query-string) - Data format for response.
11332    /// * *callback* (query-string) - JSONP
11333    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11334    /// * *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.
11335    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11336    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11337    /// * *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.
11338    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11339    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11340    pub fn param<T>(
11341        mut self,
11342        name: T,
11343        value: T,
11344    ) -> ProjectLocationVpcFlowLogsConfigCreateCall<'a, C>
11345    where
11346        T: AsRef<str>,
11347    {
11348        self._additional_params
11349            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11350        self
11351    }
11352
11353    /// Identifies the authorization scope for the method you are building.
11354    ///
11355    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11356    /// [`Scope::CloudPlatform`].
11357    ///
11358    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11359    /// tokens for more than one scope.
11360    ///
11361    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11362    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11363    /// sufficient, a read-write scope will do as well.
11364    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationVpcFlowLogsConfigCreateCall<'a, C>
11365    where
11366        St: AsRef<str>,
11367    {
11368        self._scopes.insert(String::from(scope.as_ref()));
11369        self
11370    }
11371    /// Identifies the authorization scope(s) for the method you are building.
11372    ///
11373    /// See [`Self::add_scope()`] for details.
11374    pub fn add_scopes<I, St>(
11375        mut self,
11376        scopes: I,
11377    ) -> ProjectLocationVpcFlowLogsConfigCreateCall<'a, C>
11378    where
11379        I: IntoIterator<Item = St>,
11380        St: AsRef<str>,
11381    {
11382        self._scopes
11383            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11384        self
11385    }
11386
11387    /// Removes all scopes, and no default scope will be used either.
11388    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11389    /// for details).
11390    pub fn clear_scopes(mut self) -> ProjectLocationVpcFlowLogsConfigCreateCall<'a, C> {
11391        self._scopes.clear();
11392        self
11393    }
11394}
11395
11396/// Deletes a specific `VpcFlowLogsConfig`.
11397///
11398/// A builder for the *locations.vpcFlowLogsConfigs.delete* method supported by a *project* resource.
11399/// It is not used directly, but through a [`ProjectMethods`] instance.
11400///
11401/// # Example
11402///
11403/// Instantiate a resource method builder
11404///
11405/// ```test_harness,no_run
11406/// # extern crate hyper;
11407/// # extern crate hyper_rustls;
11408/// # extern crate google_networkmanagement1 as networkmanagement1;
11409/// # async fn dox() {
11410/// # use networkmanagement1::{NetworkManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11411///
11412/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11413/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11414/// #     .with_native_roots()
11415/// #     .unwrap()
11416/// #     .https_only()
11417/// #     .enable_http2()
11418/// #     .build();
11419///
11420/// # let executor = hyper_util::rt::TokioExecutor::new();
11421/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11422/// #     secret,
11423/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11424/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11425/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11426/// #     ),
11427/// # ).build().await.unwrap();
11428///
11429/// # let client = hyper_util::client::legacy::Client::builder(
11430/// #     hyper_util::rt::TokioExecutor::new()
11431/// # )
11432/// # .build(
11433/// #     hyper_rustls::HttpsConnectorBuilder::new()
11434/// #         .with_native_roots()
11435/// #         .unwrap()
11436/// #         .https_or_http()
11437/// #         .enable_http2()
11438/// #         .build()
11439/// # );
11440/// # let mut hub = NetworkManagement::new(client, auth);
11441/// // You can configure optional parameters by calling the respective setters at will, and
11442/// // execute the final call using `doit()`.
11443/// // Values shown here are possibly random and not representative !
11444/// let result = hub.projects().locations_vpc_flow_logs_configs_delete("name")
11445///              .doit().await;
11446/// # }
11447/// ```
11448pub struct ProjectLocationVpcFlowLogsConfigDeleteCall<'a, C>
11449where
11450    C: 'a,
11451{
11452    hub: &'a NetworkManagement<C>,
11453    _name: String,
11454    _delegate: Option<&'a mut dyn common::Delegate>,
11455    _additional_params: HashMap<String, String>,
11456    _scopes: BTreeSet<String>,
11457}
11458
11459impl<'a, C> common::CallBuilder for ProjectLocationVpcFlowLogsConfigDeleteCall<'a, C> {}
11460
11461impl<'a, C> ProjectLocationVpcFlowLogsConfigDeleteCall<'a, C>
11462where
11463    C: common::Connector,
11464{
11465    /// Perform the operation you have build so far.
11466    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
11467        use std::borrow::Cow;
11468        use std::io::{Read, Seek};
11469
11470        use common::{url::Params, ToParts};
11471        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11472
11473        let mut dd = common::DefaultDelegate;
11474        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11475        dlg.begin(common::MethodInfo {
11476            id: "networkmanagement.projects.locations.vpcFlowLogsConfigs.delete",
11477            http_method: hyper::Method::DELETE,
11478        });
11479
11480        for &field in ["alt", "name"].iter() {
11481            if self._additional_params.contains_key(field) {
11482                dlg.finished(false);
11483                return Err(common::Error::FieldClash(field));
11484            }
11485        }
11486
11487        let mut params = Params::with_capacity(3 + self._additional_params.len());
11488        params.push("name", self._name);
11489
11490        params.extend(self._additional_params.iter());
11491
11492        params.push("alt", "json");
11493        let mut url = self.hub._base_url.clone() + "v1/{+name}";
11494        if self._scopes.is_empty() {
11495            self._scopes
11496                .insert(Scope::CloudPlatform.as_ref().to_string());
11497        }
11498
11499        #[allow(clippy::single_element_loop)]
11500        for &(find_this, param_name) in [("{+name}", "name")].iter() {
11501            url = params.uri_replacement(url, param_name, find_this, true);
11502        }
11503        {
11504            let to_remove = ["name"];
11505            params.remove_params(&to_remove);
11506        }
11507
11508        let url = params.parse_with_url(&url);
11509
11510        loop {
11511            let token = match self
11512                .hub
11513                .auth
11514                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11515                .await
11516            {
11517                Ok(token) => token,
11518                Err(e) => match dlg.token(e) {
11519                    Ok(token) => token,
11520                    Err(e) => {
11521                        dlg.finished(false);
11522                        return Err(common::Error::MissingToken(e));
11523                    }
11524                },
11525            };
11526            let mut req_result = {
11527                let client = &self.hub.client;
11528                dlg.pre_request();
11529                let mut req_builder = hyper::Request::builder()
11530                    .method(hyper::Method::DELETE)
11531                    .uri(url.as_str())
11532                    .header(USER_AGENT, self.hub._user_agent.clone());
11533
11534                if let Some(token) = token.as_ref() {
11535                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11536                }
11537
11538                let request = req_builder
11539                    .header(CONTENT_LENGTH, 0_u64)
11540                    .body(common::to_body::<String>(None));
11541
11542                client.request(request.unwrap()).await
11543            };
11544
11545            match req_result {
11546                Err(err) => {
11547                    if let common::Retry::After(d) = dlg.http_error(&err) {
11548                        sleep(d).await;
11549                        continue;
11550                    }
11551                    dlg.finished(false);
11552                    return Err(common::Error::HttpError(err));
11553                }
11554                Ok(res) => {
11555                    let (mut parts, body) = res.into_parts();
11556                    let mut body = common::Body::new(body);
11557                    if !parts.status.is_success() {
11558                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11559                        let error = serde_json::from_str(&common::to_string(&bytes));
11560                        let response = common::to_response(parts, bytes.into());
11561
11562                        if let common::Retry::After(d) =
11563                            dlg.http_failure(&response, error.as_ref().ok())
11564                        {
11565                            sleep(d).await;
11566                            continue;
11567                        }
11568
11569                        dlg.finished(false);
11570
11571                        return Err(match error {
11572                            Ok(value) => common::Error::BadRequest(value),
11573                            _ => common::Error::Failure(response),
11574                        });
11575                    }
11576                    let response = {
11577                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11578                        let encoded = common::to_string(&bytes);
11579                        match serde_json::from_str(&encoded) {
11580                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11581                            Err(error) => {
11582                                dlg.response_json_decode_error(&encoded, &error);
11583                                return Err(common::Error::JsonDecodeError(
11584                                    encoded.to_string(),
11585                                    error,
11586                                ));
11587                            }
11588                        }
11589                    };
11590
11591                    dlg.finished(true);
11592                    return Ok(response);
11593                }
11594            }
11595        }
11596    }
11597
11598    /// Required. The resource name of the VpcFlowLogsConfig, in one of the following formats: - For a project-level resource: `projects/{project_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}` - For an organization-level resource: `organizations/{organization_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}`
11599    ///
11600    /// Sets the *name* path property to the given value.
11601    ///
11602    /// Even though the property as already been set when instantiating this call,
11603    /// we provide this method for API completeness.
11604    pub fn name(mut self, new_value: &str) -> ProjectLocationVpcFlowLogsConfigDeleteCall<'a, C> {
11605        self._name = new_value.to_string();
11606        self
11607    }
11608    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11609    /// while executing the actual API request.
11610    ///
11611    /// ````text
11612    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11613    /// ````
11614    ///
11615    /// Sets the *delegate* property to the given value.
11616    pub fn delegate(
11617        mut self,
11618        new_value: &'a mut dyn common::Delegate,
11619    ) -> ProjectLocationVpcFlowLogsConfigDeleteCall<'a, C> {
11620        self._delegate = Some(new_value);
11621        self
11622    }
11623
11624    /// Set any additional parameter of the query string used in the request.
11625    /// It should be used to set parameters which are not yet available through their own
11626    /// setters.
11627    ///
11628    /// Please note that this method must not be used to set any of the known parameters
11629    /// which have their own setter method. If done anyway, the request will fail.
11630    ///
11631    /// # Additional Parameters
11632    ///
11633    /// * *$.xgafv* (query-string) - V1 error format.
11634    /// * *access_token* (query-string) - OAuth access token.
11635    /// * *alt* (query-string) - Data format for response.
11636    /// * *callback* (query-string) - JSONP
11637    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11638    /// * *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.
11639    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11640    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11641    /// * *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.
11642    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11643    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11644    pub fn param<T>(
11645        mut self,
11646        name: T,
11647        value: T,
11648    ) -> ProjectLocationVpcFlowLogsConfigDeleteCall<'a, C>
11649    where
11650        T: AsRef<str>,
11651    {
11652        self._additional_params
11653            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11654        self
11655    }
11656
11657    /// Identifies the authorization scope for the method you are building.
11658    ///
11659    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11660    /// [`Scope::CloudPlatform`].
11661    ///
11662    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11663    /// tokens for more than one scope.
11664    ///
11665    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11666    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11667    /// sufficient, a read-write scope will do as well.
11668    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationVpcFlowLogsConfigDeleteCall<'a, C>
11669    where
11670        St: AsRef<str>,
11671    {
11672        self._scopes.insert(String::from(scope.as_ref()));
11673        self
11674    }
11675    /// Identifies the authorization scope(s) for the method you are building.
11676    ///
11677    /// See [`Self::add_scope()`] for details.
11678    pub fn add_scopes<I, St>(
11679        mut self,
11680        scopes: I,
11681    ) -> ProjectLocationVpcFlowLogsConfigDeleteCall<'a, C>
11682    where
11683        I: IntoIterator<Item = St>,
11684        St: AsRef<str>,
11685    {
11686        self._scopes
11687            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11688        self
11689    }
11690
11691    /// Removes all scopes, and no default scope will be used either.
11692    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11693    /// for details).
11694    pub fn clear_scopes(mut self) -> ProjectLocationVpcFlowLogsConfigDeleteCall<'a, C> {
11695        self._scopes.clear();
11696        self
11697    }
11698}
11699
11700/// Gets the details of a specific `VpcFlowLogsConfig`.
11701///
11702/// A builder for the *locations.vpcFlowLogsConfigs.get* method supported by a *project* resource.
11703/// It is not used directly, but through a [`ProjectMethods`] instance.
11704///
11705/// # Example
11706///
11707/// Instantiate a resource method builder
11708///
11709/// ```test_harness,no_run
11710/// # extern crate hyper;
11711/// # extern crate hyper_rustls;
11712/// # extern crate google_networkmanagement1 as networkmanagement1;
11713/// # async fn dox() {
11714/// # use networkmanagement1::{NetworkManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11715///
11716/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11717/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11718/// #     .with_native_roots()
11719/// #     .unwrap()
11720/// #     .https_only()
11721/// #     .enable_http2()
11722/// #     .build();
11723///
11724/// # let executor = hyper_util::rt::TokioExecutor::new();
11725/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11726/// #     secret,
11727/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11728/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11729/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11730/// #     ),
11731/// # ).build().await.unwrap();
11732///
11733/// # let client = hyper_util::client::legacy::Client::builder(
11734/// #     hyper_util::rt::TokioExecutor::new()
11735/// # )
11736/// # .build(
11737/// #     hyper_rustls::HttpsConnectorBuilder::new()
11738/// #         .with_native_roots()
11739/// #         .unwrap()
11740/// #         .https_or_http()
11741/// #         .enable_http2()
11742/// #         .build()
11743/// # );
11744/// # let mut hub = NetworkManagement::new(client, auth);
11745/// // You can configure optional parameters by calling the respective setters at will, and
11746/// // execute the final call using `doit()`.
11747/// // Values shown here are possibly random and not representative !
11748/// let result = hub.projects().locations_vpc_flow_logs_configs_get("name")
11749///              .doit().await;
11750/// # }
11751/// ```
11752pub struct ProjectLocationVpcFlowLogsConfigGetCall<'a, C>
11753where
11754    C: 'a,
11755{
11756    hub: &'a NetworkManagement<C>,
11757    _name: String,
11758    _delegate: Option<&'a mut dyn common::Delegate>,
11759    _additional_params: HashMap<String, String>,
11760    _scopes: BTreeSet<String>,
11761}
11762
11763impl<'a, C> common::CallBuilder for ProjectLocationVpcFlowLogsConfigGetCall<'a, C> {}
11764
11765impl<'a, C> ProjectLocationVpcFlowLogsConfigGetCall<'a, C>
11766where
11767    C: common::Connector,
11768{
11769    /// Perform the operation you have build so far.
11770    pub async fn doit(mut self) -> common::Result<(common::Response, VpcFlowLogsConfig)> {
11771        use std::borrow::Cow;
11772        use std::io::{Read, Seek};
11773
11774        use common::{url::Params, ToParts};
11775        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11776
11777        let mut dd = common::DefaultDelegate;
11778        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11779        dlg.begin(common::MethodInfo {
11780            id: "networkmanagement.projects.locations.vpcFlowLogsConfigs.get",
11781            http_method: hyper::Method::GET,
11782        });
11783
11784        for &field in ["alt", "name"].iter() {
11785            if self._additional_params.contains_key(field) {
11786                dlg.finished(false);
11787                return Err(common::Error::FieldClash(field));
11788            }
11789        }
11790
11791        let mut params = Params::with_capacity(3 + self._additional_params.len());
11792        params.push("name", self._name);
11793
11794        params.extend(self._additional_params.iter());
11795
11796        params.push("alt", "json");
11797        let mut url = self.hub._base_url.clone() + "v1/{+name}";
11798        if self._scopes.is_empty() {
11799            self._scopes
11800                .insert(Scope::CloudPlatform.as_ref().to_string());
11801        }
11802
11803        #[allow(clippy::single_element_loop)]
11804        for &(find_this, param_name) in [("{+name}", "name")].iter() {
11805            url = params.uri_replacement(url, param_name, find_this, true);
11806        }
11807        {
11808            let to_remove = ["name"];
11809            params.remove_params(&to_remove);
11810        }
11811
11812        let url = params.parse_with_url(&url);
11813
11814        loop {
11815            let token = match self
11816                .hub
11817                .auth
11818                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11819                .await
11820            {
11821                Ok(token) => token,
11822                Err(e) => match dlg.token(e) {
11823                    Ok(token) => token,
11824                    Err(e) => {
11825                        dlg.finished(false);
11826                        return Err(common::Error::MissingToken(e));
11827                    }
11828                },
11829            };
11830            let mut req_result = {
11831                let client = &self.hub.client;
11832                dlg.pre_request();
11833                let mut req_builder = hyper::Request::builder()
11834                    .method(hyper::Method::GET)
11835                    .uri(url.as_str())
11836                    .header(USER_AGENT, self.hub._user_agent.clone());
11837
11838                if let Some(token) = token.as_ref() {
11839                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11840                }
11841
11842                let request = req_builder
11843                    .header(CONTENT_LENGTH, 0_u64)
11844                    .body(common::to_body::<String>(None));
11845
11846                client.request(request.unwrap()).await
11847            };
11848
11849            match req_result {
11850                Err(err) => {
11851                    if let common::Retry::After(d) = dlg.http_error(&err) {
11852                        sleep(d).await;
11853                        continue;
11854                    }
11855                    dlg.finished(false);
11856                    return Err(common::Error::HttpError(err));
11857                }
11858                Ok(res) => {
11859                    let (mut parts, body) = res.into_parts();
11860                    let mut body = common::Body::new(body);
11861                    if !parts.status.is_success() {
11862                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11863                        let error = serde_json::from_str(&common::to_string(&bytes));
11864                        let response = common::to_response(parts, bytes.into());
11865
11866                        if let common::Retry::After(d) =
11867                            dlg.http_failure(&response, error.as_ref().ok())
11868                        {
11869                            sleep(d).await;
11870                            continue;
11871                        }
11872
11873                        dlg.finished(false);
11874
11875                        return Err(match error {
11876                            Ok(value) => common::Error::BadRequest(value),
11877                            _ => common::Error::Failure(response),
11878                        });
11879                    }
11880                    let response = {
11881                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11882                        let encoded = common::to_string(&bytes);
11883                        match serde_json::from_str(&encoded) {
11884                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11885                            Err(error) => {
11886                                dlg.response_json_decode_error(&encoded, &error);
11887                                return Err(common::Error::JsonDecodeError(
11888                                    encoded.to_string(),
11889                                    error,
11890                                ));
11891                            }
11892                        }
11893                    };
11894
11895                    dlg.finished(true);
11896                    return Ok(response);
11897                }
11898            }
11899        }
11900    }
11901
11902    /// Required. The resource name of the VpcFlowLogsConfig, in one of the following formats: - For project-level resources: `projects/{project_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}` - For organization-level resources: `organizations/{organization_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}`
11903    ///
11904    /// Sets the *name* path property to the given value.
11905    ///
11906    /// Even though the property as already been set when instantiating this call,
11907    /// we provide this method for API completeness.
11908    pub fn name(mut self, new_value: &str) -> ProjectLocationVpcFlowLogsConfigGetCall<'a, C> {
11909        self._name = new_value.to_string();
11910        self
11911    }
11912    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11913    /// while executing the actual API request.
11914    ///
11915    /// ````text
11916    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11917    /// ````
11918    ///
11919    /// Sets the *delegate* property to the given value.
11920    pub fn delegate(
11921        mut self,
11922        new_value: &'a mut dyn common::Delegate,
11923    ) -> ProjectLocationVpcFlowLogsConfigGetCall<'a, C> {
11924        self._delegate = Some(new_value);
11925        self
11926    }
11927
11928    /// Set any additional parameter of the query string used in the request.
11929    /// It should be used to set parameters which are not yet available through their own
11930    /// setters.
11931    ///
11932    /// Please note that this method must not be used to set any of the known parameters
11933    /// which have their own setter method. If done anyway, the request will fail.
11934    ///
11935    /// # Additional Parameters
11936    ///
11937    /// * *$.xgafv* (query-string) - V1 error format.
11938    /// * *access_token* (query-string) - OAuth access token.
11939    /// * *alt* (query-string) - Data format for response.
11940    /// * *callback* (query-string) - JSONP
11941    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11942    /// * *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.
11943    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11944    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11945    /// * *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.
11946    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11947    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11948    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationVpcFlowLogsConfigGetCall<'a, C>
11949    where
11950        T: AsRef<str>,
11951    {
11952        self._additional_params
11953            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11954        self
11955    }
11956
11957    /// Identifies the authorization scope for the method you are building.
11958    ///
11959    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11960    /// [`Scope::CloudPlatform`].
11961    ///
11962    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11963    /// tokens for more than one scope.
11964    ///
11965    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11966    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11967    /// sufficient, a read-write scope will do as well.
11968    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationVpcFlowLogsConfigGetCall<'a, C>
11969    where
11970        St: AsRef<str>,
11971    {
11972        self._scopes.insert(String::from(scope.as_ref()));
11973        self
11974    }
11975    /// Identifies the authorization scope(s) for the method you are building.
11976    ///
11977    /// See [`Self::add_scope()`] for details.
11978    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationVpcFlowLogsConfigGetCall<'a, C>
11979    where
11980        I: IntoIterator<Item = St>,
11981        St: AsRef<str>,
11982    {
11983        self._scopes
11984            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11985        self
11986    }
11987
11988    /// Removes all scopes, and no default scope will be used either.
11989    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11990    /// for details).
11991    pub fn clear_scopes(mut self) -> ProjectLocationVpcFlowLogsConfigGetCall<'a, C> {
11992        self._scopes.clear();
11993        self
11994    }
11995}
11996
11997/// Lists all `VpcFlowLogsConfigs` in a given project.
11998///
11999/// A builder for the *locations.vpcFlowLogsConfigs.list* method supported by a *project* resource.
12000/// It is not used directly, but through a [`ProjectMethods`] instance.
12001///
12002/// # Example
12003///
12004/// Instantiate a resource method builder
12005///
12006/// ```test_harness,no_run
12007/// # extern crate hyper;
12008/// # extern crate hyper_rustls;
12009/// # extern crate google_networkmanagement1 as networkmanagement1;
12010/// # async fn dox() {
12011/// # use networkmanagement1::{NetworkManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12012///
12013/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12014/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12015/// #     .with_native_roots()
12016/// #     .unwrap()
12017/// #     .https_only()
12018/// #     .enable_http2()
12019/// #     .build();
12020///
12021/// # let executor = hyper_util::rt::TokioExecutor::new();
12022/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12023/// #     secret,
12024/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12025/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12026/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12027/// #     ),
12028/// # ).build().await.unwrap();
12029///
12030/// # let client = hyper_util::client::legacy::Client::builder(
12031/// #     hyper_util::rt::TokioExecutor::new()
12032/// # )
12033/// # .build(
12034/// #     hyper_rustls::HttpsConnectorBuilder::new()
12035/// #         .with_native_roots()
12036/// #         .unwrap()
12037/// #         .https_or_http()
12038/// #         .enable_http2()
12039/// #         .build()
12040/// # );
12041/// # let mut hub = NetworkManagement::new(client, auth);
12042/// // You can configure optional parameters by calling the respective setters at will, and
12043/// // execute the final call using `doit()`.
12044/// // Values shown here are possibly random and not representative !
12045/// let result = hub.projects().locations_vpc_flow_logs_configs_list("parent")
12046///              .page_token("et")
12047///              .page_size(-22)
12048///              .order_by("sadipscing")
12049///              .filter("Stet")
12050///              .doit().await;
12051/// # }
12052/// ```
12053pub struct ProjectLocationVpcFlowLogsConfigListCall<'a, C>
12054where
12055    C: 'a,
12056{
12057    hub: &'a NetworkManagement<C>,
12058    _parent: String,
12059    _page_token: Option<String>,
12060    _page_size: Option<i32>,
12061    _order_by: Option<String>,
12062    _filter: Option<String>,
12063    _delegate: Option<&'a mut dyn common::Delegate>,
12064    _additional_params: HashMap<String, String>,
12065    _scopes: BTreeSet<String>,
12066}
12067
12068impl<'a, C> common::CallBuilder for ProjectLocationVpcFlowLogsConfigListCall<'a, C> {}
12069
12070impl<'a, C> ProjectLocationVpcFlowLogsConfigListCall<'a, C>
12071where
12072    C: common::Connector,
12073{
12074    /// Perform the operation you have build so far.
12075    pub async fn doit(
12076        mut self,
12077    ) -> common::Result<(common::Response, ListVpcFlowLogsConfigsResponse)> {
12078        use std::borrow::Cow;
12079        use std::io::{Read, Seek};
12080
12081        use common::{url::Params, ToParts};
12082        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12083
12084        let mut dd = common::DefaultDelegate;
12085        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12086        dlg.begin(common::MethodInfo {
12087            id: "networkmanagement.projects.locations.vpcFlowLogsConfigs.list",
12088            http_method: hyper::Method::GET,
12089        });
12090
12091        for &field in [
12092            "alt",
12093            "parent",
12094            "pageToken",
12095            "pageSize",
12096            "orderBy",
12097            "filter",
12098        ]
12099        .iter()
12100        {
12101            if self._additional_params.contains_key(field) {
12102                dlg.finished(false);
12103                return Err(common::Error::FieldClash(field));
12104            }
12105        }
12106
12107        let mut params = Params::with_capacity(7 + self._additional_params.len());
12108        params.push("parent", self._parent);
12109        if let Some(value) = self._page_token.as_ref() {
12110            params.push("pageToken", value);
12111        }
12112        if let Some(value) = self._page_size.as_ref() {
12113            params.push("pageSize", value.to_string());
12114        }
12115        if let Some(value) = self._order_by.as_ref() {
12116            params.push("orderBy", value);
12117        }
12118        if let Some(value) = self._filter.as_ref() {
12119            params.push("filter", value);
12120        }
12121
12122        params.extend(self._additional_params.iter());
12123
12124        params.push("alt", "json");
12125        let mut url = self.hub._base_url.clone() + "v1/{+parent}/vpcFlowLogsConfigs";
12126        if self._scopes.is_empty() {
12127            self._scopes
12128                .insert(Scope::CloudPlatform.as_ref().to_string());
12129        }
12130
12131        #[allow(clippy::single_element_loop)]
12132        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
12133            url = params.uri_replacement(url, param_name, find_this, true);
12134        }
12135        {
12136            let to_remove = ["parent"];
12137            params.remove_params(&to_remove);
12138        }
12139
12140        let url = params.parse_with_url(&url);
12141
12142        loop {
12143            let token = match self
12144                .hub
12145                .auth
12146                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12147                .await
12148            {
12149                Ok(token) => token,
12150                Err(e) => match dlg.token(e) {
12151                    Ok(token) => token,
12152                    Err(e) => {
12153                        dlg.finished(false);
12154                        return Err(common::Error::MissingToken(e));
12155                    }
12156                },
12157            };
12158            let mut req_result = {
12159                let client = &self.hub.client;
12160                dlg.pre_request();
12161                let mut req_builder = hyper::Request::builder()
12162                    .method(hyper::Method::GET)
12163                    .uri(url.as_str())
12164                    .header(USER_AGENT, self.hub._user_agent.clone());
12165
12166                if let Some(token) = token.as_ref() {
12167                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12168                }
12169
12170                let request = req_builder
12171                    .header(CONTENT_LENGTH, 0_u64)
12172                    .body(common::to_body::<String>(None));
12173
12174                client.request(request.unwrap()).await
12175            };
12176
12177            match req_result {
12178                Err(err) => {
12179                    if let common::Retry::After(d) = dlg.http_error(&err) {
12180                        sleep(d).await;
12181                        continue;
12182                    }
12183                    dlg.finished(false);
12184                    return Err(common::Error::HttpError(err));
12185                }
12186                Ok(res) => {
12187                    let (mut parts, body) = res.into_parts();
12188                    let mut body = common::Body::new(body);
12189                    if !parts.status.is_success() {
12190                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12191                        let error = serde_json::from_str(&common::to_string(&bytes));
12192                        let response = common::to_response(parts, bytes.into());
12193
12194                        if let common::Retry::After(d) =
12195                            dlg.http_failure(&response, error.as_ref().ok())
12196                        {
12197                            sleep(d).await;
12198                            continue;
12199                        }
12200
12201                        dlg.finished(false);
12202
12203                        return Err(match error {
12204                            Ok(value) => common::Error::BadRequest(value),
12205                            _ => common::Error::Failure(response),
12206                        });
12207                    }
12208                    let response = {
12209                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12210                        let encoded = common::to_string(&bytes);
12211                        match serde_json::from_str(&encoded) {
12212                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12213                            Err(error) => {
12214                                dlg.response_json_decode_error(&encoded, &error);
12215                                return Err(common::Error::JsonDecodeError(
12216                                    encoded.to_string(),
12217                                    error,
12218                                ));
12219                            }
12220                        }
12221                    };
12222
12223                    dlg.finished(true);
12224                    return Ok(response);
12225                }
12226            }
12227        }
12228    }
12229
12230    /// Required. The parent resource of the VpcFlowLogsConfig, in one of the following formats: - For project-level resources: `projects/{project_id}/locations/global` - For organization-level resources: `organizations/{organization_id}/locations/global`
12231    ///
12232    /// Sets the *parent* path property to the given value.
12233    ///
12234    /// Even though the property as already been set when instantiating this call,
12235    /// we provide this method for API completeness.
12236    pub fn parent(mut self, new_value: &str) -> ProjectLocationVpcFlowLogsConfigListCall<'a, C> {
12237        self._parent = new_value.to_string();
12238        self
12239    }
12240    /// Optional. Page token from an earlier query, as returned in `next_page_token`.
12241    ///
12242    /// Sets the *page token* query property to the given value.
12243    pub fn page_token(
12244        mut self,
12245        new_value: &str,
12246    ) -> ProjectLocationVpcFlowLogsConfigListCall<'a, C> {
12247        self._page_token = Some(new_value.to_string());
12248        self
12249    }
12250    /// Optional. Number of `VpcFlowLogsConfigs` to return.
12251    ///
12252    /// Sets the *page size* query property to the given value.
12253    pub fn page_size(mut self, new_value: i32) -> ProjectLocationVpcFlowLogsConfigListCall<'a, C> {
12254        self._page_size = Some(new_value);
12255        self
12256    }
12257    /// Optional. Field to use to sort the list.
12258    ///
12259    /// Sets the *order by* query property to the given value.
12260    pub fn order_by(mut self, new_value: &str) -> ProjectLocationVpcFlowLogsConfigListCall<'a, C> {
12261        self._order_by = Some(new_value.to_string());
12262        self
12263    }
12264    /// Optional. Lists the `VpcFlowLogsConfigs` that match the filter expression. A filter expression must use the supported [CEL logic operators] (https://cloud.google.com/vpc/docs/about-flow-logs-records#supported_cel_logic_operators).
12265    ///
12266    /// Sets the *filter* query property to the given value.
12267    pub fn filter(mut self, new_value: &str) -> ProjectLocationVpcFlowLogsConfigListCall<'a, C> {
12268        self._filter = Some(new_value.to_string());
12269        self
12270    }
12271    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12272    /// while executing the actual API request.
12273    ///
12274    /// ````text
12275    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12276    /// ````
12277    ///
12278    /// Sets the *delegate* property to the given value.
12279    pub fn delegate(
12280        mut self,
12281        new_value: &'a mut dyn common::Delegate,
12282    ) -> ProjectLocationVpcFlowLogsConfigListCall<'a, C> {
12283        self._delegate = Some(new_value);
12284        self
12285    }
12286
12287    /// Set any additional parameter of the query string used in the request.
12288    /// It should be used to set parameters which are not yet available through their own
12289    /// setters.
12290    ///
12291    /// Please note that this method must not be used to set any of the known parameters
12292    /// which have their own setter method. If done anyway, the request will fail.
12293    ///
12294    /// # Additional Parameters
12295    ///
12296    /// * *$.xgafv* (query-string) - V1 error format.
12297    /// * *access_token* (query-string) - OAuth access token.
12298    /// * *alt* (query-string) - Data format for response.
12299    /// * *callback* (query-string) - JSONP
12300    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12301    /// * *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.
12302    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12303    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12304    /// * *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.
12305    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12306    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12307    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationVpcFlowLogsConfigListCall<'a, C>
12308    where
12309        T: AsRef<str>,
12310    {
12311        self._additional_params
12312            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12313        self
12314    }
12315
12316    /// Identifies the authorization scope for the method you are building.
12317    ///
12318    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12319    /// [`Scope::CloudPlatform`].
12320    ///
12321    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12322    /// tokens for more than one scope.
12323    ///
12324    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12325    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12326    /// sufficient, a read-write scope will do as well.
12327    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationVpcFlowLogsConfigListCall<'a, C>
12328    where
12329        St: AsRef<str>,
12330    {
12331        self._scopes.insert(String::from(scope.as_ref()));
12332        self
12333    }
12334    /// Identifies the authorization scope(s) for the method you are building.
12335    ///
12336    /// See [`Self::add_scope()`] for details.
12337    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationVpcFlowLogsConfigListCall<'a, C>
12338    where
12339        I: IntoIterator<Item = St>,
12340        St: AsRef<str>,
12341    {
12342        self._scopes
12343            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12344        self
12345    }
12346
12347    /// Removes all scopes, and no default scope will be used either.
12348    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12349    /// for details).
12350    pub fn clear_scopes(mut self) -> ProjectLocationVpcFlowLogsConfigListCall<'a, C> {
12351        self._scopes.clear();
12352        self
12353    }
12354}
12355
12356/// Updates an existing `VpcFlowLogsConfig`. If a configuration with the exact same settings already exists (even if the ID is different), the creation fails. Notes: 1. Updating a configuration with `state=DISABLED` will fail. 2. The following fields are not considered as settings for the purpose of the check mentioned above, therefore - updating another configuration with the same fields but different values for the following fields will fail as well: * name * create_time * update_time * labels * description
12357///
12358/// A builder for the *locations.vpcFlowLogsConfigs.patch* method supported by a *project* resource.
12359/// It is not used directly, but through a [`ProjectMethods`] instance.
12360///
12361/// # Example
12362///
12363/// Instantiate a resource method builder
12364///
12365/// ```test_harness,no_run
12366/// # extern crate hyper;
12367/// # extern crate hyper_rustls;
12368/// # extern crate google_networkmanagement1 as networkmanagement1;
12369/// use networkmanagement1::api::VpcFlowLogsConfig;
12370/// # async fn dox() {
12371/// # use networkmanagement1::{NetworkManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12372///
12373/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12374/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12375/// #     .with_native_roots()
12376/// #     .unwrap()
12377/// #     .https_only()
12378/// #     .enable_http2()
12379/// #     .build();
12380///
12381/// # let executor = hyper_util::rt::TokioExecutor::new();
12382/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12383/// #     secret,
12384/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12385/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12386/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12387/// #     ),
12388/// # ).build().await.unwrap();
12389///
12390/// # let client = hyper_util::client::legacy::Client::builder(
12391/// #     hyper_util::rt::TokioExecutor::new()
12392/// # )
12393/// # .build(
12394/// #     hyper_rustls::HttpsConnectorBuilder::new()
12395/// #         .with_native_roots()
12396/// #         .unwrap()
12397/// #         .https_or_http()
12398/// #         .enable_http2()
12399/// #         .build()
12400/// # );
12401/// # let mut hub = NetworkManagement::new(client, auth);
12402/// // As the method needs a request, you would usually fill it with the desired information
12403/// // into the respective structure. Some of the parts shown here might not be applicable !
12404/// // Values shown here are possibly random and not representative !
12405/// let mut req = VpcFlowLogsConfig::default();
12406///
12407/// // You can configure optional parameters by calling the respective setters at will, and
12408/// // execute the final call using `doit()`.
12409/// // Values shown here are possibly random and not representative !
12410/// let result = hub.projects().locations_vpc_flow_logs_configs_patch(req, "name")
12411///              .update_mask(FieldMask::new::<&str>(&[]))
12412///              .doit().await;
12413/// # }
12414/// ```
12415pub struct ProjectLocationVpcFlowLogsConfigPatchCall<'a, C>
12416where
12417    C: 'a,
12418{
12419    hub: &'a NetworkManagement<C>,
12420    _request: VpcFlowLogsConfig,
12421    _name: String,
12422    _update_mask: Option<common::FieldMask>,
12423    _delegate: Option<&'a mut dyn common::Delegate>,
12424    _additional_params: HashMap<String, String>,
12425    _scopes: BTreeSet<String>,
12426}
12427
12428impl<'a, C> common::CallBuilder for ProjectLocationVpcFlowLogsConfigPatchCall<'a, C> {}
12429
12430impl<'a, C> ProjectLocationVpcFlowLogsConfigPatchCall<'a, C>
12431where
12432    C: common::Connector,
12433{
12434    /// Perform the operation you have build so far.
12435    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
12436        use std::borrow::Cow;
12437        use std::io::{Read, Seek};
12438
12439        use common::{url::Params, ToParts};
12440        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12441
12442        let mut dd = common::DefaultDelegate;
12443        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12444        dlg.begin(common::MethodInfo {
12445            id: "networkmanagement.projects.locations.vpcFlowLogsConfigs.patch",
12446            http_method: hyper::Method::PATCH,
12447        });
12448
12449        for &field in ["alt", "name", "updateMask"].iter() {
12450            if self._additional_params.contains_key(field) {
12451                dlg.finished(false);
12452                return Err(common::Error::FieldClash(field));
12453            }
12454        }
12455
12456        let mut params = Params::with_capacity(5 + self._additional_params.len());
12457        params.push("name", self._name);
12458        if let Some(value) = self._update_mask.as_ref() {
12459            params.push("updateMask", value.to_string());
12460        }
12461
12462        params.extend(self._additional_params.iter());
12463
12464        params.push("alt", "json");
12465        let mut url = self.hub._base_url.clone() + "v1/{+name}";
12466        if self._scopes.is_empty() {
12467            self._scopes
12468                .insert(Scope::CloudPlatform.as_ref().to_string());
12469        }
12470
12471        #[allow(clippy::single_element_loop)]
12472        for &(find_this, param_name) in [("{+name}", "name")].iter() {
12473            url = params.uri_replacement(url, param_name, find_this, true);
12474        }
12475        {
12476            let to_remove = ["name"];
12477            params.remove_params(&to_remove);
12478        }
12479
12480        let url = params.parse_with_url(&url);
12481
12482        let mut json_mime_type = mime::APPLICATION_JSON;
12483        let mut request_value_reader = {
12484            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12485            common::remove_json_null_values(&mut value);
12486            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12487            serde_json::to_writer(&mut dst, &value).unwrap();
12488            dst
12489        };
12490        let request_size = request_value_reader
12491            .seek(std::io::SeekFrom::End(0))
12492            .unwrap();
12493        request_value_reader
12494            .seek(std::io::SeekFrom::Start(0))
12495            .unwrap();
12496
12497        loop {
12498            let token = match self
12499                .hub
12500                .auth
12501                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12502                .await
12503            {
12504                Ok(token) => token,
12505                Err(e) => match dlg.token(e) {
12506                    Ok(token) => token,
12507                    Err(e) => {
12508                        dlg.finished(false);
12509                        return Err(common::Error::MissingToken(e));
12510                    }
12511                },
12512            };
12513            request_value_reader
12514                .seek(std::io::SeekFrom::Start(0))
12515                .unwrap();
12516            let mut req_result = {
12517                let client = &self.hub.client;
12518                dlg.pre_request();
12519                let mut req_builder = hyper::Request::builder()
12520                    .method(hyper::Method::PATCH)
12521                    .uri(url.as_str())
12522                    .header(USER_AGENT, self.hub._user_agent.clone());
12523
12524                if let Some(token) = token.as_ref() {
12525                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12526                }
12527
12528                let request = req_builder
12529                    .header(CONTENT_TYPE, json_mime_type.to_string())
12530                    .header(CONTENT_LENGTH, request_size as u64)
12531                    .body(common::to_body(
12532                        request_value_reader.get_ref().clone().into(),
12533                    ));
12534
12535                client.request(request.unwrap()).await
12536            };
12537
12538            match req_result {
12539                Err(err) => {
12540                    if let common::Retry::After(d) = dlg.http_error(&err) {
12541                        sleep(d).await;
12542                        continue;
12543                    }
12544                    dlg.finished(false);
12545                    return Err(common::Error::HttpError(err));
12546                }
12547                Ok(res) => {
12548                    let (mut parts, body) = res.into_parts();
12549                    let mut body = common::Body::new(body);
12550                    if !parts.status.is_success() {
12551                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12552                        let error = serde_json::from_str(&common::to_string(&bytes));
12553                        let response = common::to_response(parts, bytes.into());
12554
12555                        if let common::Retry::After(d) =
12556                            dlg.http_failure(&response, error.as_ref().ok())
12557                        {
12558                            sleep(d).await;
12559                            continue;
12560                        }
12561
12562                        dlg.finished(false);
12563
12564                        return Err(match error {
12565                            Ok(value) => common::Error::BadRequest(value),
12566                            _ => common::Error::Failure(response),
12567                        });
12568                    }
12569                    let response = {
12570                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12571                        let encoded = common::to_string(&bytes);
12572                        match serde_json::from_str(&encoded) {
12573                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12574                            Err(error) => {
12575                                dlg.response_json_decode_error(&encoded, &error);
12576                                return Err(common::Error::JsonDecodeError(
12577                                    encoded.to_string(),
12578                                    error,
12579                                ));
12580                            }
12581                        }
12582                    };
12583
12584                    dlg.finished(true);
12585                    return Ok(response);
12586                }
12587            }
12588        }
12589    }
12590
12591    ///
12592    /// Sets the *request* property to the given value.
12593    ///
12594    /// Even though the property as already been set when instantiating this call,
12595    /// we provide this method for API completeness.
12596    pub fn request(
12597        mut self,
12598        new_value: VpcFlowLogsConfig,
12599    ) -> ProjectLocationVpcFlowLogsConfigPatchCall<'a, C> {
12600        self._request = new_value;
12601        self
12602    }
12603    /// Identifier. Unique name of the configuration. The name can have one of the following forms: - For project-level configurations: `projects/{project_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}` - For organization-level configurations: `organizations/{organization_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}`
12604    ///
12605    /// Sets the *name* path property to the given value.
12606    ///
12607    /// Even though the property as already been set when instantiating this call,
12608    /// we provide this method for API completeness.
12609    pub fn name(mut self, new_value: &str) -> ProjectLocationVpcFlowLogsConfigPatchCall<'a, C> {
12610        self._name = new_value.to_string();
12611        self
12612    }
12613    /// Required. Mask of fields to update. At least one path must be supplied in this field. For example, to change the state of the configuration to ENABLED, specify `update_mask` = `"state"`, and the `vpc_flow_logs_config` would be: `vpc_flow_logs_config = { name = "projects/my-project/locations/global/vpcFlowLogsConfigs/my-config" state = "ENABLED" }`
12614    ///
12615    /// Sets the *update mask* query property to the given value.
12616    pub fn update_mask(
12617        mut self,
12618        new_value: common::FieldMask,
12619    ) -> ProjectLocationVpcFlowLogsConfigPatchCall<'a, C> {
12620        self._update_mask = Some(new_value);
12621        self
12622    }
12623    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12624    /// while executing the actual API request.
12625    ///
12626    /// ````text
12627    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12628    /// ````
12629    ///
12630    /// Sets the *delegate* property to the given value.
12631    pub fn delegate(
12632        mut self,
12633        new_value: &'a mut dyn common::Delegate,
12634    ) -> ProjectLocationVpcFlowLogsConfigPatchCall<'a, C> {
12635        self._delegate = Some(new_value);
12636        self
12637    }
12638
12639    /// Set any additional parameter of the query string used in the request.
12640    /// It should be used to set parameters which are not yet available through their own
12641    /// setters.
12642    ///
12643    /// Please note that this method must not be used to set any of the known parameters
12644    /// which have their own setter method. If done anyway, the request will fail.
12645    ///
12646    /// # Additional Parameters
12647    ///
12648    /// * *$.xgafv* (query-string) - V1 error format.
12649    /// * *access_token* (query-string) - OAuth access token.
12650    /// * *alt* (query-string) - Data format for response.
12651    /// * *callback* (query-string) - JSONP
12652    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12653    /// * *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.
12654    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12655    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12656    /// * *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.
12657    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12658    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12659    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationVpcFlowLogsConfigPatchCall<'a, C>
12660    where
12661        T: AsRef<str>,
12662    {
12663        self._additional_params
12664            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12665        self
12666    }
12667
12668    /// Identifies the authorization scope for the method you are building.
12669    ///
12670    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12671    /// [`Scope::CloudPlatform`].
12672    ///
12673    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12674    /// tokens for more than one scope.
12675    ///
12676    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12677    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12678    /// sufficient, a read-write scope will do as well.
12679    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationVpcFlowLogsConfigPatchCall<'a, C>
12680    where
12681        St: AsRef<str>,
12682    {
12683        self._scopes.insert(String::from(scope.as_ref()));
12684        self
12685    }
12686    /// Identifies the authorization scope(s) for the method you are building.
12687    ///
12688    /// See [`Self::add_scope()`] for details.
12689    pub fn add_scopes<I, St>(
12690        mut self,
12691        scopes: I,
12692    ) -> ProjectLocationVpcFlowLogsConfigPatchCall<'a, C>
12693    where
12694        I: IntoIterator<Item = St>,
12695        St: AsRef<str>,
12696    {
12697        self._scopes
12698            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12699        self
12700    }
12701
12702    /// Removes all scopes, and no default scope will be used either.
12703    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12704    /// for details).
12705    pub fn clear_scopes(mut self) -> ProjectLocationVpcFlowLogsConfigPatchCall<'a, C> {
12706        self._scopes.clear();
12707        self
12708    }
12709}
12710
12711/// QueryOrgVpcFlowLogsConfigs returns a list of all organization-level VPC Flow Logs configurations applicable to the specified project.
12712///
12713/// A builder for the *locations.vpcFlowLogsConfigs.queryOrgVpcFlowLogsConfigs* method supported by a *project* resource.
12714/// It is not used directly, but through a [`ProjectMethods`] instance.
12715///
12716/// # Example
12717///
12718/// Instantiate a resource method builder
12719///
12720/// ```test_harness,no_run
12721/// # extern crate hyper;
12722/// # extern crate hyper_rustls;
12723/// # extern crate google_networkmanagement1 as networkmanagement1;
12724/// # async fn dox() {
12725/// # use networkmanagement1::{NetworkManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12726///
12727/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12728/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12729/// #     .with_native_roots()
12730/// #     .unwrap()
12731/// #     .https_only()
12732/// #     .enable_http2()
12733/// #     .build();
12734///
12735/// # let executor = hyper_util::rt::TokioExecutor::new();
12736/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12737/// #     secret,
12738/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12739/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12740/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12741/// #     ),
12742/// # ).build().await.unwrap();
12743///
12744/// # let client = hyper_util::client::legacy::Client::builder(
12745/// #     hyper_util::rt::TokioExecutor::new()
12746/// # )
12747/// # .build(
12748/// #     hyper_rustls::HttpsConnectorBuilder::new()
12749/// #         .with_native_roots()
12750/// #         .unwrap()
12751/// #         .https_or_http()
12752/// #         .enable_http2()
12753/// #         .build()
12754/// # );
12755/// # let mut hub = NetworkManagement::new(client, auth);
12756/// // You can configure optional parameters by calling the respective setters at will, and
12757/// // execute the final call using `doit()`.
12758/// // Values shown here are possibly random and not representative !
12759/// let result = hub.projects().locations_vpc_flow_logs_configs_query_org_vpc_flow_logs_configs("parent")
12760///              .page_token("vero")
12761///              .page_size(-76)
12762///              .filter("invidunt")
12763///              .doit().await;
12764/// # }
12765/// ```
12766pub struct ProjectLocationVpcFlowLogsConfigQueryOrgVpcFlowLogsConfigCall<'a, C>
12767where
12768    C: 'a,
12769{
12770    hub: &'a NetworkManagement<C>,
12771    _parent: String,
12772    _page_token: Option<String>,
12773    _page_size: Option<i32>,
12774    _filter: Option<String>,
12775    _delegate: Option<&'a mut dyn common::Delegate>,
12776    _additional_params: HashMap<String, String>,
12777    _scopes: BTreeSet<String>,
12778}
12779
12780impl<'a, C> common::CallBuilder
12781    for ProjectLocationVpcFlowLogsConfigQueryOrgVpcFlowLogsConfigCall<'a, C>
12782{
12783}
12784
12785impl<'a, C> ProjectLocationVpcFlowLogsConfigQueryOrgVpcFlowLogsConfigCall<'a, C>
12786where
12787    C: common::Connector,
12788{
12789    /// Perform the operation you have build so far.
12790    pub async fn doit(
12791        mut self,
12792    ) -> common::Result<(common::Response, QueryOrgVpcFlowLogsConfigsResponse)> {
12793        use std::borrow::Cow;
12794        use std::io::{Read, Seek};
12795
12796        use common::{url::Params, ToParts};
12797        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12798
12799        let mut dd = common::DefaultDelegate;
12800        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12801        dlg.begin(common::MethodInfo { id: "networkmanagement.projects.locations.vpcFlowLogsConfigs.queryOrgVpcFlowLogsConfigs",
12802                               http_method: hyper::Method::GET });
12803
12804        for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
12805            if self._additional_params.contains_key(field) {
12806                dlg.finished(false);
12807                return Err(common::Error::FieldClash(field));
12808            }
12809        }
12810
12811        let mut params = Params::with_capacity(6 + self._additional_params.len());
12812        params.push("parent", self._parent);
12813        if let Some(value) = self._page_token.as_ref() {
12814            params.push("pageToken", value);
12815        }
12816        if let Some(value) = self._page_size.as_ref() {
12817            params.push("pageSize", value.to_string());
12818        }
12819        if let Some(value) = self._filter.as_ref() {
12820            params.push("filter", value);
12821        }
12822
12823        params.extend(self._additional_params.iter());
12824
12825        params.push("alt", "json");
12826        let mut url = self.hub._base_url.clone()
12827            + "v1/{+parent}/vpcFlowLogsConfigs:queryOrgVpcFlowLogsConfigs";
12828        if self._scopes.is_empty() {
12829            self._scopes
12830                .insert(Scope::CloudPlatform.as_ref().to_string());
12831        }
12832
12833        #[allow(clippy::single_element_loop)]
12834        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
12835            url = params.uri_replacement(url, param_name, find_this, true);
12836        }
12837        {
12838            let to_remove = ["parent"];
12839            params.remove_params(&to_remove);
12840        }
12841
12842        let url = params.parse_with_url(&url);
12843
12844        loop {
12845            let token = match self
12846                .hub
12847                .auth
12848                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12849                .await
12850            {
12851                Ok(token) => token,
12852                Err(e) => match dlg.token(e) {
12853                    Ok(token) => token,
12854                    Err(e) => {
12855                        dlg.finished(false);
12856                        return Err(common::Error::MissingToken(e));
12857                    }
12858                },
12859            };
12860            let mut req_result = {
12861                let client = &self.hub.client;
12862                dlg.pre_request();
12863                let mut req_builder = hyper::Request::builder()
12864                    .method(hyper::Method::GET)
12865                    .uri(url.as_str())
12866                    .header(USER_AGENT, self.hub._user_agent.clone());
12867
12868                if let Some(token) = token.as_ref() {
12869                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12870                }
12871
12872                let request = req_builder
12873                    .header(CONTENT_LENGTH, 0_u64)
12874                    .body(common::to_body::<String>(None));
12875
12876                client.request(request.unwrap()).await
12877            };
12878
12879            match req_result {
12880                Err(err) => {
12881                    if let common::Retry::After(d) = dlg.http_error(&err) {
12882                        sleep(d).await;
12883                        continue;
12884                    }
12885                    dlg.finished(false);
12886                    return Err(common::Error::HttpError(err));
12887                }
12888                Ok(res) => {
12889                    let (mut parts, body) = res.into_parts();
12890                    let mut body = common::Body::new(body);
12891                    if !parts.status.is_success() {
12892                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12893                        let error = serde_json::from_str(&common::to_string(&bytes));
12894                        let response = common::to_response(parts, bytes.into());
12895
12896                        if let common::Retry::After(d) =
12897                            dlg.http_failure(&response, error.as_ref().ok())
12898                        {
12899                            sleep(d).await;
12900                            continue;
12901                        }
12902
12903                        dlg.finished(false);
12904
12905                        return Err(match error {
12906                            Ok(value) => common::Error::BadRequest(value),
12907                            _ => common::Error::Failure(response),
12908                        });
12909                    }
12910                    let response = {
12911                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12912                        let encoded = common::to_string(&bytes);
12913                        match serde_json::from_str(&encoded) {
12914                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12915                            Err(error) => {
12916                                dlg.response_json_decode_error(&encoded, &error);
12917                                return Err(common::Error::JsonDecodeError(
12918                                    encoded.to_string(),
12919                                    error,
12920                                ));
12921                            }
12922                        }
12923                    };
12924
12925                    dlg.finished(true);
12926                    return Ok(response);
12927                }
12928            }
12929        }
12930    }
12931
12932    /// Required. The parent resource of the VpcFlowLogsConfig, specified in the following format: `projects/{project_id}/locations/global`
12933    ///
12934    /// Sets the *parent* path property to the given value.
12935    ///
12936    /// Even though the property as already been set when instantiating this call,
12937    /// we provide this method for API completeness.
12938    pub fn parent(
12939        mut self,
12940        new_value: &str,
12941    ) -> ProjectLocationVpcFlowLogsConfigQueryOrgVpcFlowLogsConfigCall<'a, C> {
12942        self._parent = new_value.to_string();
12943        self
12944    }
12945    /// Optional. Page token from an earlier query, as returned in `next_page_token`.
12946    ///
12947    /// Sets the *page token* query property to the given value.
12948    pub fn page_token(
12949        mut self,
12950        new_value: &str,
12951    ) -> ProjectLocationVpcFlowLogsConfigQueryOrgVpcFlowLogsConfigCall<'a, C> {
12952        self._page_token = Some(new_value.to_string());
12953        self
12954    }
12955    /// Optional. Number of `VpcFlowLogsConfigs` to return.
12956    ///
12957    /// Sets the *page size* query property to the given value.
12958    pub fn page_size(
12959        mut self,
12960        new_value: i32,
12961    ) -> ProjectLocationVpcFlowLogsConfigQueryOrgVpcFlowLogsConfigCall<'a, C> {
12962        self._page_size = Some(new_value);
12963        self
12964    }
12965    /// Optional. Lists the `VpcFlowLogsConfigs` that match the filter expression. A filter expression must use the supported [CEL logic operators] (https://cloud.google.com/vpc/docs/about-flow-logs-records#supported_cel_logic_operators).
12966    ///
12967    /// Sets the *filter* query property to the given value.
12968    pub fn filter(
12969        mut self,
12970        new_value: &str,
12971    ) -> ProjectLocationVpcFlowLogsConfigQueryOrgVpcFlowLogsConfigCall<'a, C> {
12972        self._filter = Some(new_value.to_string());
12973        self
12974    }
12975    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12976    /// while executing the actual API request.
12977    ///
12978    /// ````text
12979    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12980    /// ````
12981    ///
12982    /// Sets the *delegate* property to the given value.
12983    pub fn delegate(
12984        mut self,
12985        new_value: &'a mut dyn common::Delegate,
12986    ) -> ProjectLocationVpcFlowLogsConfigQueryOrgVpcFlowLogsConfigCall<'a, C> {
12987        self._delegate = Some(new_value);
12988        self
12989    }
12990
12991    /// Set any additional parameter of the query string used in the request.
12992    /// It should be used to set parameters which are not yet available through their own
12993    /// setters.
12994    ///
12995    /// Please note that this method must not be used to set any of the known parameters
12996    /// which have their own setter method. If done anyway, the request will fail.
12997    ///
12998    /// # Additional Parameters
12999    ///
13000    /// * *$.xgafv* (query-string) - V1 error format.
13001    /// * *access_token* (query-string) - OAuth access token.
13002    /// * *alt* (query-string) - Data format for response.
13003    /// * *callback* (query-string) - JSONP
13004    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13005    /// * *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.
13006    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13007    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13008    /// * *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.
13009    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13010    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13011    pub fn param<T>(
13012        mut self,
13013        name: T,
13014        value: T,
13015    ) -> ProjectLocationVpcFlowLogsConfigQueryOrgVpcFlowLogsConfigCall<'a, C>
13016    where
13017        T: AsRef<str>,
13018    {
13019        self._additional_params
13020            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13021        self
13022    }
13023
13024    /// Identifies the authorization scope for the method you are building.
13025    ///
13026    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13027    /// [`Scope::CloudPlatform`].
13028    ///
13029    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13030    /// tokens for more than one scope.
13031    ///
13032    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13033    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13034    /// sufficient, a read-write scope will do as well.
13035    pub fn add_scope<St>(
13036        mut self,
13037        scope: St,
13038    ) -> ProjectLocationVpcFlowLogsConfigQueryOrgVpcFlowLogsConfigCall<'a, C>
13039    where
13040        St: AsRef<str>,
13041    {
13042        self._scopes.insert(String::from(scope.as_ref()));
13043        self
13044    }
13045    /// Identifies the authorization scope(s) for the method you are building.
13046    ///
13047    /// See [`Self::add_scope()`] for details.
13048    pub fn add_scopes<I, St>(
13049        mut self,
13050        scopes: I,
13051    ) -> ProjectLocationVpcFlowLogsConfigQueryOrgVpcFlowLogsConfigCall<'a, C>
13052    where
13053        I: IntoIterator<Item = St>,
13054        St: AsRef<str>,
13055    {
13056        self._scopes
13057            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13058        self
13059    }
13060
13061    /// Removes all scopes, and no default scope will be used either.
13062    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13063    /// for details).
13064    pub fn clear_scopes(
13065        mut self,
13066    ) -> ProjectLocationVpcFlowLogsConfigQueryOrgVpcFlowLogsConfigCall<'a, C> {
13067        self._scopes.clear();
13068        self
13069    }
13070}
13071
13072/// ShowEffectiveFlowLogsConfigs returns a list of all VPC Flow Logs configurations applicable to a specified resource.
13073///
13074/// A builder for the *locations.vpcFlowLogsConfigs.showEffectiveFlowLogsConfigs* method supported by a *project* resource.
13075/// It is not used directly, but through a [`ProjectMethods`] instance.
13076///
13077/// # Example
13078///
13079/// Instantiate a resource method builder
13080///
13081/// ```test_harness,no_run
13082/// # extern crate hyper;
13083/// # extern crate hyper_rustls;
13084/// # extern crate google_networkmanagement1 as networkmanagement1;
13085/// # async fn dox() {
13086/// # use networkmanagement1::{NetworkManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13087///
13088/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13089/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13090/// #     .with_native_roots()
13091/// #     .unwrap()
13092/// #     .https_only()
13093/// #     .enable_http2()
13094/// #     .build();
13095///
13096/// # let executor = hyper_util::rt::TokioExecutor::new();
13097/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13098/// #     secret,
13099/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13100/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13101/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13102/// #     ),
13103/// # ).build().await.unwrap();
13104///
13105/// # let client = hyper_util::client::legacy::Client::builder(
13106/// #     hyper_util::rt::TokioExecutor::new()
13107/// # )
13108/// # .build(
13109/// #     hyper_rustls::HttpsConnectorBuilder::new()
13110/// #         .with_native_roots()
13111/// #         .unwrap()
13112/// #         .https_or_http()
13113/// #         .enable_http2()
13114/// #         .build()
13115/// # );
13116/// # let mut hub = NetworkManagement::new(client, auth);
13117/// // You can configure optional parameters by calling the respective setters at will, and
13118/// // execute the final call using `doit()`.
13119/// // Values shown here are possibly random and not representative !
13120/// let result = hub.projects().locations_vpc_flow_logs_configs_show_effective_flow_logs_configs("parent")
13121///              .resource("vero")
13122///              .page_token("elitr")
13123///              .page_size(-6)
13124///              .filter("diam")
13125///              .doit().await;
13126/// # }
13127/// ```
13128pub struct ProjectLocationVpcFlowLogsConfigShowEffectiveFlowLogsConfigCall<'a, C>
13129where
13130    C: 'a,
13131{
13132    hub: &'a NetworkManagement<C>,
13133    _parent: String,
13134    _resource: Option<String>,
13135    _page_token: Option<String>,
13136    _page_size: Option<i32>,
13137    _filter: Option<String>,
13138    _delegate: Option<&'a mut dyn common::Delegate>,
13139    _additional_params: HashMap<String, String>,
13140    _scopes: BTreeSet<String>,
13141}
13142
13143impl<'a, C> common::CallBuilder
13144    for ProjectLocationVpcFlowLogsConfigShowEffectiveFlowLogsConfigCall<'a, C>
13145{
13146}
13147
13148impl<'a, C> ProjectLocationVpcFlowLogsConfigShowEffectiveFlowLogsConfigCall<'a, C>
13149where
13150    C: common::Connector,
13151{
13152    /// Perform the operation you have build so far.
13153    pub async fn doit(
13154        mut self,
13155    ) -> common::Result<(common::Response, ShowEffectiveFlowLogsConfigsResponse)> {
13156        use std::borrow::Cow;
13157        use std::io::{Read, Seek};
13158
13159        use common::{url::Params, ToParts};
13160        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13161
13162        let mut dd = common::DefaultDelegate;
13163        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13164        dlg.begin(common::MethodInfo { id: "networkmanagement.projects.locations.vpcFlowLogsConfigs.showEffectiveFlowLogsConfigs",
13165                               http_method: hyper::Method::GET });
13166
13167        for &field in [
13168            "alt",
13169            "parent",
13170            "resource",
13171            "pageToken",
13172            "pageSize",
13173            "filter",
13174        ]
13175        .iter()
13176        {
13177            if self._additional_params.contains_key(field) {
13178                dlg.finished(false);
13179                return Err(common::Error::FieldClash(field));
13180            }
13181        }
13182
13183        let mut params = Params::with_capacity(7 + self._additional_params.len());
13184        params.push("parent", self._parent);
13185        if let Some(value) = self._resource.as_ref() {
13186            params.push("resource", value);
13187        }
13188        if let Some(value) = self._page_token.as_ref() {
13189            params.push("pageToken", value);
13190        }
13191        if let Some(value) = self._page_size.as_ref() {
13192            params.push("pageSize", value.to_string());
13193        }
13194        if let Some(value) = self._filter.as_ref() {
13195            params.push("filter", value);
13196        }
13197
13198        params.extend(self._additional_params.iter());
13199
13200        params.push("alt", "json");
13201        let mut url = self.hub._base_url.clone()
13202            + "v1/{+parent}/vpcFlowLogsConfigs:showEffectiveFlowLogsConfigs";
13203        if self._scopes.is_empty() {
13204            self._scopes
13205                .insert(Scope::CloudPlatform.as_ref().to_string());
13206        }
13207
13208        #[allow(clippy::single_element_loop)]
13209        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
13210            url = params.uri_replacement(url, param_name, find_this, true);
13211        }
13212        {
13213            let to_remove = ["parent"];
13214            params.remove_params(&to_remove);
13215        }
13216
13217        let url = params.parse_with_url(&url);
13218
13219        loop {
13220            let token = match self
13221                .hub
13222                .auth
13223                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13224                .await
13225            {
13226                Ok(token) => token,
13227                Err(e) => match dlg.token(e) {
13228                    Ok(token) => token,
13229                    Err(e) => {
13230                        dlg.finished(false);
13231                        return Err(common::Error::MissingToken(e));
13232                    }
13233                },
13234            };
13235            let mut req_result = {
13236                let client = &self.hub.client;
13237                dlg.pre_request();
13238                let mut req_builder = hyper::Request::builder()
13239                    .method(hyper::Method::GET)
13240                    .uri(url.as_str())
13241                    .header(USER_AGENT, self.hub._user_agent.clone());
13242
13243                if let Some(token) = token.as_ref() {
13244                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13245                }
13246
13247                let request = req_builder
13248                    .header(CONTENT_LENGTH, 0_u64)
13249                    .body(common::to_body::<String>(None));
13250
13251                client.request(request.unwrap()).await
13252            };
13253
13254            match req_result {
13255                Err(err) => {
13256                    if let common::Retry::After(d) = dlg.http_error(&err) {
13257                        sleep(d).await;
13258                        continue;
13259                    }
13260                    dlg.finished(false);
13261                    return Err(common::Error::HttpError(err));
13262                }
13263                Ok(res) => {
13264                    let (mut parts, body) = res.into_parts();
13265                    let mut body = common::Body::new(body);
13266                    if !parts.status.is_success() {
13267                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13268                        let error = serde_json::from_str(&common::to_string(&bytes));
13269                        let response = common::to_response(parts, bytes.into());
13270
13271                        if let common::Retry::After(d) =
13272                            dlg.http_failure(&response, error.as_ref().ok())
13273                        {
13274                            sleep(d).await;
13275                            continue;
13276                        }
13277
13278                        dlg.finished(false);
13279
13280                        return Err(match error {
13281                            Ok(value) => common::Error::BadRequest(value),
13282                            _ => common::Error::Failure(response),
13283                        });
13284                    }
13285                    let response = {
13286                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13287                        let encoded = common::to_string(&bytes);
13288                        match serde_json::from_str(&encoded) {
13289                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13290                            Err(error) => {
13291                                dlg.response_json_decode_error(&encoded, &error);
13292                                return Err(common::Error::JsonDecodeError(
13293                                    encoded.to_string(),
13294                                    error,
13295                                ));
13296                            }
13297                        }
13298                    };
13299
13300                    dlg.finished(true);
13301                    return Ok(response);
13302                }
13303            }
13304        }
13305    }
13306
13307    /// Required. The parent resource of the VpcFlowLogsConfig, specified in the following format: `projects/{project_id}/locations/global`
13308    ///
13309    /// Sets the *parent* path property to the given value.
13310    ///
13311    /// Even though the property as already been set when instantiating this call,
13312    /// we provide this method for API completeness.
13313    pub fn parent(
13314        mut self,
13315        new_value: &str,
13316    ) -> ProjectLocationVpcFlowLogsConfigShowEffectiveFlowLogsConfigCall<'a, C> {
13317        self._parent = new_value.to_string();
13318        self
13319    }
13320    /// Required. The resource to get the effective VPC Flow Logs configuration for. The resource must belong to the same project as the parent. The resource must be a network, subnetwork, interconnect attachment, VPN tunnel, or a project.
13321    ///
13322    /// Sets the *resource* query property to the given value.
13323    pub fn resource(
13324        mut self,
13325        new_value: &str,
13326    ) -> ProjectLocationVpcFlowLogsConfigShowEffectiveFlowLogsConfigCall<'a, C> {
13327        self._resource = Some(new_value.to_string());
13328        self
13329    }
13330    /// Optional. Page token from an earlier query, as returned in `next_page_token`.
13331    ///
13332    /// Sets the *page token* query property to the given value.
13333    pub fn page_token(
13334        mut self,
13335        new_value: &str,
13336    ) -> ProjectLocationVpcFlowLogsConfigShowEffectiveFlowLogsConfigCall<'a, C> {
13337        self._page_token = Some(new_value.to_string());
13338        self
13339    }
13340    /// Optional. Number of `EffectiveVpcFlowLogsConfigs` to return. Default is 30.
13341    ///
13342    /// Sets the *page size* query property to the given value.
13343    pub fn page_size(
13344        mut self,
13345        new_value: i32,
13346    ) -> ProjectLocationVpcFlowLogsConfigShowEffectiveFlowLogsConfigCall<'a, C> {
13347        self._page_size = Some(new_value);
13348        self
13349    }
13350    /// Optional. Lists the `EffectiveVpcFlowLogsConfigs` that match the filter expression. A filter expression must use the supported [CEL logic operators] (https://cloud.google.com/vpc/docs/about-flow-logs-records#supported_cel_logic_operators).
13351    ///
13352    /// Sets the *filter* query property to the given value.
13353    pub fn filter(
13354        mut self,
13355        new_value: &str,
13356    ) -> ProjectLocationVpcFlowLogsConfigShowEffectiveFlowLogsConfigCall<'a, C> {
13357        self._filter = Some(new_value.to_string());
13358        self
13359    }
13360    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13361    /// while executing the actual API request.
13362    ///
13363    /// ````text
13364    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13365    /// ````
13366    ///
13367    /// Sets the *delegate* property to the given value.
13368    pub fn delegate(
13369        mut self,
13370        new_value: &'a mut dyn common::Delegate,
13371    ) -> ProjectLocationVpcFlowLogsConfigShowEffectiveFlowLogsConfigCall<'a, C> {
13372        self._delegate = Some(new_value);
13373        self
13374    }
13375
13376    /// Set any additional parameter of the query string used in the request.
13377    /// It should be used to set parameters which are not yet available through their own
13378    /// setters.
13379    ///
13380    /// Please note that this method must not be used to set any of the known parameters
13381    /// which have their own setter method. If done anyway, the request will fail.
13382    ///
13383    /// # Additional Parameters
13384    ///
13385    /// * *$.xgafv* (query-string) - V1 error format.
13386    /// * *access_token* (query-string) - OAuth access token.
13387    /// * *alt* (query-string) - Data format for response.
13388    /// * *callback* (query-string) - JSONP
13389    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13390    /// * *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.
13391    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13392    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13393    /// * *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.
13394    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13395    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13396    pub fn param<T>(
13397        mut self,
13398        name: T,
13399        value: T,
13400    ) -> ProjectLocationVpcFlowLogsConfigShowEffectiveFlowLogsConfigCall<'a, C>
13401    where
13402        T: AsRef<str>,
13403    {
13404        self._additional_params
13405            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13406        self
13407    }
13408
13409    /// Identifies the authorization scope for the method you are building.
13410    ///
13411    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13412    /// [`Scope::CloudPlatform`].
13413    ///
13414    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13415    /// tokens for more than one scope.
13416    ///
13417    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13418    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13419    /// sufficient, a read-write scope will do as well.
13420    pub fn add_scope<St>(
13421        mut self,
13422        scope: St,
13423    ) -> ProjectLocationVpcFlowLogsConfigShowEffectiveFlowLogsConfigCall<'a, C>
13424    where
13425        St: AsRef<str>,
13426    {
13427        self._scopes.insert(String::from(scope.as_ref()));
13428        self
13429    }
13430    /// Identifies the authorization scope(s) for the method you are building.
13431    ///
13432    /// See [`Self::add_scope()`] for details.
13433    pub fn add_scopes<I, St>(
13434        mut self,
13435        scopes: I,
13436    ) -> ProjectLocationVpcFlowLogsConfigShowEffectiveFlowLogsConfigCall<'a, C>
13437    where
13438        I: IntoIterator<Item = St>,
13439        St: AsRef<str>,
13440    {
13441        self._scopes
13442            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13443        self
13444    }
13445
13446    /// Removes all scopes, and no default scope will be used either.
13447    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13448    /// for details).
13449    pub fn clear_scopes(
13450        mut self,
13451    ) -> ProjectLocationVpcFlowLogsConfigShowEffectiveFlowLogsConfigCall<'a, C> {
13452        self._scopes.clear();
13453        self
13454    }
13455}
13456
13457/// Gets information about a location.
13458///
13459/// A builder for the *locations.get* method supported by a *project* resource.
13460/// It is not used directly, but through a [`ProjectMethods`] instance.
13461///
13462/// # Example
13463///
13464/// Instantiate a resource method builder
13465///
13466/// ```test_harness,no_run
13467/// # extern crate hyper;
13468/// # extern crate hyper_rustls;
13469/// # extern crate google_networkmanagement1 as networkmanagement1;
13470/// # async fn dox() {
13471/// # use networkmanagement1::{NetworkManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13472///
13473/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13474/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13475/// #     .with_native_roots()
13476/// #     .unwrap()
13477/// #     .https_only()
13478/// #     .enable_http2()
13479/// #     .build();
13480///
13481/// # let executor = hyper_util::rt::TokioExecutor::new();
13482/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13483/// #     secret,
13484/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13485/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13486/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13487/// #     ),
13488/// # ).build().await.unwrap();
13489///
13490/// # let client = hyper_util::client::legacy::Client::builder(
13491/// #     hyper_util::rt::TokioExecutor::new()
13492/// # )
13493/// # .build(
13494/// #     hyper_rustls::HttpsConnectorBuilder::new()
13495/// #         .with_native_roots()
13496/// #         .unwrap()
13497/// #         .https_or_http()
13498/// #         .enable_http2()
13499/// #         .build()
13500/// # );
13501/// # let mut hub = NetworkManagement::new(client, auth);
13502/// // You can configure optional parameters by calling the respective setters at will, and
13503/// // execute the final call using `doit()`.
13504/// // Values shown here are possibly random and not representative !
13505/// let result = hub.projects().locations_get("name")
13506///              .doit().await;
13507/// # }
13508/// ```
13509pub struct ProjectLocationGetCall<'a, C>
13510where
13511    C: 'a,
13512{
13513    hub: &'a NetworkManagement<C>,
13514    _name: String,
13515    _delegate: Option<&'a mut dyn common::Delegate>,
13516    _additional_params: HashMap<String, String>,
13517    _scopes: BTreeSet<String>,
13518}
13519
13520impl<'a, C> common::CallBuilder for ProjectLocationGetCall<'a, C> {}
13521
13522impl<'a, C> ProjectLocationGetCall<'a, C>
13523where
13524    C: common::Connector,
13525{
13526    /// Perform the operation you have build so far.
13527    pub async fn doit(mut self) -> common::Result<(common::Response, Location)> {
13528        use std::borrow::Cow;
13529        use std::io::{Read, Seek};
13530
13531        use common::{url::Params, ToParts};
13532        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13533
13534        let mut dd = common::DefaultDelegate;
13535        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13536        dlg.begin(common::MethodInfo {
13537            id: "networkmanagement.projects.locations.get",
13538            http_method: hyper::Method::GET,
13539        });
13540
13541        for &field in ["alt", "name"].iter() {
13542            if self._additional_params.contains_key(field) {
13543                dlg.finished(false);
13544                return Err(common::Error::FieldClash(field));
13545            }
13546        }
13547
13548        let mut params = Params::with_capacity(3 + self._additional_params.len());
13549        params.push("name", self._name);
13550
13551        params.extend(self._additional_params.iter());
13552
13553        params.push("alt", "json");
13554        let mut url = self.hub._base_url.clone() + "v1/{+name}";
13555        if self._scopes.is_empty() {
13556            self._scopes
13557                .insert(Scope::CloudPlatform.as_ref().to_string());
13558        }
13559
13560        #[allow(clippy::single_element_loop)]
13561        for &(find_this, param_name) in [("{+name}", "name")].iter() {
13562            url = params.uri_replacement(url, param_name, find_this, true);
13563        }
13564        {
13565            let to_remove = ["name"];
13566            params.remove_params(&to_remove);
13567        }
13568
13569        let url = params.parse_with_url(&url);
13570
13571        loop {
13572            let token = match self
13573                .hub
13574                .auth
13575                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13576                .await
13577            {
13578                Ok(token) => token,
13579                Err(e) => match dlg.token(e) {
13580                    Ok(token) => token,
13581                    Err(e) => {
13582                        dlg.finished(false);
13583                        return Err(common::Error::MissingToken(e));
13584                    }
13585                },
13586            };
13587            let mut req_result = {
13588                let client = &self.hub.client;
13589                dlg.pre_request();
13590                let mut req_builder = hyper::Request::builder()
13591                    .method(hyper::Method::GET)
13592                    .uri(url.as_str())
13593                    .header(USER_AGENT, self.hub._user_agent.clone());
13594
13595                if let Some(token) = token.as_ref() {
13596                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13597                }
13598
13599                let request = req_builder
13600                    .header(CONTENT_LENGTH, 0_u64)
13601                    .body(common::to_body::<String>(None));
13602
13603                client.request(request.unwrap()).await
13604            };
13605
13606            match req_result {
13607                Err(err) => {
13608                    if let common::Retry::After(d) = dlg.http_error(&err) {
13609                        sleep(d).await;
13610                        continue;
13611                    }
13612                    dlg.finished(false);
13613                    return Err(common::Error::HttpError(err));
13614                }
13615                Ok(res) => {
13616                    let (mut parts, body) = res.into_parts();
13617                    let mut body = common::Body::new(body);
13618                    if !parts.status.is_success() {
13619                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13620                        let error = serde_json::from_str(&common::to_string(&bytes));
13621                        let response = common::to_response(parts, bytes.into());
13622
13623                        if let common::Retry::After(d) =
13624                            dlg.http_failure(&response, error.as_ref().ok())
13625                        {
13626                            sleep(d).await;
13627                            continue;
13628                        }
13629
13630                        dlg.finished(false);
13631
13632                        return Err(match error {
13633                            Ok(value) => common::Error::BadRequest(value),
13634                            _ => common::Error::Failure(response),
13635                        });
13636                    }
13637                    let response = {
13638                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13639                        let encoded = common::to_string(&bytes);
13640                        match serde_json::from_str(&encoded) {
13641                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13642                            Err(error) => {
13643                                dlg.response_json_decode_error(&encoded, &error);
13644                                return Err(common::Error::JsonDecodeError(
13645                                    encoded.to_string(),
13646                                    error,
13647                                ));
13648                            }
13649                        }
13650                    };
13651
13652                    dlg.finished(true);
13653                    return Ok(response);
13654                }
13655            }
13656        }
13657    }
13658
13659    /// Resource name for the location.
13660    ///
13661    /// Sets the *name* path property to the given value.
13662    ///
13663    /// Even though the property as already been set when instantiating this call,
13664    /// we provide this method for API completeness.
13665    pub fn name(mut self, new_value: &str) -> ProjectLocationGetCall<'a, C> {
13666        self._name = new_value.to_string();
13667        self
13668    }
13669    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13670    /// while executing the actual API request.
13671    ///
13672    /// ````text
13673    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13674    /// ````
13675    ///
13676    /// Sets the *delegate* property to the given value.
13677    pub fn delegate(
13678        mut self,
13679        new_value: &'a mut dyn common::Delegate,
13680    ) -> ProjectLocationGetCall<'a, C> {
13681        self._delegate = Some(new_value);
13682        self
13683    }
13684
13685    /// Set any additional parameter of the query string used in the request.
13686    /// It should be used to set parameters which are not yet available through their own
13687    /// setters.
13688    ///
13689    /// Please note that this method must not be used to set any of the known parameters
13690    /// which have their own setter method. If done anyway, the request will fail.
13691    ///
13692    /// # Additional Parameters
13693    ///
13694    /// * *$.xgafv* (query-string) - V1 error format.
13695    /// * *access_token* (query-string) - OAuth access token.
13696    /// * *alt* (query-string) - Data format for response.
13697    /// * *callback* (query-string) - JSONP
13698    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13699    /// * *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.
13700    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13701    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13702    /// * *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.
13703    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13704    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13705    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C>
13706    where
13707        T: AsRef<str>,
13708    {
13709        self._additional_params
13710            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13711        self
13712    }
13713
13714    /// Identifies the authorization scope for the method you are building.
13715    ///
13716    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13717    /// [`Scope::CloudPlatform`].
13718    ///
13719    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13720    /// tokens for more than one scope.
13721    ///
13722    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13723    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13724    /// sufficient, a read-write scope will do as well.
13725    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetCall<'a, C>
13726    where
13727        St: AsRef<str>,
13728    {
13729        self._scopes.insert(String::from(scope.as_ref()));
13730        self
13731    }
13732    /// Identifies the authorization scope(s) for the method you are building.
13733    ///
13734    /// See [`Self::add_scope()`] for details.
13735    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetCall<'a, C>
13736    where
13737        I: IntoIterator<Item = St>,
13738        St: AsRef<str>,
13739    {
13740        self._scopes
13741            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13742        self
13743    }
13744
13745    /// Removes all scopes, and no default scope will be used either.
13746    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13747    /// for details).
13748    pub fn clear_scopes(mut self) -> ProjectLocationGetCall<'a, C> {
13749        self._scopes.clear();
13750        self
13751    }
13752}
13753
13754/// Lists information about the supported locations for this service.
13755///
13756/// A builder for the *locations.list* method supported by a *project* resource.
13757/// It is not used directly, but through a [`ProjectMethods`] instance.
13758///
13759/// # Example
13760///
13761/// Instantiate a resource method builder
13762///
13763/// ```test_harness,no_run
13764/// # extern crate hyper;
13765/// # extern crate hyper_rustls;
13766/// # extern crate google_networkmanagement1 as networkmanagement1;
13767/// # async fn dox() {
13768/// # use networkmanagement1::{NetworkManagement, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13769///
13770/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13771/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13772/// #     .with_native_roots()
13773/// #     .unwrap()
13774/// #     .https_only()
13775/// #     .enable_http2()
13776/// #     .build();
13777///
13778/// # let executor = hyper_util::rt::TokioExecutor::new();
13779/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13780/// #     secret,
13781/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13782/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13783/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13784/// #     ),
13785/// # ).build().await.unwrap();
13786///
13787/// # let client = hyper_util::client::legacy::Client::builder(
13788/// #     hyper_util::rt::TokioExecutor::new()
13789/// # )
13790/// # .build(
13791/// #     hyper_rustls::HttpsConnectorBuilder::new()
13792/// #         .with_native_roots()
13793/// #         .unwrap()
13794/// #         .https_or_http()
13795/// #         .enable_http2()
13796/// #         .build()
13797/// # );
13798/// # let mut hub = NetworkManagement::new(client, auth);
13799/// // You can configure optional parameters by calling the respective setters at will, and
13800/// // execute the final call using `doit()`.
13801/// // Values shown here are possibly random and not representative !
13802/// let result = hub.projects().locations_list("name")
13803///              .page_token("accusam")
13804///              .page_size(-59)
13805///              .filter("consetetur")
13806///              .add_extra_location_types("voluptua.")
13807///              .doit().await;
13808/// # }
13809/// ```
13810pub struct ProjectLocationListCall<'a, C>
13811where
13812    C: 'a,
13813{
13814    hub: &'a NetworkManagement<C>,
13815    _name: String,
13816    _page_token: Option<String>,
13817    _page_size: Option<i32>,
13818    _filter: Option<String>,
13819    _extra_location_types: Vec<String>,
13820    _delegate: Option<&'a mut dyn common::Delegate>,
13821    _additional_params: HashMap<String, String>,
13822    _scopes: BTreeSet<String>,
13823}
13824
13825impl<'a, C> common::CallBuilder for ProjectLocationListCall<'a, C> {}
13826
13827impl<'a, C> ProjectLocationListCall<'a, C>
13828where
13829    C: common::Connector,
13830{
13831    /// Perform the operation you have build so far.
13832    pub async fn doit(mut self) -> common::Result<(common::Response, ListLocationsResponse)> {
13833        use std::borrow::Cow;
13834        use std::io::{Read, Seek};
13835
13836        use common::{url::Params, ToParts};
13837        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13838
13839        let mut dd = common::DefaultDelegate;
13840        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13841        dlg.begin(common::MethodInfo {
13842            id: "networkmanagement.projects.locations.list",
13843            http_method: hyper::Method::GET,
13844        });
13845
13846        for &field in [
13847            "alt",
13848            "name",
13849            "pageToken",
13850            "pageSize",
13851            "filter",
13852            "extraLocationTypes",
13853        ]
13854        .iter()
13855        {
13856            if self._additional_params.contains_key(field) {
13857                dlg.finished(false);
13858                return Err(common::Error::FieldClash(field));
13859            }
13860        }
13861
13862        let mut params = Params::with_capacity(7 + self._additional_params.len());
13863        params.push("name", self._name);
13864        if let Some(value) = self._page_token.as_ref() {
13865            params.push("pageToken", value);
13866        }
13867        if let Some(value) = self._page_size.as_ref() {
13868            params.push("pageSize", value.to_string());
13869        }
13870        if let Some(value) = self._filter.as_ref() {
13871            params.push("filter", value);
13872        }
13873        if !self._extra_location_types.is_empty() {
13874            for f in self._extra_location_types.iter() {
13875                params.push("extraLocationTypes", f);
13876            }
13877        }
13878
13879        params.extend(self._additional_params.iter());
13880
13881        params.push("alt", "json");
13882        let mut url = self.hub._base_url.clone() + "v1/{+name}/locations";
13883        if self._scopes.is_empty() {
13884            self._scopes
13885                .insert(Scope::CloudPlatform.as_ref().to_string());
13886        }
13887
13888        #[allow(clippy::single_element_loop)]
13889        for &(find_this, param_name) in [("{+name}", "name")].iter() {
13890            url = params.uri_replacement(url, param_name, find_this, true);
13891        }
13892        {
13893            let to_remove = ["name"];
13894            params.remove_params(&to_remove);
13895        }
13896
13897        let url = params.parse_with_url(&url);
13898
13899        loop {
13900            let token = match self
13901                .hub
13902                .auth
13903                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13904                .await
13905            {
13906                Ok(token) => token,
13907                Err(e) => match dlg.token(e) {
13908                    Ok(token) => token,
13909                    Err(e) => {
13910                        dlg.finished(false);
13911                        return Err(common::Error::MissingToken(e));
13912                    }
13913                },
13914            };
13915            let mut req_result = {
13916                let client = &self.hub.client;
13917                dlg.pre_request();
13918                let mut req_builder = hyper::Request::builder()
13919                    .method(hyper::Method::GET)
13920                    .uri(url.as_str())
13921                    .header(USER_AGENT, self.hub._user_agent.clone());
13922
13923                if let Some(token) = token.as_ref() {
13924                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13925                }
13926
13927                let request = req_builder
13928                    .header(CONTENT_LENGTH, 0_u64)
13929                    .body(common::to_body::<String>(None));
13930
13931                client.request(request.unwrap()).await
13932            };
13933
13934            match req_result {
13935                Err(err) => {
13936                    if let common::Retry::After(d) = dlg.http_error(&err) {
13937                        sleep(d).await;
13938                        continue;
13939                    }
13940                    dlg.finished(false);
13941                    return Err(common::Error::HttpError(err));
13942                }
13943                Ok(res) => {
13944                    let (mut parts, body) = res.into_parts();
13945                    let mut body = common::Body::new(body);
13946                    if !parts.status.is_success() {
13947                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13948                        let error = serde_json::from_str(&common::to_string(&bytes));
13949                        let response = common::to_response(parts, bytes.into());
13950
13951                        if let common::Retry::After(d) =
13952                            dlg.http_failure(&response, error.as_ref().ok())
13953                        {
13954                            sleep(d).await;
13955                            continue;
13956                        }
13957
13958                        dlg.finished(false);
13959
13960                        return Err(match error {
13961                            Ok(value) => common::Error::BadRequest(value),
13962                            _ => common::Error::Failure(response),
13963                        });
13964                    }
13965                    let response = {
13966                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13967                        let encoded = common::to_string(&bytes);
13968                        match serde_json::from_str(&encoded) {
13969                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13970                            Err(error) => {
13971                                dlg.response_json_decode_error(&encoded, &error);
13972                                return Err(common::Error::JsonDecodeError(
13973                                    encoded.to_string(),
13974                                    error,
13975                                ));
13976                            }
13977                        }
13978                    };
13979
13980                    dlg.finished(true);
13981                    return Ok(response);
13982                }
13983            }
13984        }
13985    }
13986
13987    /// The resource that owns the locations collection, if applicable.
13988    ///
13989    /// Sets the *name* path property to the given value.
13990    ///
13991    /// Even though the property as already been set when instantiating this call,
13992    /// we provide this method for API completeness.
13993    pub fn name(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
13994        self._name = new_value.to_string();
13995        self
13996    }
13997    /// A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.
13998    ///
13999    /// Sets the *page token* query property to the given value.
14000    pub fn page_token(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
14001        self._page_token = Some(new_value.to_string());
14002        self
14003    }
14004    /// The maximum number of results to return. If not set, the service selects a default.
14005    ///
14006    /// Sets the *page size* query property to the given value.
14007    pub fn page_size(mut self, new_value: i32) -> ProjectLocationListCall<'a, C> {
14008        self._page_size = Some(new_value);
14009        self
14010    }
14011    /// A filter to narrow down results to a preferred subset. The filtering language accepts strings like `"displayName=tokyo"`, and is documented in more detail in [AIP-160](https://google.aip.dev/160).
14012    ///
14013    /// Sets the *filter* query property to the given value.
14014    pub fn filter(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
14015        self._filter = Some(new_value.to_string());
14016        self
14017    }
14018    /// Optional. Do not use this field. It is unsupported and is ignored unless explicitly documented otherwise. This is primarily for internal usage.
14019    ///
14020    /// Append the given value to the *extra location types* query property.
14021    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
14022    pub fn add_extra_location_types(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
14023        self._extra_location_types.push(new_value.to_string());
14024        self
14025    }
14026    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14027    /// while executing the actual API request.
14028    ///
14029    /// ````text
14030    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14031    /// ````
14032    ///
14033    /// Sets the *delegate* property to the given value.
14034    pub fn delegate(
14035        mut self,
14036        new_value: &'a mut dyn common::Delegate,
14037    ) -> ProjectLocationListCall<'a, C> {
14038        self._delegate = Some(new_value);
14039        self
14040    }
14041
14042    /// Set any additional parameter of the query string used in the request.
14043    /// It should be used to set parameters which are not yet available through their own
14044    /// setters.
14045    ///
14046    /// Please note that this method must not be used to set any of the known parameters
14047    /// which have their own setter method. If done anyway, the request will fail.
14048    ///
14049    /// # Additional Parameters
14050    ///
14051    /// * *$.xgafv* (query-string) - V1 error format.
14052    /// * *access_token* (query-string) - OAuth access token.
14053    /// * *alt* (query-string) - Data format for response.
14054    /// * *callback* (query-string) - JSONP
14055    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14056    /// * *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.
14057    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14058    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14059    /// * *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.
14060    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14061    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14062    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C>
14063    where
14064        T: AsRef<str>,
14065    {
14066        self._additional_params
14067            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14068        self
14069    }
14070
14071    /// Identifies the authorization scope for the method you are building.
14072    ///
14073    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14074    /// [`Scope::CloudPlatform`].
14075    ///
14076    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14077    /// tokens for more than one scope.
14078    ///
14079    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14080    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14081    /// sufficient, a read-write scope will do as well.
14082    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationListCall<'a, C>
14083    where
14084        St: AsRef<str>,
14085    {
14086        self._scopes.insert(String::from(scope.as_ref()));
14087        self
14088    }
14089    /// Identifies the authorization scope(s) for the method you are building.
14090    ///
14091    /// See [`Self::add_scope()`] for details.
14092    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationListCall<'a, C>
14093    where
14094        I: IntoIterator<Item = St>,
14095        St: AsRef<str>,
14096    {
14097        self._scopes
14098            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14099        self
14100    }
14101
14102    /// Removes all scopes, and no default scope will be used either.
14103    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14104    /// for details).
14105    pub fn clear_scopes(mut self) -> ProjectLocationListCall<'a, C> {
14106        self._scopes.clear();
14107        self
14108    }
14109}