google_connectors1/
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 Connectors 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_connectors1 as connectors1;
49/// use connectors1::api::EndUserAuthentication;
50/// use connectors1::{Result, Error};
51/// # async fn dox() {
52/// use connectors1::{Connectors, 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 = Connectors::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 = EndUserAuthentication::default();
94///
95/// // You can configure optional parameters by calling the respective setters at will, and
96/// // execute the final call using `doit()`.
97/// // Values shown here are possibly random and not representative !
98/// let result = hub.projects().locations_connections_end_user_authentications_create(req, "parent")
99///              .end_user_authentication_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 Connectors<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 Connectors<C> {}
131
132impl<'a, C> Connectors<C> {
133    pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> Connectors<C> {
134        Connectors {
135            client,
136            auth: Box::new(auth),
137            _user_agent: "google-api-rust-client/7.0.0".to_string(),
138            _base_url: "https://connectors.googleapis.com/".to_string(),
139            _root_url: "https://connectors.googleapis.com/".to_string(),
140        }
141    }
142
143    pub fn projects(&'a self) -> ProjectMethods<'a, C> {
144        ProjectMethods { hub: self }
145    }
146
147    /// Set the user-agent header field to use in all requests to the server.
148    /// It defaults to `google-api-rust-client/7.0.0`.
149    ///
150    /// Returns the previously set user-agent.
151    pub fn user_agent(&mut self, agent_name: String) -> String {
152        std::mem::replace(&mut self._user_agent, agent_name)
153    }
154
155    /// Set the base url to use in all requests to the server.
156    /// It defaults to `https://connectors.googleapis.com/`.
157    ///
158    /// Returns the previously set base url.
159    pub fn base_url(&mut self, new_base_url: String) -> String {
160        std::mem::replace(&mut self._base_url, new_base_url)
161    }
162
163    /// Set the root url to use in all requests to the server.
164    /// It defaults to `https://connectors.googleapis.com/`.
165    ///
166    /// Returns the previously set root url.
167    pub fn root_url(&mut self, new_root_url: String) -> String {
168        std::mem::replace(&mut self._root_url, new_root_url)
169    }
170}
171
172// ############
173// SCHEMAS ###
174// ##########
175/// 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.
176///
177/// This type is not used in any activity, and only used as *part* of another schema.
178///
179#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
180#[serde_with::serde_as]
181#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
182pub struct AuditConfig {
183    /// The configuration for logging of each type of permission.
184    #[serde(rename = "auditLogConfigs")]
185    pub audit_log_configs: Option<Vec<AuditLogConfig>>,
186    /// 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.
187    pub service: Option<String>,
188}
189
190impl common::Part for AuditConfig {}
191
192/// 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.
193///
194/// This type is not used in any activity, and only used as *part* of another schema.
195///
196#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
197#[serde_with::serde_as]
198#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
199pub struct AuditLogConfig {
200    /// Specifies the identities that do not cause logging for this type of permission. Follows the same format of Binding.members.
201    #[serde(rename = "exemptedMembers")]
202    pub exempted_members: Option<Vec<String>>,
203    /// The log type that this config enables.
204    #[serde(rename = "logType")]
205    pub log_type: Option<String>,
206}
207
208impl common::Part for AuditLogConfig {}
209
210/// AuthConfig defines details of a authentication type.
211///
212/// This type is not used in any activity, and only used as *part* of another schema.
213///
214#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
215#[serde_with::serde_as]
216#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
217pub struct AuthConfig {
218    /// Optional. List containing additional auth configs.
219    #[serde(rename = "additionalVariables")]
220    pub additional_variables: Option<Vec<ConfigVariable>>,
221    /// Optional. Identifier key for auth config
222    #[serde(rename = "authKey")]
223    pub auth_key: Option<String>,
224    /// Optional. The type of authentication configured.
225    #[serde(rename = "authType")]
226    pub auth_type: Option<String>,
227    /// Oauth2AuthCodeFlow.
228    #[serde(rename = "oauth2AuthCodeFlow")]
229    pub oauth2_auth_code_flow: Option<Oauth2AuthCodeFlow>,
230    /// Oauth2AuthCodeFlowGoogleManaged.
231    #[serde(rename = "oauth2AuthCodeFlowGoogleManaged")]
232    pub oauth2_auth_code_flow_google_managed: Option<Oauth2AuthCodeFlowGoogleManaged>,
233    /// Oauth2ClientCredentials.
234    #[serde(rename = "oauth2ClientCredentials")]
235    pub oauth2_client_credentials: Option<Oauth2ClientCredentials>,
236    /// Oauth2JwtBearer.
237    #[serde(rename = "oauth2JwtBearer")]
238    pub oauth2_jwt_bearer: Option<Oauth2JwtBearer>,
239    /// SSH Public Key.
240    #[serde(rename = "sshPublicKey")]
241    pub ssh_public_key: Option<SshPublicKey>,
242    /// UserPassword.
243    #[serde(rename = "userPassword")]
244    pub user_password: Option<UserPassword>,
245}
246
247impl common::Part for AuthConfig {}
248
249/// AuthConfigTemplate defines required field over an authentication type.
250///
251/// This type is not used in any activity, and only used as *part* of another schema.
252///
253#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
254#[serde_with::serde_as]
255#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
256pub struct AuthConfigTemplate {
257    /// Identifier key for auth config
258    #[serde(rename = "authKey")]
259    pub auth_key: Option<String>,
260    /// The type of authentication configured.
261    #[serde(rename = "authType")]
262    pub auth_type: Option<String>,
263    /// Config variables to describe an `AuthConfig` for a `Connection`.
264    #[serde(rename = "configVariableTemplates")]
265    pub config_variable_templates: Option<Vec<ConfigVariableTemplate>>,
266    /// Connector specific description for an authentication template.
267    pub description: Option<String>,
268    /// Display name for authentication template.
269    #[serde(rename = "displayName")]
270    pub display_name: Option<String>,
271    /// Whether the auth config is the default one.
272    #[serde(rename = "isDefault")]
273    pub is_default: Option<bool>,
274}
275
276impl common::Part for AuthConfigTemplate {}
277
278/// AuthField defines a field in an authentication type.
279///
280/// This type is not used in any activity, and only used as *part* of another schema.
281///
282#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
283#[serde_with::serde_as]
284#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
285pub struct AuthField {
286    /// Data type of the field.
287    #[serde(rename = "dataType")]
288    pub data_type: Option<String>,
289    /// Description of the field.
290    pub description: Option<String>,
291    /// Key of the field.
292    pub key: Option<String>,
293}
294
295impl common::Part for AuthField {}
296
297/// AuthObject defines a JSON schema of an authentication type.
298///
299/// This type is not used in any activity, and only used as *part* of another schema.
300///
301#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
302#[serde_with::serde_as]
303#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
304pub struct AuthObject {
305    /// Whether the object has additional properties.
306    #[serde(rename = "additionalProperties")]
307    pub additional_properties: Option<bool>,
308    /// Auth key of the object.
309    #[serde(rename = "authKey")]
310    pub auth_key: Option<String>,
311    /// Auth type of the object.
312    #[serde(rename = "authType")]
313    pub auth_type: Option<String>,
314    /// Description of the object.
315    pub description: Option<String>,
316    /// Whether the object is the default one.
317    #[serde(rename = "isDefault")]
318    pub is_default: Option<bool>,
319    /// Properties of the object.
320    pub properties: Option<HashMap<String, AuthProperty>>,
321    /// Type of the object.
322    #[serde(rename = "type")]
323    pub type_: Option<String>,
324}
325
326impl common::Part for AuthObject {}
327
328/// AuthProperty defines a property of an authentication type.
329///
330/// This type is not used in any activity, and only used as *part* of another schema.
331///
332#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
333#[serde_with::serde_as]
334#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
335pub struct AuthProperty {
336    /// Description of the property.
337    pub description: Option<String>,
338    /// Type of the property.
339    #[serde(rename = "type")]
340    pub type_: Option<String>,
341}
342
343impl common::Part for AuthProperty {}
344
345/// AuthSchema defines the schema of an authentication type.
346///
347/// This type is not used in any activity, and only used as *part* of another schema.
348///
349#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
350#[serde_with::serde_as]
351#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
352pub struct AuthSchema {
353    /// List of AuthFields.
354    #[serde(rename = "authFields")]
355    pub auth_fields: Option<Vec<AuthField>>,
356    /// Auth key of the schema.
357    #[serde(rename = "authKey")]
358    pub auth_key: Option<String>,
359    /// Auth type of the schema.
360    #[serde(rename = "authType")]
361    pub auth_type: Option<String>,
362    /// Description of the schema.
363    pub description: Option<String>,
364    /// Display name of the schema.
365    #[serde(rename = "displayName")]
366    pub display_name: Option<String>,
367    /// Whether the auth schema is the default one.
368    #[serde(rename = "isDefault")]
369    pub is_default: Option<bool>,
370}
371
372impl common::Part for AuthSchema {}
373
374/// This configuration captures the details required to render an authorization link for the OAuth Authorization Code Flow.
375///
376/// This type is not used in any activity, and only used as *part* of another schema.
377///
378#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
379#[serde_with::serde_as]
380#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
381pub struct AuthorizationCodeLink {
382    /// Optional. The client ID assigned to the Google Cloud Connectors OAuth app for the connector data source.
383    #[serde(rename = "clientId")]
384    pub client_id: Option<String>,
385    /// Optional. The client secret assigned to the Google Cloud Connectors OAuth app for the connector data source.
386    #[serde(rename = "clientSecret")]
387    pub client_secret: Option<Secret>,
388    /// Optional. Whether to enable PKCE for the auth code flow.
389    #[serde(rename = "enablePkce")]
390    pub enable_pkce: Option<bool>,
391    /// Optional. Omit query params from the redirect URI.
392    #[serde(rename = "omitQueryParams")]
393    pub omit_query_params: Option<bool>,
394    /// Optional. The scopes for which the user will authorize Google Cloud Connectors on the connector data source.
395    pub scopes: Option<Vec<String>>,
396    /// Optional. The base URI the user must click to trigger the authorization code login flow.
397    pub uri: Option<String>,
398}
399
400impl common::Part for AuthorizationCodeLink {}
401
402/// Billing config for the connection.
403///
404/// This type is not used in any activity, and only used as *part* of another schema.
405///
406#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
407#[serde_with::serde_as]
408#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
409pub struct BillingConfig {
410    /// Output only. Billing category for the connector.
411    #[serde(rename = "billingCategory")]
412    pub billing_category: Option<String>,
413}
414
415impl common::Part for BillingConfig {}
416
417/// Associates `members`, or principals, with a `role`.
418///
419/// This type is not used in any activity, and only used as *part* of another schema.
420///
421#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
422#[serde_with::serde_as]
423#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
424pub struct Binding {
425    /// 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).
426    pub condition: Option<Expr>,
427    /// 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`.
428    pub members: Option<Vec<String>>,
429    /// 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).
430    pub role: Option<String>,
431}
432
433impl common::Part for Binding {}
434
435/// The request message for Operations.CancelOperation.
436///
437/// # Activities
438///
439/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
440/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
441///
442/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (request)
443#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
444#[serde_with::serde_as]
445#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
446pub struct CancelOperationRequest {
447    _never_set: Option<bool>,
448}
449
450impl common::RequestValue for CancelOperationRequest {}
451
452/// ConfigVariable represents a configuration variable present in a Connection. or AuthConfig.
453///
454/// This type is not used in any activity, and only used as *part* of another schema.
455///
456#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
457#[serde_with::serde_as]
458#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
459pub struct ConfigVariable {
460    /// Value is a bool.
461    #[serde(rename = "boolValue")]
462    pub bool_value: Option<bool>,
463    /// Value is a Encryption Key.
464    #[serde(rename = "encryptionKeyValue")]
465    pub encryption_key_value: Option<EncryptionKey>,
466    /// Value is an integer
467    #[serde(rename = "intValue")]
468    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
469    pub int_value: Option<i64>,
470    /// Optional. Key of the config variable.
471    pub key: Option<String>,
472    /// Value is a secret.
473    #[serde(rename = "secretValue")]
474    pub secret_value: Option<Secret>,
475    /// Value is a string.
476    #[serde(rename = "stringValue")]
477    pub string_value: Option<String>,
478}
479
480impl common::Part for ConfigVariable {}
481
482/// ConfigVariableTemplate provides metadata about a `ConfigVariable` that is used in a Connection.
483///
484/// This type is not used in any activity, and only used as *part* of another schema.
485///
486#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
487#[serde_with::serde_as]
488#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
489pub struct ConfigVariableTemplate {
490    /// Optional. Authorization code link options. To be populated if `ValueType` is `AUTHORIZATION_CODE`
491    #[serde(rename = "authorizationCodeLink")]
492    pub authorization_code_link: Option<AuthorizationCodeLink>,
493    /// Optional. Description.
494    pub description: Option<String>,
495    /// Optional. Display name of the parameter.
496    #[serde(rename = "displayName")]
497    pub display_name: Option<String>,
498    /// Optional. Enum options. To be populated if `ValueType` is `ENUM`
499    #[serde(rename = "enumOptions")]
500    pub enum_options: Option<Vec<EnumOption>>,
501    /// Optional. enum source denotes the source of api to fill the enum options
502    #[serde(rename = "enumSource")]
503    pub enum_source: Option<String>,
504    /// Optional. Indicates if current template is part of advanced settings
505    #[serde(rename = "isAdvanced")]
506    pub is_advanced: Option<bool>,
507    /// Optional. Key of the config variable.
508    pub key: Option<String>,
509    /// Optional. Location Type denotes where this value should be sent in BYOC connections.
510    #[serde(rename = "locationType")]
511    pub location_type: Option<String>,
512    /// Optional. MultipleSelectConfig represents the multiple options for a config variable.
513    #[serde(rename = "multipleSelectConfig")]
514    pub multiple_select_config: Option<MultipleSelectConfig>,
515    /// Optional. Flag represents that this `ConfigVariable` must be provided for a connection.
516    pub required: Option<bool>,
517    /// Optional. Condition under which a field would be required. The condition can be represented in the form of a logical expression.
518    #[serde(rename = "requiredCondition")]
519    pub required_condition: Option<LogicalExpression>,
520    /// Optional. Role grant configuration for the config variable.
521    #[serde(rename = "roleGrant")]
522    pub role_grant: Option<RoleGrant>,
523    /// Output only. State of the config variable.
524    pub state: Option<String>,
525    /// Optional. Regular expression in RE2 syntax used for validating the `value` of a `ConfigVariable`.
526    #[serde(rename = "validationRegex")]
527    pub validation_regex: Option<String>,
528    /// Optional. Type of the parameter: string, int, bool etc. consider custom type for the benefit for the validation.
529    #[serde(rename = "valueType")]
530    pub value_type: Option<String>,
531}
532
533impl common::Part for ConfigVariableTemplate {}
534
535/// Connection represents an instance of connector.
536///
537/// # Activities
538///
539/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
540/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
541///
542/// * [locations connections create projects](ProjectLocationConnectionCreateCall) (request)
543/// * [locations connections get projects](ProjectLocationConnectionGetCall) (response)
544/// * [locations connections patch projects](ProjectLocationConnectionPatchCall) (request)
545#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
546#[serde_with::serde_as]
547#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
548pub struct Connection {
549    /// Optional. Async operations enabled for the connection. If Async Operations is enabled, Connection allows the customers to initiate async long running operations using the actions API.
550    #[serde(rename = "asyncOperationsEnabled")]
551    pub async_operations_enabled: Option<bool>,
552    /// Optional. Configuration for establishing the connection's authentication with an external system.
553    #[serde(rename = "authConfig")]
554    pub auth_config: Option<AuthConfig>,
555    /// Optional. Auth override enabled for the connection. If Auth Override is enabled, Connection allows the backend service auth to be overridden in the entities/actions API.
556    #[serde(rename = "authOverrideEnabled")]
557    pub auth_override_enabled: Option<bool>,
558    /// Output only. Billing config for the connection.
559    #[serde(rename = "billingConfig")]
560    pub billing_config: Option<BillingConfig>,
561    /// Optional. Configuration for configuring the connection with an external system.
562    #[serde(rename = "configVariables")]
563    pub config_variables: Option<Vec<ConfigVariable>>,
564    /// Output only. Connection revision. This field is only updated when the connection is created or updated by User.
565    #[serde(rename = "connectionRevision")]
566    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
567    pub connection_revision: Option<i64>,
568    /// Required. Connector version on which the connection is created. The format is: projects/*/locations/*/providers/*/connectors/*/versions/* Only global location is supported for ConnectorVersion resource.
569    #[serde(rename = "connectorVersion")]
570    pub connector_version: Option<String>,
571    /// Output only. Infra configs supported by Connector Version.
572    #[serde(rename = "connectorVersionInfraConfig")]
573    pub connector_version_infra_config: Option<ConnectorVersionInfraConfig>,
574    /// Output only. Flag to mark the version indicating the launch stage.
575    #[serde(rename = "connectorVersionLaunchStage")]
576    pub connector_version_launch_stage: Option<String>,
577    /// Output only. Created time.
578    #[serde(rename = "createTime")]
579    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
580    /// Optional. Description of the resource.
581    pub description: Option<String>,
582    /// Optional. Configuration of the Connector's destination. Only accepted for Connectors that accepts user defined destination(s).
583    #[serde(rename = "destinationConfigs")]
584    pub destination_configs: Option<Vec<DestinationConfig>>,
585    /// Output only. GCR location where the envoy image is stored. formatted like: gcr.io/{bucketName}/{imageName}
586    #[serde(rename = "envoyImageLocation")]
587    pub envoy_image_location: Option<String>,
588    /// Optional. Additional Oauth2.0 Auth config for EUA. If the connection is configured using non-OAuth authentication but OAuth needs to be used for EUA, this field can be populated with the OAuth config. This should be a OAuth2AuthCodeFlow Auth type only.
589    #[serde(rename = "euaOauthAuthConfig")]
590    pub eua_oauth_auth_config: Option<AuthConfig>,
591    /// Optional. Eventing config of a connection
592    #[serde(rename = "eventingConfig")]
593    pub eventing_config: Option<EventingConfig>,
594    /// Optional. Eventing enablement type. Will be nil if eventing is not enabled.
595    #[serde(rename = "eventingEnablementType")]
596    pub eventing_enablement_type: Option<String>,
597    /// Output only. Eventing Runtime Data.
598    #[serde(rename = "eventingRuntimeData")]
599    pub eventing_runtime_data: Option<EventingRuntimeData>,
600    /// Optional. Fallback on admin credentials for the connection. If this both auth_override_enabled and fallback_on_admin_credentials are set to true, the connection will use the admin credentials if the dynamic auth header is not present during auth override.
601    #[serde(rename = "fallbackOnAdminCredentials")]
602    pub fallback_on_admin_credentials: Option<bool>,
603    /// Output only. The name of the Hostname of the Service Directory service with TLS.
604    pub host: Option<String>,
605    /// Output only. GCR location where the runtime image is stored. formatted like: gcr.io/{bucketName}/{imageName}
606    #[serde(rename = "imageLocation")]
607    pub image_location: Option<String>,
608    /// Output only. Is trusted tester program enabled for the project.
609    #[serde(rename = "isTrustedTester")]
610    pub is_trusted_tester: Option<bool>,
611    /// Optional. Resource labels to represent user-provided metadata. Refer to cloud documentation on labels for more details. https://cloud.google.com/compute/docs/labeling-resources
612    pub labels: Option<HashMap<String, String>>,
613    /// Optional. Configuration that indicates whether or not the Connection can be edited.
614    #[serde(rename = "lockConfig")]
615    pub lock_config: Option<LockConfig>,
616    /// Optional. Log configuration for the connection.
617    #[serde(rename = "logConfig")]
618    pub log_config: Option<ConnectorsLogConfig>,
619    /// Output only. Resource name of the Connection. Format: projects/{project}/locations/{location}/connections/{connection}
620    pub name: Option<String>,
621    /// Optional. Node configuration for the connection.
622    #[serde(rename = "nodeConfig")]
623    pub node_config: Option<NodeConfig>,
624    /// Optional. Service account needed for runtime plane to access Google Cloud resources.
625    #[serde(rename = "serviceAccount")]
626    pub service_account: Option<String>,
627    /// Output only. The name of the Service Directory service name. Used for Private Harpoon to resolve the ILB address. e.g. "projects/cloud-connectors-e2e-testing/locations/us-central1/namespaces/istio-system/services/istio-ingressgateway-connectors"
628    #[serde(rename = "serviceDirectory")]
629    pub service_directory: Option<String>,
630    /// Optional. Ssl config of a connection
631    #[serde(rename = "sslConfig")]
632    pub ssl_config: Option<SslConfig>,
633    /// Output only. Current status of the connection.
634    pub status: Option<ConnectionStatus>,
635    /// Output only. This subscription type enum states the subscription type of the project.
636    #[serde(rename = "subscriptionType")]
637    pub subscription_type: Option<String>,
638    /// Optional. Suspended indicates if a user has suspended a connection or not.
639    pub suspended: Option<bool>,
640    /// Output only. The name of the Service Directory service with TLS.
641    #[serde(rename = "tlsServiceDirectory")]
642    pub tls_service_directory: Option<String>,
643    /// Optional. Traffic shaping configuration for the connection.
644    #[serde(rename = "trafficShapingConfigs")]
645    pub traffic_shaping_configs: Option<Vec<TrafficShapingConfig>>,
646    /// Output only. Updated time.
647    #[serde(rename = "updateTime")]
648    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
649}
650
651impl common::RequestValue for Connection {}
652impl common::ResponseResult for Connection {}
653
654/// ConnectionSchemaMetadata is the singleton resource of each connection. It includes the entity and action names of runtime resources exposed by a connection backend.
655///
656/// # Activities
657///
658/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
659/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
660///
661/// * [locations connections get connection schema metadata projects](ProjectLocationConnectionGetConnectionSchemaMetadataCall) (response)
662#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
663#[serde_with::serde_as]
664#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
665pub struct ConnectionSchemaMetadata {
666    /// Output only. List of actions.
667    pub actions: Option<Vec<String>>,
668    /// Output only. List of entity names.
669    pub entities: Option<Vec<String>>,
670    /// Error message for users.
671    #[serde(rename = "errorMessage")]
672    pub error_message: Option<String>,
673    /// Output only. Resource name. Format: projects/{project}/locations/{location}/connections/{connection}/connectionSchemaMetadata
674    pub name: Option<String>,
675    /// Output only. Timestamp when the connection runtime schema refresh was triggered.
676    #[serde(rename = "refreshTime")]
677    pub refresh_time: Option<chrono::DateTime<chrono::offset::Utc>>,
678    /// Output only. The current state of runtime schema.
679    pub state: Option<String>,
680    /// Output only. Timestamp when the connection runtime schema was updated.
681    #[serde(rename = "updateTime")]
682    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
683}
684
685impl common::ResponseResult for ConnectionSchemaMetadata {}
686
687/// ConnectionStatus indicates the state of the connection.
688///
689/// This type is not used in any activity, and only used as *part* of another schema.
690///
691#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
692#[serde_with::serde_as]
693#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
694pub struct ConnectionStatus {
695    /// Description.
696    pub description: Option<String>,
697    /// State.
698    pub state: Option<String>,
699    /// Status provides detailed information for the state.
700    pub status: Option<String>,
701}
702
703impl common::Part for ConnectionStatus {}
704
705/// Connectors indicates a specific connector type, e.x. Salesforce, SAP etc.
706///
707/// # Activities
708///
709/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
710/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
711///
712/// * [locations providers connectors get projects](ProjectLocationProviderConnectorGetCall) (response)
713#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
714#[serde_with::serde_as]
715#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
716pub struct Connector {
717    /// Output only. Category of the connector.
718    pub category: Option<String>,
719    /// Output only. The type of the connector.
720    #[serde(rename = "connectorType")]
721    pub connector_type: Option<String>,
722    /// Output only. Created time.
723    #[serde(rename = "createTime")]
724    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
725    /// Output only. Description of the resource.
726    pub description: Option<String>,
727    /// Output only. Display name.
728    #[serde(rename = "displayName")]
729    pub display_name: Option<String>,
730    /// Output only. Link to documentation page.
731    #[serde(rename = "documentationUri")]
732    pub documentation_uri: Option<String>,
733    /// Output only. Eventing details. Will be null if eventing is not supported.
734    #[serde(rename = "eventingDetails")]
735    pub eventing_details: Option<EventingDetails>,
736    /// Output only. Link to external page.
737    #[serde(rename = "externalUri")]
738    pub external_uri: Option<String>,
739    /// Output only. Resource labels to represent user-provided metadata. Refer to cloud documentation on labels for more details. https://cloud.google.com/compute/docs/labeling-resources
740    pub labels: Option<HashMap<String, String>>,
741    /// Output only. Flag to mark the version indicating the launch stage.
742    #[serde(rename = "launchStage")]
743    pub launch_stage: Option<String>,
744    /// Output only. Marketplace connector details. Will be null if the connector is not marketplace connector.
745    #[serde(rename = "marketplaceConnectorDetails")]
746    pub marketplace_connector_details: Option<MarketplaceConnectorDetails>,
747    /// Output only. Resource name of the Connector. Format: projects/{project}/locations/{location}/providers/{provider}/connectors/{connector} Only global location is supported for Connector resource.
748    pub name: Option<String>,
749    /// Output only. Tags of the connector.
750    pub tags: Option<Vec<String>>,
751    /// Output only. Updated time.
752    #[serde(rename = "updateTime")]
753    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
754    /// Output only. Cloud storage location of icons etc consumed by UI.
755    #[serde(rename = "webAssetsLocation")]
756    pub web_assets_location: Option<String>,
757}
758
759impl common::ResponseResult for Connector {}
760
761/// This cofiguration provides infra configs like rate limit threshold which need to be configurable for every connector version
762///
763/// This type is not used in any activity, and only used as *part* of another schema.
764///
765#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
766#[serde_with::serde_as]
767#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
768pub struct ConnectorInfraConfig {
769    /// Indicates that the Cloud Run CPU should always be allocated.
770    #[serde(rename = "alwaysAllocateCpu")]
771    pub always_allocate_cpu: Option<bool>,
772    /// The window used for ratelimiting runtime requests to connections.
773    #[serde(rename = "connectionRatelimitWindowSeconds")]
774    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
775    pub connection_ratelimit_window_seconds: Option<i64>,
776    /// Indicate whether connector versioning is enabled.
777    #[serde(rename = "connectorVersioningEnabled")]
778    pub connector_versioning_enabled: Option<bool>,
779    /// Indicate whether connector is deployed on GKE/CloudRun
780    #[serde(rename = "deploymentModel")]
781    pub deployment_model: Option<String>,
782    /// HPA autoscaling config.
783    #[serde(rename = "hpaConfig")]
784    pub hpa_config: Option<HPAConfig>,
785    /// Max QPS supported for internal requests originating from Connd.
786    #[serde(rename = "internalclientRatelimitThreshold")]
787    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
788    pub internalclient_ratelimit_threshold: Option<i64>,
789    /// Max Instance Request Conncurrency for Cloud Run service.
790    #[serde(rename = "maxInstanceRequestConcurrency")]
791    pub max_instance_request_concurrency: Option<i32>,
792    /// Indicate whether connector is being migrated to cloud run deployment model.
793    #[serde(rename = "migrateDeploymentModel")]
794    pub migrate_deployment_model: Option<bool>,
795    /// Indicate whether connector is being migrated to TLS.
796    #[serde(rename = "migrateTls")]
797    pub migrate_tls: Option<bool>,
798    /// Network egress mode override to migrate to direct VPC egress.
799    #[serde(rename = "networkEgressModeOverride")]
800    pub network_egress_mode_override: Option<NetworkEgressModeOverride>,
801    /// Indicate whether cloud spanner is required for connector job.
802    #[serde(rename = "provisionCloudSpanner")]
803    pub provision_cloud_spanner: Option<bool>,
804    /// Indicate whether memstore is required for connector job.
805    #[serde(rename = "provisionMemstore")]
806    pub provision_memstore: Option<bool>,
807    /// Max QPS supported by the connector version before throttling of requests.
808    #[serde(rename = "ratelimitThreshold")]
809    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
810    pub ratelimit_threshold: Option<i64>,
811    /// System resource limits.
812    #[serde(rename = "resourceLimits")]
813    pub resource_limits: Option<ResourceLimits>,
814    /// System resource requests.
815    #[serde(rename = "resourceRequests")]
816    pub resource_requests: Option<ResourceRequests>,
817    /// The name of shared connector deployment.
818    #[serde(rename = "sharedDeployment")]
819    pub shared_deployment: Option<String>,
820}
821
822impl common::Part for ConnectorInfraConfig {}
823
824/// ConnectorVersion indicates a specific version of a connector.
825///
826/// # Activities
827///
828/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
829/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
830///
831/// * [locations providers connectors versions get projects](ProjectLocationProviderConnectorVersionGetCall) (response)
832#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
833#[serde_with::serde_as]
834#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
835pub struct ConnectorVersion {
836    /// Output only. List of auth configs supported by the Connector Version.
837    #[serde(rename = "authConfigTemplates")]
838    pub auth_config_templates: Option<Vec<AuthConfigTemplate>>,
839    /// Output only. Flag to mark the dynamic auth override.
840    #[serde(rename = "authOverrideEnabled")]
841    pub auth_override_enabled: Option<bool>,
842    /// Output only. List of config variables needed to create a connection.
843    #[serde(rename = "configVariableTemplates")]
844    pub config_variable_templates: Option<Vec<ConfigVariableTemplate>>,
845    /// Output only. Infra configs supported by Connector.
846    #[serde(rename = "connectorInfraConfig")]
847    pub connector_infra_config: Option<ConnectorInfraConfig>,
848    /// Output only. Created time.
849    #[serde(rename = "createTime")]
850    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
851    /// Output only. List of destination configs needed to create a connection.
852    #[serde(rename = "destinationConfigTemplates")]
853    pub destination_config_templates: Option<Vec<DestinationConfigTemplate>>,
854    /// Output only. Display name.
855    #[serde(rename = "displayName")]
856    pub display_name: Option<String>,
857    /// Output only. Configuration for Egress Control.
858    #[serde(rename = "egressControlConfig")]
859    pub egress_control_config: Option<EgressControlConfig>,
860    /// Output only. Eventing configuration supported by the Connector.
861    #[serde(rename = "eventingConfigTemplate")]
862    pub eventing_config_template: Option<EventingConfigTemplate>,
863    /// Output only. Is custom actions supported.
864    #[serde(rename = "isCustomActionsSupported")]
865    pub is_custom_actions_supported: Option<bool>,
866    /// Output only. Is custom entities supported.
867    #[serde(rename = "isCustomEntitiesSupported")]
868    pub is_custom_entities_supported: Option<bool>,
869    /// Output only. Resource labels to represent user-provided metadata. Refer to cloud documentation on labels for more details. https://cloud.google.com/compute/docs/labeling-resources
870    pub labels: Option<HashMap<String, String>>,
871    /// Output only. Flag to mark the version indicating the launch stage.
872    #[serde(rename = "launchStage")]
873    pub launch_stage: Option<String>,
874    /// Output only. Resource name of the Version. Format: projects/{project}/locations/{location}/providers/{provider}/connectors/{connector}/versions/{version} Only global location is supported for Connector resource.
875    pub name: Option<String>,
876    /// Output only. ReleaseVersion of the connector, for example: "1.0.1-alpha".
877    #[serde(rename = "releaseVersion")]
878    pub release_version: Option<String>,
879    /// Output only. Role grant configuration for this config variable. It will be DEPRECATED soon.
880    #[serde(rename = "roleGrant")]
881    pub role_grant: Option<RoleGrant>,
882    /// Output only. Role grant configurations for this connector version.
883    #[serde(rename = "roleGrants")]
884    pub role_grants: Option<Vec<RoleGrant>>,
885    /// Connection Schema Refresh Config
886    #[serde(rename = "schemaRefreshConfig")]
887    pub schema_refresh_config: Option<SchemaRefreshConfig>,
888    /// Output only. Ssl configuration supported by the Connector.
889    #[serde(rename = "sslConfigTemplate")]
890    pub ssl_config_template: Option<SslConfigTemplate>,
891    /// Output only. Information about the runtime features supported by the Connector.
892    #[serde(rename = "supportedRuntimeFeatures")]
893    pub supported_runtime_features: Option<SupportedRuntimeFeatures>,
894    /// Output only. Supported standard actions.
895    #[serde(rename = "supportedStandardActions")]
896    pub supported_standard_actions: Option<Vec<StandardAction>>,
897    /// Output only. Supported standard entities.
898    #[serde(rename = "supportedStandardEntities")]
899    pub supported_standard_entities: Option<Vec<StandardEntity>>,
900    /// Output only. Unsupported connection types.
901    #[serde(rename = "unsupportedConnectionTypes")]
902    pub unsupported_connection_types: Option<Vec<String>>,
903    /// Output only. Updated time.
904    #[serde(rename = "updateTime")]
905    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
906    /// Output only. VPCSC config for the connector.
907    #[serde(rename = "vpcscConfig")]
908    pub vpcsc_config: Option<VpcscConfig>,
909}
910
911impl common::ResponseResult for ConnectorVersion {}
912
913/// This configuration provides infra configs like rate limit threshold which need to be configurable for every connector version
914///
915/// This type is not used in any activity, and only used as *part* of another schema.
916///
917#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
918#[serde_with::serde_as]
919#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
920pub struct ConnectorVersionInfraConfig {
921    /// Output only. The window used for ratelimiting runtime requests to connections.
922    #[serde(rename = "connectionRatelimitWindowSeconds")]
923    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
924    pub connection_ratelimit_window_seconds: Option<i64>,
925    /// Output only. Indicates whether connector is deployed on GKE/CloudRun
926    #[serde(rename = "deploymentModel")]
927    pub deployment_model: Option<String>,
928    /// Output only. Status of the deployment model migration.
929    #[serde(rename = "deploymentModelMigrationState")]
930    pub deployment_model_migration_state: Option<String>,
931    /// Output only. HPA autoscaling config.
932    #[serde(rename = "hpaConfig")]
933    pub hpa_config: Option<HPAConfig>,
934    /// Output only. Max QPS supported for internal requests originating from Connd.
935    #[serde(rename = "internalclientRatelimitThreshold")]
936    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
937    pub internalclient_ratelimit_threshold: Option<i64>,
938    /// Output only. Max instance request concurrency.
939    #[serde(rename = "maxInstanceRequestConcurrency")]
940    pub max_instance_request_concurrency: Option<i32>,
941    /// Output only. Max QPS supported by the connector version before throttling of requests.
942    #[serde(rename = "ratelimitThreshold")]
943    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
944    pub ratelimit_threshold: Option<i64>,
945    /// Output only. System resource limits.
946    #[serde(rename = "resourceLimits")]
947    pub resource_limits: Option<ResourceLimits>,
948    /// Output only. System resource requests.
949    #[serde(rename = "resourceRequests")]
950    pub resource_requests: Option<ResourceRequests>,
951    /// Output only. The name of shared connector deployment.
952    #[serde(rename = "sharedDeployment")]
953    pub shared_deployment: Option<String>,
954    /// Output only. Status of the TLS migration.
955    #[serde(rename = "tlsMigrationState")]
956    pub tls_migration_state: Option<String>,
957}
958
959impl common::Part for ConnectorVersionInfraConfig {}
960
961/// Log configuration for the connection.
962///
963/// This type is not used in any activity, and only used as *part* of another schema.
964///
965#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
966#[serde_with::serde_as]
967#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
968pub struct ConnectorsLogConfig {
969    /// Optional. Enabled represents whether logging is enabled or not for a connection.
970    pub enabled: Option<bool>,
971    /// Optional. Log configuration level.
972    pub level: Option<String>,
973}
974
975impl common::Part for ConnectorsLogConfig {}
976
977/// CustomConnector represents the custom connector defined by the customer as part of byoc.
978///
979/// # Activities
980///
981/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
982/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
983///
984/// * [locations global custom connectors create projects](ProjectLocationGlobalCustomConnectorCreateCall) (request)
985/// * [locations global custom connectors get projects](ProjectLocationGlobalCustomConnectorGetCall) (response)
986/// * [locations global custom connectors patch projects](ProjectLocationGlobalCustomConnectorPatchCall) (request)
987#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
988#[serde_with::serde_as]
989#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
990pub struct CustomConnector {
991    /// Output only. Active connector versions.
992    #[serde(rename = "activeConnectorVersions")]
993    pub active_connector_versions: Option<Vec<String>>,
994    /// Output only. All connector versions.
995    #[serde(rename = "allConnectorVersions")]
996    pub all_connector_versions: Option<Vec<String>>,
997    /// Output only. All marketplace versions.
998    #[serde(rename = "allMarketplaceVersions")]
999    pub all_marketplace_versions: Option<Vec<String>>,
1000    /// Output only. Created time.
1001    #[serde(rename = "createTime")]
1002    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1003    /// Required. Type of the custom connector.
1004    #[serde(rename = "customConnectorType")]
1005    pub custom_connector_type: Option<String>,
1006    /// Optional. Description of the resource.
1007    pub description: Option<String>,
1008    /// Optional. Display name.
1009    #[serde(rename = "displayName")]
1010    pub display_name: Option<String>,
1011    /// Optional. Resource labels to represent user-provided metadata. Refer to cloud documentation on labels for more details. https://cloud.google.com/compute/docs/labeling-resources
1012    pub labels: Option<HashMap<String, String>>,
1013    /// Optional. Logo of the resource.
1014    pub logo: Option<String>,
1015    /// Identifier. Resource name of the CustomConnector. Format: projects/{project}/locations/{location}/customConnectors/{connector}
1016    pub name: Option<String>,
1017    /// Output only. Published marketplace versions.
1018    #[serde(rename = "publishedMarketplaceVersions")]
1019    pub published_marketplace_versions: Option<Vec<String>>,
1020    /// Output only. Updated time.
1021    #[serde(rename = "updateTime")]
1022    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1023}
1024
1025impl common::RequestValue for CustomConnector {}
1026impl common::ResponseResult for CustomConnector {}
1027
1028/// CustomConnectorVersion indicates a specific version of a connector.
1029///
1030/// # Activities
1031///
1032/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1033/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1034///
1035/// * [locations global custom connectors custom connector versions create projects](ProjectLocationGlobalCustomConnectorCustomConnectorVersionCreateCall) (request)
1036/// * [locations global custom connectors custom connector versions get projects](ProjectLocationGlobalCustomConnectorCustomConnectorVersionGetCall) (response)
1037#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1038#[serde_with::serde_as]
1039#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1040pub struct CustomConnectorVersion {
1041    /// Optional. Indicates if Async Operations/Connector Job is supported. This is only available for SDK based custom connectors.
1042    #[serde(rename = "asyncOperationsSupport")]
1043    pub async_operations_support: Option<bool>,
1044    /// Optional. Authentication config for accessing connector service (facade). This is used only when enable_backend_destination_config is true.
1045    #[serde(rename = "authConfig")]
1046    pub auth_config: Option<AuthConfig>,
1047    /// Optional. Auth Config Templates is only used when connector backend is enabled. This is used to specify the auth configs supported by the connector backend service to talk to the actual application backend.
1048    #[serde(rename = "authConfigTemplates")]
1049    pub auth_config_templates: Option<Vec<AuthConfigTemplate>>,
1050    /// Optional. Auth override support.
1051    #[serde(rename = "authOverrideSupport")]
1052    pub auth_override_support: Option<bool>,
1053    /// Optional. Backend variable templates is only used when connector backend is enabled. This is used to specify the variables required by the connector backend service to talk to the actual application backend. This translates to additional variable templates in the connection config.
1054    #[serde(rename = "backendVariableTemplates")]
1055    pub backend_variable_templates: Option<Vec<ConfigVariableTemplate>>,
1056    /// Output only. Created time.
1057    #[serde(rename = "createTime")]
1058    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1059    /// Optional. Destination config(s) for accessing connector service (facade). This is used only when enable_backend_destination_config is true.
1060    #[serde(rename = "destinationConfigs")]
1061    pub destination_configs: Option<Vec<DestinationConfig>>,
1062    /// Optional. Indicates if an intermediatory connectorservice is used as backend. When this is enabled, the connector destination and connector auth config are required. For SDK based connectors, this is always enabled.
1063    #[serde(rename = "enableBackendDestinationConfig")]
1064    pub enable_backend_destination_config: Option<bool>,
1065    /// Optional. Resource labels to represent user-provided metadata. Refer to cloud documentation on labels for more details. https://cloud.google.com/compute/docs/labeling-resources
1066    pub labels: Option<HashMap<String, String>>,
1067    /// Output only. Identifier. Resource name of the Version. Format: projects/{project}/locations/{location}/customConnectors/{custom_connector}/customConnectorVersions/{custom_connector_version}
1068    pub name: Option<String>,
1069    /// Optional. Partner metadata details. This should be populated only when publishing the custom connector to partner connector.
1070    #[serde(rename = "partnerMetadata")]
1071    pub partner_metadata: Option<PartnerMetadata>,
1072    /// Output only. Publish status of a custom connector.
1073    #[serde(rename = "publishStatus")]
1074    pub publish_status: Option<PublishStatus>,
1075    /// Optional. Service account used by runtime plane to access auth config secrets.
1076    #[serde(rename = "serviceAccount")]
1077    pub service_account: Option<String>,
1078    /// Optional. Location of the custom connector spec. This is only used for Open API based custom connectors. The location can be either a public url like `https://public-url.com/spec` Or a Google Cloud Storage location like `gs:///`.
1079    #[serde(rename = "specLocation")]
1080    pub spec_location: Option<String>,
1081    /// Output only. Server URLs parsed from the Open API spec. This is only used for Open API based custom connectors.
1082    #[serde(rename = "specServerUrls")]
1083    pub spec_server_urls: Option<Vec<String>>,
1084    /// Output only. State of the custom connector version.
1085    pub state: Option<String>,
1086    /// Output only. Updated time.
1087    #[serde(rename = "updateTime")]
1088    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1089}
1090
1091impl common::RequestValue for CustomConnectorVersion {}
1092impl common::ResponseResult for CustomConnectorVersion {}
1093
1094/// Dead Letter configuration details provided by the user.
1095///
1096/// This type is not used in any activity, and only used as *part* of another schema.
1097///
1098#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1099#[serde_with::serde_as]
1100#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1101pub struct DeadLetterConfig {
1102    /// Optional. Project which has the topic given.
1103    #[serde(rename = "projectId")]
1104    pub project_id: Option<String>,
1105    /// Optional. Topic to push events which couldn't be processed.
1106    pub topic: Option<String>,
1107}
1108
1109impl common::Part for DeadLetterConfig {}
1110
1111/// Request message for ConnectorsService.DeprecateCustomConnectorVersion
1112///
1113/// # Activities
1114///
1115/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1116/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1117///
1118/// * [locations custom connectors custom connector versions deprecate projects](ProjectLocationCustomConnectorCustomConnectorVersionDeprecateCall) (request)
1119#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1120#[serde_with::serde_as]
1121#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1122pub struct DeprecateCustomConnectorVersionRequest {
1123    _never_set: Option<bool>,
1124}
1125
1126impl common::RequestValue for DeprecateCustomConnectorVersionRequest {}
1127
1128/// There is no detailed description.
1129///
1130/// This type is not used in any activity, and only used as *part* of another schema.
1131///
1132#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1133#[serde_with::serde_as]
1134#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1135pub struct Destination {
1136    /// For publicly routable host.
1137    pub host: Option<String>,
1138    /// The port is the target port number that is accepted by the destination.
1139    pub port: Option<i32>,
1140    /// PSC service attachments. Format: projects/*/regions/*/serviceAttachments/*
1141    #[serde(rename = "serviceAttachment")]
1142    pub service_attachment: Option<String>,
1143}
1144
1145impl common::Part for Destination {}
1146
1147/// Define the Connectors target endpoint.
1148///
1149/// This type is not used in any activity, and only used as *part* of another schema.
1150///
1151#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1152#[serde_with::serde_as]
1153#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1154pub struct DestinationConfig {
1155    /// The destinations for the key.
1156    pub destinations: Option<Vec<Destination>>,
1157    /// The key is the destination identifier that is supported by the Connector.
1158    pub key: Option<String>,
1159}
1160
1161impl common::Part for DestinationConfig {}
1162
1163/// DestinationConfigTemplate defines required destinations supported by the Connector.
1164///
1165/// This type is not used in any activity, and only used as *part* of another schema.
1166///
1167#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1168#[serde_with::serde_as]
1169#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1170pub struct DestinationConfigTemplate {
1171    /// Autocomplete suggestions for destination URL field.
1172    #[serde(rename = "autocompleteSuggestions")]
1173    pub autocomplete_suggestions: Option<Vec<String>>,
1174    /// The default port.
1175    #[serde(rename = "defaultPort")]
1176    pub default_port: Option<i32>,
1177    /// Description.
1178    pub description: Option<String>,
1179    /// Display name of the parameter.
1180    #[serde(rename = "displayName")]
1181    pub display_name: Option<String>,
1182    /// Whether the current destination tempalate is part of Advanced settings
1183    #[serde(rename = "isAdvanced")]
1184    pub is_advanced: Option<bool>,
1185    /// Key of the destination.
1186    pub key: Option<String>,
1187    /// The maximum number of destinations supported for this key.
1188    pub max: Option<i32>,
1189    /// The minimum number of destinations supported for this key.
1190    pub min: Option<i32>,
1191    /// Whether port number should be provided by customers.
1192    #[serde(rename = "portFieldType")]
1193    pub port_field_type: Option<String>,
1194    /// Regex pattern for host.
1195    #[serde(rename = "regexPattern")]
1196    pub regex_pattern: Option<String>,
1197}
1198
1199impl common::Part for DestinationConfigTemplate {}
1200
1201/// EUASecret provides a reference to entries in Secret Manager.
1202///
1203/// This type is not used in any activity, and only used as *part* of another schema.
1204///
1205#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1206#[serde_with::serde_as]
1207#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1208pub struct EUASecret {
1209    /// Optional. The plain string value of the secret.
1210    #[serde(rename = "secretValue")]
1211    pub secret_value: Option<String>,
1212    /// Optional. The resource name of the secret version in the format, format as: `projects/*/secrets/*/versions/*`.
1213    #[serde(rename = "secretVersion")]
1214    pub secret_version: Option<String>,
1215}
1216
1217impl common::Part for EUASecret {}
1218
1219/// Egress control config for connector runtime. These configurations define the rules to identify which outbound domains/hosts needs to be whitelisted. It may be a static information for a particular connector version or it is derived from the configurations provided by the customer in Connection resource.
1220///
1221/// This type is not used in any activity, and only used as *part* of another schema.
1222///
1223#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1224#[serde_with::serde_as]
1225#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1226pub struct EgressControlConfig {
1227    /// Static Comma separated backends which are common for all Connection resources. Supported formats for each backend are host:port or just host (host can be ip address or domain name).
1228    pub backends: Option<String>,
1229    /// Extractions Rules to extract the backends from customer provided configuration.
1230    #[serde(rename = "extractionRules")]
1231    pub extraction_rules: Option<ExtractionRules>,
1232}
1233
1234impl common::Part for EgressControlConfig {}
1235
1236/// 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); }
1237///
1238/// # Activities
1239///
1240/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1241/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1242///
1243/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (response)
1244/// * [locations operations delete projects](ProjectLocationOperationDeleteCall) (response)
1245#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1246#[serde_with::serde_as]
1247#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1248pub struct Empty {
1249    _never_set: Option<bool>,
1250}
1251
1252impl common::ResponseResult for Empty {}
1253
1254/// Regional encryption config for CMEK details.
1255///
1256/// This type is not used in any activity, and only used as *part* of another schema.
1257///
1258#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1259#[serde_with::serde_as]
1260#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1261pub struct EncryptionConfig {
1262    /// Optional. Encryption type for the region.
1263    #[serde(rename = "encryptionType")]
1264    pub encryption_type: Option<String>,
1265    /// Optional. KMS crypto key. This field accepts identifiers of the form `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/ {crypto_key}`
1266    #[serde(rename = "kmsKeyName")]
1267    pub kms_key_name: Option<String>,
1268}
1269
1270impl common::Part for EncryptionConfig {}
1271
1272/// Encryption Key value.
1273///
1274/// This type is not used in any activity, and only used as *part* of another schema.
1275///
1276#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1277#[serde_with::serde_as]
1278#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1279pub struct EncryptionKey {
1280    /// Optional. The [KMS key name] with which the content of the Operation is encrypted. The expected format: `projects/*/locations/*/keyRings/*/cryptoKeys/*`. Will be empty string if google managed.
1281    #[serde(rename = "kmsKeyName")]
1282    pub kms_key_name: Option<String>,
1283    /// Type.
1284    #[serde(rename = "type")]
1285    pub type_: Option<String>,
1286}
1287
1288impl common::Part for EncryptionKey {}
1289
1290/// Endpoint message includes details of the Destination endpoint.
1291///
1292/// This type is not used in any activity, and only used as *part* of another schema.
1293///
1294#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1295#[serde_with::serde_as]
1296#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1297pub struct EndPoint {
1298    /// Optional. The URI of the Endpoint.
1299    #[serde(rename = "endpointUri")]
1300    pub endpoint_uri: Option<String>,
1301    /// Optional. List of Header to be added to the Endpoint.
1302    pub headers: Option<Vec<Header>>,
1303}
1304
1305impl common::Part for EndPoint {}
1306
1307/// AuthConfig defines details of a authentication type.
1308///
1309/// # Activities
1310///
1311/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1312/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1313///
1314/// * [locations connections end user authentications create projects](ProjectLocationConnectionEndUserAuthenticationCreateCall) (request)
1315/// * [locations connections end user authentications get projects](ProjectLocationConnectionEndUserAuthenticationGetCall) (response)
1316/// * [locations connections end user authentications patch projects](ProjectLocationConnectionEndUserAuthenticationPatchCall) (request)
1317#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1318#[serde_with::serde_as]
1319#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1320pub struct EndUserAuthentication {
1321    /// Optional. Config variables for the EndUserAuthentication.
1322    #[serde(rename = "configVariables")]
1323    pub config_variables: Option<Vec<EndUserAuthenticationConfigVariable>>,
1324    /// Output only. Created time.
1325    #[serde(rename = "createTime")]
1326    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1327    /// Optional. Destination configs for the EndUserAuthentication.
1328    #[serde(rename = "destinationConfigs")]
1329    pub destination_configs: Option<Vec<DestinationConfig>>,
1330    /// Optional. The EndUserAuthenticationConfig for the EndUserAuthentication.
1331    #[serde(rename = "endUserAuthenticationConfig")]
1332    pub end_user_authentication_config: Option<EndUserAuthenticationConfig>,
1333    /// Optional. Labels for the EndUserAuthentication.
1334    pub labels: Option<Vec<String>>,
1335    /// Required. Identifier. Resource name of the EndUserAuthentication. Format: projects/{project}/locations/{location}/connections/{connection}/endUserAuthentications/{end_user_authentication}
1336    pub name: Option<String>,
1337    /// Optional. The destination to hit when we receive an event
1338    #[serde(rename = "notifyEndpointDestination")]
1339    pub notify_endpoint_destination: Option<EndUserAuthenticationNotifyEndpointDestination>,
1340    /// Optional. Roles for the EndUserAuthentication.
1341    pub roles: Option<Vec<String>>,
1342    /// Optional. Status of the EndUserAuthentication.
1343    pub status: Option<EndUserAuthenticationEndUserAuthenticationStatus>,
1344    /// Output only. Updated time.
1345    #[serde(rename = "updateTime")]
1346    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1347    /// Optional. The user id of the user.
1348    #[serde(rename = "userId")]
1349    pub user_id: Option<String>,
1350}
1351
1352impl common::RequestValue for EndUserAuthentication {}
1353impl common::ResponseResult for EndUserAuthentication {}
1354
1355/// EndUserAuthenticationConfig defines details of a authentication configuration for EUC
1356///
1357/// This type is not used in any activity, and only used as *part* of another schema.
1358///
1359#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1360#[serde_with::serde_as]
1361#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1362pub struct EndUserAuthenticationConfig {
1363    /// Optional. List containing additional auth configs.
1364    #[serde(rename = "additionalVariables")]
1365    pub additional_variables: Option<Vec<EndUserAuthenticationConfigVariable>>,
1366    /// Identifier key for auth config
1367    #[serde(rename = "authKey")]
1368    pub auth_key: Option<String>,
1369    /// The type of authentication configured.
1370    #[serde(rename = "authType")]
1371    pub auth_type: Option<String>,
1372    /// Oauth2AuthCodeFlow.
1373    #[serde(rename = "oauth2AuthCodeFlow")]
1374    pub oauth2_auth_code_flow: Option<EndUserAuthenticationConfigOauth2AuthCodeFlow>,
1375    /// Oauth2AuthCodeFlowGoogleManaged.
1376    #[serde(rename = "oauth2AuthCodeFlowGoogleManaged")]
1377    pub oauth2_auth_code_flow_google_managed:
1378        Option<EndUserAuthenticationConfigOauth2AuthCodeFlowGoogleManaged>,
1379    /// Oauth2ClientCredentials.
1380    #[serde(rename = "oauth2ClientCredentials")]
1381    pub oauth2_client_credentials: Option<EndUserAuthenticationConfigOauth2ClientCredentials>,
1382    /// Oauth2JwtBearer.
1383    #[serde(rename = "oauth2JwtBearer")]
1384    pub oauth2_jwt_bearer: Option<EndUserAuthenticationConfigOauth2JwtBearer>,
1385    /// SSH Public Key.
1386    #[serde(rename = "sshPublicKey")]
1387    pub ssh_public_key: Option<EndUserAuthenticationConfigSshPublicKey>,
1388    /// UserPassword.
1389    #[serde(rename = "userPassword")]
1390    pub user_password: Option<EndUserAuthenticationConfigUserPassword>,
1391}
1392
1393impl common::Part for EndUserAuthenticationConfig {}
1394
1395/// Parameters to support Oauth 2.0 Auth Code Grant Authentication. See https://www.rfc-editor.org/rfc/rfc6749#section-1.3.1 for more details.
1396///
1397/// This type is not used in any activity, and only used as *part* of another schema.
1398///
1399#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1400#[serde_with::serde_as]
1401#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1402pub struct EndUserAuthenticationConfigOauth2AuthCodeFlow {
1403    /// Optional. Authorization code to be exchanged for access and refresh tokens.
1404    #[serde(rename = "authCode")]
1405    pub auth_code: Option<String>,
1406    /// Optional. Auth URL for Authorization Code Flow
1407    #[serde(rename = "authUri")]
1408    pub auth_uri: Option<String>,
1409    /// Optional. Client ID for user-provided OAuth app.
1410    #[serde(rename = "clientId")]
1411    pub client_id: Option<String>,
1412    /// Optional. Client secret for user-provided OAuth app.
1413    #[serde(rename = "clientSecret")]
1414    pub client_secret: Option<EUASecret>,
1415    /// Optional. Whether to enable PKCE when the user performs the auth code flow.
1416    #[serde(rename = "enablePkce")]
1417    pub enable_pkce: Option<bool>,
1418    /// Optional. Auth Code Data
1419    #[serde(rename = "oauthTokenData")]
1420    pub oauth_token_data: Option<OAuthTokenData>,
1421    /// Optional. PKCE verifier to be used during the auth code exchange.
1422    #[serde(rename = "pkceVerifier")]
1423    pub pkce_verifier: Option<String>,
1424    /// Optional. Redirect URI to be provided during the auth code exchange.
1425    #[serde(rename = "redirectUri")]
1426    pub redirect_uri: Option<String>,
1427    /// Optional. Scopes the connection will request when the user performs the auth code flow.
1428    pub scopes: Option<Vec<String>>,
1429}
1430
1431impl common::Part for EndUserAuthenticationConfigOauth2AuthCodeFlow {}
1432
1433/// Parameters to support Oauth 2.0 Auth Code Grant Authentication using Google Provided OAuth Client. See https://tools.ietf.org/html/rfc6749#section-1.3.1 for more details.
1434///
1435/// This type is not used in any activity, and only used as *part* of another schema.
1436///
1437#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1438#[serde_with::serde_as]
1439#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1440pub struct EndUserAuthenticationConfigOauth2AuthCodeFlowGoogleManaged {
1441    /// Optional. Authorization code to be exchanged for access and refresh tokens.
1442    #[serde(rename = "authCode")]
1443    pub auth_code: Option<String>,
1444    /// Auth Code Data
1445    #[serde(rename = "oauthTokenData")]
1446    pub oauth_token_data: Option<OAuthTokenData>,
1447    /// Optional. Redirect URI to be provided during the auth code exchange.
1448    #[serde(rename = "redirectUri")]
1449    pub redirect_uri: Option<String>,
1450    /// Required. Scopes the connection will request when the user performs the auth code flow.
1451    pub scopes: Option<Vec<String>>,
1452}
1453
1454impl common::Part for EndUserAuthenticationConfigOauth2AuthCodeFlowGoogleManaged {}
1455
1456/// Parameters to support Oauth 2.0 Client Credentials Grant Authentication. See https://tools.ietf.org/html/rfc6749#section-1.3.4 for more details.
1457///
1458/// This type is not used in any activity, and only used as *part* of another schema.
1459///
1460#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1461#[serde_with::serde_as]
1462#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1463pub struct EndUserAuthenticationConfigOauth2ClientCredentials {
1464    /// The client identifier.
1465    #[serde(rename = "clientId")]
1466    pub client_id: Option<String>,
1467    /// Required. string value or secret version containing the client secret.
1468    #[serde(rename = "clientSecret")]
1469    pub client_secret: Option<EUASecret>,
1470}
1471
1472impl common::Part for EndUserAuthenticationConfigOauth2ClientCredentials {}
1473
1474/// Parameters to support JSON Web Token (JWT) Profile for Oauth 2.0 Authorization Grant based authentication. See https://tools.ietf.org/html/rfc7523 for more details.
1475///
1476/// This type is not used in any activity, and only used as *part* of another schema.
1477///
1478#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1479#[serde_with::serde_as]
1480#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1481pub struct EndUserAuthenticationConfigOauth2JwtBearer {
1482    /// Required. secret version/value reference containing a PKCS#8 PEM-encoded private key associated with the Client Certificate. This private key will be used to sign JWTs used for the jwt-bearer authorization grant. Specified in the form as: `projects/*/strings/*/versions/*`.
1483    #[serde(rename = "clientKey")]
1484    pub client_key: Option<EUASecret>,
1485    /// JwtClaims providers fields to generate the token.
1486    #[serde(rename = "jwtClaims")]
1487    pub jwt_claims: Option<EndUserAuthenticationConfigOauth2JwtBearerJwtClaims>,
1488}
1489
1490impl common::Part for EndUserAuthenticationConfigOauth2JwtBearer {}
1491
1492/// JWT claims used for the jwt-bearer authorization grant.
1493///
1494/// This type is not used in any activity, and only used as *part* of another schema.
1495///
1496#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1497#[serde_with::serde_as]
1498#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1499pub struct EndUserAuthenticationConfigOauth2JwtBearerJwtClaims {
1500    /// Value for the "aud" claim.
1501    pub audience: Option<String>,
1502    /// Value for the "iss" claim.
1503    pub issuer: Option<String>,
1504    /// Value for the "sub" claim.
1505    pub subject: Option<String>,
1506}
1507
1508impl common::Part for EndUserAuthenticationConfigOauth2JwtBearerJwtClaims {}
1509
1510/// Parameters to support Ssh public key Authentication.
1511///
1512/// This type is not used in any activity, and only used as *part* of another schema.
1513///
1514#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1515#[serde_with::serde_as]
1516#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1517pub struct EndUserAuthenticationConfigSshPublicKey {
1518    /// Format of SSH Client cert.
1519    #[serde(rename = "certType")]
1520    pub cert_type: Option<String>,
1521    /// Required. SSH Client Cert. It should contain both public and private key.
1522    #[serde(rename = "sshClientCert")]
1523    pub ssh_client_cert: Option<EUASecret>,
1524    /// Required. Password (passphrase) for ssh client certificate if it has one.
1525    #[serde(rename = "sshClientCertPass")]
1526    pub ssh_client_cert_pass: Option<EUASecret>,
1527    /// The user account used to authenticate.
1528    pub username: Option<String>,
1529}
1530
1531impl common::Part for EndUserAuthenticationConfigSshPublicKey {}
1532
1533/// Parameters to support Username and Password Authentication.
1534///
1535/// This type is not used in any activity, and only used as *part* of another schema.
1536///
1537#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1538#[serde_with::serde_as]
1539#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1540pub struct EndUserAuthenticationConfigUserPassword {
1541    /// Required. string value or secret version reference containing the password.
1542    pub password: Option<EUASecret>,
1543    /// Username.
1544    pub username: Option<String>,
1545}
1546
1547impl common::Part for EndUserAuthenticationConfigUserPassword {}
1548
1549/// EndUserAuthenticationConfigVariable represents a configuration variable present in a EndUserAuthentication.
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 EndUserAuthenticationConfigVariable {
1557    /// Value is a bool.
1558    #[serde(rename = "boolValue")]
1559    pub bool_value: Option<bool>,
1560    /// Value is an integer
1561    #[serde(rename = "intValue")]
1562    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1563    pub int_value: Option<i64>,
1564    /// Required. Key of the config variable.
1565    pub key: Option<String>,
1566    /// Value is a secret
1567    #[serde(rename = "secretValue")]
1568    pub secret_value: Option<EUASecret>,
1569    /// Value is a string.
1570    #[serde(rename = "stringValue")]
1571    pub string_value: Option<String>,
1572}
1573
1574impl common::Part for EndUserAuthenticationConfigVariable {}
1575
1576/// EndUserAuthentication Status denotes the status of the EndUserAuthentication resource.
1577///
1578/// This type is not used in any activity, and only used as *part* of another schema.
1579///
1580#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1581#[serde_with::serde_as]
1582#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1583pub struct EndUserAuthenticationEndUserAuthenticationStatus {
1584    /// Output only. Description of the state.
1585    pub description: Option<String>,
1586    /// Output only. State of Event Subscription resource.
1587    pub state: Option<String>,
1588}
1589
1590impl common::Part for EndUserAuthenticationEndUserAuthenticationStatus {}
1591
1592/// Message for NotifyEndpointDestination Destination to hit when the refresh token is expired.
1593///
1594/// This type is not used in any activity, and only used as *part* of another schema.
1595///
1596#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1597#[serde_with::serde_as]
1598#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1599pub struct EndUserAuthenticationNotifyEndpointDestination {
1600    /// Optional. OPTION 1: Hit an endpoint when the refresh token is expired.
1601    pub endpoint: Option<EndUserAuthenticationNotifyEndpointDestinationEndPoint>,
1602    /// Required. Service account needed for runtime plane to notify the backend.
1603    #[serde(rename = "serviceAccount")]
1604    pub service_account: Option<String>,
1605    /// Required. type of the destination
1606    #[serde(rename = "type")]
1607    pub type_: Option<String>,
1608}
1609
1610impl common::Part for EndUserAuthenticationNotifyEndpointDestination {}
1611
1612/// Endpoint message includes details of the Destination endpoint.
1613///
1614/// This type is not used in any activity, and only used as *part* of another schema.
1615///
1616#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1617#[serde_with::serde_as]
1618#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1619pub struct EndUserAuthenticationNotifyEndpointDestinationEndPoint {
1620    /// Required. The URI of the Endpoint.
1621    #[serde(rename = "endpointUri")]
1622    pub endpoint_uri: Option<String>,
1623    /// Optional. List of Header to be added to the Endpoint.
1624    pub headers: Option<Vec<EndUserAuthenticationNotifyEndpointDestinationEndPointHeader>>,
1625}
1626
1627impl common::Part for EndUserAuthenticationNotifyEndpointDestinationEndPoint {}
1628
1629/// Header details for a given header to be added to Endpoint.
1630///
1631/// This type is not used in any activity, and only used as *part* of another schema.
1632///
1633#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1634#[serde_with::serde_as]
1635#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1636pub struct EndUserAuthenticationNotifyEndpointDestinationEndPointHeader {
1637    /// Required. Key of Header.
1638    pub key: Option<String>,
1639    /// Required. Value of Header.
1640    pub value: Option<String>,
1641}
1642
1643impl common::Part for EndUserAuthenticationNotifyEndpointDestinationEndPointHeader {}
1644
1645/// represents the Connector’s Endpoint Attachment resource
1646///
1647/// # Activities
1648///
1649/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1650/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1651///
1652/// * [locations endpoint attachments create projects](ProjectLocationEndpointAttachmentCreateCall) (request)
1653/// * [locations endpoint attachments get projects](ProjectLocationEndpointAttachmentGetCall) (response)
1654/// * [locations endpoint attachments patch projects](ProjectLocationEndpointAttachmentPatchCall) (request)
1655#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1656#[serde_with::serde_as]
1657#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1658pub struct EndpointAttachment {
1659    /// Output only. Created time.
1660    #[serde(rename = "createTime")]
1661    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1662    /// Optional. Description of the resource.
1663    pub description: Option<String>,
1664    /// Optional. The Private Service Connect Connection Endpoint Global Access. https://cloud.google.com/vpc/docs/about-accessing-vpc-hosted-services-endpoints#global-access
1665    #[serde(rename = "endpointGlobalAccess")]
1666    pub endpoint_global_access: Option<bool>,
1667    /// Output only. The Private Service Connect connection endpoint ip
1668    #[serde(rename = "endpointIp")]
1669    pub endpoint_ip: Option<String>,
1670    /// Optional. Resource labels to represent user-provided metadata. Refer to cloud documentation on labels for more details. https://cloud.google.com/compute/docs/labeling-resources
1671    pub labels: Option<HashMap<String, String>>,
1672    /// Output only. Resource name of the Endpoint Attachment. Format: projects/{project}/locations/{location}/endpointAttachments/{endpoint_attachment}
1673    pub name: Option<String>,
1674    /// Required. The path of the service attachment
1675    #[serde(rename = "serviceAttachment")]
1676    pub service_attachment: Option<String>,
1677    /// Output only. The Private Service Connect Connection Endpoint State. This value is only available in the Full view.
1678    pub state: Option<String>,
1679    /// Output only. Updated time.
1680    #[serde(rename = "updateTime")]
1681    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1682}
1683
1684impl common::RequestValue for EndpointAttachment {}
1685impl common::ResponseResult for EndpointAttachment {}
1686
1687/// Data enrichment configuration.
1688///
1689/// This type is not used in any activity, and only used as *part* of another schema.
1690///
1691#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1692#[serde_with::serde_as]
1693#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1694pub struct EnrichmentConfig {
1695    /// Optional. Append ACL to the event.
1696    #[serde(rename = "appendAcl")]
1697    pub append_acl: Option<bool>,
1698}
1699
1700impl common::Part for EnrichmentConfig {}
1701
1702/// EnumOption definition
1703///
1704/// This type is not used in any activity, and only used as *part* of another schema.
1705///
1706#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1707#[serde_with::serde_as]
1708#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1709pub struct EnumOption {
1710    /// Optional. Display name of the option.
1711    #[serde(rename = "displayName")]
1712    pub display_name: Option<String>,
1713    /// Optional. Id of the option.
1714    pub id: Option<String>,
1715}
1716
1717impl common::Part for EnumOption {}
1718
1719/// represents the Connector’s EventSubscription resource
1720///
1721/// # Activities
1722///
1723/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1724/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1725///
1726/// * [locations connections event subscriptions create projects](ProjectLocationConnectionEventSubscriptionCreateCall) (request)
1727/// * [locations connections event subscriptions get projects](ProjectLocationConnectionEventSubscriptionGetCall) (response)
1728/// * [locations connections event subscriptions patch projects](ProjectLocationConnectionEventSubscriptionPatchCall) (request)
1729#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1730#[serde_with::serde_as]
1731#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1732pub struct EventSubscription {
1733    /// Output only. Created time.
1734    #[serde(rename = "createTime")]
1735    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1736    /// Optional. The destination to hit when we receive an event
1737    pub destinations: Option<EventSubscriptionDestination>,
1738    /// Optional. Event type id of the event of current EventSubscription.
1739    #[serde(rename = "eventTypeId")]
1740    pub event_type_id: Option<String>,
1741    /// Optional. JMS is the source for the event listener.
1742    pub jms: Option<JMS>,
1743    /// Required. Identifier. Resource name of the EventSubscription. Format: projects/{project}/locations/{location}/connections/{connection}/eventSubscriptions/{event_subscription}
1744    pub name: Option<String>,
1745    /// Optional. Status indicates the status of the event subscription resource
1746    pub status: Option<EventSubscriptionStatus>,
1747    /// Optional. name of the Subscriber for the current EventSubscription.
1748    pub subscriber: Option<String>,
1749    /// Optional. Link for Subscriber of the current EventSubscription.
1750    #[serde(rename = "subscriberLink")]
1751    pub subscriber_link: Option<String>,
1752    /// Optional. Configuration for configuring the trigger
1753    #[serde(rename = "triggerConfigVariables")]
1754    pub trigger_config_variables: Option<Vec<ConfigVariable>>,
1755    /// Output only. Updated time.
1756    #[serde(rename = "updateTime")]
1757    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1758}
1759
1760impl common::RequestValue for EventSubscription {}
1761impl common::ResponseResult for EventSubscription {}
1762
1763/// Message for EventSubscription Destination to act on receiving an event
1764///
1765/// This type is not used in any activity, and only used as *part* of another schema.
1766///
1767#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1768#[serde_with::serde_as]
1769#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1770pub struct EventSubscriptionDestination {
1771    /// OPTION 1: Hit an endpoint when we receive an event.
1772    pub endpoint: Option<EndPoint>,
1773    /// OPTION 3: Write the event to Pub/Sub topic.
1774    pub pubsub: Option<PubSub>,
1775    /// Optional. Service account needed for runtime plane to trigger IP workflow.
1776    #[serde(rename = "serviceAccount")]
1777    pub service_account: Option<String>,
1778    /// Optional. type of the destination
1779    #[serde(rename = "type")]
1780    pub type_: Option<String>,
1781}
1782
1783impl common::Part for EventSubscriptionDestination {}
1784
1785/// EventSubscription Status denotes the status of the EventSubscription resource.
1786///
1787/// This type is not used in any activity, and only used as *part* of another schema.
1788///
1789#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1790#[serde_with::serde_as]
1791#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1792pub struct EventSubscriptionStatus {
1793    /// Output only. Description of the state.
1794    pub description: Option<String>,
1795    /// Output only. State of Event Subscription resource.
1796    pub state: Option<String>,
1797}
1798
1799impl common::Part for EventSubscriptionStatus {}
1800
1801/// EventType includes fields.
1802///
1803/// # Activities
1804///
1805/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1806/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1807///
1808/// * [locations providers connectors versions eventtypes get projects](ProjectLocationProviderConnectorVersionEventtypeGetCall) (response)
1809#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1810#[serde_with::serde_as]
1811#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1812pub struct EventType {
1813    /// Output only. Created time.
1814    #[serde(rename = "createTime")]
1815    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1816    /// Output only. Schema of the event payload after enriched. Will be null if read before send is not supported.
1817    #[serde(rename = "enrichedEventPayloadSchema")]
1818    pub enriched_event_payload_schema: Option<String>,
1819    /// Output only. Runtime entity type name. Will be null if entity type map is not available. Used for read before send feature.
1820    #[serde(rename = "entityType")]
1821    pub entity_type: Option<String>,
1822    /// Output only. Schema of webhook event payload.
1823    #[serde(rename = "eventPayloadSchema")]
1824    pub event_payload_schema: Option<String>,
1825    /// Output only. Event type id. Example: `ticket.created`.
1826    #[serde(rename = "eventTypeId")]
1827    pub event_type_id: Option<String>,
1828    /// Output only. Id path denotes the path of id in webhook payload.
1829    #[serde(rename = "idPath")]
1830    pub id_path: Option<String>,
1831    /// Output only. Resource name of the eventtype. Format: projects/{project}/locations/{location}/providers/{provider}/connectors/{connector}/versions/{version}/eventtypes/{eventtype} Only global location is supported for Connector resource.
1832    pub name: Option<String>,
1833    /// Output only. Updated time.
1834    #[serde(rename = "updateTime")]
1835    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1836}
1837
1838impl common::ResponseResult for EventType {}
1839
1840/// Eventing Configuration of a connection next: 19
1841///
1842/// This type is not used in any activity, and only used as *part* of another schema.
1843///
1844#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1845#[serde_with::serde_as]
1846#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1847pub struct EventingConfig {
1848    /// Optional. Additional eventing related field values
1849    #[serde(rename = "additionalVariables")]
1850    pub additional_variables: Option<Vec<ConfigVariable>>,
1851    /// Optional. Auth details for the webhook adapter.
1852    #[serde(rename = "authConfig")]
1853    pub auth_config: Option<AuthConfig>,
1854    /// Optional. Dead letter configuration for eventing of a connection.
1855    #[serde(rename = "deadLetterConfig")]
1856    pub dead_letter_config: Option<DeadLetterConfig>,
1857    /// Optional. Data enrichment configuration.
1858    #[serde(rename = "enrichmentConfig")]
1859    pub enrichment_config: Option<EnrichmentConfig>,
1860    /// Optional. Enrichment Enabled.
1861    #[serde(rename = "enrichmentEnabled")]
1862    pub enrichment_enabled: Option<bool>,
1863    /// Optional. Ingress endpoint of the event listener. This is used only when private connectivity is enabled.
1864    #[serde(rename = "eventsListenerIngressEndpoint")]
1865    pub events_listener_ingress_endpoint: Option<String>,
1866    /// Optional. Auth details for the event listener.
1867    #[serde(rename = "listenerAuthConfig")]
1868    pub listener_auth_config: Option<AuthConfig>,
1869    /// Optional. List of projects to be allowlisted for the service attachment created in the tenant project for eventing ingress.
1870    #[serde(rename = "privateConnectivityAllowlistedProjects")]
1871    pub private_connectivity_allowlisted_projects: Option<Vec<String>>,
1872    /// Optional. Private Connectivity Enabled.
1873    #[serde(rename = "privateConnectivityEnabled")]
1874    pub private_connectivity_enabled: Option<bool>,
1875    /// Optional. Proxy for Eventing auto-registration.
1876    #[serde(rename = "proxyDestinationConfig")]
1877    pub proxy_destination_config: Option<DestinationConfig>,
1878    /// Optional. Registration endpoint for auto registration.
1879    #[serde(rename = "registrationDestinationConfig")]
1880    pub registration_destination_config: Option<DestinationConfig>,
1881    /// Optional. Ssl config of a connection
1882    #[serde(rename = "sslConfig")]
1883    pub ssl_config: Option<SslConfig>,
1884}
1885
1886impl common::Part for EventingConfig {}
1887
1888/// Eventing Config details of a connector version. next: 14
1889///
1890/// This type is not used in any activity, and only used as *part* of another schema.
1891///
1892#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1893#[serde_with::serde_as]
1894#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1895pub struct EventingConfigTemplate {
1896    /// Additional fields that need to be rendered.
1897    #[serde(rename = "additionalVariables")]
1898    pub additional_variables: Option<Vec<ConfigVariableTemplate>>,
1899    /// AuthConfigTemplates represents the auth values for the webhook adapter.
1900    #[serde(rename = "authConfigTemplates")]
1901    pub auth_config_templates: Option<Vec<AuthConfigTemplate>>,
1902    /// Auto refresh to extend webhook life.
1903    #[serde(rename = "autoRefresh")]
1904    pub auto_refresh: Option<bool>,
1905    /// Auto Registration supported.
1906    #[serde(rename = "autoRegistrationSupported")]
1907    pub auto_registration_supported: Option<bool>,
1908    /// Encryption key (can be either Google managed or CMEK).
1909    #[serde(rename = "encryptionKeyTemplate")]
1910    pub encryption_key_template: Option<ConfigVariableTemplate>,
1911    /// Enrichment Supported.
1912    #[serde(rename = "enrichmentSupported")]
1913    pub enrichment_supported: Option<bool>,
1914    /// The type of the event listener for a specific connector.
1915    #[serde(rename = "eventListenerType")]
1916    pub event_listener_type: Option<String>,
1917    /// Is Eventing Supported.
1918    #[serde(rename = "isEventingSupported")]
1919    pub is_eventing_supported: Option<bool>,
1920    /// ListenerAuthConfigTemplates represents the auth values for the event listener.
1921    #[serde(rename = "listenerAuthConfigTemplates")]
1922    pub listener_auth_config_templates: Option<Vec<AuthConfigTemplate>>,
1923    /// Proxy destination config template.
1924    #[serde(rename = "proxyDestinationConfig")]
1925    pub proxy_destination_config: Option<DestinationConfigTemplate>,
1926    /// Registration host destination config template.
1927    #[serde(rename = "registrationDestinationConfig")]
1928    pub registration_destination_config: Option<DestinationConfigTemplate>,
1929    /// SSL Config template for the connector version.
1930    #[serde(rename = "sslConfigTemplate")]
1931    pub ssl_config_template: Option<SslConfigTemplate>,
1932    /// Trigger Config fields that needs to be rendered
1933    #[serde(rename = "triggerConfigVariables")]
1934    pub trigger_config_variables: Option<Vec<ConfigVariableTemplate>>,
1935}
1936
1937impl common::Part for EventingConfigTemplate {}
1938
1939/// Eventing Details message.
1940///
1941/// This type is not used in any activity, and only used as *part* of another schema.
1942///
1943#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1944#[serde_with::serde_as]
1945#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1946pub struct EventingDetails {
1947    /// Output only. Custom Event Types.
1948    #[serde(rename = "customEventTypes")]
1949    pub custom_event_types: Option<bool>,
1950    /// Output only. Description.
1951    pub description: Option<String>,
1952    /// Output only. Link to public documentation.
1953    #[serde(rename = "documentationLink")]
1954    pub documentation_link: Option<String>,
1955    /// Output only. Cloud storage location of the icon.
1956    #[serde(rename = "iconLocation")]
1957    pub icon_location: Option<String>,
1958    /// Output only. Eventing Launch Stage.
1959    #[serde(rename = "launchStage")]
1960    pub launch_stage: Option<String>,
1961    /// Output only. Name of the Eventing trigger.
1962    pub name: Option<String>,
1963    /// Output only. Array of search keywords.
1964    #[serde(rename = "searchTags")]
1965    pub search_tags: Option<Vec<String>>,
1966    /// Output only. The type of the event listener for a specific connector.
1967    #[serde(rename = "type")]
1968    pub type_: Option<String>,
1969}
1970
1971impl common::Part for EventingDetails {}
1972
1973/// Eventing runtime data has the details related to eventing managed by the system.
1974///
1975/// This type is not used in any activity, and only used as *part* of another schema.
1976///
1977#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1978#[serde_with::serde_as]
1979#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1980pub struct EventingRuntimeData {
1981    /// Output only. Events listener endpoint. The value will populated after provisioning the events listener.
1982    #[serde(rename = "eventsListenerEndpoint")]
1983    pub events_listener_endpoint: Option<String>,
1984    /// Output only. Events listener PSC Service attachment. The value will be populated after provisioning the events listener with private connectivity enabled.
1985    #[serde(rename = "eventsListenerPscSa")]
1986    pub events_listener_psc_sa: Option<String>,
1987    /// Output only. Current status of eventing.
1988    pub status: Option<EventingStatus>,
1989    /// Output only. Webhook data.
1990    #[serde(rename = "webhookData")]
1991    pub webhook_data: Option<WebhookData>,
1992    /// Output only. Webhook subscriptions.
1993    #[serde(rename = "webhookSubscriptions")]
1994    pub webhook_subscriptions: Option<WebhookSubscriptions>,
1995}
1996
1997impl common::Part for EventingRuntimeData {}
1998
1999/// EventingStatus indicates the state of eventing.
2000///
2001/// This type is not used in any activity, and only used as *part* of another schema.
2002///
2003#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2004#[serde_with::serde_as]
2005#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2006pub struct EventingStatus {
2007    /// Output only. Description of error if State is set to "ERROR".
2008    pub description: Option<String>,
2009    /// Output only. State.
2010    pub state: Option<String>,
2011}
2012
2013impl common::Part for EventingStatus {}
2014
2015/// 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.
2016///
2017/// This type is not used in any activity, and only used as *part* of another schema.
2018///
2019#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2020#[serde_with::serde_as]
2021#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2022pub struct Expr {
2023    /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
2024    pub description: Option<String>,
2025    /// Textual representation of an expression in Common Expression Language syntax.
2026    pub expression: Option<String>,
2027    /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
2028    pub location: Option<String>,
2029    /// 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.
2030    pub title: Option<String>,
2031}
2032
2033impl common::Part for Expr {}
2034
2035/// Extraction Rule.
2036///
2037/// This type is not used in any activity, and only used as *part* of another schema.
2038///
2039#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2040#[serde_with::serde_as]
2041#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2042pub struct ExtractionRule {
2043    /// Regex used to extract backend details from source. If empty, whole source value will be used.
2044    #[serde(rename = "extractionRegex")]
2045    pub extraction_regex: Option<String>,
2046    /// Source on which the rule is applied.
2047    pub source: Option<Source>,
2048}
2049
2050impl common::Part for ExtractionRule {}
2051
2052/// Extraction Rules to identity the backends from customer provided configuration in Connection resource.
2053///
2054/// This type is not used in any activity, and only used as *part* of another schema.
2055///
2056#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2057#[serde_with::serde_as]
2058#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2059pub struct ExtractionRules {
2060    /// Collection of Extraction Rule.
2061    #[serde(rename = "extractionRule")]
2062    pub extraction_rule: Option<Vec<ExtractionRule>>,
2063}
2064
2065impl common::Part for ExtractionRules {}
2066
2067/// Response message for Connectors.GetAuthSchema.
2068///
2069/// # Activities
2070///
2071/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2072/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2073///
2074/// * [locations providers connectors versions fetch auth schema projects](ProjectLocationProviderConnectorVersionFetchAuthSchemaCall) (response)
2075#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2076#[serde_with::serde_as]
2077#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2078pub struct FetchAuthSchemaResponse {
2079    /// List of AuthSchemas.
2080    #[serde(rename = "authSchemas")]
2081    pub auth_schemas: Option<Vec<AuthSchema>>,
2082    /// JSON schema of the AuthSchemas. This is only populated if the view is JSON_SCHEMA. The schema is in draft-07 format.
2083    #[serde(rename = "jsonSchema")]
2084    pub json_schema: Option<JsonAuthSchema>,
2085}
2086
2087impl common::ResponseResult for FetchAuthSchemaResponse {}
2088
2089/// Metadata of an entity field.
2090///
2091/// This type is not used in any activity, and only used as *part* of another schema.
2092///
2093#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2094#[serde_with::serde_as]
2095#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2096pub struct Field {
2097    /// The following map contains fields that are not explicitly mentioned above,this give connectors the flexibility to add new metadata fields.
2098    #[serde(rename = "additionalDetails")]
2099    pub additional_details: Option<HashMap<String, serde_json::Value>>,
2100    /// The data type of the Field.
2101    #[serde(rename = "dataType")]
2102    pub data_type: Option<String>,
2103    /// The following field specifies the default value of the Field provided by the external system if a value is not provided.
2104    #[serde(rename = "defaultValue")]
2105    pub default_value: Option<serde_json::Value>,
2106    /// A brief description of the Field.
2107    pub description: Option<String>,
2108    /// Name of the Field.
2109    pub field: Option<String>,
2110    /// JsonSchema representation of this entity's schema
2111    #[serde(rename = "jsonSchema")]
2112    pub json_schema: Option<JsonSchema>,
2113    /// The following boolean field specifies if the current Field acts as a primary key or id if the parent is of type entity.
2114    pub key: Option<bool>,
2115    /// Specifies whether a null value is allowed.
2116    pub nullable: Option<bool>,
2117    /// Specifies if the Field is readonly.
2118    pub readonly: Option<bool>,
2119}
2120
2121impl common::Part for Field {}
2122
2123/// Field that needs to be compared.
2124///
2125/// This type is not used in any activity, and only used as *part* of another schema.
2126///
2127#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2128#[serde_with::serde_as]
2129#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2130pub struct FieldComparison {
2131    /// Boolean value
2132    #[serde(rename = "boolValue")]
2133    pub bool_value: Option<bool>,
2134    /// Optional. Comparator to use for comparing the field value.
2135    pub comparator: Option<String>,
2136    /// Integer value
2137    #[serde(rename = "intValue")]
2138    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2139    pub int_value: Option<i64>,
2140    /// Optional. Key of the field.
2141    pub key: Option<String>,
2142    /// String value
2143    #[serde(rename = "stringValue")]
2144    pub string_value: Option<String>,
2145}
2146
2147impl common::Part for FieldComparison {}
2148
2149/// Autoscaling config for connector deployment system metrics.
2150///
2151/// This type is not used in any activity, and only used as *part* of another schema.
2152///
2153#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2154#[serde_with::serde_as]
2155#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2156pub struct HPAConfig {
2157    /// Output only. Percent CPU utilization where HPA triggers autoscaling.
2158    #[serde(rename = "cpuUtilizationThreshold")]
2159    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2160    pub cpu_utilization_threshold: Option<i64>,
2161    /// Output only. Percent Memory utilization where HPA triggers autoscaling.
2162    #[serde(rename = "memoryUtilizationThreshold")]
2163    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2164    pub memory_utilization_threshold: Option<i64>,
2165}
2166
2167impl common::Part for HPAConfig {}
2168
2169/// Header details for a given header to be added to Endpoint.
2170///
2171/// This type is not used in any activity, and only used as *part* of another schema.
2172///
2173#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2174#[serde_with::serde_as]
2175#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2176pub struct Header {
2177    /// Optional. Key of Header.
2178    pub key: Option<String>,
2179    /// Optional. Value of Header.
2180    pub value: Option<String>,
2181}
2182
2183impl common::Part for Header {}
2184
2185/// Metadata of an input parameter.
2186///
2187/// This type is not used in any activity, and only used as *part* of another schema.
2188///
2189#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2190#[serde_with::serde_as]
2191#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2192pub struct InputParameter {
2193    /// The data type of the Parameter.
2194    #[serde(rename = "dataType")]
2195    pub data_type: Option<String>,
2196    /// The following field specifies the default value of the Parameter provided by the external system if a value is not provided.
2197    #[serde(rename = "defaultValue")]
2198    pub default_value: Option<serde_json::Value>,
2199    /// A brief description of the Parameter.
2200    pub description: Option<String>,
2201    /// JsonSchema representation of this action's parameter
2202    #[serde(rename = "jsonSchema")]
2203    pub json_schema: Option<JsonSchema>,
2204    /// Specifies whether a null value is allowed.
2205    pub nullable: Option<bool>,
2206    /// Name of the Parameter.
2207    pub parameter: Option<String>,
2208}
2209
2210impl common::Part for InputParameter {}
2211
2212/// JMS message denotes the source of the event
2213///
2214/// This type is not used in any activity, and only used as *part* of another schema.
2215///
2216#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2217#[serde_with::serde_as]
2218#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2219pub struct JMS {
2220    /// Optional. Name of the JMS source. i.e. queueName or topicName
2221    pub name: Option<String>,
2222    /// Optional. Type of the JMS Source. i.e. Queue or Topic
2223    #[serde(rename = "type")]
2224    pub type_: Option<String>,
2225}
2226
2227impl common::Part for JMS {}
2228
2229/// JsonAuthSchema defines the JSON schema of all authentication types.
2230///
2231/// This type is not used in any activity, and only used as *part* of another schema.
2232///
2233#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2234#[serde_with::serde_as]
2235#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2236pub struct JsonAuthSchema {
2237    /// JSON schema of the AuthSchemas.
2238    #[serde(rename = "$schema")]
2239    pub schema: Option<String>,
2240    /// List of AuthObjects.
2241    #[serde(rename = "oneOf")]
2242    pub one_of: Option<Vec<AuthObject>>,
2243}
2244
2245impl common::Part for JsonAuthSchema {}
2246
2247/// JsonSchema representation of schema metadata
2248///
2249/// This type is not used in any activity, and only used as *part* of another schema.
2250///
2251#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2252#[serde_with::serde_as]
2253#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2254pub struct JsonSchema {
2255    /// Additional details apart from standard json schema fields, this gives flexibility to store metadata about the schema
2256    #[serde(rename = "additionalDetails")]
2257    pub additional_details: Option<HashMap<String, serde_json::Value>>,
2258    /// The default value of the field or object described by this schema.
2259    pub default: Option<serde_json::Value>,
2260    /// A description of this schema.
2261    pub description: Option<String>,
2262    /// Possible values for an enumeration. This works in conjunction with `type` to represent types with a fixed set of legal values
2263    #[serde(rename = "enum")]
2264    pub enum_: Option<Vec<serde_json::Value>>,
2265    /// Format of the value as per https://json-schema.org/understanding-json-schema/reference/string.html#format
2266    pub format: Option<String>,
2267    /// Schema that applies to array values, applicable only if this is of type `array`.
2268    pub items: Option<Option<Box<JsonSchema>>>,
2269    /// JDBC datatype of the field.
2270    #[serde(rename = "jdbcType")]
2271    pub jdbc_type: Option<String>,
2272    /// The child schemas, applicable only if this is of type `object`. The key is the name of the property and the value is the json schema that describes that property
2273    pub properties: Option<HashMap<String, JsonSchema>>,
2274    /// Whether this property is required.
2275    pub required: Option<Vec<String>>,
2276    /// JSON Schema Validation: A Vocabulary for Structural Validation of JSON
2277    #[serde(rename = "type")]
2278    pub type_: Option<Vec<String>>,
2279}
2280
2281impl common::Part for JsonSchema {}
2282
2283/// JWT claims used for the jwt-bearer authorization grant.
2284///
2285/// This type is not used in any activity, and only used as *part* of another schema.
2286///
2287#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2288#[serde_with::serde_as]
2289#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2290pub struct JwtClaims {
2291    /// Optional. Value for the "aud" claim.
2292    pub audience: Option<String>,
2293    /// Optional. Value for the "iss" claim.
2294    pub issuer: Option<String>,
2295    /// Optional. Value for the "sub" claim.
2296    pub subject: Option<String>,
2297}
2298
2299impl common::Part for JwtClaims {}
2300
2301/// Response message for ListActions API
2302///
2303/// # Activities
2304///
2305/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2306/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2307///
2308/// * [locations connections connection schema metadata list actions projects](ProjectLocationConnectionConnectionSchemaMetadataListActionCall) (response)
2309#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2310#[serde_with::serde_as]
2311#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2312pub struct ListActionsResponse {
2313    /// list of actions
2314    pub actions: Option<Vec<RuntimeActionSchema>>,
2315    /// token for next page
2316    #[serde(rename = "nextPageToken")]
2317    pub next_page_token: Option<String>,
2318}
2319
2320impl common::ResponseResult for ListActionsResponse {}
2321
2322/// Response message for ConnectorsService.ListConnections
2323///
2324/// # Activities
2325///
2326/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2327/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2328///
2329/// * [locations connections list projects](ProjectLocationConnectionListCall) (response)
2330#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2331#[serde_with::serde_as]
2332#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2333pub struct ListConnectionsResponse {
2334    /// Connections.
2335    pub connections: Option<Vec<Connection>>,
2336    /// Next page token.
2337    #[serde(rename = "nextPageToken")]
2338    pub next_page_token: Option<String>,
2339    /// Locations that could not be reached.
2340    pub unreachable: Option<Vec<String>>,
2341}
2342
2343impl common::ResponseResult for ListConnectionsResponse {}
2344
2345/// Response message for Connectors.ListConnectorVersions.
2346///
2347/// # Activities
2348///
2349/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2350/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2351///
2352/// * [locations providers connectors versions list projects](ProjectLocationProviderConnectorVersionListCall) (response)
2353#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2354#[serde_with::serde_as]
2355#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2356pub struct ListConnectorVersionsResponse {
2357    /// A list of connector versions.
2358    #[serde(rename = "connectorVersions")]
2359    pub connector_versions: Option<Vec<ConnectorVersion>>,
2360    /// Next page token.
2361    #[serde(rename = "nextPageToken")]
2362    pub next_page_token: Option<String>,
2363    /// Locations that could not be reached.
2364    pub unreachable: Option<Vec<String>>,
2365}
2366
2367impl common::ResponseResult for ListConnectorVersionsResponse {}
2368
2369/// Response message for Connectors.ListConnectors.
2370///
2371/// # Activities
2372///
2373/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2374/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2375///
2376/// * [locations providers connectors list projects](ProjectLocationProviderConnectorListCall) (response)
2377#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2378#[serde_with::serde_as]
2379#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2380pub struct ListConnectorsResponse {
2381    /// A list of connectors.
2382    pub connectors: Option<Vec<Connector>>,
2383    /// Next page token.
2384    #[serde(rename = "nextPageToken")]
2385    pub next_page_token: Option<String>,
2386    /// Locations that could not be reached.
2387    pub unreachable: Option<Vec<String>>,
2388}
2389
2390impl common::ResponseResult for ListConnectorsResponse {}
2391
2392/// Response message for Connectors.ListCustomConnectorVersions.
2393///
2394/// # Activities
2395///
2396/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2397/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2398///
2399/// * [locations global custom connectors custom connector versions list projects](ProjectLocationGlobalCustomConnectorCustomConnectorVersionListCall) (response)
2400#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2401#[serde_with::serde_as]
2402#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2403pub struct ListCustomConnectorVersionsResponse {
2404    /// A list of connector versions.
2405    #[serde(rename = "customConnectorVersions")]
2406    pub custom_connector_versions: Option<Vec<CustomConnectorVersion>>,
2407    /// Next page token.
2408    #[serde(rename = "nextPageToken")]
2409    pub next_page_token: Option<String>,
2410    /// Locations that could not be reached.
2411    pub unreachable: Option<Vec<String>>,
2412}
2413
2414impl common::ResponseResult for ListCustomConnectorVersionsResponse {}
2415
2416/// Response message for Connectors.ListCustomConnectors.
2417///
2418/// # Activities
2419///
2420/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2421/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2422///
2423/// * [locations global custom connectors list projects](ProjectLocationGlobalCustomConnectorListCall) (response)
2424#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2425#[serde_with::serde_as]
2426#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2427pub struct ListCustomConnectorsResponse {
2428    /// A list of customConnectors.
2429    #[serde(rename = "customConnectors")]
2430    pub custom_connectors: Option<Vec<CustomConnector>>,
2431    /// Next page token.
2432    #[serde(rename = "nextPageToken")]
2433    pub next_page_token: Option<String>,
2434    /// Locations that could not be reached.
2435    pub unreachable: Option<Vec<String>>,
2436}
2437
2438impl common::ResponseResult for ListCustomConnectorsResponse {}
2439
2440/// Response message for ConnectorsService.ListEndUserAuthentications
2441///
2442/// # Activities
2443///
2444/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2445/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2446///
2447/// * [locations connections end user authentications list projects](ProjectLocationConnectionEndUserAuthenticationListCall) (response)
2448#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2449#[serde_with::serde_as]
2450#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2451pub struct ListEndUserAuthenticationsResponse {
2452    /// Subscriptions.
2453    #[serde(rename = "endUserAuthentications")]
2454    pub end_user_authentications: Option<Vec<EndUserAuthentication>>,
2455    /// Next page token.
2456    #[serde(rename = "nextPageToken")]
2457    pub next_page_token: Option<String>,
2458    /// Locations that could not be reached.
2459    pub unreachable: Option<Vec<String>>,
2460}
2461
2462impl common::ResponseResult for ListEndUserAuthenticationsResponse {}
2463
2464/// Response message for ConnectorsService.ListEndpointAttachments
2465///
2466/// # Activities
2467///
2468/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2469/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2470///
2471/// * [locations endpoint attachments list projects](ProjectLocationEndpointAttachmentListCall) (response)
2472#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2473#[serde_with::serde_as]
2474#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2475pub struct ListEndpointAttachmentsResponse {
2476    /// EndpointAttachments.
2477    #[serde(rename = "endpointAttachments")]
2478    pub endpoint_attachments: Option<Vec<EndpointAttachment>>,
2479    /// Next page token.
2480    #[serde(rename = "nextPageToken")]
2481    pub next_page_token: Option<String>,
2482    /// Locations that could not be reached.
2483    pub unreachable: Option<Vec<String>>,
2484}
2485
2486impl common::ResponseResult for ListEndpointAttachmentsResponse {}
2487
2488/// Response message for ListEntityTypes API
2489///
2490/// # Activities
2491///
2492/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2493/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2494///
2495/// * [locations connections connection schema metadata list entity types projects](ProjectLocationConnectionConnectionSchemaMetadataListEntityTypeCall) (response)
2496#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2497#[serde_with::serde_as]
2498#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2499pub struct ListEntityTypesResponse {
2500    /// list of entity types
2501    #[serde(rename = "entityTypes")]
2502    pub entity_types: Option<Vec<RuntimeEntitySchema>>,
2503    /// token for next page
2504    #[serde(rename = "nextPageToken")]
2505    pub next_page_token: Option<String>,
2506}
2507
2508impl common::ResponseResult for ListEntityTypesResponse {}
2509
2510/// Response message for ConnectorsService.ListEventSubscriptions
2511///
2512/// # Activities
2513///
2514/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2515/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2516///
2517/// * [locations connections event subscriptions list projects](ProjectLocationConnectionEventSubscriptionListCall) (response)
2518#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2519#[serde_with::serde_as]
2520#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2521pub struct ListEventSubscriptionsResponse {
2522    /// Subscriptions.
2523    #[serde(rename = "eventSubscriptions")]
2524    pub event_subscriptions: Option<Vec<EventSubscription>>,
2525    /// Next page token.
2526    #[serde(rename = "nextPageToken")]
2527    pub next_page_token: Option<String>,
2528    /// Locations that could not be reached.
2529    pub unreachable: Option<Vec<String>>,
2530}
2531
2532impl common::ResponseResult for ListEventSubscriptionsResponse {}
2533
2534/// Response message for Connectors.ListEventTypes.
2535///
2536/// # Activities
2537///
2538/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2539/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2540///
2541/// * [locations providers connectors versions eventtypes list projects](ProjectLocationProviderConnectorVersionEventtypeListCall) (response)
2542#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2543#[serde_with::serde_as]
2544#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2545pub struct ListEventTypesResponse {
2546    /// A list of connector versions.
2547    #[serde(rename = "eventTypes")]
2548    pub event_types: Option<Vec<EventType>>,
2549    /// Next page token.
2550    #[serde(rename = "nextPageToken")]
2551    pub next_page_token: Option<String>,
2552}
2553
2554impl common::ResponseResult for ListEventTypesResponse {}
2555
2556/// The response message for Locations.ListLocations.
2557///
2558/// # Activities
2559///
2560/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2561/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2562///
2563/// * [locations list projects](ProjectLocationListCall) (response)
2564#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2565#[serde_with::serde_as]
2566#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2567pub struct ListLocationsResponse {
2568    /// A list of locations that matches the specified filter in the request.
2569    pub locations: Option<Vec<Location>>,
2570    /// The standard List next-page token.
2571    #[serde(rename = "nextPageToken")]
2572    pub next_page_token: Option<String>,
2573}
2574
2575impl common::ResponseResult for ListLocationsResponse {}
2576
2577/// Response message for ConnectorsService.ListManagedZones
2578///
2579/// # Activities
2580///
2581/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2582/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2583///
2584/// * [locations global managed zones list projects](ProjectLocationGlobalManagedZoneListCall) (response)
2585#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2586#[serde_with::serde_as]
2587#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2588pub struct ListManagedZonesResponse {
2589    /// ManagedZones.
2590    #[serde(rename = "managedZones")]
2591    pub managed_zones: Option<Vec<ManagedZone>>,
2592    /// Next page token.
2593    #[serde(rename = "nextPageToken")]
2594    pub next_page_token: Option<String>,
2595    /// Locations that could not be reached.
2596    pub unreachable: Option<Vec<String>>,
2597}
2598
2599impl common::ResponseResult for ListManagedZonesResponse {}
2600
2601/// The response message for Operations.ListOperations.
2602///
2603/// # Activities
2604///
2605/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2606/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2607///
2608/// * [locations operations list projects](ProjectLocationOperationListCall) (response)
2609#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2610#[serde_with::serde_as]
2611#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2612pub struct ListOperationsResponse {
2613    /// The standard List next-page token.
2614    #[serde(rename = "nextPageToken")]
2615    pub next_page_token: Option<String>,
2616    /// A list of operations that matches the specified filter in the request.
2617    pub operations: Option<Vec<Operation>>,
2618    /// Unordered list. Unreachable resources. Populated when the request sets `ListOperationsRequest.return_partial_success` and reads across collections e.g. when attempting to list all resources across all supported locations.
2619    pub unreachable: Option<Vec<String>>,
2620}
2621
2622impl common::ResponseResult for ListOperationsResponse {}
2623
2624/// Response message for Connectors.ListProviders.
2625///
2626/// # Activities
2627///
2628/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2629/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2630///
2631/// * [locations providers list projects](ProjectLocationProviderListCall) (response)
2632#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2633#[serde_with::serde_as]
2634#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2635pub struct ListProvidersResponse {
2636    /// Next page token.
2637    #[serde(rename = "nextPageToken")]
2638    pub next_page_token: Option<String>,
2639    /// A list of providers.
2640    pub providers: Option<Vec<Provider>>,
2641    /// Locations that could not be reached.
2642    pub unreachable: Option<Vec<String>>,
2643}
2644
2645impl common::ResponseResult for ListProvidersResponse {}
2646
2647/// Response message for ConnectorsService.ListRuntimeActionSchemas.
2648///
2649/// # Activities
2650///
2651/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2652/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2653///
2654/// * [locations connections runtime action schemas list projects](ProjectLocationConnectionRuntimeActionSchemaListCall) (response)
2655#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2656#[serde_with::serde_as]
2657#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2658pub struct ListRuntimeActionSchemasResponse {
2659    /// Next page token.
2660    #[serde(rename = "nextPageToken")]
2661    pub next_page_token: Option<String>,
2662    /// Runtime action schemas.
2663    #[serde(rename = "runtimeActionSchemas")]
2664    pub runtime_action_schemas: Option<Vec<RuntimeActionSchema>>,
2665}
2666
2667impl common::ResponseResult for ListRuntimeActionSchemasResponse {}
2668
2669/// Response message for ConnectorsService.ListRuntimeEntitySchemas.
2670///
2671/// # Activities
2672///
2673/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2674/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2675///
2676/// * [locations connections runtime entity schemas list projects](ProjectLocationConnectionRuntimeEntitySchemaListCall) (response)
2677#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2678#[serde_with::serde_as]
2679#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2680pub struct ListRuntimeEntitySchemasResponse {
2681    /// Next page token.
2682    #[serde(rename = "nextPageToken")]
2683    pub next_page_token: Option<String>,
2684    /// Runtime entity schemas.
2685    #[serde(rename = "runtimeEntitySchemas")]
2686    pub runtime_entity_schemas: Option<Vec<RuntimeEntitySchema>>,
2687}
2688
2689impl common::ResponseResult for ListRuntimeEntitySchemasResponse {}
2690
2691/// Expected request for ListenEvent API.
2692///
2693/// # Activities
2694///
2695/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2696/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2697///
2698/// * [locations connections listen event projects](ProjectLocationConnectionListenEventCall) (request)
2699#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2700#[serde_with::serde_as]
2701#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2702pub struct ListenEventRequest {
2703    /// Optional. Request payload.
2704    pub payload: Option<HashMap<String, serde_json::Value>>,
2705}
2706
2707impl common::RequestValue for ListenEventRequest {}
2708
2709/// Expected response for ListenEvent API.
2710///
2711/// # Activities
2712///
2713/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2714/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2715///
2716/// * [locations connections listen event projects](ProjectLocationConnectionListenEventCall) (response)
2717#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2718#[serde_with::serde_as]
2719#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2720pub struct ListenEventResponse {
2721    _never_set: Option<bool>,
2722}
2723
2724impl common::ResponseResult for ListenEventResponse {}
2725
2726/// A resource that represents a Google Cloud location.
2727///
2728/// # Activities
2729///
2730/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2731/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2732///
2733/// * [locations get projects](ProjectLocationGetCall) (response)
2734#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2735#[serde_with::serde_as]
2736#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2737pub struct Location {
2738    /// The friendly name for this location, typically a nearby city name. For example, "Tokyo".
2739    #[serde(rename = "displayName")]
2740    pub display_name: Option<String>,
2741    /// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"}
2742    pub labels: Option<HashMap<String, String>>,
2743    /// The canonical id for this location. For example: `"us-east1"`.
2744    #[serde(rename = "locationId")]
2745    pub location_id: Option<String>,
2746    /// Service-specific metadata. For example the available capacity at the given location.
2747    pub metadata: Option<HashMap<String, serde_json::Value>>,
2748    /// Resource name for the location, which may vary between implementations. For example: `"projects/example-project/locations/us-east1"`
2749    pub name: Option<String>,
2750}
2751
2752impl common::ResponseResult for Location {}
2753
2754/// Determines whether or no a connection is locked. If locked, a reason must be specified.
2755///
2756/// This type is not used in any activity, and only used as *part* of another schema.
2757///
2758#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2759#[serde_with::serde_as]
2760#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2761pub struct LockConfig {
2762    /// Optional. Indicates whether or not the connection is locked.
2763    pub locked: Option<bool>,
2764    /// Optional. Describes why a connection is locked.
2765    pub reason: Option<String>,
2766}
2767
2768impl common::Part for LockConfig {}
2769
2770/// Struct for representing boolean expressions.
2771///
2772/// This type is not used in any activity, and only used as *part* of another schema.
2773///
2774#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2775#[serde_with::serde_as]
2776#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2777pub struct LogicalExpression {
2778    /// Optional. A list of fields to be compared.
2779    #[serde(rename = "fieldComparisons")]
2780    pub field_comparisons: Option<Vec<FieldComparison>>,
2781    /// Optional. A list of nested conditions to be compared.
2782    #[serde(rename = "logicalExpressions")]
2783    pub logical_expressions: Option<Vec<LogicalExpression>>,
2784    /// Optional. The logical operator to use between the fields and conditions.
2785    #[serde(rename = "logicalOperator")]
2786    pub logical_operator: Option<String>,
2787}
2788
2789impl common::Part for LogicalExpression {}
2790
2791/// represents the Connector’s Managed Zone resource
2792///
2793/// # Activities
2794///
2795/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2796/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2797///
2798/// * [locations global managed zones create projects](ProjectLocationGlobalManagedZoneCreateCall) (request)
2799/// * [locations global managed zones get projects](ProjectLocationGlobalManagedZoneGetCall) (response)
2800/// * [locations global managed zones patch projects](ProjectLocationGlobalManagedZonePatchCall) (request)
2801#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2802#[serde_with::serde_as]
2803#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2804pub struct ManagedZone {
2805    /// Output only. Created time.
2806    #[serde(rename = "createTime")]
2807    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2808    /// Optional. Description of the resource.
2809    pub description: Option<String>,
2810    /// Required. DNS Name of the resource
2811    pub dns: Option<String>,
2812    /// Optional. Resource labels to represent user-provided metadata. Refer to cloud documentation on labels for more details. https://cloud.google.com/compute/docs/labeling-resources
2813    pub labels: Option<HashMap<String, String>>,
2814    /// Output only. Resource name of the Managed Zone. Format: projects/{project}/locations/global/managedZones/{managed_zone}
2815    pub name: Option<String>,
2816    /// Required. The name of the Target Project
2817    #[serde(rename = "targetProject")]
2818    pub target_project: Option<String>,
2819    /// Required. The name of the Target Project VPC Network
2820    #[serde(rename = "targetVpc")]
2821    pub target_vpc: Option<String>,
2822    /// Output only. Updated time.
2823    #[serde(rename = "updateTime")]
2824    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2825}
2826
2827impl common::RequestValue for ManagedZone {}
2828impl common::ResponseResult for ManagedZone {}
2829
2830/// Marketplace connector details.
2831///
2832/// This type is not used in any activity, and only used as *part* of another schema.
2833///
2834#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2835#[serde_with::serde_as]
2836#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2837pub struct MarketplaceConnectorDetails {
2838    /// Marketplace product name.
2839    #[serde(rename = "marketplaceProduct")]
2840    pub marketplace_product: Option<String>,
2841    /// Marketplace product ID.
2842    #[serde(rename = "marketplaceProductId")]
2843    pub marketplace_product_id: Option<String>,
2844    /// Marketplace product URL.
2845    #[serde(rename = "marketplaceProductUri")]
2846    pub marketplace_product_uri: Option<String>,
2847    /// The name of the partner.
2848    pub partner: Option<String>,
2849}
2850
2851impl common::Part for MarketplaceConnectorDetails {}
2852
2853/// MultipleSelectConfig represents the multiple options for a config variable.
2854///
2855/// This type is not used in any activity, and only used as *part* of another schema.
2856///
2857#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2858#[serde_with::serde_as]
2859#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2860pub struct MultipleSelectConfig {
2861    /// Optional. Allow custom values.
2862    #[serde(rename = "allowCustomValues")]
2863    pub allow_custom_values: Option<bool>,
2864    /// Required. Multiple select options.
2865    #[serde(rename = "multipleSelectOptions")]
2866    pub multiple_select_options: Option<Vec<MultipleSelectOption>>,
2867    /// Required. Value separator. Only "," can be used for OAuth auth code flow scope field.
2868    #[serde(rename = "valueSeparator")]
2869    pub value_separator: Option<String>,
2870}
2871
2872impl common::Part for MultipleSelectConfig {}
2873
2874/// MultiplSelecteOption represents the single option for a config variable.
2875///
2876/// This type is not used in any activity, and only used as *part* of another schema.
2877///
2878#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2879#[serde_with::serde_as]
2880#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2881pub struct MultipleSelectOption {
2882    /// Optional. Value of the option.
2883    pub description: Option<String>,
2884    /// Required. Display name of the option.
2885    #[serde(rename = "displayName")]
2886    pub display_name: Option<String>,
2887    /// Required. Key of the option.
2888    pub key: Option<String>,
2889    /// Optional. Indicates if the option is preselected.
2890    pub preselected: Option<bool>,
2891}
2892
2893impl common::Part for MultipleSelectOption {}
2894
2895/// Regional Network Config.
2896///
2897/// This type is not used in any activity, and only used as *part* of another schema.
2898///
2899#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2900#[serde_with::serde_as]
2901#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2902pub struct NetworkConfig {
2903    /// Output only. Egress IPs
2904    #[serde(rename = "egressIps")]
2905    pub egress_ips: Option<Vec<String>>,
2906    /// Optional. Egress mode for the network.
2907    #[serde(rename = "egressMode")]
2908    pub egress_mode: Option<String>,
2909}
2910
2911impl common::Part for NetworkConfig {}
2912
2913/// NetworkEgressModeOverride provides the network egress mode override for a connector.
2914///
2915/// This type is not used in any activity, and only used as *part* of another schema.
2916///
2917#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2918#[serde_with::serde_as]
2919#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2920pub struct NetworkEgressModeOverride {
2921    /// boolean should be set to true to make sure only eventing enabled connections are migrated to direct vpc egress.
2922    #[serde(rename = "isEventingOverrideEnabled")]
2923    pub is_eventing_override_enabled: Option<bool>,
2924    /// boolean should be set to true to make sure only async operations enabled connections are migrated to direct vpc egress.
2925    #[serde(rename = "isJobsOverrideEnabled")]
2926    pub is_jobs_override_enabled: Option<bool>,
2927    /// Determines the VPC Egress mode for the connector.
2928    #[serde(rename = "networkEgressMode")]
2929    pub network_egress_mode: Option<String>,
2930}
2931
2932impl common::Part for NetworkEgressModeOverride {}
2933
2934/// Node configuration for the connection.
2935///
2936/// This type is not used in any activity, and only used as *part* of another schema.
2937///
2938#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2939#[serde_with::serde_as]
2940#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2941pub struct NodeConfig {
2942    /// Optional. Maximum number of nodes in the runtime nodes.
2943    #[serde(rename = "maxNodeCount")]
2944    pub max_node_count: Option<i32>,
2945    /// Optional. Minimum number of nodes in the runtime nodes.
2946    #[serde(rename = "minNodeCount")]
2947    pub min_node_count: Option<i32>,
2948}
2949
2950impl common::Part for NodeConfig {}
2951
2952/// pass only at create and not update using updateMask Auth Code Data
2953///
2954/// This type is not used in any activity, and only used as *part* of another schema.
2955///
2956#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2957#[serde_with::serde_as]
2958#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2959pub struct OAuthTokenData {
2960    /// Optional. Access token for the connection.
2961    #[serde(rename = "accessToken")]
2962    pub access_token: Option<EUASecret>,
2963    /// Optional. Timestamp when the access token was created.
2964    #[serde(rename = "createTime")]
2965    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2966    /// Optional. Time in seconds when the access token expires.
2967    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
2968    pub expiry: Option<chrono::Duration>,
2969    /// Optional. Refresh token for the connection.
2970    #[serde(rename = "refreshToken")]
2971    pub refresh_token: Option<EUASecret>,
2972}
2973
2974impl common::Part for OAuthTokenData {}
2975
2976/// Parameters to support Oauth 2.0 Auth Code Grant Authentication. See https://www.rfc-editor.org/rfc/rfc6749#section-1.3.1 for more details.
2977///
2978/// This type is not used in any activity, and only used as *part* of another schema.
2979///
2980#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2981#[serde_with::serde_as]
2982#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2983pub struct Oauth2AuthCodeFlow {
2984    /// Optional. Authorization code to be exchanged for access and refresh tokens.
2985    #[serde(rename = "authCode")]
2986    pub auth_code: Option<String>,
2987    /// Optional. Auth URL for Authorization Code Flow
2988    #[serde(rename = "authUri")]
2989    pub auth_uri: Option<String>,
2990    /// Optional. Client ID for user-provided OAuth app.
2991    #[serde(rename = "clientId")]
2992    pub client_id: Option<String>,
2993    /// Optional. Client secret for user-provided OAuth app.
2994    #[serde(rename = "clientSecret")]
2995    pub client_secret: Option<Secret>,
2996    /// Optional. Whether to enable PKCE when the user performs the auth code flow.
2997    #[serde(rename = "enablePkce")]
2998    pub enable_pkce: Option<bool>,
2999    /// Optional. PKCE verifier to be used during the auth code exchange.
3000    #[serde(rename = "pkceVerifier")]
3001    pub pkce_verifier: Option<String>,
3002    /// Optional. Redirect URI to be provided during the auth code exchange.
3003    #[serde(rename = "redirectUri")]
3004    pub redirect_uri: Option<String>,
3005    /// Optional. Scopes the connection will request when the user performs the auth code flow.
3006    pub scopes: Option<Vec<String>>,
3007}
3008
3009impl common::Part for Oauth2AuthCodeFlow {}
3010
3011/// Parameters to support Oauth 2.0 Auth Code Grant Authentication using Google Provided OAuth Client. See https://tools.ietf.org/html/rfc6749#section-1.3.1 for more details.
3012///
3013/// This type is not used in any activity, and only used as *part* of another schema.
3014///
3015#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3016#[serde_with::serde_as]
3017#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3018pub struct Oauth2AuthCodeFlowGoogleManaged {
3019    /// Optional. Authorization code to be exchanged for access and refresh tokens.
3020    #[serde(rename = "authCode")]
3021    pub auth_code: Option<String>,
3022    /// Optional. Redirect URI to be provided during the auth code exchange.
3023    #[serde(rename = "redirectUri")]
3024    pub redirect_uri: Option<String>,
3025    /// Required. Scopes the connection will request when the user performs the auth code flow.
3026    pub scopes: Option<Vec<String>>,
3027}
3028
3029impl common::Part for Oauth2AuthCodeFlowGoogleManaged {}
3030
3031/// Parameters to support Oauth 2.0 Client Credentials Grant Authentication. See https://tools.ietf.org/html/rfc6749#section-1.3.4 for more details.
3032///
3033/// This type is not used in any activity, and only used as *part* of another schema.
3034///
3035#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3036#[serde_with::serde_as]
3037#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3038pub struct Oauth2ClientCredentials {
3039    /// Optional. The client identifier.
3040    #[serde(rename = "clientId")]
3041    pub client_id: Option<String>,
3042    /// Optional. Secret version reference containing the client secret.
3043    #[serde(rename = "clientSecret")]
3044    pub client_secret: Option<Secret>,
3045}
3046
3047impl common::Part for Oauth2ClientCredentials {}
3048
3049/// Parameters to support JSON Web Token (JWT) Profile for Oauth 2.0 Authorization Grant based authentication. See https://tools.ietf.org/html/rfc7523 for more details.
3050///
3051/// This type is not used in any activity, and only used as *part* of another schema.
3052///
3053#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3054#[serde_with::serde_as]
3055#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3056pub struct Oauth2JwtBearer {
3057    /// Optional. Secret version reference containing a PKCS#8 PEM-encoded private key associated with the Client Certificate. This private key will be used to sign JWTs used for the jwt-bearer authorization grant. Specified in the form as: `projects/*/secrets/*/versions/*`.
3058    #[serde(rename = "clientKey")]
3059    pub client_key: Option<Secret>,
3060    /// Optional. JwtClaims providers fields to generate the token.
3061    #[serde(rename = "jwtClaims")]
3062    pub jwt_claims: Option<JwtClaims>,
3063}
3064
3065impl common::Part for Oauth2JwtBearer {}
3066
3067/// This resource represents a long-running operation that is the result of a network API call.
3068///
3069/// # Activities
3070///
3071/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3072/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3073///
3074/// * [locations connections connection schema metadata get action projects](ProjectLocationConnectionConnectionSchemaMetadataGetActionCall) (response)
3075/// * [locations connections connection schema metadata get entity type projects](ProjectLocationConnectionConnectionSchemaMetadataGetEntityTypeCall) (response)
3076/// * [locations connections connection schema metadata refresh projects](ProjectLocationConnectionConnectionSchemaMetadataRefreshCall) (response)
3077/// * [locations connections end user authentications create projects](ProjectLocationConnectionEndUserAuthenticationCreateCall) (response)
3078/// * [locations connections end user authentications delete projects](ProjectLocationConnectionEndUserAuthenticationDeleteCall) (response)
3079/// * [locations connections end user authentications patch projects](ProjectLocationConnectionEndUserAuthenticationPatchCall) (response)
3080/// * [locations connections event subscriptions create projects](ProjectLocationConnectionEventSubscriptionCreateCall) (response)
3081/// * [locations connections event subscriptions delete projects](ProjectLocationConnectionEventSubscriptionDeleteCall) (response)
3082/// * [locations connections event subscriptions patch projects](ProjectLocationConnectionEventSubscriptionPatchCall) (response)
3083/// * [locations connections event subscriptions retry projects](ProjectLocationConnectionEventSubscriptionRetryCall) (response)
3084/// * [locations connections create projects](ProjectLocationConnectionCreateCall) (response)
3085/// * [locations connections delete projects](ProjectLocationConnectionDeleteCall) (response)
3086/// * [locations connections patch projects](ProjectLocationConnectionPatchCall) (response)
3087/// * [locations connections repair eventing projects](ProjectLocationConnectionRepairEventingCall) (response)
3088/// * [locations custom connectors custom connector versions delete projects](ProjectLocationCustomConnectorCustomConnectorVersionDeleteCall) (response)
3089/// * [locations custom connectors custom connector versions deprecate projects](ProjectLocationCustomConnectorCustomConnectorVersionDeprecateCall) (response)
3090/// * [locations custom connectors custom connector versions publish projects](ProjectLocationCustomConnectorCustomConnectorVersionPublishCall) (response)
3091/// * [locations custom connectors custom connector versions withdraw projects](ProjectLocationCustomConnectorCustomConnectorVersionWithdrawCall) (response)
3092/// * [locations endpoint attachments create projects](ProjectLocationEndpointAttachmentCreateCall) (response)
3093/// * [locations endpoint attachments delete projects](ProjectLocationEndpointAttachmentDeleteCall) (response)
3094/// * [locations endpoint attachments patch projects](ProjectLocationEndpointAttachmentPatchCall) (response)
3095/// * [locations global custom connectors custom connector versions create projects](ProjectLocationGlobalCustomConnectorCustomConnectorVersionCreateCall) (response)
3096/// * [locations global custom connectors create projects](ProjectLocationGlobalCustomConnectorCreateCall) (response)
3097/// * [locations global custom connectors delete projects](ProjectLocationGlobalCustomConnectorDeleteCall) (response)
3098/// * [locations global custom connectors patch projects](ProjectLocationGlobalCustomConnectorPatchCall) (response)
3099/// * [locations global managed zones create projects](ProjectLocationGlobalManagedZoneCreateCall) (response)
3100/// * [locations global managed zones delete projects](ProjectLocationGlobalManagedZoneDeleteCall) (response)
3101/// * [locations global managed zones patch projects](ProjectLocationGlobalManagedZonePatchCall) (response)
3102/// * [locations global update settings projects](ProjectLocationGlobalUpdateSettingCall) (response)
3103/// * [locations operations get projects](ProjectLocationOperationGetCall) (response)
3104/// * [locations update regional settings projects](ProjectLocationUpdateRegionalSettingCall) (response)
3105#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3106#[serde_with::serde_as]
3107#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3108pub struct Operation {
3109    /// 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.
3110    pub done: Option<bool>,
3111    /// The error result of the operation in case of failure or cancellation.
3112    pub error: Option<Status>,
3113    /// 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.
3114    pub metadata: Option<HashMap<String, serde_json::Value>>,
3115    /// 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}`.
3116    pub name: Option<String>,
3117    /// 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`.
3118    pub response: Option<HashMap<String, serde_json::Value>>,
3119}
3120
3121impl common::ResponseResult for Operation {}
3122
3123/// Partner metadata details. This will be populated when publishing the custom connector as a partner connector version. On publishing, parntner connector version will be created using the fields in PartnerMetadata.
3124///
3125/// This type is not used in any activity, and only used as *part* of another schema.
3126///
3127#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3128#[serde_with::serde_as]
3129#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3130pub struct PartnerMetadata {
3131    /// Required. Whether the user has accepted the Google Cloud Platform Terms of Service (https://cloud.google.com/terms/) and the Google Cloud Marketplace Terms of Service (https://cloud.google.com/terms/marketplace/launcher?hl=en).
3132    #[serde(rename = "acceptGcpTos")]
3133    pub accept_gcp_tos: Option<bool>,
3134    /// Optional. Additional comments for the submission.
3135    #[serde(rename = "additionalComments")]
3136    pub additional_comments: Option<String>,
3137    /// Required. Confirmation that connector meets all applicable requirements mentioned in the Partner Connector Publishing requirements list and Partner onboardiong requirements list (https://cloud.google.com/marketplace/docs/partners/get-started#requirements).
3138    #[serde(rename = "confirmPartnerRequirements")]
3139    pub confirm_partner_requirements: Option<bool>,
3140    /// Required. Public URL for the demo video.
3141    #[serde(rename = "demoUri")]
3142    pub demo_uri: Option<String>,
3143    /// Output only. Has dynamic open api spec uri.
3144    #[serde(rename = "hasDynamicSpecUri")]
3145    pub has_dynamic_spec_uri: Option<bool>,
3146    /// Required. Integration example templates for the custom connector.
3147    #[serde(rename = "integrationTemplates")]
3148    pub integration_templates: Option<String>,
3149    /// Output only. Local spec path. Required if has_dynamic_spec_uri is true.
3150    #[serde(rename = "localSpecPath")]
3151    pub local_spec_path: Option<String>,
3152    /// Optional. Marketplace product name.
3153    #[serde(rename = "marketplaceProduct")]
3154    pub marketplace_product: Option<String>,
3155    /// Required. Marketplace product ID.
3156    #[serde(rename = "marketplaceProductId")]
3157    pub marketplace_product_id: Option<String>,
3158    /// Optional. Marketplace product project ID.
3159    #[serde(rename = "marketplaceProductProjectId")]
3160    pub marketplace_product_project_id: Option<String>,
3161    /// Optional. Marketplace product URL.
3162    #[serde(rename = "marketplaceProductUri")]
3163    pub marketplace_product_uri: Option<String>,
3164    /// Required. Partner name.
3165    pub partner: Option<String>,
3166    /// Required. Partner connector display name.
3167    #[serde(rename = "partnerConnectorDisplayName")]
3168    pub partner_connector_display_name: Option<String>,
3169    /// Output only. Publish request time.
3170    #[serde(rename = "publishRequestTime")]
3171    pub publish_request_time: Option<chrono::DateTime<chrono::offset::Utc>>,
3172    /// Required. Target application for which partner connector is built.
3173    #[serde(rename = "targetApplication")]
3174    pub target_application: Option<String>,
3175    /// Required. Target customer segment for the partner connector.
3176    #[serde(rename = "targetCustomerSegment")]
3177    pub target_customer_segment: Option<String>,
3178    /// Required. Details about partner connector use cases.
3179    #[serde(rename = "useCases")]
3180    pub use_cases: Option<String>,
3181}
3182
3183impl common::Part for PartnerMetadata {}
3184
3185/// 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/).
3186///
3187/// # Activities
3188///
3189/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3190/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3191///
3192/// * [locations connections get iam policy projects](ProjectLocationConnectionGetIamPolicyCall) (response)
3193/// * [locations connections set iam policy projects](ProjectLocationConnectionSetIamPolicyCall) (response)
3194/// * [locations providers get iam policy projects](ProjectLocationProviderGetIamPolicyCall) (response)
3195/// * [locations providers set iam policy projects](ProjectLocationProviderSetIamPolicyCall) (response)
3196#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3197#[serde_with::serde_as]
3198#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3199pub struct Policy {
3200    /// Specifies cloud audit logging configuration for this policy.
3201    #[serde(rename = "auditConfigs")]
3202    pub audit_configs: Option<Vec<AuditConfig>>,
3203    /// 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`.
3204    pub bindings: Option<Vec<Binding>>,
3205    /// `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.
3206    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
3207    pub etag: Option<Vec<u8>>,
3208    /// 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).
3209    pub version: Option<i32>,
3210}
3211
3212impl common::ResponseResult for Policy {}
3213
3214/// Provider indicates the owner who provides the connectors.
3215///
3216/// # Activities
3217///
3218/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3219/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3220///
3221/// * [locations providers get projects](ProjectLocationProviderGetCall) (response)
3222#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3223#[serde_with::serde_as]
3224#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3225pub struct Provider {
3226    /// Output only. Created time.
3227    #[serde(rename = "createTime")]
3228    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
3229    /// Output only. Description of the resource.
3230    pub description: Option<String>,
3231    /// Output only. Display name.
3232    #[serde(rename = "displayName")]
3233    pub display_name: Option<String>,
3234    /// Output only. Link to documentation page.
3235    #[serde(rename = "documentationUri")]
3236    pub documentation_uri: Option<String>,
3237    /// Output only. Link to external page.
3238    #[serde(rename = "externalUri")]
3239    pub external_uri: Option<String>,
3240    /// Output only. Resource labels to represent user-provided metadata. Refer to cloud documentation on labels for more details. https://cloud.google.com/compute/docs/labeling-resources
3241    pub labels: Option<HashMap<String, String>>,
3242    /// Output only. Flag to mark the version indicating the launch stage.
3243    #[serde(rename = "launchStage")]
3244    pub launch_stage: Option<String>,
3245    /// Output only. Resource name of the Provider. Format: projects/{project}/locations/{location}/providers/{provider} Only global location is supported for Provider resource.
3246    pub name: Option<String>,
3247    /// Output only. Updated time.
3248    #[serde(rename = "updateTime")]
3249    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
3250    /// Output only. Cloud storage location of icons etc consumed by UI.
3251    #[serde(rename = "webAssetsLocation")]
3252    pub web_assets_location: Option<String>,
3253}
3254
3255impl common::ResponseResult for Provider {}
3256
3257/// Pub/Sub message includes details of the Destination Pub/Sub topic.
3258///
3259/// This type is not used in any activity, and only used as *part* of another schema.
3260///
3261#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3262#[serde_with::serde_as]
3263#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3264pub struct PubSub {
3265    /// Optional. Pub/Sub message attributes to be added to the Pub/Sub message.
3266    pub attributes: Option<HashMap<String, String>>,
3267    /// Optional. Configuration for configuring the trigger
3268    #[serde(rename = "configVariables")]
3269    pub config_variables: Option<Vec<ConfigVariable>>,
3270    /// Required. The project id which has the Pub/Sub topic.
3271    #[serde(rename = "projectId")]
3272    pub project_id: Option<String>,
3273    /// Required. The topic id of the Pub/Sub topic.
3274    #[serde(rename = "topicId")]
3275    pub topic_id: Option<String>,
3276}
3277
3278impl common::Part for PubSub {}
3279
3280/// Request message for ConnectorsService.PublishCustomConnectorVersion
3281///
3282/// # Activities
3283///
3284/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3285/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3286///
3287/// * [locations custom connectors custom connector versions publish projects](ProjectLocationCustomConnectorCustomConnectorVersionPublishCall) (request)
3288#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3289#[serde_with::serde_as]
3290#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3291pub struct PublishCustomConnectorVersionRequest {
3292    /// Required. Partner metadata details for validating and publishing the custom connector as a partner connector version.
3293    #[serde(rename = "partnerMetadata")]
3294    pub partner_metadata: Option<PartnerMetadata>,
3295}
3296
3297impl common::RequestValue for PublishCustomConnectorVersionRequest {}
3298
3299/// Publish status of a custom connector.
3300///
3301/// This type is not used in any activity, and only used as *part* of another schema.
3302///
3303#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3304#[serde_with::serde_as]
3305#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3306pub struct PublishStatus {
3307    /// Output only. Publish state of the custom connector.
3308    #[serde(rename = "publishState")]
3309    pub publish_state: Option<String>,
3310    /// Output only. Publish time.
3311    #[serde(rename = "publishTime")]
3312    pub publish_time: Option<chrono::DateTime<chrono::offset::Utc>>,
3313    /// Output only. Partner connector name. Will be set on the custom connector. Format: providers/partner/connectors//versions/
3314    #[serde(rename = "publishedAs")]
3315    pub published_as: Option<String>,
3316    /// Output only. Custom connector name. Will be set on the partner connector. Format: providers/customconnectors/connectors//versions/
3317    #[serde(rename = "publishedSource")]
3318    pub published_source: Option<String>,
3319}
3320
3321impl common::Part for PublishStatus {}
3322
3323/// Request message for ConnectorsService.RefreshConnectionSchemaMetadata.
3324///
3325/// # Activities
3326///
3327/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3328/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3329///
3330/// * [locations connections connection schema metadata refresh projects](ProjectLocationConnectionConnectionSchemaMetadataRefreshCall) (request)
3331#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3332#[serde_with::serde_as]
3333#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3334pub struct RefreshConnectionSchemaMetadataRequest {
3335    _never_set: Option<bool>,
3336}
3337
3338impl common::RequestValue for RefreshConnectionSchemaMetadataRequest {}
3339
3340/// Regional Settings details.
3341///
3342/// # Activities
3343///
3344/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3345/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3346///
3347/// * [locations get regional settings projects](ProjectLocationGetRegionalSettingCall) (response)
3348/// * [locations update regional settings projects](ProjectLocationUpdateRegionalSettingCall) (request)
3349#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3350#[serde_with::serde_as]
3351#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3352pub struct RegionalSettings {
3353    /// Optional. Regional encryption config to hold CMEK details.
3354    #[serde(rename = "encryptionConfig")]
3355    pub encryption_config: Option<EncryptionConfig>,
3356    /// Output only. Resource name of the Connection. Format: projects/{project}/locations/{location}/regionalSettings
3357    pub name: Option<String>,
3358    /// Optional. Regional network config.
3359    #[serde(rename = "networkConfig")]
3360    pub network_config: Option<NetworkConfig>,
3361    /// Output only. Specifies whether the region is provisioned.
3362    pub provisioned: Option<bool>,
3363}
3364
3365impl common::RequestValue for RegionalSettings {}
3366impl common::ResponseResult for RegionalSettings {}
3367
3368/// Request message for ConnectorsService.RepairEventing
3369///
3370/// # Activities
3371///
3372/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3373/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3374///
3375/// * [locations connections repair eventing projects](ProjectLocationConnectionRepairEventingCall) (request)
3376#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3377#[serde_with::serde_as]
3378#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3379pub struct RepairEventingRequest {
3380    _never_set: Option<bool>,
3381}
3382
3383impl common::RequestValue for RepairEventingRequest {}
3384
3385/// Resource definition
3386///
3387/// This type is not used in any activity, and only used as *part* of another schema.
3388///
3389#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3390#[serde_with::serde_as]
3391#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3392pub struct Resource {
3393    /// Optional. Template to uniquely represent a Google Cloud resource in a format IAM expects This is a template that can have references to other values provided in the config variable template.
3394    #[serde(rename = "pathTemplate")]
3395    pub path_template: Option<String>,
3396    /// Optional. Different types of resource supported.
3397    #[serde(rename = "type")]
3398    pub type_: Option<String>,
3399}
3400
3401impl common::Part for Resource {}
3402
3403/// Resource limits defined for connection pods of a given connector type.
3404///
3405/// This type is not used in any activity, and only used as *part* of another schema.
3406///
3407#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3408#[serde_with::serde_as]
3409#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3410pub struct ResourceLimits {
3411    /// Output only. CPU limit.
3412    pub cpu: Option<String>,
3413    /// Output only. Memory limit.
3414    pub memory: Option<String>,
3415}
3416
3417impl common::Part for ResourceLimits {}
3418
3419/// Resource requests defined for connection pods of a given connector type.
3420///
3421/// This type is not used in any activity, and only used as *part* of another schema.
3422///
3423#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3424#[serde_with::serde_as]
3425#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3426pub struct ResourceRequests {
3427    /// Output only. CPU request.
3428    pub cpu: Option<String>,
3429    /// Output only. Memory request.
3430    pub memory: Option<String>,
3431}
3432
3433impl common::Part for ResourceRequests {}
3434
3435/// Metadata of result field.
3436///
3437/// This type is not used in any activity, and only used as *part* of another schema.
3438///
3439#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3440#[serde_with::serde_as]
3441#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3442pub struct ResultMetadata {
3443    /// The data type of the field.
3444    #[serde(rename = "dataType")]
3445    pub data_type: Option<String>,
3446    /// The following field specifies the default value of the Parameter provided by the external system if a value is not provided.
3447    #[serde(rename = "defaultValue")]
3448    pub default_value: Option<serde_json::Value>,
3449    /// A brief description of the field.
3450    pub description: Option<String>,
3451    /// Name of the result field.
3452    pub field: Option<String>,
3453    /// JsonSchema representation of this action's result
3454    #[serde(rename = "jsonSchema")]
3455    pub json_schema: Option<JsonSchema>,
3456    /// Specifies whether a null value is allowed.
3457    pub nullable: Option<bool>,
3458}
3459
3460impl common::Part for ResultMetadata {}
3461
3462/// Request message for ConnectorsService.RefreshEventSubscription
3463///
3464/// # Activities
3465///
3466/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3467/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3468///
3469/// * [locations connections event subscriptions retry projects](ProjectLocationConnectionEventSubscriptionRetryCall) (request)
3470#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3471#[serde_with::serde_as]
3472#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3473pub struct RetryEventSubscriptionRequest {
3474    _never_set: Option<bool>,
3475}
3476
3477impl common::RequestValue for RetryEventSubscriptionRequest {}
3478
3479/// This configuration defines all the Cloud IAM roles that needs to be granted to a particular Google Cloud resource for the selected principal like service account. These configurations will let UI display to customers what IAM roles need to be granted by them. Or these configurations can be used by the UI to render a 'grant' button to do the same on behalf of the user.
3480///
3481/// This type is not used in any activity, and only used as *part* of another schema.
3482///
3483#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3484#[serde_with::serde_as]
3485#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3486pub struct RoleGrant {
3487    /// Optional. Template that UI can use to provide helper text to customers.
3488    #[serde(rename = "helperTextTemplate")]
3489    pub helper_text_template: Option<String>,
3490    /// Optional. Principal/Identity for whom the role need to assigned.
3491    pub principal: Option<String>,
3492    /// Optional. Resource on which the roles needs to be granted for the principal.
3493    pub resource: Option<Resource>,
3494    /// Optional. List of roles that need to be granted.
3495    pub roles: Option<Vec<String>>,
3496}
3497
3498impl common::Part for RoleGrant {}
3499
3500/// Schema of a runtime action.
3501///
3502/// This type is not used in any activity, and only used as *part* of another schema.
3503///
3504#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3505#[serde_with::serde_as]
3506#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3507pub struct RuntimeActionSchema {
3508    /// Output only. Name of the action.
3509    pub action: Option<String>,
3510    /// Output only. Brief Description of action
3511    pub description: Option<String>,
3512    /// Output only. Display Name of action to be shown on client side
3513    #[serde(rename = "displayName")]
3514    pub display_name: Option<String>,
3515    /// Output only. JsonSchema representation of this action's input metadata
3516    #[serde(rename = "inputJsonSchema")]
3517    pub input_json_schema: Option<JsonSchema>,
3518    /// Output only. List of input parameter metadata for the action.
3519    #[serde(rename = "inputParameters")]
3520    pub input_parameters: Option<Vec<InputParameter>>,
3521    /// Output only. Input schema as string.
3522    #[serde(rename = "inputSchemaAsString")]
3523    pub input_schema_as_string: Option<String>,
3524    /// Output only. JsonSchema representation of this action's result metadata
3525    #[serde(rename = "resultJsonSchema")]
3526    pub result_json_schema: Option<JsonSchema>,
3527    /// Output only. List of result field metadata.
3528    #[serde(rename = "resultMetadata")]
3529    pub result_metadata: Option<Vec<ResultMetadata>>,
3530    /// Output only. Result schema as string.
3531    #[serde(rename = "resultSchemaAsString")]
3532    pub result_schema_as_string: Option<String>,
3533}
3534
3535impl common::Part for RuntimeActionSchema {}
3536
3537/// RuntimeConfig is the singleton resource of each location. It includes generic resource configs consumed by control plane and runtime plane like: pub/sub topic/subscription resource name, Cloud Storage location storing schema etc.
3538///
3539/// # Activities
3540///
3541/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3542/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3543///
3544/// * [locations get runtime config projects](ProjectLocationGetRuntimeConfigCall) (response)
3545#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3546#[serde_with::serde_as]
3547#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3548pub struct RuntimeConfig {
3549    /// Output only. Pub/Sub subscription for connd to receive message. E.g. projects/{project-id}/subscriptions/{topic-id}
3550    #[serde(rename = "conndSubscription")]
3551    pub connd_subscription: Option<String>,
3552    /// Output only. Pub/Sub topic for connd to send message. E.g. projects/{project-id}/topics/{topic-id}
3553    #[serde(rename = "conndTopic")]
3554    pub connd_topic: Option<String>,
3555    /// Output only. Pub/Sub subscription for control plane to receive message. E.g. projects/{project-id}/subscriptions/{topic-id}
3556    #[serde(rename = "controlPlaneSubscription")]
3557    pub control_plane_subscription: Option<String>,
3558    /// Output only. Pub/Sub topic for control plne to send message. communication. E.g. projects/{project-id}/topics/{topic-id}
3559    #[serde(rename = "controlPlaneTopic")]
3560    pub control_plane_topic: Option<String>,
3561    /// Output only. location_id of the runtime location. E.g. "us-west1".
3562    #[serde(rename = "locationId")]
3563    pub location_id: Option<String>,
3564    /// Output only. Name of the runtimeConfig resource. Format: projects/{project}/locations/{location}/runtimeConfig
3565    pub name: Option<String>,
3566    /// Output only. The endpoint of the connectors runtime ingress.
3567    #[serde(rename = "runtimeEndpoint")]
3568    pub runtime_endpoint: Option<String>,
3569    /// Output only. The Cloud Storage bucket that stores connector's schema reports.
3570    #[serde(rename = "schemaGcsBucket")]
3571    pub schema_gcs_bucket: Option<String>,
3572    /// Output only. The name of the Service Directory service name.
3573    #[serde(rename = "serviceDirectory")]
3574    pub service_directory: Option<String>,
3575    /// Output only. The state of the location.
3576    pub state: Option<String>,
3577}
3578
3579impl common::ResponseResult for RuntimeConfig {}
3580
3581/// Schema of a runtime entity.
3582///
3583/// This type is not used in any activity, and only used as *part* of another schema.
3584///
3585#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3586#[serde_with::serde_as]
3587#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3588pub struct RuntimeEntitySchema {
3589    /// Output only. Name of the entity.
3590    pub entity: Option<String>,
3591    /// Output only. List of fields in the entity.
3592    pub fields: Option<Vec<Field>>,
3593    /// Output only. JsonSchema representation of this entity's metadata
3594    #[serde(rename = "jsonSchema")]
3595    pub json_schema: Option<JsonSchema>,
3596    /// List of operations supported by this entity
3597    pub operations: Option<Vec<String>>,
3598}
3599
3600impl common::Part for RuntimeEntitySchema {}
3601
3602/// Config for connection schema refresh
3603///
3604/// This type is not used in any activity, and only used as *part* of another schema.
3605///
3606#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3607#[serde_with::serde_as]
3608#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3609pub struct SchemaRefreshConfig {
3610    /// Whether to use displayName for actions in UI.
3611    #[serde(rename = "useActionDisplayNames")]
3612    pub use_action_display_names: Option<bool>,
3613    /// Whether to use synchronous schema refresh.
3614    #[serde(rename = "useSynchronousSchemaRefresh")]
3615    pub use_synchronous_schema_refresh: Option<bool>,
3616}
3617
3618impl common::Part for SchemaRefreshConfig {}
3619
3620/// SearchConnectionInstance represents an instance of connector with specific fields
3621///
3622/// This type is not used in any activity, and only used as *part* of another schema.
3623///
3624#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3625#[serde_with::serde_as]
3626#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3627pub struct SearchConnectionInstance {
3628    /// Output only. Schema of a runtime action.
3629    #[serde(rename = "actionSchema")]
3630    pub action_schema: Option<RuntimeActionSchema>,
3631    /// Output only. Connection details
3632    pub connection: Option<Connection>,
3633    /// Output only. Schema of a runtime entity.
3634    #[serde(rename = "entitySchema")]
3635    pub entity_schema: Option<RuntimeEntitySchema>,
3636}
3637
3638impl common::Part for SearchConnectionInstance {}
3639
3640/// Response message for Connectors.SearchConnections.
3641///
3642/// # Activities
3643///
3644/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3645/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3646///
3647/// * [locations connections search projects](ProjectLocationConnectionSearchCall) (response)
3648#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3649#[serde_with::serde_as]
3650#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3651pub struct SearchConnectionsResponse {
3652    /// A list of connectors.
3653    pub connections: Option<Vec<SearchConnectionInstance>>,
3654    /// Optional. page_token
3655    #[serde(rename = "nextPageToken")]
3656    pub next_page_token: Option<String>,
3657    /// Locations that could not be reached.
3658    pub unreachable: Option<Vec<String>>,
3659}
3660
3661impl common::ResponseResult for SearchConnectionsResponse {}
3662
3663/// Secret provides a reference to entries in Secret Manager.
3664///
3665/// This type is not used in any activity, and only used as *part* of another schema.
3666///
3667#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3668#[serde_with::serde_as]
3669#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3670pub struct Secret {
3671    /// Optional. The resource name of the secret version in the format, format as: `projects/*/secrets/*/versions/*`.
3672    #[serde(rename = "secretVersion")]
3673    pub secret_version: Option<String>,
3674}
3675
3676impl common::Part for Secret {}
3677
3678/// Request message for `SetIamPolicy` method.
3679///
3680/// # Activities
3681///
3682/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3683/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3684///
3685/// * [locations connections set iam policy projects](ProjectLocationConnectionSetIamPolicyCall) (request)
3686/// * [locations providers set iam policy projects](ProjectLocationProviderSetIamPolicyCall) (request)
3687#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3688#[serde_with::serde_as]
3689#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3690pub struct SetIamPolicyRequest {
3691    /// 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.
3692    pub policy: Option<Policy>,
3693    /// 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"`
3694    #[serde(rename = "updateMask")]
3695    pub update_mask: Option<common::FieldMask>,
3696}
3697
3698impl common::RequestValue for SetIamPolicyRequest {}
3699
3700/// Global Settings details.
3701///
3702/// # Activities
3703///
3704/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3705/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3706///
3707/// * [locations global get settings projects](ProjectLocationGlobalGetSettingCall) (response)
3708/// * [locations global update settings projects](ProjectLocationGlobalUpdateSettingCall) (request)
3709#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3710#[serde_with::serde_as]
3711#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3712pub struct Settings {
3713    /// Output only. Resource name of the Connection. Format: projects/{project}/locations/global/settings}
3714    pub name: Option<String>,
3715    /// Output only. Flag indicates if user is in PayG model
3716    pub payg: Option<bool>,
3717    /// Output only. Tenant project id of the consumer project.
3718    #[serde(rename = "tenantProjectId")]
3719    pub tenant_project_id: Option<String>,
3720    /// Optional. Flag indicates whether vpc-sc is enabled.
3721    pub vpcsc: Option<bool>,
3722}
3723
3724impl common::RequestValue for Settings {}
3725impl common::ResponseResult for Settings {}
3726
3727/// Source to extract the backend from.
3728///
3729/// This type is not used in any activity, and only used as *part* of another schema.
3730///
3731#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3732#[serde_with::serde_as]
3733#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3734pub struct Source {
3735    /// Field identifier. For example config variable name.
3736    #[serde(rename = "fieldId")]
3737    pub field_id: Option<String>,
3738    /// Type of the source.
3739    #[serde(rename = "sourceType")]
3740    pub source_type: Option<String>,
3741}
3742
3743impl common::Part for Source {}
3744
3745/// Parameters to support Ssh public key Authentication.
3746///
3747/// This type is not used in any activity, and only used as *part* of another schema.
3748///
3749#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3750#[serde_with::serde_as]
3751#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3752pub struct SshPublicKey {
3753    /// Optional. Format of SSH Client cert.
3754    #[serde(rename = "certType")]
3755    pub cert_type: Option<String>,
3756    /// Optional. SSH Client Cert. It should contain both public and private key.
3757    #[serde(rename = "sshClientCert")]
3758    pub ssh_client_cert: Option<Secret>,
3759    /// Optional. Password (passphrase) for ssh client certificate if it has one.
3760    #[serde(rename = "sshClientCertPass")]
3761    pub ssh_client_cert_pass: Option<Secret>,
3762    /// Optional. The user account used to authenticate.
3763    pub username: Option<String>,
3764}
3765
3766impl common::Part for SshPublicKey {}
3767
3768/// SSL Configuration of a connection
3769///
3770/// This type is not used in any activity, and only used as *part* of another schema.
3771///
3772#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3773#[serde_with::serde_as]
3774#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3775pub struct SslConfig {
3776    /// Optional. Additional SSL related field values
3777    #[serde(rename = "additionalVariables")]
3778    pub additional_variables: Option<Vec<ConfigVariable>>,
3779    /// Optional. Type of Client Cert (PEM/JKS/.. etc.)
3780    #[serde(rename = "clientCertType")]
3781    pub client_cert_type: Option<String>,
3782    /// Optional. Client Certificate
3783    #[serde(rename = "clientCertificate")]
3784    pub client_certificate: Option<Secret>,
3785    /// Optional. Client Private Key
3786    #[serde(rename = "clientPrivateKey")]
3787    pub client_private_key: Option<Secret>,
3788    /// Optional. Secret containing the passphrase protecting the Client Private Key
3789    #[serde(rename = "clientPrivateKeyPass")]
3790    pub client_private_key_pass: Option<Secret>,
3791    /// Optional. Private Server Certificate. Needs to be specified if trust model is `PRIVATE`.
3792    #[serde(rename = "privateServerCertificate")]
3793    pub private_server_certificate: Option<Secret>,
3794    /// Optional. Type of Server Cert (PEM/JKS/.. etc.)
3795    #[serde(rename = "serverCertType")]
3796    pub server_cert_type: Option<String>,
3797    /// Optional. Trust Model of the SSL connection
3798    #[serde(rename = "trustModel")]
3799    pub trust_model: Option<String>,
3800    /// Optional. Controls the ssl type for the given connector version.
3801    #[serde(rename = "type")]
3802    pub type_: Option<String>,
3803    /// Optional. Bool for enabling SSL
3804    #[serde(rename = "useSsl")]
3805    pub use_ssl: Option<bool>,
3806}
3807
3808impl common::Part for SslConfig {}
3809
3810/// Ssl config details of a connector version
3811///
3812/// This type is not used in any activity, and only used as *part* of another schema.
3813///
3814#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3815#[serde_with::serde_as]
3816#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3817pub struct SslConfigTemplate {
3818    /// Any additional fields that need to be rendered
3819    #[serde(rename = "additionalVariables")]
3820    pub additional_variables: Option<Vec<ConfigVariableTemplate>>,
3821    /// List of supported Client Cert Types
3822    #[serde(rename = "clientCertType")]
3823    pub client_cert_type: Option<Vec<String>>,
3824    /// Boolean for determining if the connector version mandates TLS.
3825    #[serde(rename = "isTlsMandatory")]
3826    pub is_tls_mandatory: Option<bool>,
3827    /// List of supported Server Cert Types
3828    #[serde(rename = "serverCertType")]
3829    pub server_cert_type: Option<Vec<String>>,
3830    /// Controls the ssl type for the given connector version
3831    #[serde(rename = "sslType")]
3832    pub ssl_type: Option<String>,
3833}
3834
3835impl common::Part for SslConfigTemplate {}
3836
3837/// Standard action
3838///
3839/// This type is not used in any activity, and only used as *part* of another schema.
3840///
3841#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3842#[serde_with::serde_as]
3843#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3844pub struct StandardAction {
3845    /// Name of the standard action.
3846    pub name: Option<String>,
3847}
3848
3849impl common::Part for StandardAction {}
3850
3851/// Standard entity
3852///
3853/// This type is not used in any activity, and only used as *part* of another schema.
3854///
3855#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3856#[serde_with::serde_as]
3857#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3858pub struct StandardEntity {
3859    /// Name of the standard entity.
3860    pub name: Option<String>,
3861}
3862
3863impl common::Part for StandardEntity {}
3864
3865/// 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).
3866///
3867/// This type is not used in any activity, and only used as *part* of another schema.
3868///
3869#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3870#[serde_with::serde_as]
3871#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3872pub struct Status {
3873    /// The status code, which should be an enum value of google.rpc.Code.
3874    pub code: Option<i32>,
3875    /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
3876    pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
3877    /// 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.
3878    pub message: Option<String>,
3879}
3880
3881impl common::Part for Status {}
3882
3883/// Supported runtime features of a connector version.
3884///
3885/// This type is not used in any activity, and only used as *part* of another schema.
3886///
3887#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3888#[serde_with::serde_as]
3889#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3890pub struct SupportedRuntimeFeatures {
3891    /// Specifies if the connector supports action apis like 'executeAction'.
3892    #[serde(rename = "actionApis")]
3893    pub action_apis: Option<bool>,
3894    /// Specifies if the connector supports async long running operations.
3895    #[serde(rename = "asyncOperations")]
3896    pub async_operations: Option<bool>,
3897    /// Specifies if the connector supports entity apis like 'createEntity'.
3898    #[serde(rename = "entityApis")]
3899    pub entity_apis: Option<bool>,
3900    /// Specifies if the connector supports 'ExecuteSqlQuery' operation.
3901    #[serde(rename = "sqlQuery")]
3902    pub sql_query: Option<bool>,
3903}
3904
3905impl common::Part for SupportedRuntimeFeatures {}
3906
3907/// Request message for `TestIamPermissions` method.
3908///
3909/// # Activities
3910///
3911/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3912/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3913///
3914/// * [locations connections test iam permissions projects](ProjectLocationConnectionTestIamPermissionCall) (request)
3915/// * [locations providers test iam permissions projects](ProjectLocationProviderTestIamPermissionCall) (request)
3916#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3917#[serde_with::serde_as]
3918#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3919pub struct TestIamPermissionsRequest {
3920    /// 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).
3921    pub permissions: Option<Vec<String>>,
3922}
3923
3924impl common::RequestValue for TestIamPermissionsRequest {}
3925
3926/// Response message for `TestIamPermissions` method.
3927///
3928/// # Activities
3929///
3930/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3931/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3932///
3933/// * [locations connections test iam permissions projects](ProjectLocationConnectionTestIamPermissionCall) (response)
3934/// * [locations providers test iam permissions projects](ProjectLocationProviderTestIamPermissionCall) (response)
3935#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3936#[serde_with::serde_as]
3937#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3938pub struct TestIamPermissionsResponse {
3939    /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed.
3940    pub permissions: Option<Vec<String>>,
3941}
3942
3943impl common::ResponseResult for TestIamPermissionsResponse {}
3944
3945/// * TrafficShapingConfig defines the configuration for shaping API traffic by specifying a quota limit and the duration over which this limit is enforced. This configuration helps to control and manage the rate at which API calls are made on the client side, preventing service overload on the backend. For example: - if the quota limit is 100 calls per 10 seconds, then the message would be: { quota_limit: 100 duration: { seconds: 10 } } - if the quota limit is 100 calls per 5 minutes, then the message would be: { quota_limit: 100 duration: { seconds: 300 } } - if the quota limit is 10000 calls per day, then the message would be: { quota_limit: 10000 duration: { seconds: 86400 } and so on.
3946///
3947/// This type is not used in any activity, and only used as *part* of another schema.
3948///
3949#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3950#[serde_with::serde_as]
3951#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3952pub struct TrafficShapingConfig {
3953    /// Required. * The duration over which the API call quota limits are calculated. This duration is used to define the time window for evaluating if the number of API calls made by a user is within the allowed quota limits. For example: - To define a quota sampled over 16 seconds, set `seconds` to 16 - To define a quota sampled over 5 minutes, set `seconds` to 300 (5 * 60) - To define a quota sampled over 1 day, set `seconds` to 86400 (24 * 60 * 60) and so on. It is important to note that this duration is not the time the quota is valid for, but rather the time window over which the quota is evaluated. For example, if the quota is 100 calls per 10 seconds, then this duration field would be set to 10 seconds.
3954    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
3955    pub duration: Option<chrono::Duration>,
3956    /// Required. Maximum number of api calls allowed.
3957    #[serde(rename = "quotaLimit")]
3958    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3959    pub quota_limit: Option<i64>,
3960}
3961
3962impl common::Part for TrafficShapingConfig {}
3963
3964/// Parameters to support Username and Password Authentication.
3965///
3966/// This type is not used in any activity, and only used as *part* of another schema.
3967///
3968#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3969#[serde_with::serde_as]
3970#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3971pub struct UserPassword {
3972    /// Optional. Secret version reference containing the password.
3973    pub password: Option<Secret>,
3974    /// Optional. Username.
3975    pub username: Option<String>,
3976}
3977
3978impl common::Part for UserPassword {}
3979
3980/// Request message for ConnectorsService.ValidateCustomConnectorSpec
3981///
3982/// # Activities
3983///
3984/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3985/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3986///
3987/// * [locations custom connectors validate custom connector spec projects](ProjectLocationCustomConnectorValidateCustomConnectorSpecCall) (request)
3988#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3989#[serde_with::serde_as]
3990#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3991pub struct ValidateCustomConnectorSpecRequest {
3992    /// Required. Service account to access the spec from Google Cloud Storage.
3993    #[serde(rename = "serviceAccount")]
3994    pub service_account: Option<String>,
3995    /// Required. Location of the custom connector spec. The location can be either a public url like `https://public-url.com/spec` Or a Google Cloud Storage location like `gs:///`
3996    #[serde(rename = "specLocation")]
3997    pub spec_location: Option<String>,
3998    /// Required. Spec type of the custom connector spec.
3999    #[serde(rename = "specType")]
4000    pub spec_type: Option<String>,
4001}
4002
4003impl common::RequestValue for ValidateCustomConnectorSpecRequest {}
4004
4005/// Response message for ConnectorsService.ValidateCustomConnectorSpec
4006///
4007/// # Activities
4008///
4009/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4010/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4011///
4012/// * [locations custom connectors validate custom connector spec projects](ProjectLocationCustomConnectorValidateCustomConnectorSpecCall) (response)
4013#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4014#[serde_with::serde_as]
4015#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4016pub struct ValidateCustomConnectorSpecResponse {
4017    /// Error message. The spec is valid if the error message is empty.
4018    #[serde(rename = "errorMessage")]
4019    pub error_message: Option<String>,
4020}
4021
4022impl common::ResponseResult for ValidateCustomConnectorSpecResponse {}
4023
4024/// This configuration provides VPCSC config for a connector.
4025///
4026/// This type is not used in any activity, and only used as *part* of another schema.
4027///
4028#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4029#[serde_with::serde_as]
4030#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4031pub struct VpcscConfig {
4032    /// The list of allowlisted FQDNs for VPCSC.
4033    #[serde(rename = "defaultAllowlistedHost")]
4034    pub default_allowlisted_host: Option<Vec<String>>,
4035    /// Whether to disable firewall VPCSC flow.
4036    #[serde(rename = "disableFirewallVpcscFlow")]
4037    pub disable_firewall_vpcsc_flow: Option<bool>,
4038}
4039
4040impl common::Part for VpcscConfig {}
4041
4042/// WebhookData has details of webhook configuration.
4043///
4044/// This type is not used in any activity, and only used as *part* of another schema.
4045///
4046#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4047#[serde_with::serde_as]
4048#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4049pub struct WebhookData {
4050    /// Output only. Additional webhook related field values.
4051    #[serde(rename = "additionalVariables")]
4052    pub additional_variables: Option<Vec<ConfigVariable>>,
4053    /// Output only. Timestamp when the webhook was created.
4054    #[serde(rename = "createTime")]
4055    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
4056    /// Output only. ID to uniquely identify webhook.
4057    pub id: Option<String>,
4058    /// Output only. Name of the Webhook
4059    pub name: Option<String>,
4060    /// Output only. Next webhook refresh time. Will be null if refresh is not supported.
4061    #[serde(rename = "nextRefreshTime")]
4062    pub next_refresh_time: Option<chrono::DateTime<chrono::offset::Utc>>,
4063    /// Output only. Timestamp when the webhook was last updated.
4064    #[serde(rename = "updateTime")]
4065    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
4066}
4067
4068impl common::Part for WebhookData {}
4069
4070/// WebhookSubscriptions has details of webhook subscriptions.
4071///
4072/// This type is not used in any activity, and only used as *part* of another schema.
4073///
4074#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4075#[serde_with::serde_as]
4076#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4077pub struct WebhookSubscriptions {
4078    /// Output only. Webhook data.
4079    #[serde(rename = "webhookData")]
4080    pub webhook_data: Option<Vec<WebhookData>>,
4081}
4082
4083impl common::Part for WebhookSubscriptions {}
4084
4085/// Request message for ConnectorsService.WithdrawCustomConnectorVersion
4086///
4087/// # Activities
4088///
4089/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4090/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4091///
4092/// * [locations custom connectors custom connector versions withdraw projects](ProjectLocationCustomConnectorCustomConnectorVersionWithdrawCall) (request)
4093#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4094#[serde_with::serde_as]
4095#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4096pub struct WithdrawCustomConnectorVersionRequest {
4097    _never_set: Option<bool>,
4098}
4099
4100impl common::RequestValue for WithdrawCustomConnectorVersionRequest {}
4101
4102// ###################
4103// MethodBuilders ###
4104// #################
4105
4106/// A builder providing access to all methods supported on *project* resources.
4107/// It is not used directly, but through the [`Connectors`] hub.
4108///
4109/// # Example
4110///
4111/// Instantiate a resource builder
4112///
4113/// ```test_harness,no_run
4114/// extern crate hyper;
4115/// extern crate hyper_rustls;
4116/// extern crate google_connectors1 as connectors1;
4117///
4118/// # async fn dox() {
4119/// use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4120///
4121/// let secret: yup_oauth2::ApplicationSecret = Default::default();
4122/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
4123///     .with_native_roots()
4124///     .unwrap()
4125///     .https_only()
4126///     .enable_http2()
4127///     .build();
4128///
4129/// let executor = hyper_util::rt::TokioExecutor::new();
4130/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4131///     secret,
4132///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4133///     yup_oauth2::client::CustomHyperClientBuilder::from(
4134///         hyper_util::client::legacy::Client::builder(executor).build(connector),
4135///     ),
4136/// ).build().await.unwrap();
4137///
4138/// let client = hyper_util::client::legacy::Client::builder(
4139///     hyper_util::rt::TokioExecutor::new()
4140/// )
4141/// .build(
4142///     hyper_rustls::HttpsConnectorBuilder::new()
4143///         .with_native_roots()
4144///         .unwrap()
4145///         .https_or_http()
4146///         .enable_http2()
4147///         .build()
4148/// );
4149/// let mut hub = Connectors::new(client, auth);
4150/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
4151/// // like `locations_connections_connection_schema_metadata_get_action(...)`, `locations_connections_connection_schema_metadata_get_entity_type(...)`, `locations_connections_connection_schema_metadata_list_actions(...)`, `locations_connections_connection_schema_metadata_list_entity_types(...)`, `locations_connections_connection_schema_metadata_refresh(...)`, `locations_connections_create(...)`, `locations_connections_delete(...)`, `locations_connections_end_user_authentications_create(...)`, `locations_connections_end_user_authentications_delete(...)`, `locations_connections_end_user_authentications_get(...)`, `locations_connections_end_user_authentications_list(...)`, `locations_connections_end_user_authentications_patch(...)`, `locations_connections_event_subscriptions_create(...)`, `locations_connections_event_subscriptions_delete(...)`, `locations_connections_event_subscriptions_get(...)`, `locations_connections_event_subscriptions_list(...)`, `locations_connections_event_subscriptions_patch(...)`, `locations_connections_event_subscriptions_retry(...)`, `locations_connections_get(...)`, `locations_connections_get_connection_schema_metadata(...)`, `locations_connections_get_iam_policy(...)`, `locations_connections_list(...)`, `locations_connections_listen_event(...)`, `locations_connections_patch(...)`, `locations_connections_repair_eventing(...)`, `locations_connections_runtime_action_schemas_list(...)`, `locations_connections_runtime_entity_schemas_list(...)`, `locations_connections_search(...)`, `locations_connections_set_iam_policy(...)`, `locations_connections_test_iam_permissions(...)`, `locations_custom_connectors_custom_connector_versions_delete(...)`, `locations_custom_connectors_custom_connector_versions_deprecate(...)`, `locations_custom_connectors_custom_connector_versions_publish(...)`, `locations_custom_connectors_custom_connector_versions_withdraw(...)`, `locations_custom_connectors_validate_custom_connector_spec(...)`, `locations_endpoint_attachments_create(...)`, `locations_endpoint_attachments_delete(...)`, `locations_endpoint_attachments_get(...)`, `locations_endpoint_attachments_list(...)`, `locations_endpoint_attachments_patch(...)`, `locations_get(...)`, `locations_get_regional_settings(...)`, `locations_get_runtime_config(...)`, `locations_global_custom_connectors_create(...)`, `locations_global_custom_connectors_custom_connector_versions_create(...)`, `locations_global_custom_connectors_custom_connector_versions_get(...)`, `locations_global_custom_connectors_custom_connector_versions_list(...)`, `locations_global_custom_connectors_delete(...)`, `locations_global_custom_connectors_get(...)`, `locations_global_custom_connectors_list(...)`, `locations_global_custom_connectors_patch(...)`, `locations_global_get_settings(...)`, `locations_global_managed_zones_create(...)`, `locations_global_managed_zones_delete(...)`, `locations_global_managed_zones_get(...)`, `locations_global_managed_zones_list(...)`, `locations_global_managed_zones_patch(...)`, `locations_global_update_settings(...)`, `locations_list(...)`, `locations_operations_cancel(...)`, `locations_operations_delete(...)`, `locations_operations_get(...)`, `locations_operations_list(...)`, `locations_providers_connectors_get(...)`, `locations_providers_connectors_list(...)`, `locations_providers_connectors_versions_eventtypes_get(...)`, `locations_providers_connectors_versions_eventtypes_list(...)`, `locations_providers_connectors_versions_fetch_auth_schema(...)`, `locations_providers_connectors_versions_get(...)`, `locations_providers_connectors_versions_list(...)`, `locations_providers_get(...)`, `locations_providers_get_iam_policy(...)`, `locations_providers_list(...)`, `locations_providers_set_iam_policy(...)`, `locations_providers_test_iam_permissions(...)` and `locations_update_regional_settings(...)`
4152/// // to build up your call.
4153/// let rb = hub.projects();
4154/// # }
4155/// ```
4156pub struct ProjectMethods<'a, C>
4157where
4158    C: 'a,
4159{
4160    hub: &'a Connectors<C>,
4161}
4162
4163impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
4164
4165impl<'a, C> ProjectMethods<'a, C> {
4166    /// Create a builder to help you perform the following task:
4167    ///
4168    /// Get action.
4169    ///
4170    /// # Arguments
4171    ///
4172    /// * `name` - Required. Resource name format: projects/{project}/locations/{location}/connections/{connection}/connectionSchemaMetadata
4173    pub fn locations_connections_connection_schema_metadata_get_action(
4174        &self,
4175        name: &str,
4176    ) -> ProjectLocationConnectionConnectionSchemaMetadataGetActionCall<'a, C> {
4177        ProjectLocationConnectionConnectionSchemaMetadataGetActionCall {
4178            hub: self.hub,
4179            _name: name.to_string(),
4180            _action_id: Default::default(),
4181            _delegate: Default::default(),
4182            _additional_params: Default::default(),
4183            _scopes: Default::default(),
4184        }
4185    }
4186
4187    /// Create a builder to help you perform the following task:
4188    ///
4189    /// Get entity type.
4190    ///
4191    /// # Arguments
4192    ///
4193    /// * `name` - Required. Resource name format: projects/{project}/locations/{location}/connections/{connection}/connectionSchemaMetadata
4194    pub fn locations_connections_connection_schema_metadata_get_entity_type(
4195        &self,
4196        name: &str,
4197    ) -> ProjectLocationConnectionConnectionSchemaMetadataGetEntityTypeCall<'a, C> {
4198        ProjectLocationConnectionConnectionSchemaMetadataGetEntityTypeCall {
4199            hub: self.hub,
4200            _name: name.to_string(),
4201            _entity_id: Default::default(),
4202            _delegate: Default::default(),
4203            _additional_params: Default::default(),
4204            _scopes: Default::default(),
4205        }
4206    }
4207
4208    /// Create a builder to help you perform the following task:
4209    ///
4210    /// List actions.
4211    ///
4212    /// # Arguments
4213    ///
4214    /// * `name` - Required. Resource name format. projects/{project}/locations/{location}/connections/{connection}/connectionSchemaMetadata
4215    pub fn locations_connections_connection_schema_metadata_list_actions(
4216        &self,
4217        name: &str,
4218    ) -> ProjectLocationConnectionConnectionSchemaMetadataListActionCall<'a, C> {
4219        ProjectLocationConnectionConnectionSchemaMetadataListActionCall {
4220            hub: self.hub,
4221            _name: name.to_string(),
4222            _view: Default::default(),
4223            _page_token: Default::default(),
4224            _page_size: Default::default(),
4225            _filter: Default::default(),
4226            _delegate: Default::default(),
4227            _additional_params: Default::default(),
4228            _scopes: Default::default(),
4229        }
4230    }
4231
4232    /// Create a builder to help you perform the following task:
4233    ///
4234    /// List entity types.
4235    ///
4236    /// # Arguments
4237    ///
4238    /// * `name` - Required. Resource name format: projects/{project}/locations/{location}/connections/{connection}/connectionSchemaMetadata
4239    pub fn locations_connections_connection_schema_metadata_list_entity_types(
4240        &self,
4241        name: &str,
4242    ) -> ProjectLocationConnectionConnectionSchemaMetadataListEntityTypeCall<'a, C> {
4243        ProjectLocationConnectionConnectionSchemaMetadataListEntityTypeCall {
4244            hub: self.hub,
4245            _name: name.to_string(),
4246            _view: Default::default(),
4247            _page_token: Default::default(),
4248            _page_size: Default::default(),
4249            _filter: Default::default(),
4250            _delegate: Default::default(),
4251            _additional_params: Default::default(),
4252            _scopes: Default::default(),
4253        }
4254    }
4255
4256    /// Create a builder to help you perform the following task:
4257    ///
4258    /// Refresh runtime schema of a connection.
4259    ///
4260    /// # Arguments
4261    ///
4262    /// * `request` - No description provided.
4263    /// * `name` - Required. Resource name. Format: projects/{project}/locations/{location}/connections/{connection}/connectionSchemaMetadata
4264    pub fn locations_connections_connection_schema_metadata_refresh(
4265        &self,
4266        request: RefreshConnectionSchemaMetadataRequest,
4267        name: &str,
4268    ) -> ProjectLocationConnectionConnectionSchemaMetadataRefreshCall<'a, C> {
4269        ProjectLocationConnectionConnectionSchemaMetadataRefreshCall {
4270            hub: self.hub,
4271            _request: request,
4272            _name: name.to_string(),
4273            _delegate: Default::default(),
4274            _additional_params: Default::default(),
4275            _scopes: Default::default(),
4276        }
4277    }
4278
4279    /// Create a builder to help you perform the following task:
4280    ///
4281    /// Creates a new EndUserAuthentication in a given project,location and connection.
4282    ///
4283    /// # Arguments
4284    ///
4285    /// * `request` - No description provided.
4286    /// * `parent` - Required. Parent resource of the EndUserAuthentication, of the form: `projects/*/locations/*/connections/*`
4287    pub fn locations_connections_end_user_authentications_create(
4288        &self,
4289        request: EndUserAuthentication,
4290        parent: &str,
4291    ) -> ProjectLocationConnectionEndUserAuthenticationCreateCall<'a, C> {
4292        ProjectLocationConnectionEndUserAuthenticationCreateCall {
4293            hub: self.hub,
4294            _request: request,
4295            _parent: parent.to_string(),
4296            _end_user_authentication_id: Default::default(),
4297            _delegate: Default::default(),
4298            _additional_params: Default::default(),
4299            _scopes: Default::default(),
4300        }
4301    }
4302
4303    /// Create a builder to help you perform the following task:
4304    ///
4305    /// Deletes a single EndUserAuthentication.
4306    ///
4307    /// # Arguments
4308    ///
4309    /// * `name` - Required. Resource name of the form: `projects/*/locations/*/connections/*/endUserAuthentication/*`
4310    pub fn locations_connections_end_user_authentications_delete(
4311        &self,
4312        name: &str,
4313    ) -> ProjectLocationConnectionEndUserAuthenticationDeleteCall<'a, C> {
4314        ProjectLocationConnectionEndUserAuthenticationDeleteCall {
4315            hub: self.hub,
4316            _name: name.to_string(),
4317            _delegate: Default::default(),
4318            _additional_params: Default::default(),
4319            _scopes: Default::default(),
4320        }
4321    }
4322
4323    /// Create a builder to help you perform the following task:
4324    ///
4325    /// Gets details of a single EndUserAuthentication.
4326    ///
4327    /// # Arguments
4328    ///
4329    /// * `name` - Required. Resource name of the form: `projects/*/locations/*/connections/*/EndUserAuthentications/*`
4330    pub fn locations_connections_end_user_authentications_get(
4331        &self,
4332        name: &str,
4333    ) -> ProjectLocationConnectionEndUserAuthenticationGetCall<'a, C> {
4334        ProjectLocationConnectionEndUserAuthenticationGetCall {
4335            hub: self.hub,
4336            _name: name.to_string(),
4337            _view: Default::default(),
4338            _delegate: Default::default(),
4339            _additional_params: Default::default(),
4340            _scopes: Default::default(),
4341        }
4342    }
4343
4344    /// Create a builder to help you perform the following task:
4345    ///
4346    /// List EndUserAuthentications in a given project,location and connection.
4347    ///
4348    /// # Arguments
4349    ///
4350    /// * `parent` - Required. Parent resource of the EndUserAuthentication, of the form: `projects/*/locations/*/connections/*`
4351    pub fn locations_connections_end_user_authentications_list(
4352        &self,
4353        parent: &str,
4354    ) -> ProjectLocationConnectionEndUserAuthenticationListCall<'a, C> {
4355        ProjectLocationConnectionEndUserAuthenticationListCall {
4356            hub: self.hub,
4357            _parent: parent.to_string(),
4358            _page_token: Default::default(),
4359            _page_size: Default::default(),
4360            _order_by: Default::default(),
4361            _filter: Default::default(),
4362            _delegate: Default::default(),
4363            _additional_params: Default::default(),
4364            _scopes: Default::default(),
4365        }
4366    }
4367
4368    /// Create a builder to help you perform the following task:
4369    ///
4370    /// Updates the parameters of a single EndUserAuthentication.
4371    ///
4372    /// # Arguments
4373    ///
4374    /// * `request` - No description provided.
4375    /// * `name` - Required. Identifier. Resource name of the EndUserAuthentication. Format: projects/{project}/locations/{location}/connections/{connection}/endUserAuthentications/{end_user_authentication}
4376    pub fn locations_connections_end_user_authentications_patch(
4377        &self,
4378        request: EndUserAuthentication,
4379        name: &str,
4380    ) -> ProjectLocationConnectionEndUserAuthenticationPatchCall<'a, C> {
4381        ProjectLocationConnectionEndUserAuthenticationPatchCall {
4382            hub: self.hub,
4383            _request: request,
4384            _name: name.to_string(),
4385            _update_mask: Default::default(),
4386            _delegate: Default::default(),
4387            _additional_params: Default::default(),
4388            _scopes: Default::default(),
4389        }
4390    }
4391
4392    /// Create a builder to help you perform the following task:
4393    ///
4394    /// Creates a new EventSubscription in a given project,location and connection.
4395    ///
4396    /// # Arguments
4397    ///
4398    /// * `request` - No description provided.
4399    /// * `parent` - Required. Parent resource of the EventSubscription, of the form: `projects/*/locations/*/connections/*`
4400    pub fn locations_connections_event_subscriptions_create(
4401        &self,
4402        request: EventSubscription,
4403        parent: &str,
4404    ) -> ProjectLocationConnectionEventSubscriptionCreateCall<'a, C> {
4405        ProjectLocationConnectionEventSubscriptionCreateCall {
4406            hub: self.hub,
4407            _request: request,
4408            _parent: parent.to_string(),
4409            _event_subscription_id: Default::default(),
4410            _delegate: Default::default(),
4411            _additional_params: Default::default(),
4412            _scopes: Default::default(),
4413        }
4414    }
4415
4416    /// Create a builder to help you perform the following task:
4417    ///
4418    /// Deletes a single EventSubscription.
4419    ///
4420    /// # Arguments
4421    ///
4422    /// * `name` - Required. Resource name of the form: `projects/*/locations/*/connections/*/eventsubscriptions/*`
4423    pub fn locations_connections_event_subscriptions_delete(
4424        &self,
4425        name: &str,
4426    ) -> ProjectLocationConnectionEventSubscriptionDeleteCall<'a, C> {
4427        ProjectLocationConnectionEventSubscriptionDeleteCall {
4428            hub: self.hub,
4429            _name: name.to_string(),
4430            _delegate: Default::default(),
4431            _additional_params: Default::default(),
4432            _scopes: Default::default(),
4433        }
4434    }
4435
4436    /// Create a builder to help you perform the following task:
4437    ///
4438    /// Gets details of a single EventSubscription.
4439    ///
4440    /// # Arguments
4441    ///
4442    /// * `name` - Required. Resource name of the form: `projects/*/locations/*/connections/*/eventSubscriptions/*`
4443    pub fn locations_connections_event_subscriptions_get(
4444        &self,
4445        name: &str,
4446    ) -> ProjectLocationConnectionEventSubscriptionGetCall<'a, C> {
4447        ProjectLocationConnectionEventSubscriptionGetCall {
4448            hub: self.hub,
4449            _name: name.to_string(),
4450            _delegate: Default::default(),
4451            _additional_params: Default::default(),
4452            _scopes: Default::default(),
4453        }
4454    }
4455
4456    /// Create a builder to help you perform the following task:
4457    ///
4458    /// List EventSubscriptions in a given project,location and connection.
4459    ///
4460    /// # Arguments
4461    ///
4462    /// * `parent` - Required. Parent resource of the EventSubscription, of the form: `projects/*/locations/*/connections/*`
4463    pub fn locations_connections_event_subscriptions_list(
4464        &self,
4465        parent: &str,
4466    ) -> ProjectLocationConnectionEventSubscriptionListCall<'a, C> {
4467        ProjectLocationConnectionEventSubscriptionListCall {
4468            hub: self.hub,
4469            _parent: parent.to_string(),
4470            _page_token: Default::default(),
4471            _page_size: Default::default(),
4472            _order_by: Default::default(),
4473            _filter: Default::default(),
4474            _delegate: Default::default(),
4475            _additional_params: Default::default(),
4476            _scopes: Default::default(),
4477        }
4478    }
4479
4480    /// Create a builder to help you perform the following task:
4481    ///
4482    /// Updates the parameters of a single EventSubscription.
4483    ///
4484    /// # Arguments
4485    ///
4486    /// * `request` - No description provided.
4487    /// * `name` - Required. Identifier. Resource name of the EventSubscription. Format: projects/{project}/locations/{location}/connections/{connection}/eventSubscriptions/{event_subscription}
4488    pub fn locations_connections_event_subscriptions_patch(
4489        &self,
4490        request: EventSubscription,
4491        name: &str,
4492    ) -> ProjectLocationConnectionEventSubscriptionPatchCall<'a, C> {
4493        ProjectLocationConnectionEventSubscriptionPatchCall {
4494            hub: self.hub,
4495            _request: request,
4496            _name: name.to_string(),
4497            _update_mask: Default::default(),
4498            _delegate: Default::default(),
4499            _additional_params: Default::default(),
4500            _scopes: Default::default(),
4501        }
4502    }
4503
4504    /// Create a builder to help you perform the following task:
4505    ///
4506    /// RetryEventSubscription retries the registration of Subscription.
4507    ///
4508    /// # Arguments
4509    ///
4510    /// * `request` - No description provided.
4511    /// * `name` - Required. Resource name of the form: `projects/*/locations/*/connections/*/eventSubscriptions/*`
4512    pub fn locations_connections_event_subscriptions_retry(
4513        &self,
4514        request: RetryEventSubscriptionRequest,
4515        name: &str,
4516    ) -> ProjectLocationConnectionEventSubscriptionRetryCall<'a, C> {
4517        ProjectLocationConnectionEventSubscriptionRetryCall {
4518            hub: self.hub,
4519            _request: request,
4520            _name: name.to_string(),
4521            _delegate: Default::default(),
4522            _additional_params: Default::default(),
4523            _scopes: Default::default(),
4524        }
4525    }
4526
4527    /// Create a builder to help you perform the following task:
4528    ///
4529    /// List schema of a runtime actions filtered by action name.
4530    ///
4531    /// # Arguments
4532    ///
4533    /// * `parent` - Required. Parent resource of RuntimeActionSchema Format: projects/{project}/locations/{location}/connections/{connection}
4534    pub fn locations_connections_runtime_action_schemas_list(
4535        &self,
4536        parent: &str,
4537    ) -> ProjectLocationConnectionRuntimeActionSchemaListCall<'a, C> {
4538        ProjectLocationConnectionRuntimeActionSchemaListCall {
4539            hub: self.hub,
4540            _parent: parent.to_string(),
4541            _schema_as_string: Default::default(),
4542            _page_token: Default::default(),
4543            _page_size: Default::default(),
4544            _filter: Default::default(),
4545            _delegate: Default::default(),
4546            _additional_params: Default::default(),
4547            _scopes: Default::default(),
4548        }
4549    }
4550
4551    /// Create a builder to help you perform the following task:
4552    ///
4553    /// List schema of a runtime entities filtered by entity name.
4554    ///
4555    /// # Arguments
4556    ///
4557    /// * `parent` - Required. Parent resource of RuntimeEntitySchema Format: projects/{project}/locations/{location}/connections/{connection}
4558    pub fn locations_connections_runtime_entity_schemas_list(
4559        &self,
4560        parent: &str,
4561    ) -> ProjectLocationConnectionRuntimeEntitySchemaListCall<'a, C> {
4562        ProjectLocationConnectionRuntimeEntitySchemaListCall {
4563            hub: self.hub,
4564            _parent: parent.to_string(),
4565            _page_token: Default::default(),
4566            _page_size: Default::default(),
4567            _filter: Default::default(),
4568            _delegate: Default::default(),
4569            _additional_params: Default::default(),
4570            _scopes: Default::default(),
4571        }
4572    }
4573
4574    /// Create a builder to help you perform the following task:
4575    ///
4576    /// Creates a new Connection in a given project and location.
4577    ///
4578    /// # Arguments
4579    ///
4580    /// * `request` - No description provided.
4581    /// * `parent` - Required. Parent resource of the Connection, of the form: `projects/*/locations/*`
4582    pub fn locations_connections_create(
4583        &self,
4584        request: Connection,
4585        parent: &str,
4586    ) -> ProjectLocationConnectionCreateCall<'a, C> {
4587        ProjectLocationConnectionCreateCall {
4588            hub: self.hub,
4589            _request: request,
4590            _parent: parent.to_string(),
4591            _connection_id: Default::default(),
4592            _delegate: Default::default(),
4593            _additional_params: Default::default(),
4594            _scopes: Default::default(),
4595        }
4596    }
4597
4598    /// Create a builder to help you perform the following task:
4599    ///
4600    /// Deletes a single Connection.
4601    ///
4602    /// # Arguments
4603    ///
4604    /// * `name` - Required. Resource name of the form: `projects/*/locations/*/connections/*`
4605    pub fn locations_connections_delete(
4606        &self,
4607        name: &str,
4608    ) -> ProjectLocationConnectionDeleteCall<'a, C> {
4609        ProjectLocationConnectionDeleteCall {
4610            hub: self.hub,
4611            _name: name.to_string(),
4612            _force: Default::default(),
4613            _delegate: Default::default(),
4614            _additional_params: Default::default(),
4615            _scopes: Default::default(),
4616        }
4617    }
4618
4619    /// Create a builder to help you perform the following task:
4620    ///
4621    /// Gets details of a single Connection.
4622    ///
4623    /// # Arguments
4624    ///
4625    /// * `name` - Required. Resource name of the form: `projects/*/locations/*/connections/*`
4626    pub fn locations_connections_get(&self, name: &str) -> ProjectLocationConnectionGetCall<'a, C> {
4627        ProjectLocationConnectionGetCall {
4628            hub: self.hub,
4629            _name: name.to_string(),
4630            _view: Default::default(),
4631            _delegate: Default::default(),
4632            _additional_params: Default::default(),
4633            _scopes: Default::default(),
4634        }
4635    }
4636
4637    /// Create a builder to help you perform the following task:
4638    ///
4639    /// Gets schema metadata of a connection. SchemaMetadata is a singleton resource for each connection.
4640    ///
4641    /// # Arguments
4642    ///
4643    /// * `name` - Required. Connection name Format: projects/{project}/locations/{location}/connections/{connection}/connectionSchemaMetadata
4644    pub fn locations_connections_get_connection_schema_metadata(
4645        &self,
4646        name: &str,
4647    ) -> ProjectLocationConnectionGetConnectionSchemaMetadataCall<'a, C> {
4648        ProjectLocationConnectionGetConnectionSchemaMetadataCall {
4649            hub: self.hub,
4650            _name: name.to_string(),
4651            _delegate: Default::default(),
4652            _additional_params: Default::default(),
4653            _scopes: Default::default(),
4654        }
4655    }
4656
4657    /// Create a builder to help you perform the following task:
4658    ///
4659    /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
4660    ///
4661    /// # Arguments
4662    ///
4663    /// * `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.
4664    pub fn locations_connections_get_iam_policy(
4665        &self,
4666        resource: &str,
4667    ) -> ProjectLocationConnectionGetIamPolicyCall<'a, C> {
4668        ProjectLocationConnectionGetIamPolicyCall {
4669            hub: self.hub,
4670            _resource: resource.to_string(),
4671            _options_requested_policy_version: Default::default(),
4672            _delegate: Default::default(),
4673            _additional_params: Default::default(),
4674            _scopes: Default::default(),
4675        }
4676    }
4677
4678    /// Create a builder to help you perform the following task:
4679    ///
4680    /// Lists Connections in a given project and location.
4681    ///
4682    /// # Arguments
4683    ///
4684    /// * `parent` - Required. Parent resource of the Connection, of the form: `projects/*/locations/*`
4685    pub fn locations_connections_list(
4686        &self,
4687        parent: &str,
4688    ) -> ProjectLocationConnectionListCall<'a, C> {
4689        ProjectLocationConnectionListCall {
4690            hub: self.hub,
4691            _parent: parent.to_string(),
4692            _view: Default::default(),
4693            _page_token: Default::default(),
4694            _page_size: Default::default(),
4695            _order_by: Default::default(),
4696            _filter: Default::default(),
4697            _delegate: Default::default(),
4698            _additional_params: Default::default(),
4699            _scopes: Default::default(),
4700        }
4701    }
4702
4703    /// Create a builder to help you perform the following task:
4704    ///
4705    /// ListenEvent listens to the event.
4706    ///
4707    /// # Arguments
4708    ///
4709    /// * `request` - No description provided.
4710    /// * `resourcePath` - Required. Resource path for request.
4711    pub fn locations_connections_listen_event(
4712        &self,
4713        request: ListenEventRequest,
4714        resource_path: &str,
4715    ) -> ProjectLocationConnectionListenEventCall<'a, C> {
4716        ProjectLocationConnectionListenEventCall {
4717            hub: self.hub,
4718            _request: request,
4719            _resource_path: resource_path.to_string(),
4720            _delegate: Default::default(),
4721            _additional_params: Default::default(),
4722            _scopes: Default::default(),
4723        }
4724    }
4725
4726    /// Create a builder to help you perform the following task:
4727    ///
4728    /// Updates the parameters of a single Connection.
4729    ///
4730    /// # Arguments
4731    ///
4732    /// * `request` - No description provided.
4733    /// * `name` - Output only. Resource name of the Connection. Format: projects/{project}/locations/{location}/connections/{connection}
4734    pub fn locations_connections_patch(
4735        &self,
4736        request: Connection,
4737        name: &str,
4738    ) -> ProjectLocationConnectionPatchCall<'a, C> {
4739        ProjectLocationConnectionPatchCall {
4740            hub: self.hub,
4741            _request: request,
4742            _name: name.to_string(),
4743            _update_mask: Default::default(),
4744            _delegate: Default::default(),
4745            _additional_params: Default::default(),
4746            _scopes: Default::default(),
4747        }
4748    }
4749
4750    /// Create a builder to help you perform the following task:
4751    ///
4752    /// RepaiEventing tries to repair eventing related event subscriptions.
4753    ///
4754    /// # Arguments
4755    ///
4756    /// * `request` - No description provided.
4757    /// * `name` - Required. Resource name of the form: `projects/*/locations/*/connections/*`
4758    pub fn locations_connections_repair_eventing(
4759        &self,
4760        request: RepairEventingRequest,
4761        name: &str,
4762    ) -> ProjectLocationConnectionRepairEventingCall<'a, C> {
4763        ProjectLocationConnectionRepairEventingCall {
4764            hub: self.hub,
4765            _request: request,
4766            _name: name.to_string(),
4767            _delegate: Default::default(),
4768            _additional_params: Default::default(),
4769            _scopes: Default::default(),
4770        }
4771    }
4772
4773    /// Create a builder to help you perform the following task:
4774    ///
4775    /// Returns Top matching Connections for a given query.
4776    ///
4777    /// # Arguments
4778    ///
4779    /// * `name` - Required. Parent resource of the Connection, of the form: `projects/*/locations/*/connections`
4780    pub fn locations_connections_search(
4781        &self,
4782        name: &str,
4783    ) -> ProjectLocationConnectionSearchCall<'a, C> {
4784        ProjectLocationConnectionSearchCall {
4785            hub: self.hub,
4786            _name: name.to_string(),
4787            _query: Default::default(),
4788            _page_token: Default::default(),
4789            _page_size: Default::default(),
4790            _delegate: Default::default(),
4791            _additional_params: Default::default(),
4792            _scopes: Default::default(),
4793        }
4794    }
4795
4796    /// Create a builder to help you perform the following task:
4797    ///
4798    /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
4799    ///
4800    /// # Arguments
4801    ///
4802    /// * `request` - No description provided.
4803    /// * `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.
4804    pub fn locations_connections_set_iam_policy(
4805        &self,
4806        request: SetIamPolicyRequest,
4807        resource: &str,
4808    ) -> ProjectLocationConnectionSetIamPolicyCall<'a, C> {
4809        ProjectLocationConnectionSetIamPolicyCall {
4810            hub: self.hub,
4811            _request: request,
4812            _resource: resource.to_string(),
4813            _delegate: Default::default(),
4814            _additional_params: Default::default(),
4815            _scopes: Default::default(),
4816        }
4817    }
4818
4819    /// Create a builder to help you perform the following task:
4820    ///
4821    /// 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.
4822    ///
4823    /// # Arguments
4824    ///
4825    /// * `request` - No description provided.
4826    /// * `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.
4827    pub fn locations_connections_test_iam_permissions(
4828        &self,
4829        request: TestIamPermissionsRequest,
4830        resource: &str,
4831    ) -> ProjectLocationConnectionTestIamPermissionCall<'a, C> {
4832        ProjectLocationConnectionTestIamPermissionCall {
4833            hub: self.hub,
4834            _request: request,
4835            _resource: resource.to_string(),
4836            _delegate: Default::default(),
4837            _additional_params: Default::default(),
4838            _scopes: Default::default(),
4839        }
4840    }
4841
4842    /// Create a builder to help you perform the following task:
4843    ///
4844    /// Deletes a single CustomConnectorVersion.
4845    ///
4846    /// # Arguments
4847    ///
4848    /// * `name` - Required. Resource name of the form: `projects/{project}/locations/{location}/customConnectors/{custom_connector}/customConnectorVersions/{custom_connector_version}`
4849    pub fn locations_custom_connectors_custom_connector_versions_delete(
4850        &self,
4851        name: &str,
4852    ) -> ProjectLocationCustomConnectorCustomConnectorVersionDeleteCall<'a, C> {
4853        ProjectLocationCustomConnectorCustomConnectorVersionDeleteCall {
4854            hub: self.hub,
4855            _name: name.to_string(),
4856            _delegate: Default::default(),
4857            _additional_params: Default::default(),
4858            _scopes: Default::default(),
4859        }
4860    }
4861
4862    /// Create a builder to help you perform the following task:
4863    ///
4864    /// Deprecates a single CustomConnectorVersion.
4865    ///
4866    /// # Arguments
4867    ///
4868    /// * `request` - No description provided.
4869    /// * `name` - Required. Resource name of the form: `projects/{project}/locations/{location}/customConnectors/{custom_connector}/customConnectorVersions/{custom_connector_version}`
4870    pub fn locations_custom_connectors_custom_connector_versions_deprecate(
4871        &self,
4872        request: DeprecateCustomConnectorVersionRequest,
4873        name: &str,
4874    ) -> ProjectLocationCustomConnectorCustomConnectorVersionDeprecateCall<'a, C> {
4875        ProjectLocationCustomConnectorCustomConnectorVersionDeprecateCall {
4876            hub: self.hub,
4877            _request: request,
4878            _name: name.to_string(),
4879            _delegate: Default::default(),
4880            _additional_params: Default::default(),
4881            _scopes: Default::default(),
4882        }
4883    }
4884
4885    /// Create a builder to help you perform the following task:
4886    ///
4887    /// Publish request for the CustomConnectorVersion. Once approved, the CustomConnectorVersion will be published as PartnerConnector.
4888    ///
4889    /// # Arguments
4890    ///
4891    /// * `request` - No description provided.
4892    /// * `name` - Required. Resource name of the form: `projects/{project}/locations/{location}/customConnectors/{custom_connector}/customConnectorVersions/{custom_connector_version}`
4893    pub fn locations_custom_connectors_custom_connector_versions_publish(
4894        &self,
4895        request: PublishCustomConnectorVersionRequest,
4896        name: &str,
4897    ) -> ProjectLocationCustomConnectorCustomConnectorVersionPublishCall<'a, C> {
4898        ProjectLocationCustomConnectorCustomConnectorVersionPublishCall {
4899            hub: self.hub,
4900            _request: request,
4901            _name: name.to_string(),
4902            _delegate: Default::default(),
4903            _additional_params: Default::default(),
4904            _scopes: Default::default(),
4905        }
4906    }
4907
4908    /// Create a builder to help you perform the following task:
4909    ///
4910    /// Withdraw the publish request for the CustomConnectorVersion. This can only be used before the CustomConnectorVersion is published.
4911    ///
4912    /// # Arguments
4913    ///
4914    /// * `request` - No description provided.
4915    /// * `name` - Required. Resource name of the form: `projects/{project}/locations/{location}/customConnectors/{custom_connector}/customConnectorVersions/{custom_connector_version}`
4916    pub fn locations_custom_connectors_custom_connector_versions_withdraw(
4917        &self,
4918        request: WithdrawCustomConnectorVersionRequest,
4919        name: &str,
4920    ) -> ProjectLocationCustomConnectorCustomConnectorVersionWithdrawCall<'a, C> {
4921        ProjectLocationCustomConnectorCustomConnectorVersionWithdrawCall {
4922            hub: self.hub,
4923            _request: request,
4924            _name: name.to_string(),
4925            _delegate: Default::default(),
4926            _additional_params: Default::default(),
4927            _scopes: Default::default(),
4928        }
4929    }
4930
4931    /// Create a builder to help you perform the following task:
4932    ///
4933    /// Validates a Custom Connector Spec.
4934    ///
4935    /// # Arguments
4936    ///
4937    /// * `request` - No description provided.
4938    /// * `parent` - Required. Location at which the custom connector is being created.
4939    pub fn locations_custom_connectors_validate_custom_connector_spec(
4940        &self,
4941        request: ValidateCustomConnectorSpecRequest,
4942        parent: &str,
4943    ) -> ProjectLocationCustomConnectorValidateCustomConnectorSpecCall<'a, C> {
4944        ProjectLocationCustomConnectorValidateCustomConnectorSpecCall {
4945            hub: self.hub,
4946            _request: request,
4947            _parent: parent.to_string(),
4948            _delegate: Default::default(),
4949            _additional_params: Default::default(),
4950            _scopes: Default::default(),
4951        }
4952    }
4953
4954    /// Create a builder to help you perform the following task:
4955    ///
4956    /// Creates a new EndpointAttachment in a given project and location.
4957    ///
4958    /// # Arguments
4959    ///
4960    /// * `request` - No description provided.
4961    /// * `parent` - Required. Parent resource of the EndpointAttachment, of the form: `projects/*/locations/*`
4962    pub fn locations_endpoint_attachments_create(
4963        &self,
4964        request: EndpointAttachment,
4965        parent: &str,
4966    ) -> ProjectLocationEndpointAttachmentCreateCall<'a, C> {
4967        ProjectLocationEndpointAttachmentCreateCall {
4968            hub: self.hub,
4969            _request: request,
4970            _parent: parent.to_string(),
4971            _endpoint_attachment_id: Default::default(),
4972            _delegate: Default::default(),
4973            _additional_params: Default::default(),
4974            _scopes: Default::default(),
4975        }
4976    }
4977
4978    /// Create a builder to help you perform the following task:
4979    ///
4980    /// Deletes a single EndpointAttachment.
4981    ///
4982    /// # Arguments
4983    ///
4984    /// * `name` - Required. Resource name of the form: `projects/*/locations/*/endpointAttachments/*`
4985    pub fn locations_endpoint_attachments_delete(
4986        &self,
4987        name: &str,
4988    ) -> ProjectLocationEndpointAttachmentDeleteCall<'a, C> {
4989        ProjectLocationEndpointAttachmentDeleteCall {
4990            hub: self.hub,
4991            _name: name.to_string(),
4992            _delegate: Default::default(),
4993            _additional_params: Default::default(),
4994            _scopes: Default::default(),
4995        }
4996    }
4997
4998    /// Create a builder to help you perform the following task:
4999    ///
5000    /// Gets details of a single EndpointAttachment.
5001    ///
5002    /// # Arguments
5003    ///
5004    /// * `name` - Required. Resource name of the form: `projects/*/locations/*/endpointAttachments/*`
5005    pub fn locations_endpoint_attachments_get(
5006        &self,
5007        name: &str,
5008    ) -> ProjectLocationEndpointAttachmentGetCall<'a, C> {
5009        ProjectLocationEndpointAttachmentGetCall {
5010            hub: self.hub,
5011            _name: name.to_string(),
5012            _view: Default::default(),
5013            _delegate: Default::default(),
5014            _additional_params: Default::default(),
5015            _scopes: Default::default(),
5016        }
5017    }
5018
5019    /// Create a builder to help you perform the following task:
5020    ///
5021    /// List EndpointAttachments in a given project
5022    ///
5023    /// # Arguments
5024    ///
5025    /// * `parent` - Required. Parent resource od the EndpointAttachment, of the form: `projects/*/locations/*`
5026    pub fn locations_endpoint_attachments_list(
5027        &self,
5028        parent: &str,
5029    ) -> ProjectLocationEndpointAttachmentListCall<'a, C> {
5030        ProjectLocationEndpointAttachmentListCall {
5031            hub: self.hub,
5032            _parent: parent.to_string(),
5033            _view: Default::default(),
5034            _page_token: Default::default(),
5035            _page_size: Default::default(),
5036            _order_by: Default::default(),
5037            _filter: Default::default(),
5038            _delegate: Default::default(),
5039            _additional_params: Default::default(),
5040            _scopes: Default::default(),
5041        }
5042    }
5043
5044    /// Create a builder to help you perform the following task:
5045    ///
5046    /// Updates the parameters of a single EndpointAttachment.
5047    ///
5048    /// # Arguments
5049    ///
5050    /// * `request` - No description provided.
5051    /// * `name` - Output only. Resource name of the Endpoint Attachment. Format: projects/{project}/locations/{location}/endpointAttachments/{endpoint_attachment}
5052    pub fn locations_endpoint_attachments_patch(
5053        &self,
5054        request: EndpointAttachment,
5055        name: &str,
5056    ) -> ProjectLocationEndpointAttachmentPatchCall<'a, C> {
5057        ProjectLocationEndpointAttachmentPatchCall {
5058            hub: self.hub,
5059            _request: request,
5060            _name: name.to_string(),
5061            _update_mask: Default::default(),
5062            _delegate: Default::default(),
5063            _additional_params: Default::default(),
5064            _scopes: Default::default(),
5065        }
5066    }
5067
5068    /// Create a builder to help you perform the following task:
5069    ///
5070    /// Creates a new CustomConnectorVersion in a given project and location.
5071    ///
5072    /// # Arguments
5073    ///
5074    /// * `request` - No description provided.
5075    /// * `parent` - Required. Parent resource of the CreateCustomConnector, of the form: `projects/{project}/locations/{location}/customConnectors/{custom_connector}`
5076    pub fn locations_global_custom_connectors_custom_connector_versions_create(
5077        &self,
5078        request: CustomConnectorVersion,
5079        parent: &str,
5080    ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionCreateCall<'a, C> {
5081        ProjectLocationGlobalCustomConnectorCustomConnectorVersionCreateCall {
5082            hub: self.hub,
5083            _request: request,
5084            _parent: parent.to_string(),
5085            _custom_connector_version_id: Default::default(),
5086            _delegate: Default::default(),
5087            _additional_params: Default::default(),
5088            _scopes: Default::default(),
5089        }
5090    }
5091
5092    /// Create a builder to help you perform the following task:
5093    ///
5094    /// Gets details of a single CustomConnectorVersion.
5095    ///
5096    /// # Arguments
5097    ///
5098    /// * `name` - Required. Resource name of the form: `projects/*/locations/{location}/customConnectors/*/customConnectorVersions/*`
5099    pub fn locations_global_custom_connectors_custom_connector_versions_get(
5100        &self,
5101        name: &str,
5102    ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionGetCall<'a, C> {
5103        ProjectLocationGlobalCustomConnectorCustomConnectorVersionGetCall {
5104            hub: self.hub,
5105            _name: name.to_string(),
5106            _delegate: Default::default(),
5107            _additional_params: Default::default(),
5108            _scopes: Default::default(),
5109        }
5110    }
5111
5112    /// Create a builder to help you perform the following task:
5113    ///
5114    /// List CustomConnectorVersions in a given project
5115    ///
5116    /// # Arguments
5117    ///
5118    /// * `parent` - Required. Parent resource of the connectors, of the form: `projects/*/locations/{location}/customConnectors/*/customConnectorVersions/*`
5119    pub fn locations_global_custom_connectors_custom_connector_versions_list(
5120        &self,
5121        parent: &str,
5122    ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionListCall<'a, C> {
5123        ProjectLocationGlobalCustomConnectorCustomConnectorVersionListCall {
5124            hub: self.hub,
5125            _parent: parent.to_string(),
5126            _page_token: Default::default(),
5127            _page_size: Default::default(),
5128            _delegate: Default::default(),
5129            _additional_params: Default::default(),
5130            _scopes: Default::default(),
5131        }
5132    }
5133
5134    /// Create a builder to help you perform the following task:
5135    ///
5136    /// Creates a new CustomConnector in a given project and location.
5137    ///
5138    /// # Arguments
5139    ///
5140    /// * `request` - No description provided.
5141    /// * `parent` - Required. Parent resource of the CreateCustomConnector, of the form: `projects/{project}/locations/*`
5142    pub fn locations_global_custom_connectors_create(
5143        &self,
5144        request: CustomConnector,
5145        parent: &str,
5146    ) -> ProjectLocationGlobalCustomConnectorCreateCall<'a, C> {
5147        ProjectLocationGlobalCustomConnectorCreateCall {
5148            hub: self.hub,
5149            _request: request,
5150            _parent: parent.to_string(),
5151            _custom_connector_id: Default::default(),
5152            _delegate: Default::default(),
5153            _additional_params: Default::default(),
5154            _scopes: Default::default(),
5155        }
5156    }
5157
5158    /// Create a builder to help you perform the following task:
5159    ///
5160    /// Deletes a single CustomConnector.
5161    ///
5162    /// # Arguments
5163    ///
5164    /// * `name` - Required. Resource name of the form: `projects/{project}/locations/{location}/customConnectors/{connector}`
5165    pub fn locations_global_custom_connectors_delete(
5166        &self,
5167        name: &str,
5168    ) -> ProjectLocationGlobalCustomConnectorDeleteCall<'a, C> {
5169        ProjectLocationGlobalCustomConnectorDeleteCall {
5170            hub: self.hub,
5171            _name: name.to_string(),
5172            _force: Default::default(),
5173            _delegate: Default::default(),
5174            _additional_params: Default::default(),
5175            _scopes: Default::default(),
5176        }
5177    }
5178
5179    /// Create a builder to help you perform the following task:
5180    ///
5181    /// Gets details of a single CustomConnector.
5182    ///
5183    /// # Arguments
5184    ///
5185    /// * `name` - Required. Resource name of the form: `projects/*/locations/*/customConnectors/*`
5186    pub fn locations_global_custom_connectors_get(
5187        &self,
5188        name: &str,
5189    ) -> ProjectLocationGlobalCustomConnectorGetCall<'a, C> {
5190        ProjectLocationGlobalCustomConnectorGetCall {
5191            hub: self.hub,
5192            _name: name.to_string(),
5193            _delegate: Default::default(),
5194            _additional_params: Default::default(),
5195            _scopes: Default::default(),
5196        }
5197    }
5198
5199    /// Create a builder to help you perform the following task:
5200    ///
5201    /// List CustomConnectorVersions in a given project
5202    ///
5203    /// # Arguments
5204    ///
5205    /// * `parent` - Required. Parent resource of the custom connectors, of the form: `projects/*/locations/*` Only global location is supported for CustomConnector resource.
5206    pub fn locations_global_custom_connectors_list(
5207        &self,
5208        parent: &str,
5209    ) -> ProjectLocationGlobalCustomConnectorListCall<'a, C> {
5210        ProjectLocationGlobalCustomConnectorListCall {
5211            hub: self.hub,
5212            _parent: parent.to_string(),
5213            _page_token: Default::default(),
5214            _page_size: Default::default(),
5215            _filter: Default::default(),
5216            _delegate: Default::default(),
5217            _additional_params: Default::default(),
5218            _scopes: Default::default(),
5219        }
5220    }
5221
5222    /// Create a builder to help you perform the following task:
5223    ///
5224    /// Updates the parameters of a CustomConnector.
5225    ///
5226    /// # Arguments
5227    ///
5228    /// * `request` - No description provided.
5229    /// * `name` - Identifier. Resource name of the CustomConnector. Format: projects/{project}/locations/{location}/customConnectors/{connector}
5230    pub fn locations_global_custom_connectors_patch(
5231        &self,
5232        request: CustomConnector,
5233        name: &str,
5234    ) -> ProjectLocationGlobalCustomConnectorPatchCall<'a, C> {
5235        ProjectLocationGlobalCustomConnectorPatchCall {
5236            hub: self.hub,
5237            _request: request,
5238            _name: name.to_string(),
5239            _update_mask: Default::default(),
5240            _delegate: Default::default(),
5241            _additional_params: Default::default(),
5242            _scopes: Default::default(),
5243        }
5244    }
5245
5246    /// Create a builder to help you perform the following task:
5247    ///
5248    /// Creates a new ManagedZone in a given project and location.
5249    ///
5250    /// # Arguments
5251    ///
5252    /// * `request` - No description provided.
5253    /// * `parent` - Required. Parent resource of the ManagedZone, of the form: `projects/*/locations/global`
5254    pub fn locations_global_managed_zones_create(
5255        &self,
5256        request: ManagedZone,
5257        parent: &str,
5258    ) -> ProjectLocationGlobalManagedZoneCreateCall<'a, C> {
5259        ProjectLocationGlobalManagedZoneCreateCall {
5260            hub: self.hub,
5261            _request: request,
5262            _parent: parent.to_string(),
5263            _managed_zone_id: Default::default(),
5264            _delegate: Default::default(),
5265            _additional_params: Default::default(),
5266            _scopes: Default::default(),
5267        }
5268    }
5269
5270    /// Create a builder to help you perform the following task:
5271    ///
5272    /// Deletes a single ManagedZone.
5273    ///
5274    /// # Arguments
5275    ///
5276    /// * `name` - Required. Resource name of the form: `projects/*/locations/global/managedZones/*`
5277    pub fn locations_global_managed_zones_delete(
5278        &self,
5279        name: &str,
5280    ) -> ProjectLocationGlobalManagedZoneDeleteCall<'a, C> {
5281        ProjectLocationGlobalManagedZoneDeleteCall {
5282            hub: self.hub,
5283            _name: name.to_string(),
5284            _delegate: Default::default(),
5285            _additional_params: Default::default(),
5286            _scopes: Default::default(),
5287        }
5288    }
5289
5290    /// Create a builder to help you perform the following task:
5291    ///
5292    /// Gets details of a single ManagedZone.
5293    ///
5294    /// # Arguments
5295    ///
5296    /// * `name` - Required. Resource name of the form: `projects/*/locations/global/managedZones/*`
5297    pub fn locations_global_managed_zones_get(
5298        &self,
5299        name: &str,
5300    ) -> ProjectLocationGlobalManagedZoneGetCall<'a, C> {
5301        ProjectLocationGlobalManagedZoneGetCall {
5302            hub: self.hub,
5303            _name: name.to_string(),
5304            _delegate: Default::default(),
5305            _additional_params: Default::default(),
5306            _scopes: Default::default(),
5307        }
5308    }
5309
5310    /// Create a builder to help you perform the following task:
5311    ///
5312    /// List ManagedZones in a given project
5313    ///
5314    /// # Arguments
5315    ///
5316    /// * `parent` - Required. Parent resource of the Managed Zone, of the form: `projects/*/locations/global`
5317    pub fn locations_global_managed_zones_list(
5318        &self,
5319        parent: &str,
5320    ) -> ProjectLocationGlobalManagedZoneListCall<'a, C> {
5321        ProjectLocationGlobalManagedZoneListCall {
5322            hub: self.hub,
5323            _parent: parent.to_string(),
5324            _return_partial_success: Default::default(),
5325            _page_token: Default::default(),
5326            _page_size: Default::default(),
5327            _order_by: Default::default(),
5328            _filter: Default::default(),
5329            _delegate: Default::default(),
5330            _additional_params: Default::default(),
5331            _scopes: Default::default(),
5332        }
5333    }
5334
5335    /// Create a builder to help you perform the following task:
5336    ///
5337    /// Updates the parameters of a single ManagedZone.
5338    ///
5339    /// # Arguments
5340    ///
5341    /// * `request` - No description provided.
5342    /// * `name` - Output only. Resource name of the Managed Zone. Format: projects/{project}/locations/global/managedZones/{managed_zone}
5343    pub fn locations_global_managed_zones_patch(
5344        &self,
5345        request: ManagedZone,
5346        name: &str,
5347    ) -> ProjectLocationGlobalManagedZonePatchCall<'a, C> {
5348        ProjectLocationGlobalManagedZonePatchCall {
5349            hub: self.hub,
5350            _request: request,
5351            _name: name.to_string(),
5352            _update_mask: Default::default(),
5353            _delegate: Default::default(),
5354            _additional_params: Default::default(),
5355            _scopes: Default::default(),
5356        }
5357    }
5358
5359    /// Create a builder to help you perform the following task:
5360    ///
5361    /// GetGlobalSettings gets settings of a project. GlobalSettings is a singleton resource.
5362    ///
5363    /// # Arguments
5364    ///
5365    /// * `name` - Required. The resource name of the Settings.
5366    pub fn locations_global_get_settings(
5367        &self,
5368        name: &str,
5369    ) -> ProjectLocationGlobalGetSettingCall<'a, C> {
5370        ProjectLocationGlobalGetSettingCall {
5371            hub: self.hub,
5372            _name: name.to_string(),
5373            _delegate: Default::default(),
5374            _additional_params: Default::default(),
5375            _scopes: Default::default(),
5376        }
5377    }
5378
5379    /// Create a builder to help you perform the following task:
5380    ///
5381    /// Update the global settings of a project.
5382    ///
5383    /// # Arguments
5384    ///
5385    /// * `request` - No description provided.
5386    /// * `name` - Output only. Resource name of the Connection. Format: projects/{project}/locations/global/settings}
5387    pub fn locations_global_update_settings(
5388        &self,
5389        request: Settings,
5390        name: &str,
5391    ) -> ProjectLocationGlobalUpdateSettingCall<'a, C> {
5392        ProjectLocationGlobalUpdateSettingCall {
5393            hub: self.hub,
5394            _request: request,
5395            _name: name.to_string(),
5396            _update_mask: Default::default(),
5397            _delegate: Default::default(),
5398            _additional_params: Default::default(),
5399            _scopes: Default::default(),
5400        }
5401    }
5402
5403    /// Create a builder to help you perform the following task:
5404    ///
5405    /// 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`.
5406    ///
5407    /// # Arguments
5408    ///
5409    /// * `request` - No description provided.
5410    /// * `name` - The name of the operation resource to be cancelled.
5411    pub fn locations_operations_cancel(
5412        &self,
5413        request: CancelOperationRequest,
5414        name: &str,
5415    ) -> ProjectLocationOperationCancelCall<'a, C> {
5416        ProjectLocationOperationCancelCall {
5417            hub: self.hub,
5418            _request: request,
5419            _name: name.to_string(),
5420            _delegate: Default::default(),
5421            _additional_params: Default::default(),
5422            _scopes: Default::default(),
5423        }
5424    }
5425
5426    /// Create a builder to help you perform the following task:
5427    ///
5428    /// 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`.
5429    ///
5430    /// # Arguments
5431    ///
5432    /// * `name` - The name of the operation resource to be deleted.
5433    pub fn locations_operations_delete(
5434        &self,
5435        name: &str,
5436    ) -> ProjectLocationOperationDeleteCall<'a, C> {
5437        ProjectLocationOperationDeleteCall {
5438            hub: self.hub,
5439            _name: name.to_string(),
5440            _delegate: Default::default(),
5441            _additional_params: Default::default(),
5442            _scopes: Default::default(),
5443        }
5444    }
5445
5446    /// Create a builder to help you perform the following task:
5447    ///
5448    /// 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.
5449    ///
5450    /// # Arguments
5451    ///
5452    /// * `name` - The name of the operation resource.
5453    pub fn locations_operations_get(&self, name: &str) -> ProjectLocationOperationGetCall<'a, C> {
5454        ProjectLocationOperationGetCall {
5455            hub: self.hub,
5456            _name: name.to_string(),
5457            _delegate: Default::default(),
5458            _additional_params: Default::default(),
5459            _scopes: Default::default(),
5460        }
5461    }
5462
5463    /// Create a builder to help you perform the following task:
5464    ///
5465    /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
5466    ///
5467    /// # Arguments
5468    ///
5469    /// * `name` - The name of the operation's parent resource.
5470    pub fn locations_operations_list(&self, name: &str) -> ProjectLocationOperationListCall<'a, C> {
5471        ProjectLocationOperationListCall {
5472            hub: self.hub,
5473            _name: name.to_string(),
5474            _return_partial_success: Default::default(),
5475            _page_token: Default::default(),
5476            _page_size: Default::default(),
5477            _filter: Default::default(),
5478            _delegate: Default::default(),
5479            _additional_params: Default::default(),
5480            _scopes: Default::default(),
5481        }
5482    }
5483
5484    /// Create a builder to help you perform the following task:
5485    ///
5486    /// Gets details of a single event type.
5487    ///
5488    /// # Arguments
5489    ///
5490    /// * `name` - Required. Resource name of the form: `projects/*/locations/*/providers/*/connectors/*/versions/*/eventtypes/*` Only global location is supported for EventType resource.
5491    pub fn locations_providers_connectors_versions_eventtypes_get(
5492        &self,
5493        name: &str,
5494    ) -> ProjectLocationProviderConnectorVersionEventtypeGetCall<'a, C> {
5495        ProjectLocationProviderConnectorVersionEventtypeGetCall {
5496            hub: self.hub,
5497            _name: name.to_string(),
5498            _delegate: Default::default(),
5499            _additional_params: Default::default(),
5500            _scopes: Default::default(),
5501        }
5502    }
5503
5504    /// Create a builder to help you perform the following task:
5505    ///
5506    /// Lists Event Types in a given Connector Version.
5507    ///
5508    /// # Arguments
5509    ///
5510    /// * `parent` - Required. Parent resource of the connectors, of the form: `projects/*/locations/*/providers/*/connectors/*/versions/*` Only global location is supported for EventType resource.
5511    pub fn locations_providers_connectors_versions_eventtypes_list(
5512        &self,
5513        parent: &str,
5514    ) -> ProjectLocationProviderConnectorVersionEventtypeListCall<'a, C> {
5515        ProjectLocationProviderConnectorVersionEventtypeListCall {
5516            hub: self.hub,
5517            _parent: parent.to_string(),
5518            _page_token: Default::default(),
5519            _page_size: Default::default(),
5520            _delegate: Default::default(),
5521            _additional_params: Default::default(),
5522            _scopes: Default::default(),
5523        }
5524    }
5525
5526    /// Create a builder to help you perform the following task:
5527    ///
5528    /// fetch and return the list of auth config variables required to override the connection backend auth.
5529    ///
5530    /// # Arguments
5531    ///
5532    /// * `name` - Required. Parent resource of the Connector Version, of the form: `projects/*/locations/*/providers/*/connectors/*/versions/*`
5533    pub fn locations_providers_connectors_versions_fetch_auth_schema(
5534        &self,
5535        name: &str,
5536    ) -> ProjectLocationProviderConnectorVersionFetchAuthSchemaCall<'a, C> {
5537        ProjectLocationProviderConnectorVersionFetchAuthSchemaCall {
5538            hub: self.hub,
5539            _name: name.to_string(),
5540            _view: Default::default(),
5541            _delegate: Default::default(),
5542            _additional_params: Default::default(),
5543            _scopes: Default::default(),
5544        }
5545    }
5546
5547    /// Create a builder to help you perform the following task:
5548    ///
5549    /// Gets details of a single connector version.
5550    ///
5551    /// # Arguments
5552    ///
5553    /// * `name` - Required. Resource name of the form: `projects/*/locations/*/providers/*/connectors/*/versions/*` Only global location is supported for ConnectorVersion resource.
5554    pub fn locations_providers_connectors_versions_get(
5555        &self,
5556        name: &str,
5557    ) -> ProjectLocationProviderConnectorVersionGetCall<'a, C> {
5558        ProjectLocationProviderConnectorVersionGetCall {
5559            hub: self.hub,
5560            _name: name.to_string(),
5561            _view: Default::default(),
5562            _delegate: Default::default(),
5563            _additional_params: Default::default(),
5564            _scopes: Default::default(),
5565        }
5566    }
5567
5568    /// Create a builder to help you perform the following task:
5569    ///
5570    /// Lists Connector Versions in a given project and location.
5571    ///
5572    /// # Arguments
5573    ///
5574    /// * `parent` - No description provided.
5575    pub fn locations_providers_connectors_versions_list(
5576        &self,
5577        parent: &str,
5578    ) -> ProjectLocationProviderConnectorVersionListCall<'a, C> {
5579        ProjectLocationProviderConnectorVersionListCall {
5580            hub: self.hub,
5581            _parent: parent.to_string(),
5582            _view: Default::default(),
5583            _page_token: Default::default(),
5584            _page_size: Default::default(),
5585            _delegate: Default::default(),
5586            _additional_params: Default::default(),
5587            _scopes: Default::default(),
5588        }
5589    }
5590
5591    /// Create a builder to help you perform the following task:
5592    ///
5593    /// Gets details of a single Connector.
5594    ///
5595    /// # Arguments
5596    ///
5597    /// * `name` - Required. Resource name of the form: `projects/*/locations/*/providers/*/connectors/*` Only global location is supported for Connector resource.
5598    pub fn locations_providers_connectors_get(
5599        &self,
5600        name: &str,
5601    ) -> ProjectLocationProviderConnectorGetCall<'a, C> {
5602        ProjectLocationProviderConnectorGetCall {
5603            hub: self.hub,
5604            _name: name.to_string(),
5605            _delegate: Default::default(),
5606            _additional_params: Default::default(),
5607            _scopes: Default::default(),
5608        }
5609    }
5610
5611    /// Create a builder to help you perform the following task:
5612    ///
5613    /// Lists Connectors in a given project and location.
5614    ///
5615    /// # Arguments
5616    ///
5617    /// * `parent` - Required. Parent resource of the connectors, of the form: `projects/*/locations/*/providers/*` Only global location is supported for Connector resource.
5618    pub fn locations_providers_connectors_list(
5619        &self,
5620        parent: &str,
5621    ) -> ProjectLocationProviderConnectorListCall<'a, C> {
5622        ProjectLocationProviderConnectorListCall {
5623            hub: self.hub,
5624            _parent: parent.to_string(),
5625            _page_token: Default::default(),
5626            _page_size: Default::default(),
5627            _filter: Default::default(),
5628            _delegate: Default::default(),
5629            _additional_params: Default::default(),
5630            _scopes: Default::default(),
5631        }
5632    }
5633
5634    /// Create a builder to help you perform the following task:
5635    ///
5636    /// Gets details of a provider.
5637    ///
5638    /// # Arguments
5639    ///
5640    /// * `name` - Required. Resource name of the form: `projects/*/locations/*/providers/*` Only global location is supported for Provider resource.
5641    pub fn locations_providers_get(&self, name: &str) -> ProjectLocationProviderGetCall<'a, C> {
5642        ProjectLocationProviderGetCall {
5643            hub: self.hub,
5644            _name: name.to_string(),
5645            _delegate: Default::default(),
5646            _additional_params: Default::default(),
5647            _scopes: Default::default(),
5648        }
5649    }
5650
5651    /// Create a builder to help you perform the following task:
5652    ///
5653    /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
5654    ///
5655    /// # Arguments
5656    ///
5657    /// * `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.
5658    pub fn locations_providers_get_iam_policy(
5659        &self,
5660        resource: &str,
5661    ) -> ProjectLocationProviderGetIamPolicyCall<'a, C> {
5662        ProjectLocationProviderGetIamPolicyCall {
5663            hub: self.hub,
5664            _resource: resource.to_string(),
5665            _options_requested_policy_version: Default::default(),
5666            _delegate: Default::default(),
5667            _additional_params: Default::default(),
5668            _scopes: Default::default(),
5669        }
5670    }
5671
5672    /// Create a builder to help you perform the following task:
5673    ///
5674    /// Lists Providers in a given project and location.
5675    ///
5676    /// # Arguments
5677    ///
5678    /// * `parent` - Required. Parent resource of the API, of the form: `projects/*/locations/*` Only global location is supported for Provider resource.
5679    pub fn locations_providers_list(&self, parent: &str) -> ProjectLocationProviderListCall<'a, C> {
5680        ProjectLocationProviderListCall {
5681            hub: self.hub,
5682            _parent: parent.to_string(),
5683            _page_token: Default::default(),
5684            _page_size: Default::default(),
5685            _delegate: Default::default(),
5686            _additional_params: Default::default(),
5687            _scopes: Default::default(),
5688        }
5689    }
5690
5691    /// Create a builder to help you perform the following task:
5692    ///
5693    /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
5694    ///
5695    /// # Arguments
5696    ///
5697    /// * `request` - No description provided.
5698    /// * `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.
5699    pub fn locations_providers_set_iam_policy(
5700        &self,
5701        request: SetIamPolicyRequest,
5702        resource: &str,
5703    ) -> ProjectLocationProviderSetIamPolicyCall<'a, C> {
5704        ProjectLocationProviderSetIamPolicyCall {
5705            hub: self.hub,
5706            _request: request,
5707            _resource: resource.to_string(),
5708            _delegate: Default::default(),
5709            _additional_params: Default::default(),
5710            _scopes: Default::default(),
5711        }
5712    }
5713
5714    /// Create a builder to help you perform the following task:
5715    ///
5716    /// 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.
5717    ///
5718    /// # Arguments
5719    ///
5720    /// * `request` - No description provided.
5721    /// * `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.
5722    pub fn locations_providers_test_iam_permissions(
5723        &self,
5724        request: TestIamPermissionsRequest,
5725        resource: &str,
5726    ) -> ProjectLocationProviderTestIamPermissionCall<'a, C> {
5727        ProjectLocationProviderTestIamPermissionCall {
5728            hub: self.hub,
5729            _request: request,
5730            _resource: resource.to_string(),
5731            _delegate: Default::default(),
5732            _additional_params: Default::default(),
5733            _scopes: Default::default(),
5734        }
5735    }
5736
5737    /// Create a builder to help you perform the following task:
5738    ///
5739    /// Gets information about a location.
5740    ///
5741    /// # Arguments
5742    ///
5743    /// * `name` - Resource name for the location.
5744    pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, C> {
5745        ProjectLocationGetCall {
5746            hub: self.hub,
5747            _name: name.to_string(),
5748            _delegate: Default::default(),
5749            _additional_params: Default::default(),
5750            _scopes: Default::default(),
5751        }
5752    }
5753
5754    /// Create a builder to help you perform the following task:
5755    ///
5756    /// GetRegionalSettings gets settings of a region. RegionalSettings is a singleton resource.
5757    ///
5758    /// # Arguments
5759    ///
5760    /// * `name` - Required. The resource name of the Regional Settings.
5761    pub fn locations_get_regional_settings(
5762        &self,
5763        name: &str,
5764    ) -> ProjectLocationGetRegionalSettingCall<'a, C> {
5765        ProjectLocationGetRegionalSettingCall {
5766            hub: self.hub,
5767            _name: name.to_string(),
5768            _delegate: Default::default(),
5769            _additional_params: Default::default(),
5770            _scopes: Default::default(),
5771        }
5772    }
5773
5774    /// Create a builder to help you perform the following task:
5775    ///
5776    /// Gets the runtimeConfig of a location. RuntimeConfig is a singleton resource for each location.
5777    ///
5778    /// # Arguments
5779    ///
5780    /// * `name` - Required. Resource name of the form: `projects/*/locations/*/runtimeConfig`
5781    pub fn locations_get_runtime_config(
5782        &self,
5783        name: &str,
5784    ) -> ProjectLocationGetRuntimeConfigCall<'a, C> {
5785        ProjectLocationGetRuntimeConfigCall {
5786            hub: self.hub,
5787            _name: name.to_string(),
5788            _delegate: Default::default(),
5789            _additional_params: Default::default(),
5790            _scopes: Default::default(),
5791        }
5792    }
5793
5794    /// Create a builder to help you perform the following task:
5795    ///
5796    /// Lists information about the supported locations for this service.
5797    ///
5798    /// # Arguments
5799    ///
5800    /// * `name` - The resource that owns the locations collection, if applicable.
5801    pub fn locations_list(&self, name: &str) -> ProjectLocationListCall<'a, C> {
5802        ProjectLocationListCall {
5803            hub: self.hub,
5804            _name: name.to_string(),
5805            _page_token: Default::default(),
5806            _page_size: Default::default(),
5807            _filter: Default::default(),
5808            _extra_location_types: Default::default(),
5809            _delegate: Default::default(),
5810            _additional_params: Default::default(),
5811            _scopes: Default::default(),
5812        }
5813    }
5814
5815    /// Create a builder to help you perform the following task:
5816    ///
5817    /// Update the settings of a region.
5818    ///
5819    /// # Arguments
5820    ///
5821    /// * `request` - No description provided.
5822    /// * `name` - Output only. Resource name of the Connection. Format: projects/{project}/locations/{location}/regionalSettings
5823    pub fn locations_update_regional_settings(
5824        &self,
5825        request: RegionalSettings,
5826        name: &str,
5827    ) -> ProjectLocationUpdateRegionalSettingCall<'a, C> {
5828        ProjectLocationUpdateRegionalSettingCall {
5829            hub: self.hub,
5830            _request: request,
5831            _name: name.to_string(),
5832            _update_mask: Default::default(),
5833            _delegate: Default::default(),
5834            _additional_params: Default::default(),
5835            _scopes: Default::default(),
5836        }
5837    }
5838}
5839
5840// ###################
5841// CallBuilders   ###
5842// #################
5843
5844/// Get action.
5845///
5846/// A builder for the *locations.connections.connectionSchemaMetadata.getAction* method supported by a *project* resource.
5847/// It is not used directly, but through a [`ProjectMethods`] instance.
5848///
5849/// # Example
5850///
5851/// Instantiate a resource method builder
5852///
5853/// ```test_harness,no_run
5854/// # extern crate hyper;
5855/// # extern crate hyper_rustls;
5856/// # extern crate google_connectors1 as connectors1;
5857/// # async fn dox() {
5858/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5859///
5860/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5861/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5862/// #     .with_native_roots()
5863/// #     .unwrap()
5864/// #     .https_only()
5865/// #     .enable_http2()
5866/// #     .build();
5867///
5868/// # let executor = hyper_util::rt::TokioExecutor::new();
5869/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5870/// #     secret,
5871/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5872/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5873/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5874/// #     ),
5875/// # ).build().await.unwrap();
5876///
5877/// # let client = hyper_util::client::legacy::Client::builder(
5878/// #     hyper_util::rt::TokioExecutor::new()
5879/// # )
5880/// # .build(
5881/// #     hyper_rustls::HttpsConnectorBuilder::new()
5882/// #         .with_native_roots()
5883/// #         .unwrap()
5884/// #         .https_or_http()
5885/// #         .enable_http2()
5886/// #         .build()
5887/// # );
5888/// # let mut hub = Connectors::new(client, auth);
5889/// // You can configure optional parameters by calling the respective setters at will, and
5890/// // execute the final call using `doit()`.
5891/// // Values shown here are possibly random and not representative !
5892/// let result = hub.projects().locations_connections_connection_schema_metadata_get_action("name")
5893///              .action_id("sed")
5894///              .doit().await;
5895/// # }
5896/// ```
5897pub struct ProjectLocationConnectionConnectionSchemaMetadataGetActionCall<'a, C>
5898where
5899    C: 'a,
5900{
5901    hub: &'a Connectors<C>,
5902    _name: String,
5903    _action_id: Option<String>,
5904    _delegate: Option<&'a mut dyn common::Delegate>,
5905    _additional_params: HashMap<String, String>,
5906    _scopes: BTreeSet<String>,
5907}
5908
5909impl<'a, C> common::CallBuilder
5910    for ProjectLocationConnectionConnectionSchemaMetadataGetActionCall<'a, C>
5911{
5912}
5913
5914impl<'a, C> ProjectLocationConnectionConnectionSchemaMetadataGetActionCall<'a, C>
5915where
5916    C: common::Connector,
5917{
5918    /// Perform the operation you have build so far.
5919    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5920        use std::borrow::Cow;
5921        use std::io::{Read, Seek};
5922
5923        use common::{url::Params, ToParts};
5924        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5925
5926        let mut dd = common::DefaultDelegate;
5927        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5928        dlg.begin(common::MethodInfo {
5929            id: "connectors.projects.locations.connections.connectionSchemaMetadata.getAction",
5930            http_method: hyper::Method::GET,
5931        });
5932
5933        for &field in ["alt", "name", "actionId"].iter() {
5934            if self._additional_params.contains_key(field) {
5935                dlg.finished(false);
5936                return Err(common::Error::FieldClash(field));
5937            }
5938        }
5939
5940        let mut params = Params::with_capacity(4 + self._additional_params.len());
5941        params.push("name", self._name);
5942        if let Some(value) = self._action_id.as_ref() {
5943            params.push("actionId", value);
5944        }
5945
5946        params.extend(self._additional_params.iter());
5947
5948        params.push("alt", "json");
5949        let mut url = self.hub._base_url.clone() + "v1/{+name}:getAction";
5950        if self._scopes.is_empty() {
5951            self._scopes
5952                .insert(Scope::CloudPlatform.as_ref().to_string());
5953        }
5954
5955        #[allow(clippy::single_element_loop)]
5956        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5957            url = params.uri_replacement(url, param_name, find_this, true);
5958        }
5959        {
5960            let to_remove = ["name"];
5961            params.remove_params(&to_remove);
5962        }
5963
5964        let url = params.parse_with_url(&url);
5965
5966        loop {
5967            let token = match self
5968                .hub
5969                .auth
5970                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5971                .await
5972            {
5973                Ok(token) => token,
5974                Err(e) => match dlg.token(e) {
5975                    Ok(token) => token,
5976                    Err(e) => {
5977                        dlg.finished(false);
5978                        return Err(common::Error::MissingToken(e));
5979                    }
5980                },
5981            };
5982            let mut req_result = {
5983                let client = &self.hub.client;
5984                dlg.pre_request();
5985                let mut req_builder = hyper::Request::builder()
5986                    .method(hyper::Method::GET)
5987                    .uri(url.as_str())
5988                    .header(USER_AGENT, self.hub._user_agent.clone());
5989
5990                if let Some(token) = token.as_ref() {
5991                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5992                }
5993
5994                let request = req_builder
5995                    .header(CONTENT_LENGTH, 0_u64)
5996                    .body(common::to_body::<String>(None));
5997
5998                client.request(request.unwrap()).await
5999            };
6000
6001            match req_result {
6002                Err(err) => {
6003                    if let common::Retry::After(d) = dlg.http_error(&err) {
6004                        sleep(d).await;
6005                        continue;
6006                    }
6007                    dlg.finished(false);
6008                    return Err(common::Error::HttpError(err));
6009                }
6010                Ok(res) => {
6011                    let (mut parts, body) = res.into_parts();
6012                    let mut body = common::Body::new(body);
6013                    if !parts.status.is_success() {
6014                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6015                        let error = serde_json::from_str(&common::to_string(&bytes));
6016                        let response = common::to_response(parts, bytes.into());
6017
6018                        if let common::Retry::After(d) =
6019                            dlg.http_failure(&response, error.as_ref().ok())
6020                        {
6021                            sleep(d).await;
6022                            continue;
6023                        }
6024
6025                        dlg.finished(false);
6026
6027                        return Err(match error {
6028                            Ok(value) => common::Error::BadRequest(value),
6029                            _ => common::Error::Failure(response),
6030                        });
6031                    }
6032                    let response = {
6033                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6034                        let encoded = common::to_string(&bytes);
6035                        match serde_json::from_str(&encoded) {
6036                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6037                            Err(error) => {
6038                                dlg.response_json_decode_error(&encoded, &error);
6039                                return Err(common::Error::JsonDecodeError(
6040                                    encoded.to_string(),
6041                                    error,
6042                                ));
6043                            }
6044                        }
6045                    };
6046
6047                    dlg.finished(true);
6048                    return Ok(response);
6049                }
6050            }
6051        }
6052    }
6053
6054    /// Required. Resource name format: projects/{project}/locations/{location}/connections/{connection}/connectionSchemaMetadata
6055    ///
6056    /// Sets the *name* path property to the given value.
6057    ///
6058    /// Even though the property as already been set when instantiating this call,
6059    /// we provide this method for API completeness.
6060    pub fn name(
6061        mut self,
6062        new_value: &str,
6063    ) -> ProjectLocationConnectionConnectionSchemaMetadataGetActionCall<'a, C> {
6064        self._name = new_value.to_string();
6065        self
6066    }
6067    /// Required. Id of the action.
6068    ///
6069    /// Sets the *action id* query property to the given value.
6070    pub fn action_id(
6071        mut self,
6072        new_value: &str,
6073    ) -> ProjectLocationConnectionConnectionSchemaMetadataGetActionCall<'a, C> {
6074        self._action_id = Some(new_value.to_string());
6075        self
6076    }
6077    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6078    /// while executing the actual API request.
6079    ///
6080    /// ````text
6081    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6082    /// ````
6083    ///
6084    /// Sets the *delegate* property to the given value.
6085    pub fn delegate(
6086        mut self,
6087        new_value: &'a mut dyn common::Delegate,
6088    ) -> ProjectLocationConnectionConnectionSchemaMetadataGetActionCall<'a, C> {
6089        self._delegate = Some(new_value);
6090        self
6091    }
6092
6093    /// Set any additional parameter of the query string used in the request.
6094    /// It should be used to set parameters which are not yet available through their own
6095    /// setters.
6096    ///
6097    /// Please note that this method must not be used to set any of the known parameters
6098    /// which have their own setter method. If done anyway, the request will fail.
6099    ///
6100    /// # Additional Parameters
6101    ///
6102    /// * *$.xgafv* (query-string) - V1 error format.
6103    /// * *access_token* (query-string) - OAuth access token.
6104    /// * *alt* (query-string) - Data format for response.
6105    /// * *callback* (query-string) - JSONP
6106    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6107    /// * *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.
6108    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6109    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6110    /// * *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.
6111    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6112    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6113    pub fn param<T>(
6114        mut self,
6115        name: T,
6116        value: T,
6117    ) -> ProjectLocationConnectionConnectionSchemaMetadataGetActionCall<'a, C>
6118    where
6119        T: AsRef<str>,
6120    {
6121        self._additional_params
6122            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6123        self
6124    }
6125
6126    /// Identifies the authorization scope for the method you are building.
6127    ///
6128    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6129    /// [`Scope::CloudPlatform`].
6130    ///
6131    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6132    /// tokens for more than one scope.
6133    ///
6134    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6135    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6136    /// sufficient, a read-write scope will do as well.
6137    pub fn add_scope<St>(
6138        mut self,
6139        scope: St,
6140    ) -> ProjectLocationConnectionConnectionSchemaMetadataGetActionCall<'a, C>
6141    where
6142        St: AsRef<str>,
6143    {
6144        self._scopes.insert(String::from(scope.as_ref()));
6145        self
6146    }
6147    /// Identifies the authorization scope(s) for the method you are building.
6148    ///
6149    /// See [`Self::add_scope()`] for details.
6150    pub fn add_scopes<I, St>(
6151        mut self,
6152        scopes: I,
6153    ) -> ProjectLocationConnectionConnectionSchemaMetadataGetActionCall<'a, C>
6154    where
6155        I: IntoIterator<Item = St>,
6156        St: AsRef<str>,
6157    {
6158        self._scopes
6159            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6160        self
6161    }
6162
6163    /// Removes all scopes, and no default scope will be used either.
6164    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6165    /// for details).
6166    pub fn clear_scopes(
6167        mut self,
6168    ) -> ProjectLocationConnectionConnectionSchemaMetadataGetActionCall<'a, C> {
6169        self._scopes.clear();
6170        self
6171    }
6172}
6173
6174/// Get entity type.
6175///
6176/// A builder for the *locations.connections.connectionSchemaMetadata.getEntityType* method supported by a *project* resource.
6177/// It is not used directly, but through a [`ProjectMethods`] instance.
6178///
6179/// # Example
6180///
6181/// Instantiate a resource method builder
6182///
6183/// ```test_harness,no_run
6184/// # extern crate hyper;
6185/// # extern crate hyper_rustls;
6186/// # extern crate google_connectors1 as connectors1;
6187/// # async fn dox() {
6188/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6189///
6190/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6191/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6192/// #     .with_native_roots()
6193/// #     .unwrap()
6194/// #     .https_only()
6195/// #     .enable_http2()
6196/// #     .build();
6197///
6198/// # let executor = hyper_util::rt::TokioExecutor::new();
6199/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6200/// #     secret,
6201/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6202/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6203/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6204/// #     ),
6205/// # ).build().await.unwrap();
6206///
6207/// # let client = hyper_util::client::legacy::Client::builder(
6208/// #     hyper_util::rt::TokioExecutor::new()
6209/// # )
6210/// # .build(
6211/// #     hyper_rustls::HttpsConnectorBuilder::new()
6212/// #         .with_native_roots()
6213/// #         .unwrap()
6214/// #         .https_or_http()
6215/// #         .enable_http2()
6216/// #         .build()
6217/// # );
6218/// # let mut hub = Connectors::new(client, auth);
6219/// // You can configure optional parameters by calling the respective setters at will, and
6220/// // execute the final call using `doit()`.
6221/// // Values shown here are possibly random and not representative !
6222/// let result = hub.projects().locations_connections_connection_schema_metadata_get_entity_type("name")
6223///              .entity_id("takimata")
6224///              .doit().await;
6225/// # }
6226/// ```
6227pub struct ProjectLocationConnectionConnectionSchemaMetadataGetEntityTypeCall<'a, C>
6228where
6229    C: 'a,
6230{
6231    hub: &'a Connectors<C>,
6232    _name: String,
6233    _entity_id: Option<String>,
6234    _delegate: Option<&'a mut dyn common::Delegate>,
6235    _additional_params: HashMap<String, String>,
6236    _scopes: BTreeSet<String>,
6237}
6238
6239impl<'a, C> common::CallBuilder
6240    for ProjectLocationConnectionConnectionSchemaMetadataGetEntityTypeCall<'a, C>
6241{
6242}
6243
6244impl<'a, C> ProjectLocationConnectionConnectionSchemaMetadataGetEntityTypeCall<'a, C>
6245where
6246    C: common::Connector,
6247{
6248    /// Perform the operation you have build so far.
6249    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6250        use std::borrow::Cow;
6251        use std::io::{Read, Seek};
6252
6253        use common::{url::Params, ToParts};
6254        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6255
6256        let mut dd = common::DefaultDelegate;
6257        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6258        dlg.begin(common::MethodInfo {
6259            id: "connectors.projects.locations.connections.connectionSchemaMetadata.getEntityType",
6260            http_method: hyper::Method::GET,
6261        });
6262
6263        for &field in ["alt", "name", "entityId"].iter() {
6264            if self._additional_params.contains_key(field) {
6265                dlg.finished(false);
6266                return Err(common::Error::FieldClash(field));
6267            }
6268        }
6269
6270        let mut params = Params::with_capacity(4 + self._additional_params.len());
6271        params.push("name", self._name);
6272        if let Some(value) = self._entity_id.as_ref() {
6273            params.push("entityId", value);
6274        }
6275
6276        params.extend(self._additional_params.iter());
6277
6278        params.push("alt", "json");
6279        let mut url = self.hub._base_url.clone() + "v1/{+name}:getEntityType";
6280        if self._scopes.is_empty() {
6281            self._scopes
6282                .insert(Scope::CloudPlatform.as_ref().to_string());
6283        }
6284
6285        #[allow(clippy::single_element_loop)]
6286        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6287            url = params.uri_replacement(url, param_name, find_this, true);
6288        }
6289        {
6290            let to_remove = ["name"];
6291            params.remove_params(&to_remove);
6292        }
6293
6294        let url = params.parse_with_url(&url);
6295
6296        loop {
6297            let token = match self
6298                .hub
6299                .auth
6300                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6301                .await
6302            {
6303                Ok(token) => token,
6304                Err(e) => match dlg.token(e) {
6305                    Ok(token) => token,
6306                    Err(e) => {
6307                        dlg.finished(false);
6308                        return Err(common::Error::MissingToken(e));
6309                    }
6310                },
6311            };
6312            let mut req_result = {
6313                let client = &self.hub.client;
6314                dlg.pre_request();
6315                let mut req_builder = hyper::Request::builder()
6316                    .method(hyper::Method::GET)
6317                    .uri(url.as_str())
6318                    .header(USER_AGENT, self.hub._user_agent.clone());
6319
6320                if let Some(token) = token.as_ref() {
6321                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6322                }
6323
6324                let request = req_builder
6325                    .header(CONTENT_LENGTH, 0_u64)
6326                    .body(common::to_body::<String>(None));
6327
6328                client.request(request.unwrap()).await
6329            };
6330
6331            match req_result {
6332                Err(err) => {
6333                    if let common::Retry::After(d) = dlg.http_error(&err) {
6334                        sleep(d).await;
6335                        continue;
6336                    }
6337                    dlg.finished(false);
6338                    return Err(common::Error::HttpError(err));
6339                }
6340                Ok(res) => {
6341                    let (mut parts, body) = res.into_parts();
6342                    let mut body = common::Body::new(body);
6343                    if !parts.status.is_success() {
6344                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6345                        let error = serde_json::from_str(&common::to_string(&bytes));
6346                        let response = common::to_response(parts, bytes.into());
6347
6348                        if let common::Retry::After(d) =
6349                            dlg.http_failure(&response, error.as_ref().ok())
6350                        {
6351                            sleep(d).await;
6352                            continue;
6353                        }
6354
6355                        dlg.finished(false);
6356
6357                        return Err(match error {
6358                            Ok(value) => common::Error::BadRequest(value),
6359                            _ => common::Error::Failure(response),
6360                        });
6361                    }
6362                    let response = {
6363                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6364                        let encoded = common::to_string(&bytes);
6365                        match serde_json::from_str(&encoded) {
6366                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6367                            Err(error) => {
6368                                dlg.response_json_decode_error(&encoded, &error);
6369                                return Err(common::Error::JsonDecodeError(
6370                                    encoded.to_string(),
6371                                    error,
6372                                ));
6373                            }
6374                        }
6375                    };
6376
6377                    dlg.finished(true);
6378                    return Ok(response);
6379                }
6380            }
6381        }
6382    }
6383
6384    /// Required. Resource name format: projects/{project}/locations/{location}/connections/{connection}/connectionSchemaMetadata
6385    ///
6386    /// Sets the *name* path property to the given value.
6387    ///
6388    /// Even though the property as already been set when instantiating this call,
6389    /// we provide this method for API completeness.
6390    pub fn name(
6391        mut self,
6392        new_value: &str,
6393    ) -> ProjectLocationConnectionConnectionSchemaMetadataGetEntityTypeCall<'a, C> {
6394        self._name = new_value.to_string();
6395        self
6396    }
6397    /// Required. Id of the entity type.
6398    ///
6399    /// Sets the *entity id* query property to the given value.
6400    pub fn entity_id(
6401        mut self,
6402        new_value: &str,
6403    ) -> ProjectLocationConnectionConnectionSchemaMetadataGetEntityTypeCall<'a, C> {
6404        self._entity_id = Some(new_value.to_string());
6405        self
6406    }
6407    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6408    /// while executing the actual API request.
6409    ///
6410    /// ````text
6411    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6412    /// ````
6413    ///
6414    /// Sets the *delegate* property to the given value.
6415    pub fn delegate(
6416        mut self,
6417        new_value: &'a mut dyn common::Delegate,
6418    ) -> ProjectLocationConnectionConnectionSchemaMetadataGetEntityTypeCall<'a, C> {
6419        self._delegate = Some(new_value);
6420        self
6421    }
6422
6423    /// Set any additional parameter of the query string used in the request.
6424    /// It should be used to set parameters which are not yet available through their own
6425    /// setters.
6426    ///
6427    /// Please note that this method must not be used to set any of the known parameters
6428    /// which have their own setter method. If done anyway, the request will fail.
6429    ///
6430    /// # Additional Parameters
6431    ///
6432    /// * *$.xgafv* (query-string) - V1 error format.
6433    /// * *access_token* (query-string) - OAuth access token.
6434    /// * *alt* (query-string) - Data format for response.
6435    /// * *callback* (query-string) - JSONP
6436    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6437    /// * *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.
6438    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6439    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6440    /// * *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.
6441    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6442    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6443    pub fn param<T>(
6444        mut self,
6445        name: T,
6446        value: T,
6447    ) -> ProjectLocationConnectionConnectionSchemaMetadataGetEntityTypeCall<'a, C>
6448    where
6449        T: AsRef<str>,
6450    {
6451        self._additional_params
6452            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6453        self
6454    }
6455
6456    /// Identifies the authorization scope for the method you are building.
6457    ///
6458    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6459    /// [`Scope::CloudPlatform`].
6460    ///
6461    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6462    /// tokens for more than one scope.
6463    ///
6464    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6465    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6466    /// sufficient, a read-write scope will do as well.
6467    pub fn add_scope<St>(
6468        mut self,
6469        scope: St,
6470    ) -> ProjectLocationConnectionConnectionSchemaMetadataGetEntityTypeCall<'a, C>
6471    where
6472        St: AsRef<str>,
6473    {
6474        self._scopes.insert(String::from(scope.as_ref()));
6475        self
6476    }
6477    /// Identifies the authorization scope(s) for the method you are building.
6478    ///
6479    /// See [`Self::add_scope()`] for details.
6480    pub fn add_scopes<I, St>(
6481        mut self,
6482        scopes: I,
6483    ) -> ProjectLocationConnectionConnectionSchemaMetadataGetEntityTypeCall<'a, C>
6484    where
6485        I: IntoIterator<Item = St>,
6486        St: AsRef<str>,
6487    {
6488        self._scopes
6489            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6490        self
6491    }
6492
6493    /// Removes all scopes, and no default scope will be used either.
6494    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6495    /// for details).
6496    pub fn clear_scopes(
6497        mut self,
6498    ) -> ProjectLocationConnectionConnectionSchemaMetadataGetEntityTypeCall<'a, C> {
6499        self._scopes.clear();
6500        self
6501    }
6502}
6503
6504/// List actions.
6505///
6506/// A builder for the *locations.connections.connectionSchemaMetadata.listActions* method supported by a *project* resource.
6507/// It is not used directly, but through a [`ProjectMethods`] instance.
6508///
6509/// # Example
6510///
6511/// Instantiate a resource method builder
6512///
6513/// ```test_harness,no_run
6514/// # extern crate hyper;
6515/// # extern crate hyper_rustls;
6516/// # extern crate google_connectors1 as connectors1;
6517/// # async fn dox() {
6518/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6519///
6520/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6521/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6522/// #     .with_native_roots()
6523/// #     .unwrap()
6524/// #     .https_only()
6525/// #     .enable_http2()
6526/// #     .build();
6527///
6528/// # let executor = hyper_util::rt::TokioExecutor::new();
6529/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6530/// #     secret,
6531/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6532/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6533/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6534/// #     ),
6535/// # ).build().await.unwrap();
6536///
6537/// # let client = hyper_util::client::legacy::Client::builder(
6538/// #     hyper_util::rt::TokioExecutor::new()
6539/// # )
6540/// # .build(
6541/// #     hyper_rustls::HttpsConnectorBuilder::new()
6542/// #         .with_native_roots()
6543/// #         .unwrap()
6544/// #         .https_or_http()
6545/// #         .enable_http2()
6546/// #         .build()
6547/// # );
6548/// # let mut hub = Connectors::new(client, auth);
6549/// // You can configure optional parameters by calling the respective setters at will, and
6550/// // execute the final call using `doit()`.
6551/// // Values shown here are possibly random and not representative !
6552/// let result = hub.projects().locations_connections_connection_schema_metadata_list_actions("name")
6553///              .view("duo")
6554///              .page_token("ipsum")
6555///              .page_size(-62)
6556///              .filter("Lorem")
6557///              .doit().await;
6558/// # }
6559/// ```
6560pub struct ProjectLocationConnectionConnectionSchemaMetadataListActionCall<'a, C>
6561where
6562    C: 'a,
6563{
6564    hub: &'a Connectors<C>,
6565    _name: String,
6566    _view: Option<String>,
6567    _page_token: Option<String>,
6568    _page_size: Option<i32>,
6569    _filter: Option<String>,
6570    _delegate: Option<&'a mut dyn common::Delegate>,
6571    _additional_params: HashMap<String, String>,
6572    _scopes: BTreeSet<String>,
6573}
6574
6575impl<'a, C> common::CallBuilder
6576    for ProjectLocationConnectionConnectionSchemaMetadataListActionCall<'a, C>
6577{
6578}
6579
6580impl<'a, C> ProjectLocationConnectionConnectionSchemaMetadataListActionCall<'a, C>
6581where
6582    C: common::Connector,
6583{
6584    /// Perform the operation you have build so far.
6585    pub async fn doit(mut self) -> common::Result<(common::Response, ListActionsResponse)> {
6586        use std::borrow::Cow;
6587        use std::io::{Read, Seek};
6588
6589        use common::{url::Params, ToParts};
6590        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6591
6592        let mut dd = common::DefaultDelegate;
6593        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6594        dlg.begin(common::MethodInfo {
6595            id: "connectors.projects.locations.connections.connectionSchemaMetadata.listActions",
6596            http_method: hyper::Method::GET,
6597        });
6598
6599        for &field in ["alt", "name", "view", "pageToken", "pageSize", "filter"].iter() {
6600            if self._additional_params.contains_key(field) {
6601                dlg.finished(false);
6602                return Err(common::Error::FieldClash(field));
6603            }
6604        }
6605
6606        let mut params = Params::with_capacity(7 + self._additional_params.len());
6607        params.push("name", self._name);
6608        if let Some(value) = self._view.as_ref() {
6609            params.push("view", value);
6610        }
6611        if let Some(value) = self._page_token.as_ref() {
6612            params.push("pageToken", value);
6613        }
6614        if let Some(value) = self._page_size.as_ref() {
6615            params.push("pageSize", value.to_string());
6616        }
6617        if let Some(value) = self._filter.as_ref() {
6618            params.push("filter", value);
6619        }
6620
6621        params.extend(self._additional_params.iter());
6622
6623        params.push("alt", "json");
6624        let mut url = self.hub._base_url.clone() + "v1/{+name}:listActions";
6625        if self._scopes.is_empty() {
6626            self._scopes
6627                .insert(Scope::CloudPlatform.as_ref().to_string());
6628        }
6629
6630        #[allow(clippy::single_element_loop)]
6631        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6632            url = params.uri_replacement(url, param_name, find_this, true);
6633        }
6634        {
6635            let to_remove = ["name"];
6636            params.remove_params(&to_remove);
6637        }
6638
6639        let url = params.parse_with_url(&url);
6640
6641        loop {
6642            let token = match self
6643                .hub
6644                .auth
6645                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6646                .await
6647            {
6648                Ok(token) => token,
6649                Err(e) => match dlg.token(e) {
6650                    Ok(token) => token,
6651                    Err(e) => {
6652                        dlg.finished(false);
6653                        return Err(common::Error::MissingToken(e));
6654                    }
6655                },
6656            };
6657            let mut req_result = {
6658                let client = &self.hub.client;
6659                dlg.pre_request();
6660                let mut req_builder = hyper::Request::builder()
6661                    .method(hyper::Method::GET)
6662                    .uri(url.as_str())
6663                    .header(USER_AGENT, self.hub._user_agent.clone());
6664
6665                if let Some(token) = token.as_ref() {
6666                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6667                }
6668
6669                let request = req_builder
6670                    .header(CONTENT_LENGTH, 0_u64)
6671                    .body(common::to_body::<String>(None));
6672
6673                client.request(request.unwrap()).await
6674            };
6675
6676            match req_result {
6677                Err(err) => {
6678                    if let common::Retry::After(d) = dlg.http_error(&err) {
6679                        sleep(d).await;
6680                        continue;
6681                    }
6682                    dlg.finished(false);
6683                    return Err(common::Error::HttpError(err));
6684                }
6685                Ok(res) => {
6686                    let (mut parts, body) = res.into_parts();
6687                    let mut body = common::Body::new(body);
6688                    if !parts.status.is_success() {
6689                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6690                        let error = serde_json::from_str(&common::to_string(&bytes));
6691                        let response = common::to_response(parts, bytes.into());
6692
6693                        if let common::Retry::After(d) =
6694                            dlg.http_failure(&response, error.as_ref().ok())
6695                        {
6696                            sleep(d).await;
6697                            continue;
6698                        }
6699
6700                        dlg.finished(false);
6701
6702                        return Err(match error {
6703                            Ok(value) => common::Error::BadRequest(value),
6704                            _ => common::Error::Failure(response),
6705                        });
6706                    }
6707                    let response = {
6708                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6709                        let encoded = common::to_string(&bytes);
6710                        match serde_json::from_str(&encoded) {
6711                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6712                            Err(error) => {
6713                                dlg.response_json_decode_error(&encoded, &error);
6714                                return Err(common::Error::JsonDecodeError(
6715                                    encoded.to_string(),
6716                                    error,
6717                                ));
6718                            }
6719                        }
6720                    };
6721
6722                    dlg.finished(true);
6723                    return Ok(response);
6724                }
6725            }
6726        }
6727    }
6728
6729    /// Required. Resource name format. projects/{project}/locations/{location}/connections/{connection}/connectionSchemaMetadata
6730    ///
6731    /// Sets the *name* path property to the given value.
6732    ///
6733    /// Even though the property as already been set when instantiating this call,
6734    /// we provide this method for API completeness.
6735    pub fn name(
6736        mut self,
6737        new_value: &str,
6738    ) -> ProjectLocationConnectionConnectionSchemaMetadataListActionCall<'a, C> {
6739        self._name = new_value.to_string();
6740        self
6741    }
6742    /// Specifies which fields are returned in response. Defaults to BASIC view.
6743    ///
6744    /// Sets the *view* query property to the given value.
6745    pub fn view(
6746        mut self,
6747        new_value: &str,
6748    ) -> ProjectLocationConnectionConnectionSchemaMetadataListActionCall<'a, C> {
6749        self._view = Some(new_value.to_string());
6750        self
6751    }
6752    /// Page token.
6753    ///
6754    /// Sets the *page token* query property to the given value.
6755    pub fn page_token(
6756        mut self,
6757        new_value: &str,
6758    ) -> ProjectLocationConnectionConnectionSchemaMetadataListActionCall<'a, C> {
6759        self._page_token = Some(new_value.to_string());
6760        self
6761    }
6762    /// Page size. If unspecified, at most 50 actions will be returned.
6763    ///
6764    /// Sets the *page size* query property to the given value.
6765    pub fn page_size(
6766        mut self,
6767        new_value: i32,
6768    ) -> ProjectLocationConnectionConnectionSchemaMetadataListActionCall<'a, C> {
6769        self._page_size = Some(new_value);
6770        self
6771    }
6772    /// Required. Filter Wildcards are not supported in the filter currently.
6773    ///
6774    /// Sets the *filter* query property to the given value.
6775    pub fn filter(
6776        mut self,
6777        new_value: &str,
6778    ) -> ProjectLocationConnectionConnectionSchemaMetadataListActionCall<'a, C> {
6779        self._filter = Some(new_value.to_string());
6780        self
6781    }
6782    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6783    /// while executing the actual API request.
6784    ///
6785    /// ````text
6786    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6787    /// ````
6788    ///
6789    /// Sets the *delegate* property to the given value.
6790    pub fn delegate(
6791        mut self,
6792        new_value: &'a mut dyn common::Delegate,
6793    ) -> ProjectLocationConnectionConnectionSchemaMetadataListActionCall<'a, C> {
6794        self._delegate = Some(new_value);
6795        self
6796    }
6797
6798    /// Set any additional parameter of the query string used in the request.
6799    /// It should be used to set parameters which are not yet available through their own
6800    /// setters.
6801    ///
6802    /// Please note that this method must not be used to set any of the known parameters
6803    /// which have their own setter method. If done anyway, the request will fail.
6804    ///
6805    /// # Additional Parameters
6806    ///
6807    /// * *$.xgafv* (query-string) - V1 error format.
6808    /// * *access_token* (query-string) - OAuth access token.
6809    /// * *alt* (query-string) - Data format for response.
6810    /// * *callback* (query-string) - JSONP
6811    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6812    /// * *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.
6813    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6814    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6815    /// * *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.
6816    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6817    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6818    pub fn param<T>(
6819        mut self,
6820        name: T,
6821        value: T,
6822    ) -> ProjectLocationConnectionConnectionSchemaMetadataListActionCall<'a, C>
6823    where
6824        T: AsRef<str>,
6825    {
6826        self._additional_params
6827            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6828        self
6829    }
6830
6831    /// Identifies the authorization scope for the method you are building.
6832    ///
6833    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6834    /// [`Scope::CloudPlatform`].
6835    ///
6836    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6837    /// tokens for more than one scope.
6838    ///
6839    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6840    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6841    /// sufficient, a read-write scope will do as well.
6842    pub fn add_scope<St>(
6843        mut self,
6844        scope: St,
6845    ) -> ProjectLocationConnectionConnectionSchemaMetadataListActionCall<'a, C>
6846    where
6847        St: AsRef<str>,
6848    {
6849        self._scopes.insert(String::from(scope.as_ref()));
6850        self
6851    }
6852    /// Identifies the authorization scope(s) for the method you are building.
6853    ///
6854    /// See [`Self::add_scope()`] for details.
6855    pub fn add_scopes<I, St>(
6856        mut self,
6857        scopes: I,
6858    ) -> ProjectLocationConnectionConnectionSchemaMetadataListActionCall<'a, C>
6859    where
6860        I: IntoIterator<Item = St>,
6861        St: AsRef<str>,
6862    {
6863        self._scopes
6864            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6865        self
6866    }
6867
6868    /// Removes all scopes, and no default scope will be used either.
6869    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6870    /// for details).
6871    pub fn clear_scopes(
6872        mut self,
6873    ) -> ProjectLocationConnectionConnectionSchemaMetadataListActionCall<'a, C> {
6874        self._scopes.clear();
6875        self
6876    }
6877}
6878
6879/// List entity types.
6880///
6881/// A builder for the *locations.connections.connectionSchemaMetadata.listEntityTypes* method supported by a *project* resource.
6882/// It is not used directly, but through a [`ProjectMethods`] instance.
6883///
6884/// # Example
6885///
6886/// Instantiate a resource method builder
6887///
6888/// ```test_harness,no_run
6889/// # extern crate hyper;
6890/// # extern crate hyper_rustls;
6891/// # extern crate google_connectors1 as connectors1;
6892/// # async fn dox() {
6893/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6894///
6895/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6896/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6897/// #     .with_native_roots()
6898/// #     .unwrap()
6899/// #     .https_only()
6900/// #     .enable_http2()
6901/// #     .build();
6902///
6903/// # let executor = hyper_util::rt::TokioExecutor::new();
6904/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6905/// #     secret,
6906/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6907/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6908/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6909/// #     ),
6910/// # ).build().await.unwrap();
6911///
6912/// # let client = hyper_util::client::legacy::Client::builder(
6913/// #     hyper_util::rt::TokioExecutor::new()
6914/// # )
6915/// # .build(
6916/// #     hyper_rustls::HttpsConnectorBuilder::new()
6917/// #         .with_native_roots()
6918/// #         .unwrap()
6919/// #         .https_or_http()
6920/// #         .enable_http2()
6921/// #         .build()
6922/// # );
6923/// # let mut hub = Connectors::new(client, auth);
6924/// // You can configure optional parameters by calling the respective setters at will, and
6925/// // execute the final call using `doit()`.
6926/// // Values shown here are possibly random and not representative !
6927/// let result = hub.projects().locations_connections_connection_schema_metadata_list_entity_types("name")
6928///              .view("eos")
6929///              .page_token("dolor")
6930///              .page_size(-17)
6931///              .filter("ipsum")
6932///              .doit().await;
6933/// # }
6934/// ```
6935pub struct ProjectLocationConnectionConnectionSchemaMetadataListEntityTypeCall<'a, C>
6936where
6937    C: 'a,
6938{
6939    hub: &'a Connectors<C>,
6940    _name: String,
6941    _view: Option<String>,
6942    _page_token: Option<String>,
6943    _page_size: Option<i32>,
6944    _filter: Option<String>,
6945    _delegate: Option<&'a mut dyn common::Delegate>,
6946    _additional_params: HashMap<String, String>,
6947    _scopes: BTreeSet<String>,
6948}
6949
6950impl<'a, C> common::CallBuilder
6951    for ProjectLocationConnectionConnectionSchemaMetadataListEntityTypeCall<'a, C>
6952{
6953}
6954
6955impl<'a, C> ProjectLocationConnectionConnectionSchemaMetadataListEntityTypeCall<'a, C>
6956where
6957    C: common::Connector,
6958{
6959    /// Perform the operation you have build so far.
6960    pub async fn doit(mut self) -> common::Result<(common::Response, ListEntityTypesResponse)> {
6961        use std::borrow::Cow;
6962        use std::io::{Read, Seek};
6963
6964        use common::{url::Params, ToParts};
6965        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6966
6967        let mut dd = common::DefaultDelegate;
6968        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6969        dlg.begin(common::MethodInfo { id: "connectors.projects.locations.connections.connectionSchemaMetadata.listEntityTypes",
6970                               http_method: hyper::Method::GET });
6971
6972        for &field in ["alt", "name", "view", "pageToken", "pageSize", "filter"].iter() {
6973            if self._additional_params.contains_key(field) {
6974                dlg.finished(false);
6975                return Err(common::Error::FieldClash(field));
6976            }
6977        }
6978
6979        let mut params = Params::with_capacity(7 + self._additional_params.len());
6980        params.push("name", self._name);
6981        if let Some(value) = self._view.as_ref() {
6982            params.push("view", value);
6983        }
6984        if let Some(value) = self._page_token.as_ref() {
6985            params.push("pageToken", value);
6986        }
6987        if let Some(value) = self._page_size.as_ref() {
6988            params.push("pageSize", value.to_string());
6989        }
6990        if let Some(value) = self._filter.as_ref() {
6991            params.push("filter", value);
6992        }
6993
6994        params.extend(self._additional_params.iter());
6995
6996        params.push("alt", "json");
6997        let mut url = self.hub._base_url.clone() + "v1/{+name}:listEntityTypes";
6998        if self._scopes.is_empty() {
6999            self._scopes
7000                .insert(Scope::CloudPlatform.as_ref().to_string());
7001        }
7002
7003        #[allow(clippy::single_element_loop)]
7004        for &(find_this, param_name) in [("{+name}", "name")].iter() {
7005            url = params.uri_replacement(url, param_name, find_this, true);
7006        }
7007        {
7008            let to_remove = ["name"];
7009            params.remove_params(&to_remove);
7010        }
7011
7012        let url = params.parse_with_url(&url);
7013
7014        loop {
7015            let token = match self
7016                .hub
7017                .auth
7018                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7019                .await
7020            {
7021                Ok(token) => token,
7022                Err(e) => match dlg.token(e) {
7023                    Ok(token) => token,
7024                    Err(e) => {
7025                        dlg.finished(false);
7026                        return Err(common::Error::MissingToken(e));
7027                    }
7028                },
7029            };
7030            let mut req_result = {
7031                let client = &self.hub.client;
7032                dlg.pre_request();
7033                let mut req_builder = hyper::Request::builder()
7034                    .method(hyper::Method::GET)
7035                    .uri(url.as_str())
7036                    .header(USER_AGENT, self.hub._user_agent.clone());
7037
7038                if let Some(token) = token.as_ref() {
7039                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7040                }
7041
7042                let request = req_builder
7043                    .header(CONTENT_LENGTH, 0_u64)
7044                    .body(common::to_body::<String>(None));
7045
7046                client.request(request.unwrap()).await
7047            };
7048
7049            match req_result {
7050                Err(err) => {
7051                    if let common::Retry::After(d) = dlg.http_error(&err) {
7052                        sleep(d).await;
7053                        continue;
7054                    }
7055                    dlg.finished(false);
7056                    return Err(common::Error::HttpError(err));
7057                }
7058                Ok(res) => {
7059                    let (mut parts, body) = res.into_parts();
7060                    let mut body = common::Body::new(body);
7061                    if !parts.status.is_success() {
7062                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7063                        let error = serde_json::from_str(&common::to_string(&bytes));
7064                        let response = common::to_response(parts, bytes.into());
7065
7066                        if let common::Retry::After(d) =
7067                            dlg.http_failure(&response, error.as_ref().ok())
7068                        {
7069                            sleep(d).await;
7070                            continue;
7071                        }
7072
7073                        dlg.finished(false);
7074
7075                        return Err(match error {
7076                            Ok(value) => common::Error::BadRequest(value),
7077                            _ => common::Error::Failure(response),
7078                        });
7079                    }
7080                    let response = {
7081                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7082                        let encoded = common::to_string(&bytes);
7083                        match serde_json::from_str(&encoded) {
7084                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7085                            Err(error) => {
7086                                dlg.response_json_decode_error(&encoded, &error);
7087                                return Err(common::Error::JsonDecodeError(
7088                                    encoded.to_string(),
7089                                    error,
7090                                ));
7091                            }
7092                        }
7093                    };
7094
7095                    dlg.finished(true);
7096                    return Ok(response);
7097                }
7098            }
7099        }
7100    }
7101
7102    /// Required. Resource name format: projects/{project}/locations/{location}/connections/{connection}/connectionSchemaMetadata
7103    ///
7104    /// Sets the *name* path property to the given value.
7105    ///
7106    /// Even though the property as already been set when instantiating this call,
7107    /// we provide this method for API completeness.
7108    pub fn name(
7109        mut self,
7110        new_value: &str,
7111    ) -> ProjectLocationConnectionConnectionSchemaMetadataListEntityTypeCall<'a, C> {
7112        self._name = new_value.to_string();
7113        self
7114    }
7115    /// Specifies which fields are returned in response. Defaults to BASIC view.
7116    ///
7117    /// Sets the *view* query property to the given value.
7118    pub fn view(
7119        mut self,
7120        new_value: &str,
7121    ) -> ProjectLocationConnectionConnectionSchemaMetadataListEntityTypeCall<'a, C> {
7122        self._view = Some(new_value.to_string());
7123        self
7124    }
7125    /// Page token.
7126    ///
7127    /// Sets the *page token* query property to the given value.
7128    pub fn page_token(
7129        mut self,
7130        new_value: &str,
7131    ) -> ProjectLocationConnectionConnectionSchemaMetadataListEntityTypeCall<'a, C> {
7132        self._page_token = Some(new_value.to_string());
7133        self
7134    }
7135    /// Page size. If unspecified, at most 50 entity types will be returned.
7136    ///
7137    /// Sets the *page size* query property to the given value.
7138    pub fn page_size(
7139        mut self,
7140        new_value: i32,
7141    ) -> ProjectLocationConnectionConnectionSchemaMetadataListEntityTypeCall<'a, C> {
7142        self._page_size = Some(new_value);
7143        self
7144    }
7145    /// Required. Filter Wildcards are not supported in the filter currently.
7146    ///
7147    /// Sets the *filter* query property to the given value.
7148    pub fn filter(
7149        mut self,
7150        new_value: &str,
7151    ) -> ProjectLocationConnectionConnectionSchemaMetadataListEntityTypeCall<'a, C> {
7152        self._filter = Some(new_value.to_string());
7153        self
7154    }
7155    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7156    /// while executing the actual API request.
7157    ///
7158    /// ````text
7159    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7160    /// ````
7161    ///
7162    /// Sets the *delegate* property to the given value.
7163    pub fn delegate(
7164        mut self,
7165        new_value: &'a mut dyn common::Delegate,
7166    ) -> ProjectLocationConnectionConnectionSchemaMetadataListEntityTypeCall<'a, C> {
7167        self._delegate = Some(new_value);
7168        self
7169    }
7170
7171    /// Set any additional parameter of the query string used in the request.
7172    /// It should be used to set parameters which are not yet available through their own
7173    /// setters.
7174    ///
7175    /// Please note that this method must not be used to set any of the known parameters
7176    /// which have their own setter method. If done anyway, the request will fail.
7177    ///
7178    /// # Additional Parameters
7179    ///
7180    /// * *$.xgafv* (query-string) - V1 error format.
7181    /// * *access_token* (query-string) - OAuth access token.
7182    /// * *alt* (query-string) - Data format for response.
7183    /// * *callback* (query-string) - JSONP
7184    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7185    /// * *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.
7186    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7187    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7188    /// * *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.
7189    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7190    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7191    pub fn param<T>(
7192        mut self,
7193        name: T,
7194        value: T,
7195    ) -> ProjectLocationConnectionConnectionSchemaMetadataListEntityTypeCall<'a, C>
7196    where
7197        T: AsRef<str>,
7198    {
7199        self._additional_params
7200            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7201        self
7202    }
7203
7204    /// Identifies the authorization scope for the method you are building.
7205    ///
7206    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7207    /// [`Scope::CloudPlatform`].
7208    ///
7209    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7210    /// tokens for more than one scope.
7211    ///
7212    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7213    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7214    /// sufficient, a read-write scope will do as well.
7215    pub fn add_scope<St>(
7216        mut self,
7217        scope: St,
7218    ) -> ProjectLocationConnectionConnectionSchemaMetadataListEntityTypeCall<'a, C>
7219    where
7220        St: AsRef<str>,
7221    {
7222        self._scopes.insert(String::from(scope.as_ref()));
7223        self
7224    }
7225    /// Identifies the authorization scope(s) for the method you are building.
7226    ///
7227    /// See [`Self::add_scope()`] for details.
7228    pub fn add_scopes<I, St>(
7229        mut self,
7230        scopes: I,
7231    ) -> ProjectLocationConnectionConnectionSchemaMetadataListEntityTypeCall<'a, C>
7232    where
7233        I: IntoIterator<Item = St>,
7234        St: AsRef<str>,
7235    {
7236        self._scopes
7237            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7238        self
7239    }
7240
7241    /// Removes all scopes, and no default scope will be used either.
7242    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7243    /// for details).
7244    pub fn clear_scopes(
7245        mut self,
7246    ) -> ProjectLocationConnectionConnectionSchemaMetadataListEntityTypeCall<'a, C> {
7247        self._scopes.clear();
7248        self
7249    }
7250}
7251
7252/// Refresh runtime schema of a connection.
7253///
7254/// A builder for the *locations.connections.connectionSchemaMetadata.refresh* method supported by a *project* resource.
7255/// It is not used directly, but through a [`ProjectMethods`] instance.
7256///
7257/// # Example
7258///
7259/// Instantiate a resource method builder
7260///
7261/// ```test_harness,no_run
7262/// # extern crate hyper;
7263/// # extern crate hyper_rustls;
7264/// # extern crate google_connectors1 as connectors1;
7265/// use connectors1::api::RefreshConnectionSchemaMetadataRequest;
7266/// # async fn dox() {
7267/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7268///
7269/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7270/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7271/// #     .with_native_roots()
7272/// #     .unwrap()
7273/// #     .https_only()
7274/// #     .enable_http2()
7275/// #     .build();
7276///
7277/// # let executor = hyper_util::rt::TokioExecutor::new();
7278/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7279/// #     secret,
7280/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7281/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7282/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7283/// #     ),
7284/// # ).build().await.unwrap();
7285///
7286/// # let client = hyper_util::client::legacy::Client::builder(
7287/// #     hyper_util::rt::TokioExecutor::new()
7288/// # )
7289/// # .build(
7290/// #     hyper_rustls::HttpsConnectorBuilder::new()
7291/// #         .with_native_roots()
7292/// #         .unwrap()
7293/// #         .https_or_http()
7294/// #         .enable_http2()
7295/// #         .build()
7296/// # );
7297/// # let mut hub = Connectors::new(client, auth);
7298/// // As the method needs a request, you would usually fill it with the desired information
7299/// // into the respective structure. Some of the parts shown here might not be applicable !
7300/// // Values shown here are possibly random and not representative !
7301/// let mut req = RefreshConnectionSchemaMetadataRequest::default();
7302///
7303/// // You can configure optional parameters by calling the respective setters at will, and
7304/// // execute the final call using `doit()`.
7305/// // Values shown here are possibly random and not representative !
7306/// let result = hub.projects().locations_connections_connection_schema_metadata_refresh(req, "name")
7307///              .doit().await;
7308/// # }
7309/// ```
7310pub struct ProjectLocationConnectionConnectionSchemaMetadataRefreshCall<'a, C>
7311where
7312    C: 'a,
7313{
7314    hub: &'a Connectors<C>,
7315    _request: RefreshConnectionSchemaMetadataRequest,
7316    _name: String,
7317    _delegate: Option<&'a mut dyn common::Delegate>,
7318    _additional_params: HashMap<String, String>,
7319    _scopes: BTreeSet<String>,
7320}
7321
7322impl<'a, C> common::CallBuilder
7323    for ProjectLocationConnectionConnectionSchemaMetadataRefreshCall<'a, C>
7324{
7325}
7326
7327impl<'a, C> ProjectLocationConnectionConnectionSchemaMetadataRefreshCall<'a, C>
7328where
7329    C: common::Connector,
7330{
7331    /// Perform the operation you have build so far.
7332    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
7333        use std::borrow::Cow;
7334        use std::io::{Read, Seek};
7335
7336        use common::{url::Params, ToParts};
7337        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7338
7339        let mut dd = common::DefaultDelegate;
7340        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7341        dlg.begin(common::MethodInfo {
7342            id: "connectors.projects.locations.connections.connectionSchemaMetadata.refresh",
7343            http_method: hyper::Method::POST,
7344        });
7345
7346        for &field in ["alt", "name"].iter() {
7347            if self._additional_params.contains_key(field) {
7348                dlg.finished(false);
7349                return Err(common::Error::FieldClash(field));
7350            }
7351        }
7352
7353        let mut params = Params::with_capacity(4 + self._additional_params.len());
7354        params.push("name", self._name);
7355
7356        params.extend(self._additional_params.iter());
7357
7358        params.push("alt", "json");
7359        let mut url = self.hub._base_url.clone() + "v1/{+name}:refresh";
7360        if self._scopes.is_empty() {
7361            self._scopes
7362                .insert(Scope::CloudPlatform.as_ref().to_string());
7363        }
7364
7365        #[allow(clippy::single_element_loop)]
7366        for &(find_this, param_name) in [("{+name}", "name")].iter() {
7367            url = params.uri_replacement(url, param_name, find_this, true);
7368        }
7369        {
7370            let to_remove = ["name"];
7371            params.remove_params(&to_remove);
7372        }
7373
7374        let url = params.parse_with_url(&url);
7375
7376        let mut json_mime_type = mime::APPLICATION_JSON;
7377        let mut request_value_reader = {
7378            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7379            common::remove_json_null_values(&mut value);
7380            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7381            serde_json::to_writer(&mut dst, &value).unwrap();
7382            dst
7383        };
7384        let request_size = request_value_reader
7385            .seek(std::io::SeekFrom::End(0))
7386            .unwrap();
7387        request_value_reader
7388            .seek(std::io::SeekFrom::Start(0))
7389            .unwrap();
7390
7391        loop {
7392            let token = match self
7393                .hub
7394                .auth
7395                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7396                .await
7397            {
7398                Ok(token) => token,
7399                Err(e) => match dlg.token(e) {
7400                    Ok(token) => token,
7401                    Err(e) => {
7402                        dlg.finished(false);
7403                        return Err(common::Error::MissingToken(e));
7404                    }
7405                },
7406            };
7407            request_value_reader
7408                .seek(std::io::SeekFrom::Start(0))
7409                .unwrap();
7410            let mut req_result = {
7411                let client = &self.hub.client;
7412                dlg.pre_request();
7413                let mut req_builder = hyper::Request::builder()
7414                    .method(hyper::Method::POST)
7415                    .uri(url.as_str())
7416                    .header(USER_AGENT, self.hub._user_agent.clone());
7417
7418                if let Some(token) = token.as_ref() {
7419                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7420                }
7421
7422                let request = req_builder
7423                    .header(CONTENT_TYPE, json_mime_type.to_string())
7424                    .header(CONTENT_LENGTH, request_size as u64)
7425                    .body(common::to_body(
7426                        request_value_reader.get_ref().clone().into(),
7427                    ));
7428
7429                client.request(request.unwrap()).await
7430            };
7431
7432            match req_result {
7433                Err(err) => {
7434                    if let common::Retry::After(d) = dlg.http_error(&err) {
7435                        sleep(d).await;
7436                        continue;
7437                    }
7438                    dlg.finished(false);
7439                    return Err(common::Error::HttpError(err));
7440                }
7441                Ok(res) => {
7442                    let (mut parts, body) = res.into_parts();
7443                    let mut body = common::Body::new(body);
7444                    if !parts.status.is_success() {
7445                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7446                        let error = serde_json::from_str(&common::to_string(&bytes));
7447                        let response = common::to_response(parts, bytes.into());
7448
7449                        if let common::Retry::After(d) =
7450                            dlg.http_failure(&response, error.as_ref().ok())
7451                        {
7452                            sleep(d).await;
7453                            continue;
7454                        }
7455
7456                        dlg.finished(false);
7457
7458                        return Err(match error {
7459                            Ok(value) => common::Error::BadRequest(value),
7460                            _ => common::Error::Failure(response),
7461                        });
7462                    }
7463                    let response = {
7464                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7465                        let encoded = common::to_string(&bytes);
7466                        match serde_json::from_str(&encoded) {
7467                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7468                            Err(error) => {
7469                                dlg.response_json_decode_error(&encoded, &error);
7470                                return Err(common::Error::JsonDecodeError(
7471                                    encoded.to_string(),
7472                                    error,
7473                                ));
7474                            }
7475                        }
7476                    };
7477
7478                    dlg.finished(true);
7479                    return Ok(response);
7480                }
7481            }
7482        }
7483    }
7484
7485    ///
7486    /// Sets the *request* property to the given value.
7487    ///
7488    /// Even though the property as already been set when instantiating this call,
7489    /// we provide this method for API completeness.
7490    pub fn request(
7491        mut self,
7492        new_value: RefreshConnectionSchemaMetadataRequest,
7493    ) -> ProjectLocationConnectionConnectionSchemaMetadataRefreshCall<'a, C> {
7494        self._request = new_value;
7495        self
7496    }
7497    /// Required. Resource name. Format: projects/{project}/locations/{location}/connections/{connection}/connectionSchemaMetadata
7498    ///
7499    /// Sets the *name* path property to the given value.
7500    ///
7501    /// Even though the property as already been set when instantiating this call,
7502    /// we provide this method for API completeness.
7503    pub fn name(
7504        mut self,
7505        new_value: &str,
7506    ) -> ProjectLocationConnectionConnectionSchemaMetadataRefreshCall<'a, C> {
7507        self._name = new_value.to_string();
7508        self
7509    }
7510    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7511    /// while executing the actual API request.
7512    ///
7513    /// ````text
7514    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7515    /// ````
7516    ///
7517    /// Sets the *delegate* property to the given value.
7518    pub fn delegate(
7519        mut self,
7520        new_value: &'a mut dyn common::Delegate,
7521    ) -> ProjectLocationConnectionConnectionSchemaMetadataRefreshCall<'a, C> {
7522        self._delegate = Some(new_value);
7523        self
7524    }
7525
7526    /// Set any additional parameter of the query string used in the request.
7527    /// It should be used to set parameters which are not yet available through their own
7528    /// setters.
7529    ///
7530    /// Please note that this method must not be used to set any of the known parameters
7531    /// which have their own setter method. If done anyway, the request will fail.
7532    ///
7533    /// # Additional Parameters
7534    ///
7535    /// * *$.xgafv* (query-string) - V1 error format.
7536    /// * *access_token* (query-string) - OAuth access token.
7537    /// * *alt* (query-string) - Data format for response.
7538    /// * *callback* (query-string) - JSONP
7539    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7540    /// * *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.
7541    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7542    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7543    /// * *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.
7544    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7545    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7546    pub fn param<T>(
7547        mut self,
7548        name: T,
7549        value: T,
7550    ) -> ProjectLocationConnectionConnectionSchemaMetadataRefreshCall<'a, C>
7551    where
7552        T: AsRef<str>,
7553    {
7554        self._additional_params
7555            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7556        self
7557    }
7558
7559    /// Identifies the authorization scope for the method you are building.
7560    ///
7561    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7562    /// [`Scope::CloudPlatform`].
7563    ///
7564    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7565    /// tokens for more than one scope.
7566    ///
7567    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7568    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7569    /// sufficient, a read-write scope will do as well.
7570    pub fn add_scope<St>(
7571        mut self,
7572        scope: St,
7573    ) -> ProjectLocationConnectionConnectionSchemaMetadataRefreshCall<'a, C>
7574    where
7575        St: AsRef<str>,
7576    {
7577        self._scopes.insert(String::from(scope.as_ref()));
7578        self
7579    }
7580    /// Identifies the authorization scope(s) for the method you are building.
7581    ///
7582    /// See [`Self::add_scope()`] for details.
7583    pub fn add_scopes<I, St>(
7584        mut self,
7585        scopes: I,
7586    ) -> ProjectLocationConnectionConnectionSchemaMetadataRefreshCall<'a, C>
7587    where
7588        I: IntoIterator<Item = St>,
7589        St: AsRef<str>,
7590    {
7591        self._scopes
7592            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7593        self
7594    }
7595
7596    /// Removes all scopes, and no default scope will be used either.
7597    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7598    /// for details).
7599    pub fn clear_scopes(
7600        mut self,
7601    ) -> ProjectLocationConnectionConnectionSchemaMetadataRefreshCall<'a, C> {
7602        self._scopes.clear();
7603        self
7604    }
7605}
7606
7607/// Creates a new EndUserAuthentication in a given project,location and connection.
7608///
7609/// A builder for the *locations.connections.endUserAuthentications.create* method supported by a *project* resource.
7610/// It is not used directly, but through a [`ProjectMethods`] instance.
7611///
7612/// # Example
7613///
7614/// Instantiate a resource method builder
7615///
7616/// ```test_harness,no_run
7617/// # extern crate hyper;
7618/// # extern crate hyper_rustls;
7619/// # extern crate google_connectors1 as connectors1;
7620/// use connectors1::api::EndUserAuthentication;
7621/// # async fn dox() {
7622/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7623///
7624/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7625/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7626/// #     .with_native_roots()
7627/// #     .unwrap()
7628/// #     .https_only()
7629/// #     .enable_http2()
7630/// #     .build();
7631///
7632/// # let executor = hyper_util::rt::TokioExecutor::new();
7633/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7634/// #     secret,
7635/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7636/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7637/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7638/// #     ),
7639/// # ).build().await.unwrap();
7640///
7641/// # let client = hyper_util::client::legacy::Client::builder(
7642/// #     hyper_util::rt::TokioExecutor::new()
7643/// # )
7644/// # .build(
7645/// #     hyper_rustls::HttpsConnectorBuilder::new()
7646/// #         .with_native_roots()
7647/// #         .unwrap()
7648/// #         .https_or_http()
7649/// #         .enable_http2()
7650/// #         .build()
7651/// # );
7652/// # let mut hub = Connectors::new(client, auth);
7653/// // As the method needs a request, you would usually fill it with the desired information
7654/// // into the respective structure. Some of the parts shown here might not be applicable !
7655/// // Values shown here are possibly random and not representative !
7656/// let mut req = EndUserAuthentication::default();
7657///
7658/// // You can configure optional parameters by calling the respective setters at will, and
7659/// // execute the final call using `doit()`.
7660/// // Values shown here are possibly random and not representative !
7661/// let result = hub.projects().locations_connections_end_user_authentications_create(req, "parent")
7662///              .end_user_authentication_id("duo")
7663///              .doit().await;
7664/// # }
7665/// ```
7666pub struct ProjectLocationConnectionEndUserAuthenticationCreateCall<'a, C>
7667where
7668    C: 'a,
7669{
7670    hub: &'a Connectors<C>,
7671    _request: EndUserAuthentication,
7672    _parent: String,
7673    _end_user_authentication_id: Option<String>,
7674    _delegate: Option<&'a mut dyn common::Delegate>,
7675    _additional_params: HashMap<String, String>,
7676    _scopes: BTreeSet<String>,
7677}
7678
7679impl<'a, C> common::CallBuilder
7680    for ProjectLocationConnectionEndUserAuthenticationCreateCall<'a, C>
7681{
7682}
7683
7684impl<'a, C> ProjectLocationConnectionEndUserAuthenticationCreateCall<'a, C>
7685where
7686    C: common::Connector,
7687{
7688    /// Perform the operation you have build so far.
7689    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
7690        use std::borrow::Cow;
7691        use std::io::{Read, Seek};
7692
7693        use common::{url::Params, ToParts};
7694        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7695
7696        let mut dd = common::DefaultDelegate;
7697        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7698        dlg.begin(common::MethodInfo {
7699            id: "connectors.projects.locations.connections.endUserAuthentications.create",
7700            http_method: hyper::Method::POST,
7701        });
7702
7703        for &field in ["alt", "parent", "endUserAuthenticationId"].iter() {
7704            if self._additional_params.contains_key(field) {
7705                dlg.finished(false);
7706                return Err(common::Error::FieldClash(field));
7707            }
7708        }
7709
7710        let mut params = Params::with_capacity(5 + self._additional_params.len());
7711        params.push("parent", self._parent);
7712        if let Some(value) = self._end_user_authentication_id.as_ref() {
7713            params.push("endUserAuthenticationId", value);
7714        }
7715
7716        params.extend(self._additional_params.iter());
7717
7718        params.push("alt", "json");
7719        let mut url = self.hub._base_url.clone() + "v1/{+parent}/endUserAuthentications";
7720        if self._scopes.is_empty() {
7721            self._scopes
7722                .insert(Scope::CloudPlatform.as_ref().to_string());
7723        }
7724
7725        #[allow(clippy::single_element_loop)]
7726        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7727            url = params.uri_replacement(url, param_name, find_this, true);
7728        }
7729        {
7730            let to_remove = ["parent"];
7731            params.remove_params(&to_remove);
7732        }
7733
7734        let url = params.parse_with_url(&url);
7735
7736        let mut json_mime_type = mime::APPLICATION_JSON;
7737        let mut request_value_reader = {
7738            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7739            common::remove_json_null_values(&mut value);
7740            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7741            serde_json::to_writer(&mut dst, &value).unwrap();
7742            dst
7743        };
7744        let request_size = request_value_reader
7745            .seek(std::io::SeekFrom::End(0))
7746            .unwrap();
7747        request_value_reader
7748            .seek(std::io::SeekFrom::Start(0))
7749            .unwrap();
7750
7751        loop {
7752            let token = match self
7753                .hub
7754                .auth
7755                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7756                .await
7757            {
7758                Ok(token) => token,
7759                Err(e) => match dlg.token(e) {
7760                    Ok(token) => token,
7761                    Err(e) => {
7762                        dlg.finished(false);
7763                        return Err(common::Error::MissingToken(e));
7764                    }
7765                },
7766            };
7767            request_value_reader
7768                .seek(std::io::SeekFrom::Start(0))
7769                .unwrap();
7770            let mut req_result = {
7771                let client = &self.hub.client;
7772                dlg.pre_request();
7773                let mut req_builder = hyper::Request::builder()
7774                    .method(hyper::Method::POST)
7775                    .uri(url.as_str())
7776                    .header(USER_AGENT, self.hub._user_agent.clone());
7777
7778                if let Some(token) = token.as_ref() {
7779                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7780                }
7781
7782                let request = req_builder
7783                    .header(CONTENT_TYPE, json_mime_type.to_string())
7784                    .header(CONTENT_LENGTH, request_size as u64)
7785                    .body(common::to_body(
7786                        request_value_reader.get_ref().clone().into(),
7787                    ));
7788
7789                client.request(request.unwrap()).await
7790            };
7791
7792            match req_result {
7793                Err(err) => {
7794                    if let common::Retry::After(d) = dlg.http_error(&err) {
7795                        sleep(d).await;
7796                        continue;
7797                    }
7798                    dlg.finished(false);
7799                    return Err(common::Error::HttpError(err));
7800                }
7801                Ok(res) => {
7802                    let (mut parts, body) = res.into_parts();
7803                    let mut body = common::Body::new(body);
7804                    if !parts.status.is_success() {
7805                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7806                        let error = serde_json::from_str(&common::to_string(&bytes));
7807                        let response = common::to_response(parts, bytes.into());
7808
7809                        if let common::Retry::After(d) =
7810                            dlg.http_failure(&response, error.as_ref().ok())
7811                        {
7812                            sleep(d).await;
7813                            continue;
7814                        }
7815
7816                        dlg.finished(false);
7817
7818                        return Err(match error {
7819                            Ok(value) => common::Error::BadRequest(value),
7820                            _ => common::Error::Failure(response),
7821                        });
7822                    }
7823                    let response = {
7824                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7825                        let encoded = common::to_string(&bytes);
7826                        match serde_json::from_str(&encoded) {
7827                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7828                            Err(error) => {
7829                                dlg.response_json_decode_error(&encoded, &error);
7830                                return Err(common::Error::JsonDecodeError(
7831                                    encoded.to_string(),
7832                                    error,
7833                                ));
7834                            }
7835                        }
7836                    };
7837
7838                    dlg.finished(true);
7839                    return Ok(response);
7840                }
7841            }
7842        }
7843    }
7844
7845    ///
7846    /// Sets the *request* property to the given value.
7847    ///
7848    /// Even though the property as already been set when instantiating this call,
7849    /// we provide this method for API completeness.
7850    pub fn request(
7851        mut self,
7852        new_value: EndUserAuthentication,
7853    ) -> ProjectLocationConnectionEndUserAuthenticationCreateCall<'a, C> {
7854        self._request = new_value;
7855        self
7856    }
7857    /// Required. Parent resource of the EndUserAuthentication, of the form: `projects/*/locations/*/connections/*`
7858    ///
7859    /// Sets the *parent* path property to the given value.
7860    ///
7861    /// Even though the property as already been set when instantiating this call,
7862    /// we provide this method for API completeness.
7863    pub fn parent(
7864        mut self,
7865        new_value: &str,
7866    ) -> ProjectLocationConnectionEndUserAuthenticationCreateCall<'a, C> {
7867        self._parent = new_value.to_string();
7868        self
7869    }
7870    /// Required. Identifier to assign to the EndUserAuthentication. Must be unique within scope of the parent resource.
7871    ///
7872    /// Sets the *end user authentication id* query property to the given value.
7873    pub fn end_user_authentication_id(
7874        mut self,
7875        new_value: &str,
7876    ) -> ProjectLocationConnectionEndUserAuthenticationCreateCall<'a, C> {
7877        self._end_user_authentication_id = Some(new_value.to_string());
7878        self
7879    }
7880    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7881    /// while executing the actual API request.
7882    ///
7883    /// ````text
7884    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7885    /// ````
7886    ///
7887    /// Sets the *delegate* property to the given value.
7888    pub fn delegate(
7889        mut self,
7890        new_value: &'a mut dyn common::Delegate,
7891    ) -> ProjectLocationConnectionEndUserAuthenticationCreateCall<'a, C> {
7892        self._delegate = Some(new_value);
7893        self
7894    }
7895
7896    /// Set any additional parameter of the query string used in the request.
7897    /// It should be used to set parameters which are not yet available through their own
7898    /// setters.
7899    ///
7900    /// Please note that this method must not be used to set any of the known parameters
7901    /// which have their own setter method. If done anyway, the request will fail.
7902    ///
7903    /// # Additional Parameters
7904    ///
7905    /// * *$.xgafv* (query-string) - V1 error format.
7906    /// * *access_token* (query-string) - OAuth access token.
7907    /// * *alt* (query-string) - Data format for response.
7908    /// * *callback* (query-string) - JSONP
7909    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7910    /// * *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.
7911    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7912    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7913    /// * *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.
7914    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7915    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7916    pub fn param<T>(
7917        mut self,
7918        name: T,
7919        value: T,
7920    ) -> ProjectLocationConnectionEndUserAuthenticationCreateCall<'a, C>
7921    where
7922        T: AsRef<str>,
7923    {
7924        self._additional_params
7925            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7926        self
7927    }
7928
7929    /// Identifies the authorization scope for the method you are building.
7930    ///
7931    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7932    /// [`Scope::CloudPlatform`].
7933    ///
7934    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7935    /// tokens for more than one scope.
7936    ///
7937    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7938    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7939    /// sufficient, a read-write scope will do as well.
7940    pub fn add_scope<St>(
7941        mut self,
7942        scope: St,
7943    ) -> ProjectLocationConnectionEndUserAuthenticationCreateCall<'a, C>
7944    where
7945        St: AsRef<str>,
7946    {
7947        self._scopes.insert(String::from(scope.as_ref()));
7948        self
7949    }
7950    /// Identifies the authorization scope(s) for the method you are building.
7951    ///
7952    /// See [`Self::add_scope()`] for details.
7953    pub fn add_scopes<I, St>(
7954        mut self,
7955        scopes: I,
7956    ) -> ProjectLocationConnectionEndUserAuthenticationCreateCall<'a, C>
7957    where
7958        I: IntoIterator<Item = St>,
7959        St: AsRef<str>,
7960    {
7961        self._scopes
7962            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7963        self
7964    }
7965
7966    /// Removes all scopes, and no default scope will be used either.
7967    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7968    /// for details).
7969    pub fn clear_scopes(
7970        mut self,
7971    ) -> ProjectLocationConnectionEndUserAuthenticationCreateCall<'a, C> {
7972        self._scopes.clear();
7973        self
7974    }
7975}
7976
7977/// Deletes a single EndUserAuthentication.
7978///
7979/// A builder for the *locations.connections.endUserAuthentications.delete* method supported by a *project* resource.
7980/// It is not used directly, but through a [`ProjectMethods`] instance.
7981///
7982/// # Example
7983///
7984/// Instantiate a resource method builder
7985///
7986/// ```test_harness,no_run
7987/// # extern crate hyper;
7988/// # extern crate hyper_rustls;
7989/// # extern crate google_connectors1 as connectors1;
7990/// # async fn dox() {
7991/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7992///
7993/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7994/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7995/// #     .with_native_roots()
7996/// #     .unwrap()
7997/// #     .https_only()
7998/// #     .enable_http2()
7999/// #     .build();
8000///
8001/// # let executor = hyper_util::rt::TokioExecutor::new();
8002/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8003/// #     secret,
8004/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8005/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8006/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8007/// #     ),
8008/// # ).build().await.unwrap();
8009///
8010/// # let client = hyper_util::client::legacy::Client::builder(
8011/// #     hyper_util::rt::TokioExecutor::new()
8012/// # )
8013/// # .build(
8014/// #     hyper_rustls::HttpsConnectorBuilder::new()
8015/// #         .with_native_roots()
8016/// #         .unwrap()
8017/// #         .https_or_http()
8018/// #         .enable_http2()
8019/// #         .build()
8020/// # );
8021/// # let mut hub = Connectors::new(client, auth);
8022/// // You can configure optional parameters by calling the respective setters at will, and
8023/// // execute the final call using `doit()`.
8024/// // Values shown here are possibly random and not representative !
8025/// let result = hub.projects().locations_connections_end_user_authentications_delete("name")
8026///              .doit().await;
8027/// # }
8028/// ```
8029pub struct ProjectLocationConnectionEndUserAuthenticationDeleteCall<'a, C>
8030where
8031    C: 'a,
8032{
8033    hub: &'a Connectors<C>,
8034    _name: String,
8035    _delegate: Option<&'a mut dyn common::Delegate>,
8036    _additional_params: HashMap<String, String>,
8037    _scopes: BTreeSet<String>,
8038}
8039
8040impl<'a, C> common::CallBuilder
8041    for ProjectLocationConnectionEndUserAuthenticationDeleteCall<'a, C>
8042{
8043}
8044
8045impl<'a, C> ProjectLocationConnectionEndUserAuthenticationDeleteCall<'a, C>
8046where
8047    C: common::Connector,
8048{
8049    /// Perform the operation you have build so far.
8050    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8051        use std::borrow::Cow;
8052        use std::io::{Read, Seek};
8053
8054        use common::{url::Params, ToParts};
8055        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8056
8057        let mut dd = common::DefaultDelegate;
8058        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8059        dlg.begin(common::MethodInfo {
8060            id: "connectors.projects.locations.connections.endUserAuthentications.delete",
8061            http_method: hyper::Method::DELETE,
8062        });
8063
8064        for &field in ["alt", "name"].iter() {
8065            if self._additional_params.contains_key(field) {
8066                dlg.finished(false);
8067                return Err(common::Error::FieldClash(field));
8068            }
8069        }
8070
8071        let mut params = Params::with_capacity(3 + self._additional_params.len());
8072        params.push("name", self._name);
8073
8074        params.extend(self._additional_params.iter());
8075
8076        params.push("alt", "json");
8077        let mut url = self.hub._base_url.clone() + "v1/{+name}";
8078        if self._scopes.is_empty() {
8079            self._scopes
8080                .insert(Scope::CloudPlatform.as_ref().to_string());
8081        }
8082
8083        #[allow(clippy::single_element_loop)]
8084        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8085            url = params.uri_replacement(url, param_name, find_this, true);
8086        }
8087        {
8088            let to_remove = ["name"];
8089            params.remove_params(&to_remove);
8090        }
8091
8092        let url = params.parse_with_url(&url);
8093
8094        loop {
8095            let token = match self
8096                .hub
8097                .auth
8098                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8099                .await
8100            {
8101                Ok(token) => token,
8102                Err(e) => match dlg.token(e) {
8103                    Ok(token) => token,
8104                    Err(e) => {
8105                        dlg.finished(false);
8106                        return Err(common::Error::MissingToken(e));
8107                    }
8108                },
8109            };
8110            let mut req_result = {
8111                let client = &self.hub.client;
8112                dlg.pre_request();
8113                let mut req_builder = hyper::Request::builder()
8114                    .method(hyper::Method::DELETE)
8115                    .uri(url.as_str())
8116                    .header(USER_AGENT, self.hub._user_agent.clone());
8117
8118                if let Some(token) = token.as_ref() {
8119                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8120                }
8121
8122                let request = req_builder
8123                    .header(CONTENT_LENGTH, 0_u64)
8124                    .body(common::to_body::<String>(None));
8125
8126                client.request(request.unwrap()).await
8127            };
8128
8129            match req_result {
8130                Err(err) => {
8131                    if let common::Retry::After(d) = dlg.http_error(&err) {
8132                        sleep(d).await;
8133                        continue;
8134                    }
8135                    dlg.finished(false);
8136                    return Err(common::Error::HttpError(err));
8137                }
8138                Ok(res) => {
8139                    let (mut parts, body) = res.into_parts();
8140                    let mut body = common::Body::new(body);
8141                    if !parts.status.is_success() {
8142                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8143                        let error = serde_json::from_str(&common::to_string(&bytes));
8144                        let response = common::to_response(parts, bytes.into());
8145
8146                        if let common::Retry::After(d) =
8147                            dlg.http_failure(&response, error.as_ref().ok())
8148                        {
8149                            sleep(d).await;
8150                            continue;
8151                        }
8152
8153                        dlg.finished(false);
8154
8155                        return Err(match error {
8156                            Ok(value) => common::Error::BadRequest(value),
8157                            _ => common::Error::Failure(response),
8158                        });
8159                    }
8160                    let response = {
8161                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8162                        let encoded = common::to_string(&bytes);
8163                        match serde_json::from_str(&encoded) {
8164                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8165                            Err(error) => {
8166                                dlg.response_json_decode_error(&encoded, &error);
8167                                return Err(common::Error::JsonDecodeError(
8168                                    encoded.to_string(),
8169                                    error,
8170                                ));
8171                            }
8172                        }
8173                    };
8174
8175                    dlg.finished(true);
8176                    return Ok(response);
8177                }
8178            }
8179        }
8180    }
8181
8182    /// Required. Resource name of the form: `projects/*/locations/*/connections/*/endUserAuthentication/*`
8183    ///
8184    /// Sets the *name* path property to the given value.
8185    ///
8186    /// Even though the property as already been set when instantiating this call,
8187    /// we provide this method for API completeness.
8188    pub fn name(
8189        mut self,
8190        new_value: &str,
8191    ) -> ProjectLocationConnectionEndUserAuthenticationDeleteCall<'a, C> {
8192        self._name = new_value.to_string();
8193        self
8194    }
8195    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8196    /// while executing the actual API request.
8197    ///
8198    /// ````text
8199    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8200    /// ````
8201    ///
8202    /// Sets the *delegate* property to the given value.
8203    pub fn delegate(
8204        mut self,
8205        new_value: &'a mut dyn common::Delegate,
8206    ) -> ProjectLocationConnectionEndUserAuthenticationDeleteCall<'a, C> {
8207        self._delegate = Some(new_value);
8208        self
8209    }
8210
8211    /// Set any additional parameter of the query string used in the request.
8212    /// It should be used to set parameters which are not yet available through their own
8213    /// setters.
8214    ///
8215    /// Please note that this method must not be used to set any of the known parameters
8216    /// which have their own setter method. If done anyway, the request will fail.
8217    ///
8218    /// # Additional Parameters
8219    ///
8220    /// * *$.xgafv* (query-string) - V1 error format.
8221    /// * *access_token* (query-string) - OAuth access token.
8222    /// * *alt* (query-string) - Data format for response.
8223    /// * *callback* (query-string) - JSONP
8224    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8225    /// * *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.
8226    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8227    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8228    /// * *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.
8229    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8230    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8231    pub fn param<T>(
8232        mut self,
8233        name: T,
8234        value: T,
8235    ) -> ProjectLocationConnectionEndUserAuthenticationDeleteCall<'a, C>
8236    where
8237        T: AsRef<str>,
8238    {
8239        self._additional_params
8240            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8241        self
8242    }
8243
8244    /// Identifies the authorization scope for the method you are building.
8245    ///
8246    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8247    /// [`Scope::CloudPlatform`].
8248    ///
8249    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8250    /// tokens for more than one scope.
8251    ///
8252    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8253    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8254    /// sufficient, a read-write scope will do as well.
8255    pub fn add_scope<St>(
8256        mut self,
8257        scope: St,
8258    ) -> ProjectLocationConnectionEndUserAuthenticationDeleteCall<'a, C>
8259    where
8260        St: AsRef<str>,
8261    {
8262        self._scopes.insert(String::from(scope.as_ref()));
8263        self
8264    }
8265    /// Identifies the authorization scope(s) for the method you are building.
8266    ///
8267    /// See [`Self::add_scope()`] for details.
8268    pub fn add_scopes<I, St>(
8269        mut self,
8270        scopes: I,
8271    ) -> ProjectLocationConnectionEndUserAuthenticationDeleteCall<'a, C>
8272    where
8273        I: IntoIterator<Item = St>,
8274        St: AsRef<str>,
8275    {
8276        self._scopes
8277            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8278        self
8279    }
8280
8281    /// Removes all scopes, and no default scope will be used either.
8282    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8283    /// for details).
8284    pub fn clear_scopes(
8285        mut self,
8286    ) -> ProjectLocationConnectionEndUserAuthenticationDeleteCall<'a, C> {
8287        self._scopes.clear();
8288        self
8289    }
8290}
8291
8292/// Gets details of a single EndUserAuthentication.
8293///
8294/// A builder for the *locations.connections.endUserAuthentications.get* method supported by a *project* resource.
8295/// It is not used directly, but through a [`ProjectMethods`] instance.
8296///
8297/// # Example
8298///
8299/// Instantiate a resource method builder
8300///
8301/// ```test_harness,no_run
8302/// # extern crate hyper;
8303/// # extern crate hyper_rustls;
8304/// # extern crate google_connectors1 as connectors1;
8305/// # async fn dox() {
8306/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8307///
8308/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8309/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8310/// #     .with_native_roots()
8311/// #     .unwrap()
8312/// #     .https_only()
8313/// #     .enable_http2()
8314/// #     .build();
8315///
8316/// # let executor = hyper_util::rt::TokioExecutor::new();
8317/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8318/// #     secret,
8319/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8320/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8321/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8322/// #     ),
8323/// # ).build().await.unwrap();
8324///
8325/// # let client = hyper_util::client::legacy::Client::builder(
8326/// #     hyper_util::rt::TokioExecutor::new()
8327/// # )
8328/// # .build(
8329/// #     hyper_rustls::HttpsConnectorBuilder::new()
8330/// #         .with_native_roots()
8331/// #         .unwrap()
8332/// #         .https_or_http()
8333/// #         .enable_http2()
8334/// #         .build()
8335/// # );
8336/// # let mut hub = Connectors::new(client, auth);
8337/// // You can configure optional parameters by calling the respective setters at will, and
8338/// // execute the final call using `doit()`.
8339/// // Values shown here are possibly random and not representative !
8340/// let result = hub.projects().locations_connections_end_user_authentications_get("name")
8341///              .view("ut")
8342///              .doit().await;
8343/// # }
8344/// ```
8345pub struct ProjectLocationConnectionEndUserAuthenticationGetCall<'a, C>
8346where
8347    C: 'a,
8348{
8349    hub: &'a Connectors<C>,
8350    _name: String,
8351    _view: Option<String>,
8352    _delegate: Option<&'a mut dyn common::Delegate>,
8353    _additional_params: HashMap<String, String>,
8354    _scopes: BTreeSet<String>,
8355}
8356
8357impl<'a, C> common::CallBuilder for ProjectLocationConnectionEndUserAuthenticationGetCall<'a, C> {}
8358
8359impl<'a, C> ProjectLocationConnectionEndUserAuthenticationGetCall<'a, C>
8360where
8361    C: common::Connector,
8362{
8363    /// Perform the operation you have build so far.
8364    pub async fn doit(mut self) -> common::Result<(common::Response, EndUserAuthentication)> {
8365        use std::borrow::Cow;
8366        use std::io::{Read, Seek};
8367
8368        use common::{url::Params, ToParts};
8369        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8370
8371        let mut dd = common::DefaultDelegate;
8372        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8373        dlg.begin(common::MethodInfo {
8374            id: "connectors.projects.locations.connections.endUserAuthentications.get",
8375            http_method: hyper::Method::GET,
8376        });
8377
8378        for &field in ["alt", "name", "view"].iter() {
8379            if self._additional_params.contains_key(field) {
8380                dlg.finished(false);
8381                return Err(common::Error::FieldClash(field));
8382            }
8383        }
8384
8385        let mut params = Params::with_capacity(4 + self._additional_params.len());
8386        params.push("name", self._name);
8387        if let Some(value) = self._view.as_ref() {
8388            params.push("view", value);
8389        }
8390
8391        params.extend(self._additional_params.iter());
8392
8393        params.push("alt", "json");
8394        let mut url = self.hub._base_url.clone() + "v1/{+name}";
8395        if self._scopes.is_empty() {
8396            self._scopes
8397                .insert(Scope::CloudPlatform.as_ref().to_string());
8398        }
8399
8400        #[allow(clippy::single_element_loop)]
8401        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8402            url = params.uri_replacement(url, param_name, find_this, true);
8403        }
8404        {
8405            let to_remove = ["name"];
8406            params.remove_params(&to_remove);
8407        }
8408
8409        let url = params.parse_with_url(&url);
8410
8411        loop {
8412            let token = match self
8413                .hub
8414                .auth
8415                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8416                .await
8417            {
8418                Ok(token) => token,
8419                Err(e) => match dlg.token(e) {
8420                    Ok(token) => token,
8421                    Err(e) => {
8422                        dlg.finished(false);
8423                        return Err(common::Error::MissingToken(e));
8424                    }
8425                },
8426            };
8427            let mut req_result = {
8428                let client = &self.hub.client;
8429                dlg.pre_request();
8430                let mut req_builder = hyper::Request::builder()
8431                    .method(hyper::Method::GET)
8432                    .uri(url.as_str())
8433                    .header(USER_AGENT, self.hub._user_agent.clone());
8434
8435                if let Some(token) = token.as_ref() {
8436                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8437                }
8438
8439                let request = req_builder
8440                    .header(CONTENT_LENGTH, 0_u64)
8441                    .body(common::to_body::<String>(None));
8442
8443                client.request(request.unwrap()).await
8444            };
8445
8446            match req_result {
8447                Err(err) => {
8448                    if let common::Retry::After(d) = dlg.http_error(&err) {
8449                        sleep(d).await;
8450                        continue;
8451                    }
8452                    dlg.finished(false);
8453                    return Err(common::Error::HttpError(err));
8454                }
8455                Ok(res) => {
8456                    let (mut parts, body) = res.into_parts();
8457                    let mut body = common::Body::new(body);
8458                    if !parts.status.is_success() {
8459                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8460                        let error = serde_json::from_str(&common::to_string(&bytes));
8461                        let response = common::to_response(parts, bytes.into());
8462
8463                        if let common::Retry::After(d) =
8464                            dlg.http_failure(&response, error.as_ref().ok())
8465                        {
8466                            sleep(d).await;
8467                            continue;
8468                        }
8469
8470                        dlg.finished(false);
8471
8472                        return Err(match error {
8473                            Ok(value) => common::Error::BadRequest(value),
8474                            _ => common::Error::Failure(response),
8475                        });
8476                    }
8477                    let response = {
8478                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8479                        let encoded = common::to_string(&bytes);
8480                        match serde_json::from_str(&encoded) {
8481                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8482                            Err(error) => {
8483                                dlg.response_json_decode_error(&encoded, &error);
8484                                return Err(common::Error::JsonDecodeError(
8485                                    encoded.to_string(),
8486                                    error,
8487                                ));
8488                            }
8489                        }
8490                    };
8491
8492                    dlg.finished(true);
8493                    return Ok(response);
8494                }
8495            }
8496        }
8497    }
8498
8499    /// Required. Resource name of the form: `projects/*/locations/*/connections/*/EndUserAuthentications/*`
8500    ///
8501    /// Sets the *name* path property to the given value.
8502    ///
8503    /// Even though the property as already been set when instantiating this call,
8504    /// we provide this method for API completeness.
8505    pub fn name(
8506        mut self,
8507        new_value: &str,
8508    ) -> ProjectLocationConnectionEndUserAuthenticationGetCall<'a, C> {
8509        self._name = new_value.to_string();
8510        self
8511    }
8512    /// Optional. View of the EndUserAuthentication to return.
8513    ///
8514    /// Sets the *view* query property to the given value.
8515    pub fn view(
8516        mut self,
8517        new_value: &str,
8518    ) -> ProjectLocationConnectionEndUserAuthenticationGetCall<'a, C> {
8519        self._view = Some(new_value.to_string());
8520        self
8521    }
8522    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8523    /// while executing the actual API request.
8524    ///
8525    /// ````text
8526    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8527    /// ````
8528    ///
8529    /// Sets the *delegate* property to the given value.
8530    pub fn delegate(
8531        mut self,
8532        new_value: &'a mut dyn common::Delegate,
8533    ) -> ProjectLocationConnectionEndUserAuthenticationGetCall<'a, C> {
8534        self._delegate = Some(new_value);
8535        self
8536    }
8537
8538    /// Set any additional parameter of the query string used in the request.
8539    /// It should be used to set parameters which are not yet available through their own
8540    /// setters.
8541    ///
8542    /// Please note that this method must not be used to set any of the known parameters
8543    /// which have their own setter method. If done anyway, the request will fail.
8544    ///
8545    /// # Additional Parameters
8546    ///
8547    /// * *$.xgafv* (query-string) - V1 error format.
8548    /// * *access_token* (query-string) - OAuth access token.
8549    /// * *alt* (query-string) - Data format for response.
8550    /// * *callback* (query-string) - JSONP
8551    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8552    /// * *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.
8553    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8554    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8555    /// * *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.
8556    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8557    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8558    pub fn param<T>(
8559        mut self,
8560        name: T,
8561        value: T,
8562    ) -> ProjectLocationConnectionEndUserAuthenticationGetCall<'a, C>
8563    where
8564        T: AsRef<str>,
8565    {
8566        self._additional_params
8567            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8568        self
8569    }
8570
8571    /// Identifies the authorization scope for the method you are building.
8572    ///
8573    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8574    /// [`Scope::CloudPlatform`].
8575    ///
8576    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8577    /// tokens for more than one scope.
8578    ///
8579    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8580    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8581    /// sufficient, a read-write scope will do as well.
8582    pub fn add_scope<St>(
8583        mut self,
8584        scope: St,
8585    ) -> ProjectLocationConnectionEndUserAuthenticationGetCall<'a, C>
8586    where
8587        St: AsRef<str>,
8588    {
8589        self._scopes.insert(String::from(scope.as_ref()));
8590        self
8591    }
8592    /// Identifies the authorization scope(s) for the method you are building.
8593    ///
8594    /// See [`Self::add_scope()`] for details.
8595    pub fn add_scopes<I, St>(
8596        mut self,
8597        scopes: I,
8598    ) -> ProjectLocationConnectionEndUserAuthenticationGetCall<'a, C>
8599    where
8600        I: IntoIterator<Item = St>,
8601        St: AsRef<str>,
8602    {
8603        self._scopes
8604            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8605        self
8606    }
8607
8608    /// Removes all scopes, and no default scope will be used either.
8609    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8610    /// for details).
8611    pub fn clear_scopes(mut self) -> ProjectLocationConnectionEndUserAuthenticationGetCall<'a, C> {
8612        self._scopes.clear();
8613        self
8614    }
8615}
8616
8617/// List EndUserAuthentications in a given project,location and connection.
8618///
8619/// A builder for the *locations.connections.endUserAuthentications.list* method supported by a *project* resource.
8620/// It is not used directly, but through a [`ProjectMethods`] instance.
8621///
8622/// # Example
8623///
8624/// Instantiate a resource method builder
8625///
8626/// ```test_harness,no_run
8627/// # extern crate hyper;
8628/// # extern crate hyper_rustls;
8629/// # extern crate google_connectors1 as connectors1;
8630/// # async fn dox() {
8631/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8632///
8633/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8634/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8635/// #     .with_native_roots()
8636/// #     .unwrap()
8637/// #     .https_only()
8638/// #     .enable_http2()
8639/// #     .build();
8640///
8641/// # let executor = hyper_util::rt::TokioExecutor::new();
8642/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8643/// #     secret,
8644/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8645/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8646/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8647/// #     ),
8648/// # ).build().await.unwrap();
8649///
8650/// # let client = hyper_util::client::legacy::Client::builder(
8651/// #     hyper_util::rt::TokioExecutor::new()
8652/// # )
8653/// # .build(
8654/// #     hyper_rustls::HttpsConnectorBuilder::new()
8655/// #         .with_native_roots()
8656/// #         .unwrap()
8657/// #         .https_or_http()
8658/// #         .enable_http2()
8659/// #         .build()
8660/// # );
8661/// # let mut hub = Connectors::new(client, auth);
8662/// // You can configure optional parameters by calling the respective setters at will, and
8663/// // execute the final call using `doit()`.
8664/// // Values shown here are possibly random and not representative !
8665/// let result = hub.projects().locations_connections_end_user_authentications_list("parent")
8666///              .page_token("rebum.")
8667///              .page_size(-57)
8668///              .order_by("ipsum")
8669///              .filter("ipsum")
8670///              .doit().await;
8671/// # }
8672/// ```
8673pub struct ProjectLocationConnectionEndUserAuthenticationListCall<'a, C>
8674where
8675    C: 'a,
8676{
8677    hub: &'a Connectors<C>,
8678    _parent: String,
8679    _page_token: Option<String>,
8680    _page_size: Option<i32>,
8681    _order_by: Option<String>,
8682    _filter: Option<String>,
8683    _delegate: Option<&'a mut dyn common::Delegate>,
8684    _additional_params: HashMap<String, String>,
8685    _scopes: BTreeSet<String>,
8686}
8687
8688impl<'a, C> common::CallBuilder for ProjectLocationConnectionEndUserAuthenticationListCall<'a, C> {}
8689
8690impl<'a, C> ProjectLocationConnectionEndUserAuthenticationListCall<'a, C>
8691where
8692    C: common::Connector,
8693{
8694    /// Perform the operation you have build so far.
8695    pub async fn doit(
8696        mut self,
8697    ) -> common::Result<(common::Response, ListEndUserAuthenticationsResponse)> {
8698        use std::borrow::Cow;
8699        use std::io::{Read, Seek};
8700
8701        use common::{url::Params, ToParts};
8702        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8703
8704        let mut dd = common::DefaultDelegate;
8705        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8706        dlg.begin(common::MethodInfo {
8707            id: "connectors.projects.locations.connections.endUserAuthentications.list",
8708            http_method: hyper::Method::GET,
8709        });
8710
8711        for &field in [
8712            "alt",
8713            "parent",
8714            "pageToken",
8715            "pageSize",
8716            "orderBy",
8717            "filter",
8718        ]
8719        .iter()
8720        {
8721            if self._additional_params.contains_key(field) {
8722                dlg.finished(false);
8723                return Err(common::Error::FieldClash(field));
8724            }
8725        }
8726
8727        let mut params = Params::with_capacity(7 + self._additional_params.len());
8728        params.push("parent", self._parent);
8729        if let Some(value) = self._page_token.as_ref() {
8730            params.push("pageToken", value);
8731        }
8732        if let Some(value) = self._page_size.as_ref() {
8733            params.push("pageSize", value.to_string());
8734        }
8735        if let Some(value) = self._order_by.as_ref() {
8736            params.push("orderBy", value);
8737        }
8738        if let Some(value) = self._filter.as_ref() {
8739            params.push("filter", value);
8740        }
8741
8742        params.extend(self._additional_params.iter());
8743
8744        params.push("alt", "json");
8745        let mut url = self.hub._base_url.clone() + "v1/{+parent}/endUserAuthentications";
8746        if self._scopes.is_empty() {
8747            self._scopes
8748                .insert(Scope::CloudPlatform.as_ref().to_string());
8749        }
8750
8751        #[allow(clippy::single_element_loop)]
8752        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8753            url = params.uri_replacement(url, param_name, find_this, true);
8754        }
8755        {
8756            let to_remove = ["parent"];
8757            params.remove_params(&to_remove);
8758        }
8759
8760        let url = params.parse_with_url(&url);
8761
8762        loop {
8763            let token = match self
8764                .hub
8765                .auth
8766                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8767                .await
8768            {
8769                Ok(token) => token,
8770                Err(e) => match dlg.token(e) {
8771                    Ok(token) => token,
8772                    Err(e) => {
8773                        dlg.finished(false);
8774                        return Err(common::Error::MissingToken(e));
8775                    }
8776                },
8777            };
8778            let mut req_result = {
8779                let client = &self.hub.client;
8780                dlg.pre_request();
8781                let mut req_builder = hyper::Request::builder()
8782                    .method(hyper::Method::GET)
8783                    .uri(url.as_str())
8784                    .header(USER_AGENT, self.hub._user_agent.clone());
8785
8786                if let Some(token) = token.as_ref() {
8787                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8788                }
8789
8790                let request = req_builder
8791                    .header(CONTENT_LENGTH, 0_u64)
8792                    .body(common::to_body::<String>(None));
8793
8794                client.request(request.unwrap()).await
8795            };
8796
8797            match req_result {
8798                Err(err) => {
8799                    if let common::Retry::After(d) = dlg.http_error(&err) {
8800                        sleep(d).await;
8801                        continue;
8802                    }
8803                    dlg.finished(false);
8804                    return Err(common::Error::HttpError(err));
8805                }
8806                Ok(res) => {
8807                    let (mut parts, body) = res.into_parts();
8808                    let mut body = common::Body::new(body);
8809                    if !parts.status.is_success() {
8810                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8811                        let error = serde_json::from_str(&common::to_string(&bytes));
8812                        let response = common::to_response(parts, bytes.into());
8813
8814                        if let common::Retry::After(d) =
8815                            dlg.http_failure(&response, error.as_ref().ok())
8816                        {
8817                            sleep(d).await;
8818                            continue;
8819                        }
8820
8821                        dlg.finished(false);
8822
8823                        return Err(match error {
8824                            Ok(value) => common::Error::BadRequest(value),
8825                            _ => common::Error::Failure(response),
8826                        });
8827                    }
8828                    let response = {
8829                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8830                        let encoded = common::to_string(&bytes);
8831                        match serde_json::from_str(&encoded) {
8832                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8833                            Err(error) => {
8834                                dlg.response_json_decode_error(&encoded, &error);
8835                                return Err(common::Error::JsonDecodeError(
8836                                    encoded.to_string(),
8837                                    error,
8838                                ));
8839                            }
8840                        }
8841                    };
8842
8843                    dlg.finished(true);
8844                    return Ok(response);
8845                }
8846            }
8847        }
8848    }
8849
8850    /// Required. Parent resource of the EndUserAuthentication, of the form: `projects/*/locations/*/connections/*`
8851    ///
8852    /// Sets the *parent* path property to the given value.
8853    ///
8854    /// Even though the property as already been set when instantiating this call,
8855    /// we provide this method for API completeness.
8856    pub fn parent(
8857        mut self,
8858        new_value: &str,
8859    ) -> ProjectLocationConnectionEndUserAuthenticationListCall<'a, C> {
8860        self._parent = new_value.to_string();
8861        self
8862    }
8863    /// Page token.
8864    ///
8865    /// Sets the *page token* query property to the given value.
8866    pub fn page_token(
8867        mut self,
8868        new_value: &str,
8869    ) -> ProjectLocationConnectionEndUserAuthenticationListCall<'a, C> {
8870        self._page_token = Some(new_value.to_string());
8871        self
8872    }
8873    /// Page size.
8874    ///
8875    /// Sets the *page size* query property to the given value.
8876    pub fn page_size(
8877        mut self,
8878        new_value: i32,
8879    ) -> ProjectLocationConnectionEndUserAuthenticationListCall<'a, C> {
8880        self._page_size = Some(new_value);
8881        self
8882    }
8883    /// Order by parameters.
8884    ///
8885    /// Sets the *order by* query property to the given value.
8886    pub fn order_by(
8887        mut self,
8888        new_value: &str,
8889    ) -> ProjectLocationConnectionEndUserAuthenticationListCall<'a, C> {
8890        self._order_by = Some(new_value.to_string());
8891        self
8892    }
8893    /// Filter.
8894    ///
8895    /// Sets the *filter* query property to the given value.
8896    pub fn filter(
8897        mut self,
8898        new_value: &str,
8899    ) -> ProjectLocationConnectionEndUserAuthenticationListCall<'a, C> {
8900        self._filter = Some(new_value.to_string());
8901        self
8902    }
8903    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8904    /// while executing the actual API request.
8905    ///
8906    /// ````text
8907    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8908    /// ````
8909    ///
8910    /// Sets the *delegate* property to the given value.
8911    pub fn delegate(
8912        mut self,
8913        new_value: &'a mut dyn common::Delegate,
8914    ) -> ProjectLocationConnectionEndUserAuthenticationListCall<'a, C> {
8915        self._delegate = Some(new_value);
8916        self
8917    }
8918
8919    /// Set any additional parameter of the query string used in the request.
8920    /// It should be used to set parameters which are not yet available through their own
8921    /// setters.
8922    ///
8923    /// Please note that this method must not be used to set any of the known parameters
8924    /// which have their own setter method. If done anyway, the request will fail.
8925    ///
8926    /// # Additional Parameters
8927    ///
8928    /// * *$.xgafv* (query-string) - V1 error format.
8929    /// * *access_token* (query-string) - OAuth access token.
8930    /// * *alt* (query-string) - Data format for response.
8931    /// * *callback* (query-string) - JSONP
8932    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8933    /// * *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.
8934    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8935    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8936    /// * *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.
8937    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8938    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8939    pub fn param<T>(
8940        mut self,
8941        name: T,
8942        value: T,
8943    ) -> ProjectLocationConnectionEndUserAuthenticationListCall<'a, C>
8944    where
8945        T: AsRef<str>,
8946    {
8947        self._additional_params
8948            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8949        self
8950    }
8951
8952    /// Identifies the authorization scope for the method you are building.
8953    ///
8954    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8955    /// [`Scope::CloudPlatform`].
8956    ///
8957    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8958    /// tokens for more than one scope.
8959    ///
8960    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8961    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8962    /// sufficient, a read-write scope will do as well.
8963    pub fn add_scope<St>(
8964        mut self,
8965        scope: St,
8966    ) -> ProjectLocationConnectionEndUserAuthenticationListCall<'a, C>
8967    where
8968        St: AsRef<str>,
8969    {
8970        self._scopes.insert(String::from(scope.as_ref()));
8971        self
8972    }
8973    /// Identifies the authorization scope(s) for the method you are building.
8974    ///
8975    /// See [`Self::add_scope()`] for details.
8976    pub fn add_scopes<I, St>(
8977        mut self,
8978        scopes: I,
8979    ) -> ProjectLocationConnectionEndUserAuthenticationListCall<'a, C>
8980    where
8981        I: IntoIterator<Item = St>,
8982        St: AsRef<str>,
8983    {
8984        self._scopes
8985            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8986        self
8987    }
8988
8989    /// Removes all scopes, and no default scope will be used either.
8990    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8991    /// for details).
8992    pub fn clear_scopes(mut self) -> ProjectLocationConnectionEndUserAuthenticationListCall<'a, C> {
8993        self._scopes.clear();
8994        self
8995    }
8996}
8997
8998/// Updates the parameters of a single EndUserAuthentication.
8999///
9000/// A builder for the *locations.connections.endUserAuthentications.patch* method supported by a *project* resource.
9001/// It is not used directly, but through a [`ProjectMethods`] instance.
9002///
9003/// # Example
9004///
9005/// Instantiate a resource method builder
9006///
9007/// ```test_harness,no_run
9008/// # extern crate hyper;
9009/// # extern crate hyper_rustls;
9010/// # extern crate google_connectors1 as connectors1;
9011/// use connectors1::api::EndUserAuthentication;
9012/// # async fn dox() {
9013/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9014///
9015/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9016/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9017/// #     .with_native_roots()
9018/// #     .unwrap()
9019/// #     .https_only()
9020/// #     .enable_http2()
9021/// #     .build();
9022///
9023/// # let executor = hyper_util::rt::TokioExecutor::new();
9024/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9025/// #     secret,
9026/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9027/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9028/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9029/// #     ),
9030/// # ).build().await.unwrap();
9031///
9032/// # let client = hyper_util::client::legacy::Client::builder(
9033/// #     hyper_util::rt::TokioExecutor::new()
9034/// # )
9035/// # .build(
9036/// #     hyper_rustls::HttpsConnectorBuilder::new()
9037/// #         .with_native_roots()
9038/// #         .unwrap()
9039/// #         .https_or_http()
9040/// #         .enable_http2()
9041/// #         .build()
9042/// # );
9043/// # let mut hub = Connectors::new(client, auth);
9044/// // As the method needs a request, you would usually fill it with the desired information
9045/// // into the respective structure. Some of the parts shown here might not be applicable !
9046/// // Values shown here are possibly random and not representative !
9047/// let mut req = EndUserAuthentication::default();
9048///
9049/// // You can configure optional parameters by calling the respective setters at will, and
9050/// // execute the final call using `doit()`.
9051/// // Values shown here are possibly random and not representative !
9052/// let result = hub.projects().locations_connections_end_user_authentications_patch(req, "name")
9053///              .update_mask(FieldMask::new::<&str>(&[]))
9054///              .doit().await;
9055/// # }
9056/// ```
9057pub struct ProjectLocationConnectionEndUserAuthenticationPatchCall<'a, C>
9058where
9059    C: 'a,
9060{
9061    hub: &'a Connectors<C>,
9062    _request: EndUserAuthentication,
9063    _name: String,
9064    _update_mask: Option<common::FieldMask>,
9065    _delegate: Option<&'a mut dyn common::Delegate>,
9066    _additional_params: HashMap<String, String>,
9067    _scopes: BTreeSet<String>,
9068}
9069
9070impl<'a, C> common::CallBuilder for ProjectLocationConnectionEndUserAuthenticationPatchCall<'a, C> {}
9071
9072impl<'a, C> ProjectLocationConnectionEndUserAuthenticationPatchCall<'a, C>
9073where
9074    C: common::Connector,
9075{
9076    /// Perform the operation you have build so far.
9077    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
9078        use std::borrow::Cow;
9079        use std::io::{Read, Seek};
9080
9081        use common::{url::Params, ToParts};
9082        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9083
9084        let mut dd = common::DefaultDelegate;
9085        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9086        dlg.begin(common::MethodInfo {
9087            id: "connectors.projects.locations.connections.endUserAuthentications.patch",
9088            http_method: hyper::Method::PATCH,
9089        });
9090
9091        for &field in ["alt", "name", "updateMask"].iter() {
9092            if self._additional_params.contains_key(field) {
9093                dlg.finished(false);
9094                return Err(common::Error::FieldClash(field));
9095            }
9096        }
9097
9098        let mut params = Params::with_capacity(5 + self._additional_params.len());
9099        params.push("name", self._name);
9100        if let Some(value) = self._update_mask.as_ref() {
9101            params.push("updateMask", value.to_string());
9102        }
9103
9104        params.extend(self._additional_params.iter());
9105
9106        params.push("alt", "json");
9107        let mut url = self.hub._base_url.clone() + "v1/{+name}";
9108        if self._scopes.is_empty() {
9109            self._scopes
9110                .insert(Scope::CloudPlatform.as_ref().to_string());
9111        }
9112
9113        #[allow(clippy::single_element_loop)]
9114        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9115            url = params.uri_replacement(url, param_name, find_this, true);
9116        }
9117        {
9118            let to_remove = ["name"];
9119            params.remove_params(&to_remove);
9120        }
9121
9122        let url = params.parse_with_url(&url);
9123
9124        let mut json_mime_type = mime::APPLICATION_JSON;
9125        let mut request_value_reader = {
9126            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9127            common::remove_json_null_values(&mut value);
9128            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9129            serde_json::to_writer(&mut dst, &value).unwrap();
9130            dst
9131        };
9132        let request_size = request_value_reader
9133            .seek(std::io::SeekFrom::End(0))
9134            .unwrap();
9135        request_value_reader
9136            .seek(std::io::SeekFrom::Start(0))
9137            .unwrap();
9138
9139        loop {
9140            let token = match self
9141                .hub
9142                .auth
9143                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9144                .await
9145            {
9146                Ok(token) => token,
9147                Err(e) => match dlg.token(e) {
9148                    Ok(token) => token,
9149                    Err(e) => {
9150                        dlg.finished(false);
9151                        return Err(common::Error::MissingToken(e));
9152                    }
9153                },
9154            };
9155            request_value_reader
9156                .seek(std::io::SeekFrom::Start(0))
9157                .unwrap();
9158            let mut req_result = {
9159                let client = &self.hub.client;
9160                dlg.pre_request();
9161                let mut req_builder = hyper::Request::builder()
9162                    .method(hyper::Method::PATCH)
9163                    .uri(url.as_str())
9164                    .header(USER_AGENT, self.hub._user_agent.clone());
9165
9166                if let Some(token) = token.as_ref() {
9167                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9168                }
9169
9170                let request = req_builder
9171                    .header(CONTENT_TYPE, json_mime_type.to_string())
9172                    .header(CONTENT_LENGTH, request_size as u64)
9173                    .body(common::to_body(
9174                        request_value_reader.get_ref().clone().into(),
9175                    ));
9176
9177                client.request(request.unwrap()).await
9178            };
9179
9180            match req_result {
9181                Err(err) => {
9182                    if let common::Retry::After(d) = dlg.http_error(&err) {
9183                        sleep(d).await;
9184                        continue;
9185                    }
9186                    dlg.finished(false);
9187                    return Err(common::Error::HttpError(err));
9188                }
9189                Ok(res) => {
9190                    let (mut parts, body) = res.into_parts();
9191                    let mut body = common::Body::new(body);
9192                    if !parts.status.is_success() {
9193                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9194                        let error = serde_json::from_str(&common::to_string(&bytes));
9195                        let response = common::to_response(parts, bytes.into());
9196
9197                        if let common::Retry::After(d) =
9198                            dlg.http_failure(&response, error.as_ref().ok())
9199                        {
9200                            sleep(d).await;
9201                            continue;
9202                        }
9203
9204                        dlg.finished(false);
9205
9206                        return Err(match error {
9207                            Ok(value) => common::Error::BadRequest(value),
9208                            _ => common::Error::Failure(response),
9209                        });
9210                    }
9211                    let response = {
9212                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9213                        let encoded = common::to_string(&bytes);
9214                        match serde_json::from_str(&encoded) {
9215                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9216                            Err(error) => {
9217                                dlg.response_json_decode_error(&encoded, &error);
9218                                return Err(common::Error::JsonDecodeError(
9219                                    encoded.to_string(),
9220                                    error,
9221                                ));
9222                            }
9223                        }
9224                    };
9225
9226                    dlg.finished(true);
9227                    return Ok(response);
9228                }
9229            }
9230        }
9231    }
9232
9233    ///
9234    /// Sets the *request* property to the given value.
9235    ///
9236    /// Even though the property as already been set when instantiating this call,
9237    /// we provide this method for API completeness.
9238    pub fn request(
9239        mut self,
9240        new_value: EndUserAuthentication,
9241    ) -> ProjectLocationConnectionEndUserAuthenticationPatchCall<'a, C> {
9242        self._request = new_value;
9243        self
9244    }
9245    /// Required. Identifier. Resource name of the EndUserAuthentication. Format: projects/{project}/locations/{location}/connections/{connection}/endUserAuthentications/{end_user_authentication}
9246    ///
9247    /// Sets the *name* path property to the given value.
9248    ///
9249    /// Even though the property as already been set when instantiating this call,
9250    /// we provide this method for API completeness.
9251    pub fn name(
9252        mut self,
9253        new_value: &str,
9254    ) -> ProjectLocationConnectionEndUserAuthenticationPatchCall<'a, C> {
9255        self._name = new_value.to_string();
9256        self
9257    }
9258    /// Required. The list of fields to update. A field will be overwritten if it is in the mask. You can modify only the fields listed below. To update the EndUserAuthentication details: * `notify_endpoint_destination`
9259    ///
9260    /// Sets the *update mask* query property to the given value.
9261    pub fn update_mask(
9262        mut self,
9263        new_value: common::FieldMask,
9264    ) -> ProjectLocationConnectionEndUserAuthenticationPatchCall<'a, C> {
9265        self._update_mask = Some(new_value);
9266        self
9267    }
9268    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9269    /// while executing the actual API request.
9270    ///
9271    /// ````text
9272    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9273    /// ````
9274    ///
9275    /// Sets the *delegate* property to the given value.
9276    pub fn delegate(
9277        mut self,
9278        new_value: &'a mut dyn common::Delegate,
9279    ) -> ProjectLocationConnectionEndUserAuthenticationPatchCall<'a, C> {
9280        self._delegate = Some(new_value);
9281        self
9282    }
9283
9284    /// Set any additional parameter of the query string used in the request.
9285    /// It should be used to set parameters which are not yet available through their own
9286    /// setters.
9287    ///
9288    /// Please note that this method must not be used to set any of the known parameters
9289    /// which have their own setter method. If done anyway, the request will fail.
9290    ///
9291    /// # Additional Parameters
9292    ///
9293    /// * *$.xgafv* (query-string) - V1 error format.
9294    /// * *access_token* (query-string) - OAuth access token.
9295    /// * *alt* (query-string) - Data format for response.
9296    /// * *callback* (query-string) - JSONP
9297    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9298    /// * *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.
9299    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9300    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9301    /// * *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.
9302    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9303    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9304    pub fn param<T>(
9305        mut self,
9306        name: T,
9307        value: T,
9308    ) -> ProjectLocationConnectionEndUserAuthenticationPatchCall<'a, C>
9309    where
9310        T: AsRef<str>,
9311    {
9312        self._additional_params
9313            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9314        self
9315    }
9316
9317    /// Identifies the authorization scope for the method you are building.
9318    ///
9319    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9320    /// [`Scope::CloudPlatform`].
9321    ///
9322    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9323    /// tokens for more than one scope.
9324    ///
9325    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9326    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9327    /// sufficient, a read-write scope will do as well.
9328    pub fn add_scope<St>(
9329        mut self,
9330        scope: St,
9331    ) -> ProjectLocationConnectionEndUserAuthenticationPatchCall<'a, C>
9332    where
9333        St: AsRef<str>,
9334    {
9335        self._scopes.insert(String::from(scope.as_ref()));
9336        self
9337    }
9338    /// Identifies the authorization scope(s) for the method you are building.
9339    ///
9340    /// See [`Self::add_scope()`] for details.
9341    pub fn add_scopes<I, St>(
9342        mut self,
9343        scopes: I,
9344    ) -> ProjectLocationConnectionEndUserAuthenticationPatchCall<'a, C>
9345    where
9346        I: IntoIterator<Item = St>,
9347        St: AsRef<str>,
9348    {
9349        self._scopes
9350            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9351        self
9352    }
9353
9354    /// Removes all scopes, and no default scope will be used either.
9355    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9356    /// for details).
9357    pub fn clear_scopes(
9358        mut self,
9359    ) -> ProjectLocationConnectionEndUserAuthenticationPatchCall<'a, C> {
9360        self._scopes.clear();
9361        self
9362    }
9363}
9364
9365/// Creates a new EventSubscription in a given project,location and connection.
9366///
9367/// A builder for the *locations.connections.eventSubscriptions.create* method supported by a *project* resource.
9368/// It is not used directly, but through a [`ProjectMethods`] instance.
9369///
9370/// # Example
9371///
9372/// Instantiate a resource method builder
9373///
9374/// ```test_harness,no_run
9375/// # extern crate hyper;
9376/// # extern crate hyper_rustls;
9377/// # extern crate google_connectors1 as connectors1;
9378/// use connectors1::api::EventSubscription;
9379/// # async fn dox() {
9380/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9381///
9382/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9383/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9384/// #     .with_native_roots()
9385/// #     .unwrap()
9386/// #     .https_only()
9387/// #     .enable_http2()
9388/// #     .build();
9389///
9390/// # let executor = hyper_util::rt::TokioExecutor::new();
9391/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9392/// #     secret,
9393/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9394/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9395/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9396/// #     ),
9397/// # ).build().await.unwrap();
9398///
9399/// # let client = hyper_util::client::legacy::Client::builder(
9400/// #     hyper_util::rt::TokioExecutor::new()
9401/// # )
9402/// # .build(
9403/// #     hyper_rustls::HttpsConnectorBuilder::new()
9404/// #         .with_native_roots()
9405/// #         .unwrap()
9406/// #         .https_or_http()
9407/// #         .enable_http2()
9408/// #         .build()
9409/// # );
9410/// # let mut hub = Connectors::new(client, auth);
9411/// // As the method needs a request, you would usually fill it with the desired information
9412/// // into the respective structure. Some of the parts shown here might not be applicable !
9413/// // Values shown here are possibly random and not representative !
9414/// let mut req = EventSubscription::default();
9415///
9416/// // You can configure optional parameters by calling the respective setters at will, and
9417/// // execute the final call using `doit()`.
9418/// // Values shown here are possibly random and not representative !
9419/// let result = hub.projects().locations_connections_event_subscriptions_create(req, "parent")
9420///              .event_subscription_id("ea")
9421///              .doit().await;
9422/// # }
9423/// ```
9424pub struct ProjectLocationConnectionEventSubscriptionCreateCall<'a, C>
9425where
9426    C: 'a,
9427{
9428    hub: &'a Connectors<C>,
9429    _request: EventSubscription,
9430    _parent: String,
9431    _event_subscription_id: Option<String>,
9432    _delegate: Option<&'a mut dyn common::Delegate>,
9433    _additional_params: HashMap<String, String>,
9434    _scopes: BTreeSet<String>,
9435}
9436
9437impl<'a, C> common::CallBuilder for ProjectLocationConnectionEventSubscriptionCreateCall<'a, C> {}
9438
9439impl<'a, C> ProjectLocationConnectionEventSubscriptionCreateCall<'a, C>
9440where
9441    C: common::Connector,
9442{
9443    /// Perform the operation you have build so far.
9444    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
9445        use std::borrow::Cow;
9446        use std::io::{Read, Seek};
9447
9448        use common::{url::Params, ToParts};
9449        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9450
9451        let mut dd = common::DefaultDelegate;
9452        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9453        dlg.begin(common::MethodInfo {
9454            id: "connectors.projects.locations.connections.eventSubscriptions.create",
9455            http_method: hyper::Method::POST,
9456        });
9457
9458        for &field in ["alt", "parent", "eventSubscriptionId"].iter() {
9459            if self._additional_params.contains_key(field) {
9460                dlg.finished(false);
9461                return Err(common::Error::FieldClash(field));
9462            }
9463        }
9464
9465        let mut params = Params::with_capacity(5 + self._additional_params.len());
9466        params.push("parent", self._parent);
9467        if let Some(value) = self._event_subscription_id.as_ref() {
9468            params.push("eventSubscriptionId", value);
9469        }
9470
9471        params.extend(self._additional_params.iter());
9472
9473        params.push("alt", "json");
9474        let mut url = self.hub._base_url.clone() + "v1/{+parent}/eventSubscriptions";
9475        if self._scopes.is_empty() {
9476            self._scopes
9477                .insert(Scope::CloudPlatform.as_ref().to_string());
9478        }
9479
9480        #[allow(clippy::single_element_loop)]
9481        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
9482            url = params.uri_replacement(url, param_name, find_this, true);
9483        }
9484        {
9485            let to_remove = ["parent"];
9486            params.remove_params(&to_remove);
9487        }
9488
9489        let url = params.parse_with_url(&url);
9490
9491        let mut json_mime_type = mime::APPLICATION_JSON;
9492        let mut request_value_reader = {
9493            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9494            common::remove_json_null_values(&mut value);
9495            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9496            serde_json::to_writer(&mut dst, &value).unwrap();
9497            dst
9498        };
9499        let request_size = request_value_reader
9500            .seek(std::io::SeekFrom::End(0))
9501            .unwrap();
9502        request_value_reader
9503            .seek(std::io::SeekFrom::Start(0))
9504            .unwrap();
9505
9506        loop {
9507            let token = match self
9508                .hub
9509                .auth
9510                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9511                .await
9512            {
9513                Ok(token) => token,
9514                Err(e) => match dlg.token(e) {
9515                    Ok(token) => token,
9516                    Err(e) => {
9517                        dlg.finished(false);
9518                        return Err(common::Error::MissingToken(e));
9519                    }
9520                },
9521            };
9522            request_value_reader
9523                .seek(std::io::SeekFrom::Start(0))
9524                .unwrap();
9525            let mut req_result = {
9526                let client = &self.hub.client;
9527                dlg.pre_request();
9528                let mut req_builder = hyper::Request::builder()
9529                    .method(hyper::Method::POST)
9530                    .uri(url.as_str())
9531                    .header(USER_AGENT, self.hub._user_agent.clone());
9532
9533                if let Some(token) = token.as_ref() {
9534                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9535                }
9536
9537                let request = req_builder
9538                    .header(CONTENT_TYPE, json_mime_type.to_string())
9539                    .header(CONTENT_LENGTH, request_size as u64)
9540                    .body(common::to_body(
9541                        request_value_reader.get_ref().clone().into(),
9542                    ));
9543
9544                client.request(request.unwrap()).await
9545            };
9546
9547            match req_result {
9548                Err(err) => {
9549                    if let common::Retry::After(d) = dlg.http_error(&err) {
9550                        sleep(d).await;
9551                        continue;
9552                    }
9553                    dlg.finished(false);
9554                    return Err(common::Error::HttpError(err));
9555                }
9556                Ok(res) => {
9557                    let (mut parts, body) = res.into_parts();
9558                    let mut body = common::Body::new(body);
9559                    if !parts.status.is_success() {
9560                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9561                        let error = serde_json::from_str(&common::to_string(&bytes));
9562                        let response = common::to_response(parts, bytes.into());
9563
9564                        if let common::Retry::After(d) =
9565                            dlg.http_failure(&response, error.as_ref().ok())
9566                        {
9567                            sleep(d).await;
9568                            continue;
9569                        }
9570
9571                        dlg.finished(false);
9572
9573                        return Err(match error {
9574                            Ok(value) => common::Error::BadRequest(value),
9575                            _ => common::Error::Failure(response),
9576                        });
9577                    }
9578                    let response = {
9579                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9580                        let encoded = common::to_string(&bytes);
9581                        match serde_json::from_str(&encoded) {
9582                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9583                            Err(error) => {
9584                                dlg.response_json_decode_error(&encoded, &error);
9585                                return Err(common::Error::JsonDecodeError(
9586                                    encoded.to_string(),
9587                                    error,
9588                                ));
9589                            }
9590                        }
9591                    };
9592
9593                    dlg.finished(true);
9594                    return Ok(response);
9595                }
9596            }
9597        }
9598    }
9599
9600    ///
9601    /// Sets the *request* property to the given value.
9602    ///
9603    /// Even though the property as already been set when instantiating this call,
9604    /// we provide this method for API completeness.
9605    pub fn request(
9606        mut self,
9607        new_value: EventSubscription,
9608    ) -> ProjectLocationConnectionEventSubscriptionCreateCall<'a, C> {
9609        self._request = new_value;
9610        self
9611    }
9612    /// Required. Parent resource of the EventSubscription, of the form: `projects/*/locations/*/connections/*`
9613    ///
9614    /// Sets the *parent* path property to the given value.
9615    ///
9616    /// Even though the property as already been set when instantiating this call,
9617    /// we provide this method for API completeness.
9618    pub fn parent(
9619        mut self,
9620        new_value: &str,
9621    ) -> ProjectLocationConnectionEventSubscriptionCreateCall<'a, C> {
9622        self._parent = new_value.to_string();
9623        self
9624    }
9625    /// Required. Identifier to assign to the Event Subscription. Must be unique within scope of the parent resource.
9626    ///
9627    /// Sets the *event subscription id* query property to the given value.
9628    pub fn event_subscription_id(
9629        mut self,
9630        new_value: &str,
9631    ) -> ProjectLocationConnectionEventSubscriptionCreateCall<'a, C> {
9632        self._event_subscription_id = Some(new_value.to_string());
9633        self
9634    }
9635    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9636    /// while executing the actual API request.
9637    ///
9638    /// ````text
9639    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9640    /// ````
9641    ///
9642    /// Sets the *delegate* property to the given value.
9643    pub fn delegate(
9644        mut self,
9645        new_value: &'a mut dyn common::Delegate,
9646    ) -> ProjectLocationConnectionEventSubscriptionCreateCall<'a, C> {
9647        self._delegate = Some(new_value);
9648        self
9649    }
9650
9651    /// Set any additional parameter of the query string used in the request.
9652    /// It should be used to set parameters which are not yet available through their own
9653    /// setters.
9654    ///
9655    /// Please note that this method must not be used to set any of the known parameters
9656    /// which have their own setter method. If done anyway, the request will fail.
9657    ///
9658    /// # Additional Parameters
9659    ///
9660    /// * *$.xgafv* (query-string) - V1 error format.
9661    /// * *access_token* (query-string) - OAuth access token.
9662    /// * *alt* (query-string) - Data format for response.
9663    /// * *callback* (query-string) - JSONP
9664    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9665    /// * *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.
9666    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9667    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9668    /// * *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.
9669    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9670    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9671    pub fn param<T>(
9672        mut self,
9673        name: T,
9674        value: T,
9675    ) -> ProjectLocationConnectionEventSubscriptionCreateCall<'a, C>
9676    where
9677        T: AsRef<str>,
9678    {
9679        self._additional_params
9680            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9681        self
9682    }
9683
9684    /// Identifies the authorization scope for the method you are building.
9685    ///
9686    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9687    /// [`Scope::CloudPlatform`].
9688    ///
9689    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9690    /// tokens for more than one scope.
9691    ///
9692    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9693    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9694    /// sufficient, a read-write scope will do as well.
9695    pub fn add_scope<St>(
9696        mut self,
9697        scope: St,
9698    ) -> ProjectLocationConnectionEventSubscriptionCreateCall<'a, C>
9699    where
9700        St: AsRef<str>,
9701    {
9702        self._scopes.insert(String::from(scope.as_ref()));
9703        self
9704    }
9705    /// Identifies the authorization scope(s) for the method you are building.
9706    ///
9707    /// See [`Self::add_scope()`] for details.
9708    pub fn add_scopes<I, St>(
9709        mut self,
9710        scopes: I,
9711    ) -> ProjectLocationConnectionEventSubscriptionCreateCall<'a, C>
9712    where
9713        I: IntoIterator<Item = St>,
9714        St: AsRef<str>,
9715    {
9716        self._scopes
9717            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9718        self
9719    }
9720
9721    /// Removes all scopes, and no default scope will be used either.
9722    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9723    /// for details).
9724    pub fn clear_scopes(mut self) -> ProjectLocationConnectionEventSubscriptionCreateCall<'a, C> {
9725        self._scopes.clear();
9726        self
9727    }
9728}
9729
9730/// Deletes a single EventSubscription.
9731///
9732/// A builder for the *locations.connections.eventSubscriptions.delete* method supported by a *project* resource.
9733/// It is not used directly, but through a [`ProjectMethods`] instance.
9734///
9735/// # Example
9736///
9737/// Instantiate a resource method builder
9738///
9739/// ```test_harness,no_run
9740/// # extern crate hyper;
9741/// # extern crate hyper_rustls;
9742/// # extern crate google_connectors1 as connectors1;
9743/// # async fn dox() {
9744/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9745///
9746/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9747/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9748/// #     .with_native_roots()
9749/// #     .unwrap()
9750/// #     .https_only()
9751/// #     .enable_http2()
9752/// #     .build();
9753///
9754/// # let executor = hyper_util::rt::TokioExecutor::new();
9755/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9756/// #     secret,
9757/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9758/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9759/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9760/// #     ),
9761/// # ).build().await.unwrap();
9762///
9763/// # let client = hyper_util::client::legacy::Client::builder(
9764/// #     hyper_util::rt::TokioExecutor::new()
9765/// # )
9766/// # .build(
9767/// #     hyper_rustls::HttpsConnectorBuilder::new()
9768/// #         .with_native_roots()
9769/// #         .unwrap()
9770/// #         .https_or_http()
9771/// #         .enable_http2()
9772/// #         .build()
9773/// # );
9774/// # let mut hub = Connectors::new(client, auth);
9775/// // You can configure optional parameters by calling the respective setters at will, and
9776/// // execute the final call using `doit()`.
9777/// // Values shown here are possibly random and not representative !
9778/// let result = hub.projects().locations_connections_event_subscriptions_delete("name")
9779///              .doit().await;
9780/// # }
9781/// ```
9782pub struct ProjectLocationConnectionEventSubscriptionDeleteCall<'a, C>
9783where
9784    C: 'a,
9785{
9786    hub: &'a Connectors<C>,
9787    _name: String,
9788    _delegate: Option<&'a mut dyn common::Delegate>,
9789    _additional_params: HashMap<String, String>,
9790    _scopes: BTreeSet<String>,
9791}
9792
9793impl<'a, C> common::CallBuilder for ProjectLocationConnectionEventSubscriptionDeleteCall<'a, C> {}
9794
9795impl<'a, C> ProjectLocationConnectionEventSubscriptionDeleteCall<'a, C>
9796where
9797    C: common::Connector,
9798{
9799    /// Perform the operation you have build so far.
9800    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
9801        use std::borrow::Cow;
9802        use std::io::{Read, Seek};
9803
9804        use common::{url::Params, ToParts};
9805        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9806
9807        let mut dd = common::DefaultDelegate;
9808        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9809        dlg.begin(common::MethodInfo {
9810            id: "connectors.projects.locations.connections.eventSubscriptions.delete",
9811            http_method: hyper::Method::DELETE,
9812        });
9813
9814        for &field in ["alt", "name"].iter() {
9815            if self._additional_params.contains_key(field) {
9816                dlg.finished(false);
9817                return Err(common::Error::FieldClash(field));
9818            }
9819        }
9820
9821        let mut params = Params::with_capacity(3 + self._additional_params.len());
9822        params.push("name", self._name);
9823
9824        params.extend(self._additional_params.iter());
9825
9826        params.push("alt", "json");
9827        let mut url = self.hub._base_url.clone() + "v1/{+name}";
9828        if self._scopes.is_empty() {
9829            self._scopes
9830                .insert(Scope::CloudPlatform.as_ref().to_string());
9831        }
9832
9833        #[allow(clippy::single_element_loop)]
9834        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9835            url = params.uri_replacement(url, param_name, find_this, true);
9836        }
9837        {
9838            let to_remove = ["name"];
9839            params.remove_params(&to_remove);
9840        }
9841
9842        let url = params.parse_with_url(&url);
9843
9844        loop {
9845            let token = match self
9846                .hub
9847                .auth
9848                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9849                .await
9850            {
9851                Ok(token) => token,
9852                Err(e) => match dlg.token(e) {
9853                    Ok(token) => token,
9854                    Err(e) => {
9855                        dlg.finished(false);
9856                        return Err(common::Error::MissingToken(e));
9857                    }
9858                },
9859            };
9860            let mut req_result = {
9861                let client = &self.hub.client;
9862                dlg.pre_request();
9863                let mut req_builder = hyper::Request::builder()
9864                    .method(hyper::Method::DELETE)
9865                    .uri(url.as_str())
9866                    .header(USER_AGENT, self.hub._user_agent.clone());
9867
9868                if let Some(token) = token.as_ref() {
9869                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9870                }
9871
9872                let request = req_builder
9873                    .header(CONTENT_LENGTH, 0_u64)
9874                    .body(common::to_body::<String>(None));
9875
9876                client.request(request.unwrap()).await
9877            };
9878
9879            match req_result {
9880                Err(err) => {
9881                    if let common::Retry::After(d) = dlg.http_error(&err) {
9882                        sleep(d).await;
9883                        continue;
9884                    }
9885                    dlg.finished(false);
9886                    return Err(common::Error::HttpError(err));
9887                }
9888                Ok(res) => {
9889                    let (mut parts, body) = res.into_parts();
9890                    let mut body = common::Body::new(body);
9891                    if !parts.status.is_success() {
9892                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9893                        let error = serde_json::from_str(&common::to_string(&bytes));
9894                        let response = common::to_response(parts, bytes.into());
9895
9896                        if let common::Retry::After(d) =
9897                            dlg.http_failure(&response, error.as_ref().ok())
9898                        {
9899                            sleep(d).await;
9900                            continue;
9901                        }
9902
9903                        dlg.finished(false);
9904
9905                        return Err(match error {
9906                            Ok(value) => common::Error::BadRequest(value),
9907                            _ => common::Error::Failure(response),
9908                        });
9909                    }
9910                    let response = {
9911                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9912                        let encoded = common::to_string(&bytes);
9913                        match serde_json::from_str(&encoded) {
9914                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9915                            Err(error) => {
9916                                dlg.response_json_decode_error(&encoded, &error);
9917                                return Err(common::Error::JsonDecodeError(
9918                                    encoded.to_string(),
9919                                    error,
9920                                ));
9921                            }
9922                        }
9923                    };
9924
9925                    dlg.finished(true);
9926                    return Ok(response);
9927                }
9928            }
9929        }
9930    }
9931
9932    /// Required. Resource name of the form: `projects/*/locations/*/connections/*/eventsubscriptions/*`
9933    ///
9934    /// Sets the *name* path property to the given value.
9935    ///
9936    /// Even though the property as already been set when instantiating this call,
9937    /// we provide this method for API completeness.
9938    pub fn name(
9939        mut self,
9940        new_value: &str,
9941    ) -> ProjectLocationConnectionEventSubscriptionDeleteCall<'a, C> {
9942        self._name = new_value.to_string();
9943        self
9944    }
9945    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9946    /// while executing the actual API request.
9947    ///
9948    /// ````text
9949    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9950    /// ````
9951    ///
9952    /// Sets the *delegate* property to the given value.
9953    pub fn delegate(
9954        mut self,
9955        new_value: &'a mut dyn common::Delegate,
9956    ) -> ProjectLocationConnectionEventSubscriptionDeleteCall<'a, C> {
9957        self._delegate = Some(new_value);
9958        self
9959    }
9960
9961    /// Set any additional parameter of the query string used in the request.
9962    /// It should be used to set parameters which are not yet available through their own
9963    /// setters.
9964    ///
9965    /// Please note that this method must not be used to set any of the known parameters
9966    /// which have their own setter method. If done anyway, the request will fail.
9967    ///
9968    /// # Additional Parameters
9969    ///
9970    /// * *$.xgafv* (query-string) - V1 error format.
9971    /// * *access_token* (query-string) - OAuth access token.
9972    /// * *alt* (query-string) - Data format for response.
9973    /// * *callback* (query-string) - JSONP
9974    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9975    /// * *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.
9976    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9977    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9978    /// * *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.
9979    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9980    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9981    pub fn param<T>(
9982        mut self,
9983        name: T,
9984        value: T,
9985    ) -> ProjectLocationConnectionEventSubscriptionDeleteCall<'a, C>
9986    where
9987        T: AsRef<str>,
9988    {
9989        self._additional_params
9990            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9991        self
9992    }
9993
9994    /// Identifies the authorization scope for the method you are building.
9995    ///
9996    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9997    /// [`Scope::CloudPlatform`].
9998    ///
9999    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10000    /// tokens for more than one scope.
10001    ///
10002    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10003    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10004    /// sufficient, a read-write scope will do as well.
10005    pub fn add_scope<St>(
10006        mut self,
10007        scope: St,
10008    ) -> ProjectLocationConnectionEventSubscriptionDeleteCall<'a, C>
10009    where
10010        St: AsRef<str>,
10011    {
10012        self._scopes.insert(String::from(scope.as_ref()));
10013        self
10014    }
10015    /// Identifies the authorization scope(s) for the method you are building.
10016    ///
10017    /// See [`Self::add_scope()`] for details.
10018    pub fn add_scopes<I, St>(
10019        mut self,
10020        scopes: I,
10021    ) -> ProjectLocationConnectionEventSubscriptionDeleteCall<'a, C>
10022    where
10023        I: IntoIterator<Item = St>,
10024        St: AsRef<str>,
10025    {
10026        self._scopes
10027            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10028        self
10029    }
10030
10031    /// Removes all scopes, and no default scope will be used either.
10032    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10033    /// for details).
10034    pub fn clear_scopes(mut self) -> ProjectLocationConnectionEventSubscriptionDeleteCall<'a, C> {
10035        self._scopes.clear();
10036        self
10037    }
10038}
10039
10040/// Gets details of a single EventSubscription.
10041///
10042/// A builder for the *locations.connections.eventSubscriptions.get* method supported by a *project* resource.
10043/// It is not used directly, but through a [`ProjectMethods`] instance.
10044///
10045/// # Example
10046///
10047/// Instantiate a resource method builder
10048///
10049/// ```test_harness,no_run
10050/// # extern crate hyper;
10051/// # extern crate hyper_rustls;
10052/// # extern crate google_connectors1 as connectors1;
10053/// # async fn dox() {
10054/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10055///
10056/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10057/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10058/// #     .with_native_roots()
10059/// #     .unwrap()
10060/// #     .https_only()
10061/// #     .enable_http2()
10062/// #     .build();
10063///
10064/// # let executor = hyper_util::rt::TokioExecutor::new();
10065/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10066/// #     secret,
10067/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10068/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10069/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10070/// #     ),
10071/// # ).build().await.unwrap();
10072///
10073/// # let client = hyper_util::client::legacy::Client::builder(
10074/// #     hyper_util::rt::TokioExecutor::new()
10075/// # )
10076/// # .build(
10077/// #     hyper_rustls::HttpsConnectorBuilder::new()
10078/// #         .with_native_roots()
10079/// #         .unwrap()
10080/// #         .https_or_http()
10081/// #         .enable_http2()
10082/// #         .build()
10083/// # );
10084/// # let mut hub = Connectors::new(client, auth);
10085/// // You can configure optional parameters by calling the respective setters at will, and
10086/// // execute the final call using `doit()`.
10087/// // Values shown here are possibly random and not representative !
10088/// let result = hub.projects().locations_connections_event_subscriptions_get("name")
10089///              .doit().await;
10090/// # }
10091/// ```
10092pub struct ProjectLocationConnectionEventSubscriptionGetCall<'a, C>
10093where
10094    C: 'a,
10095{
10096    hub: &'a Connectors<C>,
10097    _name: String,
10098    _delegate: Option<&'a mut dyn common::Delegate>,
10099    _additional_params: HashMap<String, String>,
10100    _scopes: BTreeSet<String>,
10101}
10102
10103impl<'a, C> common::CallBuilder for ProjectLocationConnectionEventSubscriptionGetCall<'a, C> {}
10104
10105impl<'a, C> ProjectLocationConnectionEventSubscriptionGetCall<'a, C>
10106where
10107    C: common::Connector,
10108{
10109    /// Perform the operation you have build so far.
10110    pub async fn doit(mut self) -> common::Result<(common::Response, EventSubscription)> {
10111        use std::borrow::Cow;
10112        use std::io::{Read, Seek};
10113
10114        use common::{url::Params, ToParts};
10115        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10116
10117        let mut dd = common::DefaultDelegate;
10118        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10119        dlg.begin(common::MethodInfo {
10120            id: "connectors.projects.locations.connections.eventSubscriptions.get",
10121            http_method: hyper::Method::GET,
10122        });
10123
10124        for &field in ["alt", "name"].iter() {
10125            if self._additional_params.contains_key(field) {
10126                dlg.finished(false);
10127                return Err(common::Error::FieldClash(field));
10128            }
10129        }
10130
10131        let mut params = Params::with_capacity(3 + self._additional_params.len());
10132        params.push("name", self._name);
10133
10134        params.extend(self._additional_params.iter());
10135
10136        params.push("alt", "json");
10137        let mut url = self.hub._base_url.clone() + "v1/{+name}";
10138        if self._scopes.is_empty() {
10139            self._scopes
10140                .insert(Scope::CloudPlatform.as_ref().to_string());
10141        }
10142
10143        #[allow(clippy::single_element_loop)]
10144        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10145            url = params.uri_replacement(url, param_name, find_this, true);
10146        }
10147        {
10148            let to_remove = ["name"];
10149            params.remove_params(&to_remove);
10150        }
10151
10152        let url = params.parse_with_url(&url);
10153
10154        loop {
10155            let token = match self
10156                .hub
10157                .auth
10158                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10159                .await
10160            {
10161                Ok(token) => token,
10162                Err(e) => match dlg.token(e) {
10163                    Ok(token) => token,
10164                    Err(e) => {
10165                        dlg.finished(false);
10166                        return Err(common::Error::MissingToken(e));
10167                    }
10168                },
10169            };
10170            let mut req_result = {
10171                let client = &self.hub.client;
10172                dlg.pre_request();
10173                let mut req_builder = hyper::Request::builder()
10174                    .method(hyper::Method::GET)
10175                    .uri(url.as_str())
10176                    .header(USER_AGENT, self.hub._user_agent.clone());
10177
10178                if let Some(token) = token.as_ref() {
10179                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10180                }
10181
10182                let request = req_builder
10183                    .header(CONTENT_LENGTH, 0_u64)
10184                    .body(common::to_body::<String>(None));
10185
10186                client.request(request.unwrap()).await
10187            };
10188
10189            match req_result {
10190                Err(err) => {
10191                    if let common::Retry::After(d) = dlg.http_error(&err) {
10192                        sleep(d).await;
10193                        continue;
10194                    }
10195                    dlg.finished(false);
10196                    return Err(common::Error::HttpError(err));
10197                }
10198                Ok(res) => {
10199                    let (mut parts, body) = res.into_parts();
10200                    let mut body = common::Body::new(body);
10201                    if !parts.status.is_success() {
10202                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10203                        let error = serde_json::from_str(&common::to_string(&bytes));
10204                        let response = common::to_response(parts, bytes.into());
10205
10206                        if let common::Retry::After(d) =
10207                            dlg.http_failure(&response, error.as_ref().ok())
10208                        {
10209                            sleep(d).await;
10210                            continue;
10211                        }
10212
10213                        dlg.finished(false);
10214
10215                        return Err(match error {
10216                            Ok(value) => common::Error::BadRequest(value),
10217                            _ => common::Error::Failure(response),
10218                        });
10219                    }
10220                    let response = {
10221                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10222                        let encoded = common::to_string(&bytes);
10223                        match serde_json::from_str(&encoded) {
10224                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10225                            Err(error) => {
10226                                dlg.response_json_decode_error(&encoded, &error);
10227                                return Err(common::Error::JsonDecodeError(
10228                                    encoded.to_string(),
10229                                    error,
10230                                ));
10231                            }
10232                        }
10233                    };
10234
10235                    dlg.finished(true);
10236                    return Ok(response);
10237                }
10238            }
10239        }
10240    }
10241
10242    /// Required. Resource name of the form: `projects/*/locations/*/connections/*/eventSubscriptions/*`
10243    ///
10244    /// Sets the *name* path property to the given value.
10245    ///
10246    /// Even though the property as already been set when instantiating this call,
10247    /// we provide this method for API completeness.
10248    pub fn name(
10249        mut self,
10250        new_value: &str,
10251    ) -> ProjectLocationConnectionEventSubscriptionGetCall<'a, C> {
10252        self._name = new_value.to_string();
10253        self
10254    }
10255    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10256    /// while executing the actual API request.
10257    ///
10258    /// ````text
10259    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10260    /// ````
10261    ///
10262    /// Sets the *delegate* property to the given value.
10263    pub fn delegate(
10264        mut self,
10265        new_value: &'a mut dyn common::Delegate,
10266    ) -> ProjectLocationConnectionEventSubscriptionGetCall<'a, C> {
10267        self._delegate = Some(new_value);
10268        self
10269    }
10270
10271    /// Set any additional parameter of the query string used in the request.
10272    /// It should be used to set parameters which are not yet available through their own
10273    /// setters.
10274    ///
10275    /// Please note that this method must not be used to set any of the known parameters
10276    /// which have their own setter method. If done anyway, the request will fail.
10277    ///
10278    /// # Additional Parameters
10279    ///
10280    /// * *$.xgafv* (query-string) - V1 error format.
10281    /// * *access_token* (query-string) - OAuth access token.
10282    /// * *alt* (query-string) - Data format for response.
10283    /// * *callback* (query-string) - JSONP
10284    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10285    /// * *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.
10286    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10287    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10288    /// * *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.
10289    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10290    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10291    pub fn param<T>(
10292        mut self,
10293        name: T,
10294        value: T,
10295    ) -> ProjectLocationConnectionEventSubscriptionGetCall<'a, C>
10296    where
10297        T: AsRef<str>,
10298    {
10299        self._additional_params
10300            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10301        self
10302    }
10303
10304    /// Identifies the authorization scope for the method you are building.
10305    ///
10306    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10307    /// [`Scope::CloudPlatform`].
10308    ///
10309    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10310    /// tokens for more than one scope.
10311    ///
10312    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10313    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10314    /// sufficient, a read-write scope will do as well.
10315    pub fn add_scope<St>(
10316        mut self,
10317        scope: St,
10318    ) -> ProjectLocationConnectionEventSubscriptionGetCall<'a, C>
10319    where
10320        St: AsRef<str>,
10321    {
10322        self._scopes.insert(String::from(scope.as_ref()));
10323        self
10324    }
10325    /// Identifies the authorization scope(s) for the method you are building.
10326    ///
10327    /// See [`Self::add_scope()`] for details.
10328    pub fn add_scopes<I, St>(
10329        mut self,
10330        scopes: I,
10331    ) -> ProjectLocationConnectionEventSubscriptionGetCall<'a, C>
10332    where
10333        I: IntoIterator<Item = St>,
10334        St: AsRef<str>,
10335    {
10336        self._scopes
10337            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10338        self
10339    }
10340
10341    /// Removes all scopes, and no default scope will be used either.
10342    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10343    /// for details).
10344    pub fn clear_scopes(mut self) -> ProjectLocationConnectionEventSubscriptionGetCall<'a, C> {
10345        self._scopes.clear();
10346        self
10347    }
10348}
10349
10350/// List EventSubscriptions in a given project,location and connection.
10351///
10352/// A builder for the *locations.connections.eventSubscriptions.list* method supported by a *project* resource.
10353/// It is not used directly, but through a [`ProjectMethods`] instance.
10354///
10355/// # Example
10356///
10357/// Instantiate a resource method builder
10358///
10359/// ```test_harness,no_run
10360/// # extern crate hyper;
10361/// # extern crate hyper_rustls;
10362/// # extern crate google_connectors1 as connectors1;
10363/// # async fn dox() {
10364/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10365///
10366/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10367/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10368/// #     .with_native_roots()
10369/// #     .unwrap()
10370/// #     .https_only()
10371/// #     .enable_http2()
10372/// #     .build();
10373///
10374/// # let executor = hyper_util::rt::TokioExecutor::new();
10375/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10376/// #     secret,
10377/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10378/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10379/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10380/// #     ),
10381/// # ).build().await.unwrap();
10382///
10383/// # let client = hyper_util::client::legacy::Client::builder(
10384/// #     hyper_util::rt::TokioExecutor::new()
10385/// # )
10386/// # .build(
10387/// #     hyper_rustls::HttpsConnectorBuilder::new()
10388/// #         .with_native_roots()
10389/// #         .unwrap()
10390/// #         .https_or_http()
10391/// #         .enable_http2()
10392/// #         .build()
10393/// # );
10394/// # let mut hub = Connectors::new(client, auth);
10395/// // You can configure optional parameters by calling the respective setters at will, and
10396/// // execute the final call using `doit()`.
10397/// // Values shown here are possibly random and not representative !
10398/// let result = hub.projects().locations_connections_event_subscriptions_list("parent")
10399///              .page_token("labore")
10400///              .page_size(-43)
10401///              .order_by("duo")
10402///              .filter("sed")
10403///              .doit().await;
10404/// # }
10405/// ```
10406pub struct ProjectLocationConnectionEventSubscriptionListCall<'a, C>
10407where
10408    C: 'a,
10409{
10410    hub: &'a Connectors<C>,
10411    _parent: String,
10412    _page_token: Option<String>,
10413    _page_size: Option<i32>,
10414    _order_by: Option<String>,
10415    _filter: Option<String>,
10416    _delegate: Option<&'a mut dyn common::Delegate>,
10417    _additional_params: HashMap<String, String>,
10418    _scopes: BTreeSet<String>,
10419}
10420
10421impl<'a, C> common::CallBuilder for ProjectLocationConnectionEventSubscriptionListCall<'a, C> {}
10422
10423impl<'a, C> ProjectLocationConnectionEventSubscriptionListCall<'a, C>
10424where
10425    C: common::Connector,
10426{
10427    /// Perform the operation you have build so far.
10428    pub async fn doit(
10429        mut self,
10430    ) -> common::Result<(common::Response, ListEventSubscriptionsResponse)> {
10431        use std::borrow::Cow;
10432        use std::io::{Read, Seek};
10433
10434        use common::{url::Params, ToParts};
10435        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10436
10437        let mut dd = common::DefaultDelegate;
10438        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10439        dlg.begin(common::MethodInfo {
10440            id: "connectors.projects.locations.connections.eventSubscriptions.list",
10441            http_method: hyper::Method::GET,
10442        });
10443
10444        for &field in [
10445            "alt",
10446            "parent",
10447            "pageToken",
10448            "pageSize",
10449            "orderBy",
10450            "filter",
10451        ]
10452        .iter()
10453        {
10454            if self._additional_params.contains_key(field) {
10455                dlg.finished(false);
10456                return Err(common::Error::FieldClash(field));
10457            }
10458        }
10459
10460        let mut params = Params::with_capacity(7 + self._additional_params.len());
10461        params.push("parent", self._parent);
10462        if let Some(value) = self._page_token.as_ref() {
10463            params.push("pageToken", value);
10464        }
10465        if let Some(value) = self._page_size.as_ref() {
10466            params.push("pageSize", value.to_string());
10467        }
10468        if let Some(value) = self._order_by.as_ref() {
10469            params.push("orderBy", value);
10470        }
10471        if let Some(value) = self._filter.as_ref() {
10472            params.push("filter", value);
10473        }
10474
10475        params.extend(self._additional_params.iter());
10476
10477        params.push("alt", "json");
10478        let mut url = self.hub._base_url.clone() + "v1/{+parent}/eventSubscriptions";
10479        if self._scopes.is_empty() {
10480            self._scopes
10481                .insert(Scope::CloudPlatform.as_ref().to_string());
10482        }
10483
10484        #[allow(clippy::single_element_loop)]
10485        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10486            url = params.uri_replacement(url, param_name, find_this, true);
10487        }
10488        {
10489            let to_remove = ["parent"];
10490            params.remove_params(&to_remove);
10491        }
10492
10493        let url = params.parse_with_url(&url);
10494
10495        loop {
10496            let token = match self
10497                .hub
10498                .auth
10499                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10500                .await
10501            {
10502                Ok(token) => token,
10503                Err(e) => match dlg.token(e) {
10504                    Ok(token) => token,
10505                    Err(e) => {
10506                        dlg.finished(false);
10507                        return Err(common::Error::MissingToken(e));
10508                    }
10509                },
10510            };
10511            let mut req_result = {
10512                let client = &self.hub.client;
10513                dlg.pre_request();
10514                let mut req_builder = hyper::Request::builder()
10515                    .method(hyper::Method::GET)
10516                    .uri(url.as_str())
10517                    .header(USER_AGENT, self.hub._user_agent.clone());
10518
10519                if let Some(token) = token.as_ref() {
10520                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10521                }
10522
10523                let request = req_builder
10524                    .header(CONTENT_LENGTH, 0_u64)
10525                    .body(common::to_body::<String>(None));
10526
10527                client.request(request.unwrap()).await
10528            };
10529
10530            match req_result {
10531                Err(err) => {
10532                    if let common::Retry::After(d) = dlg.http_error(&err) {
10533                        sleep(d).await;
10534                        continue;
10535                    }
10536                    dlg.finished(false);
10537                    return Err(common::Error::HttpError(err));
10538                }
10539                Ok(res) => {
10540                    let (mut parts, body) = res.into_parts();
10541                    let mut body = common::Body::new(body);
10542                    if !parts.status.is_success() {
10543                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10544                        let error = serde_json::from_str(&common::to_string(&bytes));
10545                        let response = common::to_response(parts, bytes.into());
10546
10547                        if let common::Retry::After(d) =
10548                            dlg.http_failure(&response, error.as_ref().ok())
10549                        {
10550                            sleep(d).await;
10551                            continue;
10552                        }
10553
10554                        dlg.finished(false);
10555
10556                        return Err(match error {
10557                            Ok(value) => common::Error::BadRequest(value),
10558                            _ => common::Error::Failure(response),
10559                        });
10560                    }
10561                    let response = {
10562                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10563                        let encoded = common::to_string(&bytes);
10564                        match serde_json::from_str(&encoded) {
10565                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10566                            Err(error) => {
10567                                dlg.response_json_decode_error(&encoded, &error);
10568                                return Err(common::Error::JsonDecodeError(
10569                                    encoded.to_string(),
10570                                    error,
10571                                ));
10572                            }
10573                        }
10574                    };
10575
10576                    dlg.finished(true);
10577                    return Ok(response);
10578                }
10579            }
10580        }
10581    }
10582
10583    /// Required. Parent resource of the EventSubscription, of the form: `projects/*/locations/*/connections/*`
10584    ///
10585    /// Sets the *parent* path property to the given value.
10586    ///
10587    /// Even though the property as already been set when instantiating this call,
10588    /// we provide this method for API completeness.
10589    pub fn parent(
10590        mut self,
10591        new_value: &str,
10592    ) -> ProjectLocationConnectionEventSubscriptionListCall<'a, C> {
10593        self._parent = new_value.to_string();
10594        self
10595    }
10596    /// Page token.
10597    ///
10598    /// Sets the *page token* query property to the given value.
10599    pub fn page_token(
10600        mut self,
10601        new_value: &str,
10602    ) -> ProjectLocationConnectionEventSubscriptionListCall<'a, C> {
10603        self._page_token = Some(new_value.to_string());
10604        self
10605    }
10606    /// Page size.
10607    ///
10608    /// Sets the *page size* query property to the given value.
10609    pub fn page_size(
10610        mut self,
10611        new_value: i32,
10612    ) -> ProjectLocationConnectionEventSubscriptionListCall<'a, C> {
10613        self._page_size = Some(new_value);
10614        self
10615    }
10616    /// Order by parameters.
10617    ///
10618    /// Sets the *order by* query property to the given value.
10619    pub fn order_by(
10620        mut self,
10621        new_value: &str,
10622    ) -> ProjectLocationConnectionEventSubscriptionListCall<'a, C> {
10623        self._order_by = Some(new_value.to_string());
10624        self
10625    }
10626    /// Filter.
10627    ///
10628    /// Sets the *filter* query property to the given value.
10629    pub fn filter(
10630        mut self,
10631        new_value: &str,
10632    ) -> ProjectLocationConnectionEventSubscriptionListCall<'a, C> {
10633        self._filter = Some(new_value.to_string());
10634        self
10635    }
10636    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10637    /// while executing the actual API request.
10638    ///
10639    /// ````text
10640    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10641    /// ````
10642    ///
10643    /// Sets the *delegate* property to the given value.
10644    pub fn delegate(
10645        mut self,
10646        new_value: &'a mut dyn common::Delegate,
10647    ) -> ProjectLocationConnectionEventSubscriptionListCall<'a, C> {
10648        self._delegate = Some(new_value);
10649        self
10650    }
10651
10652    /// Set any additional parameter of the query string used in the request.
10653    /// It should be used to set parameters which are not yet available through their own
10654    /// setters.
10655    ///
10656    /// Please note that this method must not be used to set any of the known parameters
10657    /// which have their own setter method. If done anyway, the request will fail.
10658    ///
10659    /// # Additional Parameters
10660    ///
10661    /// * *$.xgafv* (query-string) - V1 error format.
10662    /// * *access_token* (query-string) - OAuth access token.
10663    /// * *alt* (query-string) - Data format for response.
10664    /// * *callback* (query-string) - JSONP
10665    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10666    /// * *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.
10667    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10668    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10669    /// * *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.
10670    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10671    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10672    pub fn param<T>(
10673        mut self,
10674        name: T,
10675        value: T,
10676    ) -> ProjectLocationConnectionEventSubscriptionListCall<'a, C>
10677    where
10678        T: AsRef<str>,
10679    {
10680        self._additional_params
10681            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10682        self
10683    }
10684
10685    /// Identifies the authorization scope for the method you are building.
10686    ///
10687    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10688    /// [`Scope::CloudPlatform`].
10689    ///
10690    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10691    /// tokens for more than one scope.
10692    ///
10693    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10694    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10695    /// sufficient, a read-write scope will do as well.
10696    pub fn add_scope<St>(
10697        mut self,
10698        scope: St,
10699    ) -> ProjectLocationConnectionEventSubscriptionListCall<'a, C>
10700    where
10701        St: AsRef<str>,
10702    {
10703        self._scopes.insert(String::from(scope.as_ref()));
10704        self
10705    }
10706    /// Identifies the authorization scope(s) for the method you are building.
10707    ///
10708    /// See [`Self::add_scope()`] for details.
10709    pub fn add_scopes<I, St>(
10710        mut self,
10711        scopes: I,
10712    ) -> ProjectLocationConnectionEventSubscriptionListCall<'a, C>
10713    where
10714        I: IntoIterator<Item = St>,
10715        St: AsRef<str>,
10716    {
10717        self._scopes
10718            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10719        self
10720    }
10721
10722    /// Removes all scopes, and no default scope will be used either.
10723    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10724    /// for details).
10725    pub fn clear_scopes(mut self) -> ProjectLocationConnectionEventSubscriptionListCall<'a, C> {
10726        self._scopes.clear();
10727        self
10728    }
10729}
10730
10731/// Updates the parameters of a single EventSubscription.
10732///
10733/// A builder for the *locations.connections.eventSubscriptions.patch* method supported by a *project* resource.
10734/// It is not used directly, but through a [`ProjectMethods`] instance.
10735///
10736/// # Example
10737///
10738/// Instantiate a resource method builder
10739///
10740/// ```test_harness,no_run
10741/// # extern crate hyper;
10742/// # extern crate hyper_rustls;
10743/// # extern crate google_connectors1 as connectors1;
10744/// use connectors1::api::EventSubscription;
10745/// # async fn dox() {
10746/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10747///
10748/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10749/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10750/// #     .with_native_roots()
10751/// #     .unwrap()
10752/// #     .https_only()
10753/// #     .enable_http2()
10754/// #     .build();
10755///
10756/// # let executor = hyper_util::rt::TokioExecutor::new();
10757/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10758/// #     secret,
10759/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10760/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10761/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10762/// #     ),
10763/// # ).build().await.unwrap();
10764///
10765/// # let client = hyper_util::client::legacy::Client::builder(
10766/// #     hyper_util::rt::TokioExecutor::new()
10767/// # )
10768/// # .build(
10769/// #     hyper_rustls::HttpsConnectorBuilder::new()
10770/// #         .with_native_roots()
10771/// #         .unwrap()
10772/// #         .https_or_http()
10773/// #         .enable_http2()
10774/// #         .build()
10775/// # );
10776/// # let mut hub = Connectors::new(client, auth);
10777/// // As the method needs a request, you would usually fill it with the desired information
10778/// // into the respective structure. Some of the parts shown here might not be applicable !
10779/// // Values shown here are possibly random and not representative !
10780/// let mut req = EventSubscription::default();
10781///
10782/// // You can configure optional parameters by calling the respective setters at will, and
10783/// // execute the final call using `doit()`.
10784/// // Values shown here are possibly random and not representative !
10785/// let result = hub.projects().locations_connections_event_subscriptions_patch(req, "name")
10786///              .update_mask(FieldMask::new::<&str>(&[]))
10787///              .doit().await;
10788/// # }
10789/// ```
10790pub struct ProjectLocationConnectionEventSubscriptionPatchCall<'a, C>
10791where
10792    C: 'a,
10793{
10794    hub: &'a Connectors<C>,
10795    _request: EventSubscription,
10796    _name: String,
10797    _update_mask: Option<common::FieldMask>,
10798    _delegate: Option<&'a mut dyn common::Delegate>,
10799    _additional_params: HashMap<String, String>,
10800    _scopes: BTreeSet<String>,
10801}
10802
10803impl<'a, C> common::CallBuilder for ProjectLocationConnectionEventSubscriptionPatchCall<'a, C> {}
10804
10805impl<'a, C> ProjectLocationConnectionEventSubscriptionPatchCall<'a, C>
10806where
10807    C: common::Connector,
10808{
10809    /// Perform the operation you have build so far.
10810    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
10811        use std::borrow::Cow;
10812        use std::io::{Read, Seek};
10813
10814        use common::{url::Params, ToParts};
10815        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10816
10817        let mut dd = common::DefaultDelegate;
10818        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10819        dlg.begin(common::MethodInfo {
10820            id: "connectors.projects.locations.connections.eventSubscriptions.patch",
10821            http_method: hyper::Method::PATCH,
10822        });
10823
10824        for &field in ["alt", "name", "updateMask"].iter() {
10825            if self._additional_params.contains_key(field) {
10826                dlg.finished(false);
10827                return Err(common::Error::FieldClash(field));
10828            }
10829        }
10830
10831        let mut params = Params::with_capacity(5 + self._additional_params.len());
10832        params.push("name", self._name);
10833        if let Some(value) = self._update_mask.as_ref() {
10834            params.push("updateMask", value.to_string());
10835        }
10836
10837        params.extend(self._additional_params.iter());
10838
10839        params.push("alt", "json");
10840        let mut url = self.hub._base_url.clone() + "v1/{+name}";
10841        if self._scopes.is_empty() {
10842            self._scopes
10843                .insert(Scope::CloudPlatform.as_ref().to_string());
10844        }
10845
10846        #[allow(clippy::single_element_loop)]
10847        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10848            url = params.uri_replacement(url, param_name, find_this, true);
10849        }
10850        {
10851            let to_remove = ["name"];
10852            params.remove_params(&to_remove);
10853        }
10854
10855        let url = params.parse_with_url(&url);
10856
10857        let mut json_mime_type = mime::APPLICATION_JSON;
10858        let mut request_value_reader = {
10859            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10860            common::remove_json_null_values(&mut value);
10861            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10862            serde_json::to_writer(&mut dst, &value).unwrap();
10863            dst
10864        };
10865        let request_size = request_value_reader
10866            .seek(std::io::SeekFrom::End(0))
10867            .unwrap();
10868        request_value_reader
10869            .seek(std::io::SeekFrom::Start(0))
10870            .unwrap();
10871
10872        loop {
10873            let token = match self
10874                .hub
10875                .auth
10876                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10877                .await
10878            {
10879                Ok(token) => token,
10880                Err(e) => match dlg.token(e) {
10881                    Ok(token) => token,
10882                    Err(e) => {
10883                        dlg.finished(false);
10884                        return Err(common::Error::MissingToken(e));
10885                    }
10886                },
10887            };
10888            request_value_reader
10889                .seek(std::io::SeekFrom::Start(0))
10890                .unwrap();
10891            let mut req_result = {
10892                let client = &self.hub.client;
10893                dlg.pre_request();
10894                let mut req_builder = hyper::Request::builder()
10895                    .method(hyper::Method::PATCH)
10896                    .uri(url.as_str())
10897                    .header(USER_AGENT, self.hub._user_agent.clone());
10898
10899                if let Some(token) = token.as_ref() {
10900                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10901                }
10902
10903                let request = req_builder
10904                    .header(CONTENT_TYPE, json_mime_type.to_string())
10905                    .header(CONTENT_LENGTH, request_size as u64)
10906                    .body(common::to_body(
10907                        request_value_reader.get_ref().clone().into(),
10908                    ));
10909
10910                client.request(request.unwrap()).await
10911            };
10912
10913            match req_result {
10914                Err(err) => {
10915                    if let common::Retry::After(d) = dlg.http_error(&err) {
10916                        sleep(d).await;
10917                        continue;
10918                    }
10919                    dlg.finished(false);
10920                    return Err(common::Error::HttpError(err));
10921                }
10922                Ok(res) => {
10923                    let (mut parts, body) = res.into_parts();
10924                    let mut body = common::Body::new(body);
10925                    if !parts.status.is_success() {
10926                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10927                        let error = serde_json::from_str(&common::to_string(&bytes));
10928                        let response = common::to_response(parts, bytes.into());
10929
10930                        if let common::Retry::After(d) =
10931                            dlg.http_failure(&response, error.as_ref().ok())
10932                        {
10933                            sleep(d).await;
10934                            continue;
10935                        }
10936
10937                        dlg.finished(false);
10938
10939                        return Err(match error {
10940                            Ok(value) => common::Error::BadRequest(value),
10941                            _ => common::Error::Failure(response),
10942                        });
10943                    }
10944                    let response = {
10945                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10946                        let encoded = common::to_string(&bytes);
10947                        match serde_json::from_str(&encoded) {
10948                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10949                            Err(error) => {
10950                                dlg.response_json_decode_error(&encoded, &error);
10951                                return Err(common::Error::JsonDecodeError(
10952                                    encoded.to_string(),
10953                                    error,
10954                                ));
10955                            }
10956                        }
10957                    };
10958
10959                    dlg.finished(true);
10960                    return Ok(response);
10961                }
10962            }
10963        }
10964    }
10965
10966    ///
10967    /// Sets the *request* property to the given value.
10968    ///
10969    /// Even though the property as already been set when instantiating this call,
10970    /// we provide this method for API completeness.
10971    pub fn request(
10972        mut self,
10973        new_value: EventSubscription,
10974    ) -> ProjectLocationConnectionEventSubscriptionPatchCall<'a, C> {
10975        self._request = new_value;
10976        self
10977    }
10978    /// Required. Identifier. Resource name of the EventSubscription. Format: projects/{project}/locations/{location}/connections/{connection}/eventSubscriptions/{event_subscription}
10979    ///
10980    /// Sets the *name* path property to the given value.
10981    ///
10982    /// Even though the property as already been set when instantiating this call,
10983    /// we provide this method for API completeness.
10984    pub fn name(
10985        mut self,
10986        new_value: &str,
10987    ) -> ProjectLocationConnectionEventSubscriptionPatchCall<'a, C> {
10988        self._name = new_value.to_string();
10989        self
10990    }
10991    /// Required. The list of fields to update. Fields are specified relative to the Subscription. A field will be overwritten if it is in the mask. You can modify only the fields listed below. To update the EventSubscription details: * `serviceAccount`
10992    ///
10993    /// Sets the *update mask* query property to the given value.
10994    pub fn update_mask(
10995        mut self,
10996        new_value: common::FieldMask,
10997    ) -> ProjectLocationConnectionEventSubscriptionPatchCall<'a, C> {
10998        self._update_mask = Some(new_value);
10999        self
11000    }
11001    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11002    /// while executing the actual API request.
11003    ///
11004    /// ````text
11005    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11006    /// ````
11007    ///
11008    /// Sets the *delegate* property to the given value.
11009    pub fn delegate(
11010        mut self,
11011        new_value: &'a mut dyn common::Delegate,
11012    ) -> ProjectLocationConnectionEventSubscriptionPatchCall<'a, C> {
11013        self._delegate = Some(new_value);
11014        self
11015    }
11016
11017    /// Set any additional parameter of the query string used in the request.
11018    /// It should be used to set parameters which are not yet available through their own
11019    /// setters.
11020    ///
11021    /// Please note that this method must not be used to set any of the known parameters
11022    /// which have their own setter method. If done anyway, the request will fail.
11023    ///
11024    /// # Additional Parameters
11025    ///
11026    /// * *$.xgafv* (query-string) - V1 error format.
11027    /// * *access_token* (query-string) - OAuth access token.
11028    /// * *alt* (query-string) - Data format for response.
11029    /// * *callback* (query-string) - JSONP
11030    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11031    /// * *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.
11032    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11033    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11034    /// * *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.
11035    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11036    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11037    pub fn param<T>(
11038        mut self,
11039        name: T,
11040        value: T,
11041    ) -> ProjectLocationConnectionEventSubscriptionPatchCall<'a, C>
11042    where
11043        T: AsRef<str>,
11044    {
11045        self._additional_params
11046            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11047        self
11048    }
11049
11050    /// Identifies the authorization scope for the method you are building.
11051    ///
11052    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11053    /// [`Scope::CloudPlatform`].
11054    ///
11055    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11056    /// tokens for more than one scope.
11057    ///
11058    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11059    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11060    /// sufficient, a read-write scope will do as well.
11061    pub fn add_scope<St>(
11062        mut self,
11063        scope: St,
11064    ) -> ProjectLocationConnectionEventSubscriptionPatchCall<'a, C>
11065    where
11066        St: AsRef<str>,
11067    {
11068        self._scopes.insert(String::from(scope.as_ref()));
11069        self
11070    }
11071    /// Identifies the authorization scope(s) for the method you are building.
11072    ///
11073    /// See [`Self::add_scope()`] for details.
11074    pub fn add_scopes<I, St>(
11075        mut self,
11076        scopes: I,
11077    ) -> ProjectLocationConnectionEventSubscriptionPatchCall<'a, C>
11078    where
11079        I: IntoIterator<Item = St>,
11080        St: AsRef<str>,
11081    {
11082        self._scopes
11083            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11084        self
11085    }
11086
11087    /// Removes all scopes, and no default scope will be used either.
11088    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11089    /// for details).
11090    pub fn clear_scopes(mut self) -> ProjectLocationConnectionEventSubscriptionPatchCall<'a, C> {
11091        self._scopes.clear();
11092        self
11093    }
11094}
11095
11096/// RetryEventSubscription retries the registration of Subscription.
11097///
11098/// A builder for the *locations.connections.eventSubscriptions.retry* method supported by a *project* resource.
11099/// It is not used directly, but through a [`ProjectMethods`] instance.
11100///
11101/// # Example
11102///
11103/// Instantiate a resource method builder
11104///
11105/// ```test_harness,no_run
11106/// # extern crate hyper;
11107/// # extern crate hyper_rustls;
11108/// # extern crate google_connectors1 as connectors1;
11109/// use connectors1::api::RetryEventSubscriptionRequest;
11110/// # async fn dox() {
11111/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11112///
11113/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11114/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11115/// #     .with_native_roots()
11116/// #     .unwrap()
11117/// #     .https_only()
11118/// #     .enable_http2()
11119/// #     .build();
11120///
11121/// # let executor = hyper_util::rt::TokioExecutor::new();
11122/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11123/// #     secret,
11124/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11125/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11126/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11127/// #     ),
11128/// # ).build().await.unwrap();
11129///
11130/// # let client = hyper_util::client::legacy::Client::builder(
11131/// #     hyper_util::rt::TokioExecutor::new()
11132/// # )
11133/// # .build(
11134/// #     hyper_rustls::HttpsConnectorBuilder::new()
11135/// #         .with_native_roots()
11136/// #         .unwrap()
11137/// #         .https_or_http()
11138/// #         .enable_http2()
11139/// #         .build()
11140/// # );
11141/// # let mut hub = Connectors::new(client, auth);
11142/// // As the method needs a request, you would usually fill it with the desired information
11143/// // into the respective structure. Some of the parts shown here might not be applicable !
11144/// // Values shown here are possibly random and not representative !
11145/// let mut req = RetryEventSubscriptionRequest::default();
11146///
11147/// // You can configure optional parameters by calling the respective setters at will, and
11148/// // execute the final call using `doit()`.
11149/// // Values shown here are possibly random and not representative !
11150/// let result = hub.projects().locations_connections_event_subscriptions_retry(req, "name")
11151///              .doit().await;
11152/// # }
11153/// ```
11154pub struct ProjectLocationConnectionEventSubscriptionRetryCall<'a, C>
11155where
11156    C: 'a,
11157{
11158    hub: &'a Connectors<C>,
11159    _request: RetryEventSubscriptionRequest,
11160    _name: String,
11161    _delegate: Option<&'a mut dyn common::Delegate>,
11162    _additional_params: HashMap<String, String>,
11163    _scopes: BTreeSet<String>,
11164}
11165
11166impl<'a, C> common::CallBuilder for ProjectLocationConnectionEventSubscriptionRetryCall<'a, C> {}
11167
11168impl<'a, C> ProjectLocationConnectionEventSubscriptionRetryCall<'a, C>
11169where
11170    C: common::Connector,
11171{
11172    /// Perform the operation you have build so far.
11173    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
11174        use std::borrow::Cow;
11175        use std::io::{Read, Seek};
11176
11177        use common::{url::Params, ToParts};
11178        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11179
11180        let mut dd = common::DefaultDelegate;
11181        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11182        dlg.begin(common::MethodInfo {
11183            id: "connectors.projects.locations.connections.eventSubscriptions.retry",
11184            http_method: hyper::Method::POST,
11185        });
11186
11187        for &field in ["alt", "name"].iter() {
11188            if self._additional_params.contains_key(field) {
11189                dlg.finished(false);
11190                return Err(common::Error::FieldClash(field));
11191            }
11192        }
11193
11194        let mut params = Params::with_capacity(4 + self._additional_params.len());
11195        params.push("name", self._name);
11196
11197        params.extend(self._additional_params.iter());
11198
11199        params.push("alt", "json");
11200        let mut url = self.hub._base_url.clone() + "v1/{+name}:retry";
11201        if self._scopes.is_empty() {
11202            self._scopes
11203                .insert(Scope::CloudPlatform.as_ref().to_string());
11204        }
11205
11206        #[allow(clippy::single_element_loop)]
11207        for &(find_this, param_name) in [("{+name}", "name")].iter() {
11208            url = params.uri_replacement(url, param_name, find_this, true);
11209        }
11210        {
11211            let to_remove = ["name"];
11212            params.remove_params(&to_remove);
11213        }
11214
11215        let url = params.parse_with_url(&url);
11216
11217        let mut json_mime_type = mime::APPLICATION_JSON;
11218        let mut request_value_reader = {
11219            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11220            common::remove_json_null_values(&mut value);
11221            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11222            serde_json::to_writer(&mut dst, &value).unwrap();
11223            dst
11224        };
11225        let request_size = request_value_reader
11226            .seek(std::io::SeekFrom::End(0))
11227            .unwrap();
11228        request_value_reader
11229            .seek(std::io::SeekFrom::Start(0))
11230            .unwrap();
11231
11232        loop {
11233            let token = match self
11234                .hub
11235                .auth
11236                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11237                .await
11238            {
11239                Ok(token) => token,
11240                Err(e) => match dlg.token(e) {
11241                    Ok(token) => token,
11242                    Err(e) => {
11243                        dlg.finished(false);
11244                        return Err(common::Error::MissingToken(e));
11245                    }
11246                },
11247            };
11248            request_value_reader
11249                .seek(std::io::SeekFrom::Start(0))
11250                .unwrap();
11251            let mut req_result = {
11252                let client = &self.hub.client;
11253                dlg.pre_request();
11254                let mut req_builder = hyper::Request::builder()
11255                    .method(hyper::Method::POST)
11256                    .uri(url.as_str())
11257                    .header(USER_AGENT, self.hub._user_agent.clone());
11258
11259                if let Some(token) = token.as_ref() {
11260                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11261                }
11262
11263                let request = req_builder
11264                    .header(CONTENT_TYPE, json_mime_type.to_string())
11265                    .header(CONTENT_LENGTH, request_size as u64)
11266                    .body(common::to_body(
11267                        request_value_reader.get_ref().clone().into(),
11268                    ));
11269
11270                client.request(request.unwrap()).await
11271            };
11272
11273            match req_result {
11274                Err(err) => {
11275                    if let common::Retry::After(d) = dlg.http_error(&err) {
11276                        sleep(d).await;
11277                        continue;
11278                    }
11279                    dlg.finished(false);
11280                    return Err(common::Error::HttpError(err));
11281                }
11282                Ok(res) => {
11283                    let (mut parts, body) = res.into_parts();
11284                    let mut body = common::Body::new(body);
11285                    if !parts.status.is_success() {
11286                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11287                        let error = serde_json::from_str(&common::to_string(&bytes));
11288                        let response = common::to_response(parts, bytes.into());
11289
11290                        if let common::Retry::After(d) =
11291                            dlg.http_failure(&response, error.as_ref().ok())
11292                        {
11293                            sleep(d).await;
11294                            continue;
11295                        }
11296
11297                        dlg.finished(false);
11298
11299                        return Err(match error {
11300                            Ok(value) => common::Error::BadRequest(value),
11301                            _ => common::Error::Failure(response),
11302                        });
11303                    }
11304                    let response = {
11305                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11306                        let encoded = common::to_string(&bytes);
11307                        match serde_json::from_str(&encoded) {
11308                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11309                            Err(error) => {
11310                                dlg.response_json_decode_error(&encoded, &error);
11311                                return Err(common::Error::JsonDecodeError(
11312                                    encoded.to_string(),
11313                                    error,
11314                                ));
11315                            }
11316                        }
11317                    };
11318
11319                    dlg.finished(true);
11320                    return Ok(response);
11321                }
11322            }
11323        }
11324    }
11325
11326    ///
11327    /// Sets the *request* property to the given value.
11328    ///
11329    /// Even though the property as already been set when instantiating this call,
11330    /// we provide this method for API completeness.
11331    pub fn request(
11332        mut self,
11333        new_value: RetryEventSubscriptionRequest,
11334    ) -> ProjectLocationConnectionEventSubscriptionRetryCall<'a, C> {
11335        self._request = new_value;
11336        self
11337    }
11338    /// Required. Resource name of the form: `projects/*/locations/*/connections/*/eventSubscriptions/*`
11339    ///
11340    /// Sets the *name* path property to the given value.
11341    ///
11342    /// Even though the property as already been set when instantiating this call,
11343    /// we provide this method for API completeness.
11344    pub fn name(
11345        mut self,
11346        new_value: &str,
11347    ) -> ProjectLocationConnectionEventSubscriptionRetryCall<'a, C> {
11348        self._name = new_value.to_string();
11349        self
11350    }
11351    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11352    /// while executing the actual API request.
11353    ///
11354    /// ````text
11355    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11356    /// ````
11357    ///
11358    /// Sets the *delegate* property to the given value.
11359    pub fn delegate(
11360        mut self,
11361        new_value: &'a mut dyn common::Delegate,
11362    ) -> ProjectLocationConnectionEventSubscriptionRetryCall<'a, C> {
11363        self._delegate = Some(new_value);
11364        self
11365    }
11366
11367    /// Set any additional parameter of the query string used in the request.
11368    /// It should be used to set parameters which are not yet available through their own
11369    /// setters.
11370    ///
11371    /// Please note that this method must not be used to set any of the known parameters
11372    /// which have their own setter method. If done anyway, the request will fail.
11373    ///
11374    /// # Additional Parameters
11375    ///
11376    /// * *$.xgafv* (query-string) - V1 error format.
11377    /// * *access_token* (query-string) - OAuth access token.
11378    /// * *alt* (query-string) - Data format for response.
11379    /// * *callback* (query-string) - JSONP
11380    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11381    /// * *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.
11382    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11383    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11384    /// * *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.
11385    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11386    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11387    pub fn param<T>(
11388        mut self,
11389        name: T,
11390        value: T,
11391    ) -> ProjectLocationConnectionEventSubscriptionRetryCall<'a, C>
11392    where
11393        T: AsRef<str>,
11394    {
11395        self._additional_params
11396            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11397        self
11398    }
11399
11400    /// Identifies the authorization scope for the method you are building.
11401    ///
11402    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11403    /// [`Scope::CloudPlatform`].
11404    ///
11405    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11406    /// tokens for more than one scope.
11407    ///
11408    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11409    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11410    /// sufficient, a read-write scope will do as well.
11411    pub fn add_scope<St>(
11412        mut self,
11413        scope: St,
11414    ) -> ProjectLocationConnectionEventSubscriptionRetryCall<'a, C>
11415    where
11416        St: AsRef<str>,
11417    {
11418        self._scopes.insert(String::from(scope.as_ref()));
11419        self
11420    }
11421    /// Identifies the authorization scope(s) for the method you are building.
11422    ///
11423    /// See [`Self::add_scope()`] for details.
11424    pub fn add_scopes<I, St>(
11425        mut self,
11426        scopes: I,
11427    ) -> ProjectLocationConnectionEventSubscriptionRetryCall<'a, C>
11428    where
11429        I: IntoIterator<Item = St>,
11430        St: AsRef<str>,
11431    {
11432        self._scopes
11433            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11434        self
11435    }
11436
11437    /// Removes all scopes, and no default scope will be used either.
11438    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11439    /// for details).
11440    pub fn clear_scopes(mut self) -> ProjectLocationConnectionEventSubscriptionRetryCall<'a, C> {
11441        self._scopes.clear();
11442        self
11443    }
11444}
11445
11446/// List schema of a runtime actions filtered by action name.
11447///
11448/// A builder for the *locations.connections.runtimeActionSchemas.list* method supported by a *project* resource.
11449/// It is not used directly, but through a [`ProjectMethods`] instance.
11450///
11451/// # Example
11452///
11453/// Instantiate a resource method builder
11454///
11455/// ```test_harness,no_run
11456/// # extern crate hyper;
11457/// # extern crate hyper_rustls;
11458/// # extern crate google_connectors1 as connectors1;
11459/// # async fn dox() {
11460/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11461///
11462/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11463/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11464/// #     .with_native_roots()
11465/// #     .unwrap()
11466/// #     .https_only()
11467/// #     .enable_http2()
11468/// #     .build();
11469///
11470/// # let executor = hyper_util::rt::TokioExecutor::new();
11471/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11472/// #     secret,
11473/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11474/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11475/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11476/// #     ),
11477/// # ).build().await.unwrap();
11478///
11479/// # let client = hyper_util::client::legacy::Client::builder(
11480/// #     hyper_util::rt::TokioExecutor::new()
11481/// # )
11482/// # .build(
11483/// #     hyper_rustls::HttpsConnectorBuilder::new()
11484/// #         .with_native_roots()
11485/// #         .unwrap()
11486/// #         .https_or_http()
11487/// #         .enable_http2()
11488/// #         .build()
11489/// # );
11490/// # let mut hub = Connectors::new(client, auth);
11491/// // You can configure optional parameters by calling the respective setters at will, and
11492/// // execute the final call using `doit()`.
11493/// // Values shown here are possibly random and not representative !
11494/// let result = hub.projects().locations_connections_runtime_action_schemas_list("parent")
11495///              .schema_as_string(true)
11496///              .page_token("et")
11497///              .page_size(-68)
11498///              .filter("vero")
11499///              .doit().await;
11500/// # }
11501/// ```
11502pub struct ProjectLocationConnectionRuntimeActionSchemaListCall<'a, C>
11503where
11504    C: 'a,
11505{
11506    hub: &'a Connectors<C>,
11507    _parent: String,
11508    _schema_as_string: Option<bool>,
11509    _page_token: Option<String>,
11510    _page_size: Option<i32>,
11511    _filter: Option<String>,
11512    _delegate: Option<&'a mut dyn common::Delegate>,
11513    _additional_params: HashMap<String, String>,
11514    _scopes: BTreeSet<String>,
11515}
11516
11517impl<'a, C> common::CallBuilder for ProjectLocationConnectionRuntimeActionSchemaListCall<'a, C> {}
11518
11519impl<'a, C> ProjectLocationConnectionRuntimeActionSchemaListCall<'a, C>
11520where
11521    C: common::Connector,
11522{
11523    /// Perform the operation you have build so far.
11524    pub async fn doit(
11525        mut self,
11526    ) -> common::Result<(common::Response, ListRuntimeActionSchemasResponse)> {
11527        use std::borrow::Cow;
11528        use std::io::{Read, Seek};
11529
11530        use common::{url::Params, ToParts};
11531        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11532
11533        let mut dd = common::DefaultDelegate;
11534        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11535        dlg.begin(common::MethodInfo {
11536            id: "connectors.projects.locations.connections.runtimeActionSchemas.list",
11537            http_method: hyper::Method::GET,
11538        });
11539
11540        for &field in [
11541            "alt",
11542            "parent",
11543            "schemaAsString",
11544            "pageToken",
11545            "pageSize",
11546            "filter",
11547        ]
11548        .iter()
11549        {
11550            if self._additional_params.contains_key(field) {
11551                dlg.finished(false);
11552                return Err(common::Error::FieldClash(field));
11553            }
11554        }
11555
11556        let mut params = Params::with_capacity(7 + self._additional_params.len());
11557        params.push("parent", self._parent);
11558        if let Some(value) = self._schema_as_string.as_ref() {
11559            params.push("schemaAsString", value.to_string());
11560        }
11561        if let Some(value) = self._page_token.as_ref() {
11562            params.push("pageToken", value);
11563        }
11564        if let Some(value) = self._page_size.as_ref() {
11565            params.push("pageSize", value.to_string());
11566        }
11567        if let Some(value) = self._filter.as_ref() {
11568            params.push("filter", value);
11569        }
11570
11571        params.extend(self._additional_params.iter());
11572
11573        params.push("alt", "json");
11574        let mut url = self.hub._base_url.clone() + "v1/{+parent}/runtimeActionSchemas";
11575        if self._scopes.is_empty() {
11576            self._scopes
11577                .insert(Scope::CloudPlatform.as_ref().to_string());
11578        }
11579
11580        #[allow(clippy::single_element_loop)]
11581        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
11582            url = params.uri_replacement(url, param_name, find_this, true);
11583        }
11584        {
11585            let to_remove = ["parent"];
11586            params.remove_params(&to_remove);
11587        }
11588
11589        let url = params.parse_with_url(&url);
11590
11591        loop {
11592            let token = match self
11593                .hub
11594                .auth
11595                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11596                .await
11597            {
11598                Ok(token) => token,
11599                Err(e) => match dlg.token(e) {
11600                    Ok(token) => token,
11601                    Err(e) => {
11602                        dlg.finished(false);
11603                        return Err(common::Error::MissingToken(e));
11604                    }
11605                },
11606            };
11607            let mut req_result = {
11608                let client = &self.hub.client;
11609                dlg.pre_request();
11610                let mut req_builder = hyper::Request::builder()
11611                    .method(hyper::Method::GET)
11612                    .uri(url.as_str())
11613                    .header(USER_AGENT, self.hub._user_agent.clone());
11614
11615                if let Some(token) = token.as_ref() {
11616                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11617                }
11618
11619                let request = req_builder
11620                    .header(CONTENT_LENGTH, 0_u64)
11621                    .body(common::to_body::<String>(None));
11622
11623                client.request(request.unwrap()).await
11624            };
11625
11626            match req_result {
11627                Err(err) => {
11628                    if let common::Retry::After(d) = dlg.http_error(&err) {
11629                        sleep(d).await;
11630                        continue;
11631                    }
11632                    dlg.finished(false);
11633                    return Err(common::Error::HttpError(err));
11634                }
11635                Ok(res) => {
11636                    let (mut parts, body) = res.into_parts();
11637                    let mut body = common::Body::new(body);
11638                    if !parts.status.is_success() {
11639                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11640                        let error = serde_json::from_str(&common::to_string(&bytes));
11641                        let response = common::to_response(parts, bytes.into());
11642
11643                        if let common::Retry::After(d) =
11644                            dlg.http_failure(&response, error.as_ref().ok())
11645                        {
11646                            sleep(d).await;
11647                            continue;
11648                        }
11649
11650                        dlg.finished(false);
11651
11652                        return Err(match error {
11653                            Ok(value) => common::Error::BadRequest(value),
11654                            _ => common::Error::Failure(response),
11655                        });
11656                    }
11657                    let response = {
11658                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11659                        let encoded = common::to_string(&bytes);
11660                        match serde_json::from_str(&encoded) {
11661                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11662                            Err(error) => {
11663                                dlg.response_json_decode_error(&encoded, &error);
11664                                return Err(common::Error::JsonDecodeError(
11665                                    encoded.to_string(),
11666                                    error,
11667                                ));
11668                            }
11669                        }
11670                    };
11671
11672                    dlg.finished(true);
11673                    return Ok(response);
11674                }
11675            }
11676        }
11677    }
11678
11679    /// Required. Parent resource of RuntimeActionSchema Format: projects/{project}/locations/{location}/connections/{connection}
11680    ///
11681    /// Sets the *parent* path property to the given value.
11682    ///
11683    /// Even though the property as already been set when instantiating this call,
11684    /// we provide this method for API completeness.
11685    pub fn parent(
11686        mut self,
11687        new_value: &str,
11688    ) -> ProjectLocationConnectionRuntimeActionSchemaListCall<'a, C> {
11689        self._parent = new_value.to_string();
11690        self
11691    }
11692    /// Optional. Flag to indicate if schema should be returned as string or not
11693    ///
11694    /// Sets the *schema as string* query property to the given value.
11695    pub fn schema_as_string(
11696        mut self,
11697        new_value: bool,
11698    ) -> ProjectLocationConnectionRuntimeActionSchemaListCall<'a, C> {
11699        self._schema_as_string = Some(new_value);
11700        self
11701    }
11702    /// Page token.
11703    ///
11704    /// Sets the *page token* query property to the given value.
11705    pub fn page_token(
11706        mut self,
11707        new_value: &str,
11708    ) -> ProjectLocationConnectionRuntimeActionSchemaListCall<'a, C> {
11709        self._page_token = Some(new_value.to_string());
11710        self
11711    }
11712    /// Page size.
11713    ///
11714    /// Sets the *page size* query property to the given value.
11715    pub fn page_size(
11716        mut self,
11717        new_value: i32,
11718    ) -> ProjectLocationConnectionRuntimeActionSchemaListCall<'a, C> {
11719        self._page_size = Some(new_value);
11720        self
11721    }
11722    /// Required. Filter Format: action="{actionId}" Only action field is supported with literal equality operator. Accepted filter example: action="CancelOrder" Wildcards are not supported in the filter currently.
11723    ///
11724    /// Sets the *filter* query property to the given value.
11725    pub fn filter(
11726        mut self,
11727        new_value: &str,
11728    ) -> ProjectLocationConnectionRuntimeActionSchemaListCall<'a, C> {
11729        self._filter = Some(new_value.to_string());
11730        self
11731    }
11732    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11733    /// while executing the actual API request.
11734    ///
11735    /// ````text
11736    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11737    /// ````
11738    ///
11739    /// Sets the *delegate* property to the given value.
11740    pub fn delegate(
11741        mut self,
11742        new_value: &'a mut dyn common::Delegate,
11743    ) -> ProjectLocationConnectionRuntimeActionSchemaListCall<'a, C> {
11744        self._delegate = Some(new_value);
11745        self
11746    }
11747
11748    /// Set any additional parameter of the query string used in the request.
11749    /// It should be used to set parameters which are not yet available through their own
11750    /// setters.
11751    ///
11752    /// Please note that this method must not be used to set any of the known parameters
11753    /// which have their own setter method. If done anyway, the request will fail.
11754    ///
11755    /// # Additional Parameters
11756    ///
11757    /// * *$.xgafv* (query-string) - V1 error format.
11758    /// * *access_token* (query-string) - OAuth access token.
11759    /// * *alt* (query-string) - Data format for response.
11760    /// * *callback* (query-string) - JSONP
11761    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11762    /// * *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.
11763    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11764    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11765    /// * *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.
11766    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11767    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11768    pub fn param<T>(
11769        mut self,
11770        name: T,
11771        value: T,
11772    ) -> ProjectLocationConnectionRuntimeActionSchemaListCall<'a, C>
11773    where
11774        T: AsRef<str>,
11775    {
11776        self._additional_params
11777            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11778        self
11779    }
11780
11781    /// Identifies the authorization scope for the method you are building.
11782    ///
11783    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11784    /// [`Scope::CloudPlatform`].
11785    ///
11786    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11787    /// tokens for more than one scope.
11788    ///
11789    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11790    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11791    /// sufficient, a read-write scope will do as well.
11792    pub fn add_scope<St>(
11793        mut self,
11794        scope: St,
11795    ) -> ProjectLocationConnectionRuntimeActionSchemaListCall<'a, C>
11796    where
11797        St: AsRef<str>,
11798    {
11799        self._scopes.insert(String::from(scope.as_ref()));
11800        self
11801    }
11802    /// Identifies the authorization scope(s) for the method you are building.
11803    ///
11804    /// See [`Self::add_scope()`] for details.
11805    pub fn add_scopes<I, St>(
11806        mut self,
11807        scopes: I,
11808    ) -> ProjectLocationConnectionRuntimeActionSchemaListCall<'a, C>
11809    where
11810        I: IntoIterator<Item = St>,
11811        St: AsRef<str>,
11812    {
11813        self._scopes
11814            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11815        self
11816    }
11817
11818    /// Removes all scopes, and no default scope will be used either.
11819    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11820    /// for details).
11821    pub fn clear_scopes(mut self) -> ProjectLocationConnectionRuntimeActionSchemaListCall<'a, C> {
11822        self._scopes.clear();
11823        self
11824    }
11825}
11826
11827/// List schema of a runtime entities filtered by entity name.
11828///
11829/// A builder for the *locations.connections.runtimeEntitySchemas.list* method supported by a *project* resource.
11830/// It is not used directly, but through a [`ProjectMethods`] instance.
11831///
11832/// # Example
11833///
11834/// Instantiate a resource method builder
11835///
11836/// ```test_harness,no_run
11837/// # extern crate hyper;
11838/// # extern crate hyper_rustls;
11839/// # extern crate google_connectors1 as connectors1;
11840/// # async fn dox() {
11841/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11842///
11843/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11844/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11845/// #     .with_native_roots()
11846/// #     .unwrap()
11847/// #     .https_only()
11848/// #     .enable_http2()
11849/// #     .build();
11850///
11851/// # let executor = hyper_util::rt::TokioExecutor::new();
11852/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11853/// #     secret,
11854/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11855/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11856/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11857/// #     ),
11858/// # ).build().await.unwrap();
11859///
11860/// # let client = hyper_util::client::legacy::Client::builder(
11861/// #     hyper_util::rt::TokioExecutor::new()
11862/// # )
11863/// # .build(
11864/// #     hyper_rustls::HttpsConnectorBuilder::new()
11865/// #         .with_native_roots()
11866/// #         .unwrap()
11867/// #         .https_or_http()
11868/// #         .enable_http2()
11869/// #         .build()
11870/// # );
11871/// # let mut hub = Connectors::new(client, auth);
11872/// // You can configure optional parameters by calling the respective setters at will, and
11873/// // execute the final call using `doit()`.
11874/// // Values shown here are possibly random and not representative !
11875/// let result = hub.projects().locations_connections_runtime_entity_schemas_list("parent")
11876///              .page_token("sed")
11877///              .page_size(-20)
11878///              .filter("dolore")
11879///              .doit().await;
11880/// # }
11881/// ```
11882pub struct ProjectLocationConnectionRuntimeEntitySchemaListCall<'a, C>
11883where
11884    C: 'a,
11885{
11886    hub: &'a Connectors<C>,
11887    _parent: String,
11888    _page_token: Option<String>,
11889    _page_size: Option<i32>,
11890    _filter: Option<String>,
11891    _delegate: Option<&'a mut dyn common::Delegate>,
11892    _additional_params: HashMap<String, String>,
11893    _scopes: BTreeSet<String>,
11894}
11895
11896impl<'a, C> common::CallBuilder for ProjectLocationConnectionRuntimeEntitySchemaListCall<'a, C> {}
11897
11898impl<'a, C> ProjectLocationConnectionRuntimeEntitySchemaListCall<'a, C>
11899where
11900    C: common::Connector,
11901{
11902    /// Perform the operation you have build so far.
11903    pub async fn doit(
11904        mut self,
11905    ) -> common::Result<(common::Response, ListRuntimeEntitySchemasResponse)> {
11906        use std::borrow::Cow;
11907        use std::io::{Read, Seek};
11908
11909        use common::{url::Params, ToParts};
11910        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11911
11912        let mut dd = common::DefaultDelegate;
11913        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11914        dlg.begin(common::MethodInfo {
11915            id: "connectors.projects.locations.connections.runtimeEntitySchemas.list",
11916            http_method: hyper::Method::GET,
11917        });
11918
11919        for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
11920            if self._additional_params.contains_key(field) {
11921                dlg.finished(false);
11922                return Err(common::Error::FieldClash(field));
11923            }
11924        }
11925
11926        let mut params = Params::with_capacity(6 + self._additional_params.len());
11927        params.push("parent", self._parent);
11928        if let Some(value) = self._page_token.as_ref() {
11929            params.push("pageToken", value);
11930        }
11931        if let Some(value) = self._page_size.as_ref() {
11932            params.push("pageSize", value.to_string());
11933        }
11934        if let Some(value) = self._filter.as_ref() {
11935            params.push("filter", value);
11936        }
11937
11938        params.extend(self._additional_params.iter());
11939
11940        params.push("alt", "json");
11941        let mut url = self.hub._base_url.clone() + "v1/{+parent}/runtimeEntitySchemas";
11942        if self._scopes.is_empty() {
11943            self._scopes
11944                .insert(Scope::CloudPlatform.as_ref().to_string());
11945        }
11946
11947        #[allow(clippy::single_element_loop)]
11948        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
11949            url = params.uri_replacement(url, param_name, find_this, true);
11950        }
11951        {
11952            let to_remove = ["parent"];
11953            params.remove_params(&to_remove);
11954        }
11955
11956        let url = params.parse_with_url(&url);
11957
11958        loop {
11959            let token = match self
11960                .hub
11961                .auth
11962                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11963                .await
11964            {
11965                Ok(token) => token,
11966                Err(e) => match dlg.token(e) {
11967                    Ok(token) => token,
11968                    Err(e) => {
11969                        dlg.finished(false);
11970                        return Err(common::Error::MissingToken(e));
11971                    }
11972                },
11973            };
11974            let mut req_result = {
11975                let client = &self.hub.client;
11976                dlg.pre_request();
11977                let mut req_builder = hyper::Request::builder()
11978                    .method(hyper::Method::GET)
11979                    .uri(url.as_str())
11980                    .header(USER_AGENT, self.hub._user_agent.clone());
11981
11982                if let Some(token) = token.as_ref() {
11983                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11984                }
11985
11986                let request = req_builder
11987                    .header(CONTENT_LENGTH, 0_u64)
11988                    .body(common::to_body::<String>(None));
11989
11990                client.request(request.unwrap()).await
11991            };
11992
11993            match req_result {
11994                Err(err) => {
11995                    if let common::Retry::After(d) = dlg.http_error(&err) {
11996                        sleep(d).await;
11997                        continue;
11998                    }
11999                    dlg.finished(false);
12000                    return Err(common::Error::HttpError(err));
12001                }
12002                Ok(res) => {
12003                    let (mut parts, body) = res.into_parts();
12004                    let mut body = common::Body::new(body);
12005                    if !parts.status.is_success() {
12006                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12007                        let error = serde_json::from_str(&common::to_string(&bytes));
12008                        let response = common::to_response(parts, bytes.into());
12009
12010                        if let common::Retry::After(d) =
12011                            dlg.http_failure(&response, error.as_ref().ok())
12012                        {
12013                            sleep(d).await;
12014                            continue;
12015                        }
12016
12017                        dlg.finished(false);
12018
12019                        return Err(match error {
12020                            Ok(value) => common::Error::BadRequest(value),
12021                            _ => common::Error::Failure(response),
12022                        });
12023                    }
12024                    let response = {
12025                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12026                        let encoded = common::to_string(&bytes);
12027                        match serde_json::from_str(&encoded) {
12028                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12029                            Err(error) => {
12030                                dlg.response_json_decode_error(&encoded, &error);
12031                                return Err(common::Error::JsonDecodeError(
12032                                    encoded.to_string(),
12033                                    error,
12034                                ));
12035                            }
12036                        }
12037                    };
12038
12039                    dlg.finished(true);
12040                    return Ok(response);
12041                }
12042            }
12043        }
12044    }
12045
12046    /// Required. Parent resource of RuntimeEntitySchema Format: projects/{project}/locations/{location}/connections/{connection}
12047    ///
12048    /// Sets the *parent* path property to the given value.
12049    ///
12050    /// Even though the property as already been set when instantiating this call,
12051    /// we provide this method for API completeness.
12052    pub fn parent(
12053        mut self,
12054        new_value: &str,
12055    ) -> ProjectLocationConnectionRuntimeEntitySchemaListCall<'a, C> {
12056        self._parent = new_value.to_string();
12057        self
12058    }
12059    /// Page token.
12060    ///
12061    /// Sets the *page token* query property to the given value.
12062    pub fn page_token(
12063        mut self,
12064        new_value: &str,
12065    ) -> ProjectLocationConnectionRuntimeEntitySchemaListCall<'a, C> {
12066        self._page_token = Some(new_value.to_string());
12067        self
12068    }
12069    /// Page size.
12070    ///
12071    /// Sets the *page size* query property to the given value.
12072    pub fn page_size(
12073        mut self,
12074        new_value: i32,
12075    ) -> ProjectLocationConnectionRuntimeEntitySchemaListCall<'a, C> {
12076        self._page_size = Some(new_value);
12077        self
12078    }
12079    /// Required. Filter Format: entity="{entityId}" Only entity field is supported with literal equality operator. Accepted filter example: entity="Order" Wildcards are not supported in the filter currently.
12080    ///
12081    /// Sets the *filter* query property to the given value.
12082    pub fn filter(
12083        mut self,
12084        new_value: &str,
12085    ) -> ProjectLocationConnectionRuntimeEntitySchemaListCall<'a, C> {
12086        self._filter = Some(new_value.to_string());
12087        self
12088    }
12089    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12090    /// while executing the actual API request.
12091    ///
12092    /// ````text
12093    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12094    /// ````
12095    ///
12096    /// Sets the *delegate* property to the given value.
12097    pub fn delegate(
12098        mut self,
12099        new_value: &'a mut dyn common::Delegate,
12100    ) -> ProjectLocationConnectionRuntimeEntitySchemaListCall<'a, C> {
12101        self._delegate = Some(new_value);
12102        self
12103    }
12104
12105    /// Set any additional parameter of the query string used in the request.
12106    /// It should be used to set parameters which are not yet available through their own
12107    /// setters.
12108    ///
12109    /// Please note that this method must not be used to set any of the known parameters
12110    /// which have their own setter method. If done anyway, the request will fail.
12111    ///
12112    /// # Additional Parameters
12113    ///
12114    /// * *$.xgafv* (query-string) - V1 error format.
12115    /// * *access_token* (query-string) - OAuth access token.
12116    /// * *alt* (query-string) - Data format for response.
12117    /// * *callback* (query-string) - JSONP
12118    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12119    /// * *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.
12120    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12121    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12122    /// * *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.
12123    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12124    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12125    pub fn param<T>(
12126        mut self,
12127        name: T,
12128        value: T,
12129    ) -> ProjectLocationConnectionRuntimeEntitySchemaListCall<'a, C>
12130    where
12131        T: AsRef<str>,
12132    {
12133        self._additional_params
12134            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12135        self
12136    }
12137
12138    /// Identifies the authorization scope for the method you are building.
12139    ///
12140    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12141    /// [`Scope::CloudPlatform`].
12142    ///
12143    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12144    /// tokens for more than one scope.
12145    ///
12146    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12147    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12148    /// sufficient, a read-write scope will do as well.
12149    pub fn add_scope<St>(
12150        mut self,
12151        scope: St,
12152    ) -> ProjectLocationConnectionRuntimeEntitySchemaListCall<'a, C>
12153    where
12154        St: AsRef<str>,
12155    {
12156        self._scopes.insert(String::from(scope.as_ref()));
12157        self
12158    }
12159    /// Identifies the authorization scope(s) for the method you are building.
12160    ///
12161    /// See [`Self::add_scope()`] for details.
12162    pub fn add_scopes<I, St>(
12163        mut self,
12164        scopes: I,
12165    ) -> ProjectLocationConnectionRuntimeEntitySchemaListCall<'a, C>
12166    where
12167        I: IntoIterator<Item = St>,
12168        St: AsRef<str>,
12169    {
12170        self._scopes
12171            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12172        self
12173    }
12174
12175    /// Removes all scopes, and no default scope will be used either.
12176    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12177    /// for details).
12178    pub fn clear_scopes(mut self) -> ProjectLocationConnectionRuntimeEntitySchemaListCall<'a, C> {
12179        self._scopes.clear();
12180        self
12181    }
12182}
12183
12184/// Creates a new Connection in a given project and location.
12185///
12186/// A builder for the *locations.connections.create* method supported by a *project* resource.
12187/// It is not used directly, but through a [`ProjectMethods`] instance.
12188///
12189/// # Example
12190///
12191/// Instantiate a resource method builder
12192///
12193/// ```test_harness,no_run
12194/// # extern crate hyper;
12195/// # extern crate hyper_rustls;
12196/// # extern crate google_connectors1 as connectors1;
12197/// use connectors1::api::Connection;
12198/// # async fn dox() {
12199/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12200///
12201/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12202/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12203/// #     .with_native_roots()
12204/// #     .unwrap()
12205/// #     .https_only()
12206/// #     .enable_http2()
12207/// #     .build();
12208///
12209/// # let executor = hyper_util::rt::TokioExecutor::new();
12210/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12211/// #     secret,
12212/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12213/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12214/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12215/// #     ),
12216/// # ).build().await.unwrap();
12217///
12218/// # let client = hyper_util::client::legacy::Client::builder(
12219/// #     hyper_util::rt::TokioExecutor::new()
12220/// # )
12221/// # .build(
12222/// #     hyper_rustls::HttpsConnectorBuilder::new()
12223/// #         .with_native_roots()
12224/// #         .unwrap()
12225/// #         .https_or_http()
12226/// #         .enable_http2()
12227/// #         .build()
12228/// # );
12229/// # let mut hub = Connectors::new(client, auth);
12230/// // As the method needs a request, you would usually fill it with the desired information
12231/// // into the respective structure. Some of the parts shown here might not be applicable !
12232/// // Values shown here are possibly random and not representative !
12233/// let mut req = Connection::default();
12234///
12235/// // You can configure optional parameters by calling the respective setters at will, and
12236/// // execute the final call using `doit()`.
12237/// // Values shown here are possibly random and not representative !
12238/// let result = hub.projects().locations_connections_create(req, "parent")
12239///              .connection_id("voluptua.")
12240///              .doit().await;
12241/// # }
12242/// ```
12243pub struct ProjectLocationConnectionCreateCall<'a, C>
12244where
12245    C: 'a,
12246{
12247    hub: &'a Connectors<C>,
12248    _request: Connection,
12249    _parent: String,
12250    _connection_id: Option<String>,
12251    _delegate: Option<&'a mut dyn common::Delegate>,
12252    _additional_params: HashMap<String, String>,
12253    _scopes: BTreeSet<String>,
12254}
12255
12256impl<'a, C> common::CallBuilder for ProjectLocationConnectionCreateCall<'a, C> {}
12257
12258impl<'a, C> ProjectLocationConnectionCreateCall<'a, C>
12259where
12260    C: common::Connector,
12261{
12262    /// Perform the operation you have build so far.
12263    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
12264        use std::borrow::Cow;
12265        use std::io::{Read, Seek};
12266
12267        use common::{url::Params, ToParts};
12268        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12269
12270        let mut dd = common::DefaultDelegate;
12271        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12272        dlg.begin(common::MethodInfo {
12273            id: "connectors.projects.locations.connections.create",
12274            http_method: hyper::Method::POST,
12275        });
12276
12277        for &field in ["alt", "parent", "connectionId"].iter() {
12278            if self._additional_params.contains_key(field) {
12279                dlg.finished(false);
12280                return Err(common::Error::FieldClash(field));
12281            }
12282        }
12283
12284        let mut params = Params::with_capacity(5 + self._additional_params.len());
12285        params.push("parent", self._parent);
12286        if let Some(value) = self._connection_id.as_ref() {
12287            params.push("connectionId", value);
12288        }
12289
12290        params.extend(self._additional_params.iter());
12291
12292        params.push("alt", "json");
12293        let mut url = self.hub._base_url.clone() + "v1/{+parent}/connections";
12294        if self._scopes.is_empty() {
12295            self._scopes
12296                .insert(Scope::CloudPlatform.as_ref().to_string());
12297        }
12298
12299        #[allow(clippy::single_element_loop)]
12300        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
12301            url = params.uri_replacement(url, param_name, find_this, true);
12302        }
12303        {
12304            let to_remove = ["parent"];
12305            params.remove_params(&to_remove);
12306        }
12307
12308        let url = params.parse_with_url(&url);
12309
12310        let mut json_mime_type = mime::APPLICATION_JSON;
12311        let mut request_value_reader = {
12312            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12313            common::remove_json_null_values(&mut value);
12314            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12315            serde_json::to_writer(&mut dst, &value).unwrap();
12316            dst
12317        };
12318        let request_size = request_value_reader
12319            .seek(std::io::SeekFrom::End(0))
12320            .unwrap();
12321        request_value_reader
12322            .seek(std::io::SeekFrom::Start(0))
12323            .unwrap();
12324
12325        loop {
12326            let token = match self
12327                .hub
12328                .auth
12329                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12330                .await
12331            {
12332                Ok(token) => token,
12333                Err(e) => match dlg.token(e) {
12334                    Ok(token) => token,
12335                    Err(e) => {
12336                        dlg.finished(false);
12337                        return Err(common::Error::MissingToken(e));
12338                    }
12339                },
12340            };
12341            request_value_reader
12342                .seek(std::io::SeekFrom::Start(0))
12343                .unwrap();
12344            let mut req_result = {
12345                let client = &self.hub.client;
12346                dlg.pre_request();
12347                let mut req_builder = hyper::Request::builder()
12348                    .method(hyper::Method::POST)
12349                    .uri(url.as_str())
12350                    .header(USER_AGENT, self.hub._user_agent.clone());
12351
12352                if let Some(token) = token.as_ref() {
12353                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12354                }
12355
12356                let request = req_builder
12357                    .header(CONTENT_TYPE, json_mime_type.to_string())
12358                    .header(CONTENT_LENGTH, request_size as u64)
12359                    .body(common::to_body(
12360                        request_value_reader.get_ref().clone().into(),
12361                    ));
12362
12363                client.request(request.unwrap()).await
12364            };
12365
12366            match req_result {
12367                Err(err) => {
12368                    if let common::Retry::After(d) = dlg.http_error(&err) {
12369                        sleep(d).await;
12370                        continue;
12371                    }
12372                    dlg.finished(false);
12373                    return Err(common::Error::HttpError(err));
12374                }
12375                Ok(res) => {
12376                    let (mut parts, body) = res.into_parts();
12377                    let mut body = common::Body::new(body);
12378                    if !parts.status.is_success() {
12379                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12380                        let error = serde_json::from_str(&common::to_string(&bytes));
12381                        let response = common::to_response(parts, bytes.into());
12382
12383                        if let common::Retry::After(d) =
12384                            dlg.http_failure(&response, error.as_ref().ok())
12385                        {
12386                            sleep(d).await;
12387                            continue;
12388                        }
12389
12390                        dlg.finished(false);
12391
12392                        return Err(match error {
12393                            Ok(value) => common::Error::BadRequest(value),
12394                            _ => common::Error::Failure(response),
12395                        });
12396                    }
12397                    let response = {
12398                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12399                        let encoded = common::to_string(&bytes);
12400                        match serde_json::from_str(&encoded) {
12401                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12402                            Err(error) => {
12403                                dlg.response_json_decode_error(&encoded, &error);
12404                                return Err(common::Error::JsonDecodeError(
12405                                    encoded.to_string(),
12406                                    error,
12407                                ));
12408                            }
12409                        }
12410                    };
12411
12412                    dlg.finished(true);
12413                    return Ok(response);
12414                }
12415            }
12416        }
12417    }
12418
12419    ///
12420    /// Sets the *request* property to the given value.
12421    ///
12422    /// Even though the property as already been set when instantiating this call,
12423    /// we provide this method for API completeness.
12424    pub fn request(mut self, new_value: Connection) -> ProjectLocationConnectionCreateCall<'a, C> {
12425        self._request = new_value;
12426        self
12427    }
12428    /// Required. Parent resource of the Connection, of the form: `projects/*/locations/*`
12429    ///
12430    /// Sets the *parent* path property to the given value.
12431    ///
12432    /// Even though the property as already been set when instantiating this call,
12433    /// we provide this method for API completeness.
12434    pub fn parent(mut self, new_value: &str) -> ProjectLocationConnectionCreateCall<'a, C> {
12435        self._parent = new_value.to_string();
12436        self
12437    }
12438    /// Required. Identifier to assign to the Connection. Must be unique within scope of the parent resource.
12439    ///
12440    /// Sets the *connection id* query property to the given value.
12441    pub fn connection_id(mut self, new_value: &str) -> ProjectLocationConnectionCreateCall<'a, C> {
12442        self._connection_id = Some(new_value.to_string());
12443        self
12444    }
12445    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12446    /// while executing the actual API request.
12447    ///
12448    /// ````text
12449    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12450    /// ````
12451    ///
12452    /// Sets the *delegate* property to the given value.
12453    pub fn delegate(
12454        mut self,
12455        new_value: &'a mut dyn common::Delegate,
12456    ) -> ProjectLocationConnectionCreateCall<'a, C> {
12457        self._delegate = Some(new_value);
12458        self
12459    }
12460
12461    /// Set any additional parameter of the query string used in the request.
12462    /// It should be used to set parameters which are not yet available through their own
12463    /// setters.
12464    ///
12465    /// Please note that this method must not be used to set any of the known parameters
12466    /// which have their own setter method. If done anyway, the request will fail.
12467    ///
12468    /// # Additional Parameters
12469    ///
12470    /// * *$.xgafv* (query-string) - V1 error format.
12471    /// * *access_token* (query-string) - OAuth access token.
12472    /// * *alt* (query-string) - Data format for response.
12473    /// * *callback* (query-string) - JSONP
12474    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12475    /// * *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.
12476    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12477    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12478    /// * *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.
12479    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12480    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12481    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationConnectionCreateCall<'a, C>
12482    where
12483        T: AsRef<str>,
12484    {
12485        self._additional_params
12486            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12487        self
12488    }
12489
12490    /// Identifies the authorization scope for the method you are building.
12491    ///
12492    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12493    /// [`Scope::CloudPlatform`].
12494    ///
12495    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12496    /// tokens for more than one scope.
12497    ///
12498    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12499    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12500    /// sufficient, a read-write scope will do as well.
12501    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionCreateCall<'a, C>
12502    where
12503        St: AsRef<str>,
12504    {
12505        self._scopes.insert(String::from(scope.as_ref()));
12506        self
12507    }
12508    /// Identifies the authorization scope(s) for the method you are building.
12509    ///
12510    /// See [`Self::add_scope()`] for details.
12511    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationConnectionCreateCall<'a, C>
12512    where
12513        I: IntoIterator<Item = St>,
12514        St: AsRef<str>,
12515    {
12516        self._scopes
12517            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12518        self
12519    }
12520
12521    /// Removes all scopes, and no default scope will be used either.
12522    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12523    /// for details).
12524    pub fn clear_scopes(mut self) -> ProjectLocationConnectionCreateCall<'a, C> {
12525        self._scopes.clear();
12526        self
12527    }
12528}
12529
12530/// Deletes a single Connection.
12531///
12532/// A builder for the *locations.connections.delete* method supported by a *project* resource.
12533/// It is not used directly, but through a [`ProjectMethods`] instance.
12534///
12535/// # Example
12536///
12537/// Instantiate a resource method builder
12538///
12539/// ```test_harness,no_run
12540/// # extern crate hyper;
12541/// # extern crate hyper_rustls;
12542/// # extern crate google_connectors1 as connectors1;
12543/// # async fn dox() {
12544/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12545///
12546/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12547/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12548/// #     .with_native_roots()
12549/// #     .unwrap()
12550/// #     .https_only()
12551/// #     .enable_http2()
12552/// #     .build();
12553///
12554/// # let executor = hyper_util::rt::TokioExecutor::new();
12555/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12556/// #     secret,
12557/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12558/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12559/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12560/// #     ),
12561/// # ).build().await.unwrap();
12562///
12563/// # let client = hyper_util::client::legacy::Client::builder(
12564/// #     hyper_util::rt::TokioExecutor::new()
12565/// # )
12566/// # .build(
12567/// #     hyper_rustls::HttpsConnectorBuilder::new()
12568/// #         .with_native_roots()
12569/// #         .unwrap()
12570/// #         .https_or_http()
12571/// #         .enable_http2()
12572/// #         .build()
12573/// # );
12574/// # let mut hub = Connectors::new(client, auth);
12575/// // You can configure optional parameters by calling the respective setters at will, and
12576/// // execute the final call using `doit()`.
12577/// // Values shown here are possibly random and not representative !
12578/// let result = hub.projects().locations_connections_delete("name")
12579///              .force(false)
12580///              .doit().await;
12581/// # }
12582/// ```
12583pub struct ProjectLocationConnectionDeleteCall<'a, C>
12584where
12585    C: 'a,
12586{
12587    hub: &'a Connectors<C>,
12588    _name: String,
12589    _force: Option<bool>,
12590    _delegate: Option<&'a mut dyn common::Delegate>,
12591    _additional_params: HashMap<String, String>,
12592    _scopes: BTreeSet<String>,
12593}
12594
12595impl<'a, C> common::CallBuilder for ProjectLocationConnectionDeleteCall<'a, C> {}
12596
12597impl<'a, C> ProjectLocationConnectionDeleteCall<'a, C>
12598where
12599    C: common::Connector,
12600{
12601    /// Perform the operation you have build so far.
12602    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
12603        use std::borrow::Cow;
12604        use std::io::{Read, Seek};
12605
12606        use common::{url::Params, ToParts};
12607        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12608
12609        let mut dd = common::DefaultDelegate;
12610        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12611        dlg.begin(common::MethodInfo {
12612            id: "connectors.projects.locations.connections.delete",
12613            http_method: hyper::Method::DELETE,
12614        });
12615
12616        for &field in ["alt", "name", "force"].iter() {
12617            if self._additional_params.contains_key(field) {
12618                dlg.finished(false);
12619                return Err(common::Error::FieldClash(field));
12620            }
12621        }
12622
12623        let mut params = Params::with_capacity(4 + self._additional_params.len());
12624        params.push("name", self._name);
12625        if let Some(value) = self._force.as_ref() {
12626            params.push("force", value.to_string());
12627        }
12628
12629        params.extend(self._additional_params.iter());
12630
12631        params.push("alt", "json");
12632        let mut url = self.hub._base_url.clone() + "v1/{+name}";
12633        if self._scopes.is_empty() {
12634            self._scopes
12635                .insert(Scope::CloudPlatform.as_ref().to_string());
12636        }
12637
12638        #[allow(clippy::single_element_loop)]
12639        for &(find_this, param_name) in [("{+name}", "name")].iter() {
12640            url = params.uri_replacement(url, param_name, find_this, true);
12641        }
12642        {
12643            let to_remove = ["name"];
12644            params.remove_params(&to_remove);
12645        }
12646
12647        let url = params.parse_with_url(&url);
12648
12649        loop {
12650            let token = match self
12651                .hub
12652                .auth
12653                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12654                .await
12655            {
12656                Ok(token) => token,
12657                Err(e) => match dlg.token(e) {
12658                    Ok(token) => token,
12659                    Err(e) => {
12660                        dlg.finished(false);
12661                        return Err(common::Error::MissingToken(e));
12662                    }
12663                },
12664            };
12665            let mut req_result = {
12666                let client = &self.hub.client;
12667                dlg.pre_request();
12668                let mut req_builder = hyper::Request::builder()
12669                    .method(hyper::Method::DELETE)
12670                    .uri(url.as_str())
12671                    .header(USER_AGENT, self.hub._user_agent.clone());
12672
12673                if let Some(token) = token.as_ref() {
12674                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12675                }
12676
12677                let request = req_builder
12678                    .header(CONTENT_LENGTH, 0_u64)
12679                    .body(common::to_body::<String>(None));
12680
12681                client.request(request.unwrap()).await
12682            };
12683
12684            match req_result {
12685                Err(err) => {
12686                    if let common::Retry::After(d) = dlg.http_error(&err) {
12687                        sleep(d).await;
12688                        continue;
12689                    }
12690                    dlg.finished(false);
12691                    return Err(common::Error::HttpError(err));
12692                }
12693                Ok(res) => {
12694                    let (mut parts, body) = res.into_parts();
12695                    let mut body = common::Body::new(body);
12696                    if !parts.status.is_success() {
12697                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12698                        let error = serde_json::from_str(&common::to_string(&bytes));
12699                        let response = common::to_response(parts, bytes.into());
12700
12701                        if let common::Retry::After(d) =
12702                            dlg.http_failure(&response, error.as_ref().ok())
12703                        {
12704                            sleep(d).await;
12705                            continue;
12706                        }
12707
12708                        dlg.finished(false);
12709
12710                        return Err(match error {
12711                            Ok(value) => common::Error::BadRequest(value),
12712                            _ => common::Error::Failure(response),
12713                        });
12714                    }
12715                    let response = {
12716                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12717                        let encoded = common::to_string(&bytes);
12718                        match serde_json::from_str(&encoded) {
12719                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12720                            Err(error) => {
12721                                dlg.response_json_decode_error(&encoded, &error);
12722                                return Err(common::Error::JsonDecodeError(
12723                                    encoded.to_string(),
12724                                    error,
12725                                ));
12726                            }
12727                        }
12728                    };
12729
12730                    dlg.finished(true);
12731                    return Ok(response);
12732                }
12733            }
12734        }
12735    }
12736
12737    /// Required. Resource name of the form: `projects/*/locations/*/connections/*`
12738    ///
12739    /// Sets the *name* path property to the given value.
12740    ///
12741    /// Even though the property as already been set when instantiating this call,
12742    /// we provide this method for API completeness.
12743    pub fn name(mut self, new_value: &str) -> ProjectLocationConnectionDeleteCall<'a, C> {
12744        self._name = new_value.to_string();
12745        self
12746    }
12747    /// Optional. If set to true, any child EndUserAuthentication/EventSubscription resources will also be deleted. Otherwise, the request will fail if the connection has any children. Followed the best practice from https://aip.dev/135#cascading-delete
12748    ///
12749    /// Sets the *force* query property to the given value.
12750    pub fn force(mut self, new_value: bool) -> ProjectLocationConnectionDeleteCall<'a, C> {
12751        self._force = Some(new_value);
12752        self
12753    }
12754    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12755    /// while executing the actual API request.
12756    ///
12757    /// ````text
12758    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12759    /// ````
12760    ///
12761    /// Sets the *delegate* property to the given value.
12762    pub fn delegate(
12763        mut self,
12764        new_value: &'a mut dyn common::Delegate,
12765    ) -> ProjectLocationConnectionDeleteCall<'a, C> {
12766        self._delegate = Some(new_value);
12767        self
12768    }
12769
12770    /// Set any additional parameter of the query string used in the request.
12771    /// It should be used to set parameters which are not yet available through their own
12772    /// setters.
12773    ///
12774    /// Please note that this method must not be used to set any of the known parameters
12775    /// which have their own setter method. If done anyway, the request will fail.
12776    ///
12777    /// # Additional Parameters
12778    ///
12779    /// * *$.xgafv* (query-string) - V1 error format.
12780    /// * *access_token* (query-string) - OAuth access token.
12781    /// * *alt* (query-string) - Data format for response.
12782    /// * *callback* (query-string) - JSONP
12783    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12784    /// * *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.
12785    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12786    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12787    /// * *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.
12788    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12789    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12790    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationConnectionDeleteCall<'a, C>
12791    where
12792        T: AsRef<str>,
12793    {
12794        self._additional_params
12795            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12796        self
12797    }
12798
12799    /// Identifies the authorization scope for the method you are building.
12800    ///
12801    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12802    /// [`Scope::CloudPlatform`].
12803    ///
12804    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12805    /// tokens for more than one scope.
12806    ///
12807    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12808    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12809    /// sufficient, a read-write scope will do as well.
12810    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionDeleteCall<'a, C>
12811    where
12812        St: AsRef<str>,
12813    {
12814        self._scopes.insert(String::from(scope.as_ref()));
12815        self
12816    }
12817    /// Identifies the authorization scope(s) for the method you are building.
12818    ///
12819    /// See [`Self::add_scope()`] for details.
12820    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationConnectionDeleteCall<'a, C>
12821    where
12822        I: IntoIterator<Item = St>,
12823        St: AsRef<str>,
12824    {
12825        self._scopes
12826            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12827        self
12828    }
12829
12830    /// Removes all scopes, and no default scope will be used either.
12831    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12832    /// for details).
12833    pub fn clear_scopes(mut self) -> ProjectLocationConnectionDeleteCall<'a, C> {
12834        self._scopes.clear();
12835        self
12836    }
12837}
12838
12839/// Gets details of a single Connection.
12840///
12841/// A builder for the *locations.connections.get* method supported by a *project* resource.
12842/// It is not used directly, but through a [`ProjectMethods`] instance.
12843///
12844/// # Example
12845///
12846/// Instantiate a resource method builder
12847///
12848/// ```test_harness,no_run
12849/// # extern crate hyper;
12850/// # extern crate hyper_rustls;
12851/// # extern crate google_connectors1 as connectors1;
12852/// # async fn dox() {
12853/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12854///
12855/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12856/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12857/// #     .with_native_roots()
12858/// #     .unwrap()
12859/// #     .https_only()
12860/// #     .enable_http2()
12861/// #     .build();
12862///
12863/// # let executor = hyper_util::rt::TokioExecutor::new();
12864/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12865/// #     secret,
12866/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12867/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12868/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12869/// #     ),
12870/// # ).build().await.unwrap();
12871///
12872/// # let client = hyper_util::client::legacy::Client::builder(
12873/// #     hyper_util::rt::TokioExecutor::new()
12874/// # )
12875/// # .build(
12876/// #     hyper_rustls::HttpsConnectorBuilder::new()
12877/// #         .with_native_roots()
12878/// #         .unwrap()
12879/// #         .https_or_http()
12880/// #         .enable_http2()
12881/// #         .build()
12882/// # );
12883/// # let mut hub = Connectors::new(client, auth);
12884/// // You can configure optional parameters by calling the respective setters at will, and
12885/// // execute the final call using `doit()`.
12886/// // Values shown here are possibly random and not representative !
12887/// let result = hub.projects().locations_connections_get("name")
12888///              .view("dolor")
12889///              .doit().await;
12890/// # }
12891/// ```
12892pub struct ProjectLocationConnectionGetCall<'a, C>
12893where
12894    C: 'a,
12895{
12896    hub: &'a Connectors<C>,
12897    _name: String,
12898    _view: Option<String>,
12899    _delegate: Option<&'a mut dyn common::Delegate>,
12900    _additional_params: HashMap<String, String>,
12901    _scopes: BTreeSet<String>,
12902}
12903
12904impl<'a, C> common::CallBuilder for ProjectLocationConnectionGetCall<'a, C> {}
12905
12906impl<'a, C> ProjectLocationConnectionGetCall<'a, C>
12907where
12908    C: common::Connector,
12909{
12910    /// Perform the operation you have build so far.
12911    pub async fn doit(mut self) -> common::Result<(common::Response, Connection)> {
12912        use std::borrow::Cow;
12913        use std::io::{Read, Seek};
12914
12915        use common::{url::Params, ToParts};
12916        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12917
12918        let mut dd = common::DefaultDelegate;
12919        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12920        dlg.begin(common::MethodInfo {
12921            id: "connectors.projects.locations.connections.get",
12922            http_method: hyper::Method::GET,
12923        });
12924
12925        for &field in ["alt", "name", "view"].iter() {
12926            if self._additional_params.contains_key(field) {
12927                dlg.finished(false);
12928                return Err(common::Error::FieldClash(field));
12929            }
12930        }
12931
12932        let mut params = Params::with_capacity(4 + self._additional_params.len());
12933        params.push("name", self._name);
12934        if let Some(value) = self._view.as_ref() {
12935            params.push("view", value);
12936        }
12937
12938        params.extend(self._additional_params.iter());
12939
12940        params.push("alt", "json");
12941        let mut url = self.hub._base_url.clone() + "v1/{+name}";
12942        if self._scopes.is_empty() {
12943            self._scopes
12944                .insert(Scope::CloudPlatform.as_ref().to_string());
12945        }
12946
12947        #[allow(clippy::single_element_loop)]
12948        for &(find_this, param_name) in [("{+name}", "name")].iter() {
12949            url = params.uri_replacement(url, param_name, find_this, true);
12950        }
12951        {
12952            let to_remove = ["name"];
12953            params.remove_params(&to_remove);
12954        }
12955
12956        let url = params.parse_with_url(&url);
12957
12958        loop {
12959            let token = match self
12960                .hub
12961                .auth
12962                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12963                .await
12964            {
12965                Ok(token) => token,
12966                Err(e) => match dlg.token(e) {
12967                    Ok(token) => token,
12968                    Err(e) => {
12969                        dlg.finished(false);
12970                        return Err(common::Error::MissingToken(e));
12971                    }
12972                },
12973            };
12974            let mut req_result = {
12975                let client = &self.hub.client;
12976                dlg.pre_request();
12977                let mut req_builder = hyper::Request::builder()
12978                    .method(hyper::Method::GET)
12979                    .uri(url.as_str())
12980                    .header(USER_AGENT, self.hub._user_agent.clone());
12981
12982                if let Some(token) = token.as_ref() {
12983                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12984                }
12985
12986                let request = req_builder
12987                    .header(CONTENT_LENGTH, 0_u64)
12988                    .body(common::to_body::<String>(None));
12989
12990                client.request(request.unwrap()).await
12991            };
12992
12993            match req_result {
12994                Err(err) => {
12995                    if let common::Retry::After(d) = dlg.http_error(&err) {
12996                        sleep(d).await;
12997                        continue;
12998                    }
12999                    dlg.finished(false);
13000                    return Err(common::Error::HttpError(err));
13001                }
13002                Ok(res) => {
13003                    let (mut parts, body) = res.into_parts();
13004                    let mut body = common::Body::new(body);
13005                    if !parts.status.is_success() {
13006                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13007                        let error = serde_json::from_str(&common::to_string(&bytes));
13008                        let response = common::to_response(parts, bytes.into());
13009
13010                        if let common::Retry::After(d) =
13011                            dlg.http_failure(&response, error.as_ref().ok())
13012                        {
13013                            sleep(d).await;
13014                            continue;
13015                        }
13016
13017                        dlg.finished(false);
13018
13019                        return Err(match error {
13020                            Ok(value) => common::Error::BadRequest(value),
13021                            _ => common::Error::Failure(response),
13022                        });
13023                    }
13024                    let response = {
13025                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13026                        let encoded = common::to_string(&bytes);
13027                        match serde_json::from_str(&encoded) {
13028                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13029                            Err(error) => {
13030                                dlg.response_json_decode_error(&encoded, &error);
13031                                return Err(common::Error::JsonDecodeError(
13032                                    encoded.to_string(),
13033                                    error,
13034                                ));
13035                            }
13036                        }
13037                    };
13038
13039                    dlg.finished(true);
13040                    return Ok(response);
13041                }
13042            }
13043        }
13044    }
13045
13046    /// Required. Resource name of the form: `projects/*/locations/*/connections/*`
13047    ///
13048    /// Sets the *name* path property to the given value.
13049    ///
13050    /// Even though the property as already been set when instantiating this call,
13051    /// we provide this method for API completeness.
13052    pub fn name(mut self, new_value: &str) -> ProjectLocationConnectionGetCall<'a, C> {
13053        self._name = new_value.to_string();
13054        self
13055    }
13056    /// Specifies which fields of the Connection are returned in the response. Defaults to `BASIC` view.
13057    ///
13058    /// Sets the *view* query property to the given value.
13059    pub fn view(mut self, new_value: &str) -> ProjectLocationConnectionGetCall<'a, C> {
13060        self._view = Some(new_value.to_string());
13061        self
13062    }
13063    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13064    /// while executing the actual API request.
13065    ///
13066    /// ````text
13067    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13068    /// ````
13069    ///
13070    /// Sets the *delegate* property to the given value.
13071    pub fn delegate(
13072        mut self,
13073        new_value: &'a mut dyn common::Delegate,
13074    ) -> ProjectLocationConnectionGetCall<'a, C> {
13075        self._delegate = Some(new_value);
13076        self
13077    }
13078
13079    /// Set any additional parameter of the query string used in the request.
13080    /// It should be used to set parameters which are not yet available through their own
13081    /// setters.
13082    ///
13083    /// Please note that this method must not be used to set any of the known parameters
13084    /// which have their own setter method. If done anyway, the request will fail.
13085    ///
13086    /// # Additional Parameters
13087    ///
13088    /// * *$.xgafv* (query-string) - V1 error format.
13089    /// * *access_token* (query-string) - OAuth access token.
13090    /// * *alt* (query-string) - Data format for response.
13091    /// * *callback* (query-string) - JSONP
13092    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13093    /// * *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.
13094    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13095    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13096    /// * *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.
13097    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13098    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13099    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationConnectionGetCall<'a, C>
13100    where
13101        T: AsRef<str>,
13102    {
13103        self._additional_params
13104            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13105        self
13106    }
13107
13108    /// Identifies the authorization scope for the method you are building.
13109    ///
13110    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13111    /// [`Scope::CloudPlatform`].
13112    ///
13113    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13114    /// tokens for more than one scope.
13115    ///
13116    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13117    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13118    /// sufficient, a read-write scope will do as well.
13119    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionGetCall<'a, C>
13120    where
13121        St: AsRef<str>,
13122    {
13123        self._scopes.insert(String::from(scope.as_ref()));
13124        self
13125    }
13126    /// Identifies the authorization scope(s) for the method you are building.
13127    ///
13128    /// See [`Self::add_scope()`] for details.
13129    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationConnectionGetCall<'a, C>
13130    where
13131        I: IntoIterator<Item = St>,
13132        St: AsRef<str>,
13133    {
13134        self._scopes
13135            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13136        self
13137    }
13138
13139    /// Removes all scopes, and no default scope will be used either.
13140    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13141    /// for details).
13142    pub fn clear_scopes(mut self) -> ProjectLocationConnectionGetCall<'a, C> {
13143        self._scopes.clear();
13144        self
13145    }
13146}
13147
13148/// Gets schema metadata of a connection. SchemaMetadata is a singleton resource for each connection.
13149///
13150/// A builder for the *locations.connections.getConnectionSchemaMetadata* method supported by a *project* resource.
13151/// It is not used directly, but through a [`ProjectMethods`] instance.
13152///
13153/// # Example
13154///
13155/// Instantiate a resource method builder
13156///
13157/// ```test_harness,no_run
13158/// # extern crate hyper;
13159/// # extern crate hyper_rustls;
13160/// # extern crate google_connectors1 as connectors1;
13161/// # async fn dox() {
13162/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13163///
13164/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13165/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13166/// #     .with_native_roots()
13167/// #     .unwrap()
13168/// #     .https_only()
13169/// #     .enable_http2()
13170/// #     .build();
13171///
13172/// # let executor = hyper_util::rt::TokioExecutor::new();
13173/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13174/// #     secret,
13175/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13176/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13177/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13178/// #     ),
13179/// # ).build().await.unwrap();
13180///
13181/// # let client = hyper_util::client::legacy::Client::builder(
13182/// #     hyper_util::rt::TokioExecutor::new()
13183/// # )
13184/// # .build(
13185/// #     hyper_rustls::HttpsConnectorBuilder::new()
13186/// #         .with_native_roots()
13187/// #         .unwrap()
13188/// #         .https_or_http()
13189/// #         .enable_http2()
13190/// #         .build()
13191/// # );
13192/// # let mut hub = Connectors::new(client, auth);
13193/// // You can configure optional parameters by calling the respective setters at will, and
13194/// // execute the final call using `doit()`.
13195/// // Values shown here are possibly random and not representative !
13196/// let result = hub.projects().locations_connections_get_connection_schema_metadata("name")
13197///              .doit().await;
13198/// # }
13199/// ```
13200pub struct ProjectLocationConnectionGetConnectionSchemaMetadataCall<'a, C>
13201where
13202    C: 'a,
13203{
13204    hub: &'a Connectors<C>,
13205    _name: String,
13206    _delegate: Option<&'a mut dyn common::Delegate>,
13207    _additional_params: HashMap<String, String>,
13208    _scopes: BTreeSet<String>,
13209}
13210
13211impl<'a, C> common::CallBuilder
13212    for ProjectLocationConnectionGetConnectionSchemaMetadataCall<'a, C>
13213{
13214}
13215
13216impl<'a, C> ProjectLocationConnectionGetConnectionSchemaMetadataCall<'a, C>
13217where
13218    C: common::Connector,
13219{
13220    /// Perform the operation you have build so far.
13221    pub async fn doit(mut self) -> common::Result<(common::Response, ConnectionSchemaMetadata)> {
13222        use std::borrow::Cow;
13223        use std::io::{Read, Seek};
13224
13225        use common::{url::Params, ToParts};
13226        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13227
13228        let mut dd = common::DefaultDelegate;
13229        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13230        dlg.begin(common::MethodInfo {
13231            id: "connectors.projects.locations.connections.getConnectionSchemaMetadata",
13232            http_method: hyper::Method::GET,
13233        });
13234
13235        for &field in ["alt", "name"].iter() {
13236            if self._additional_params.contains_key(field) {
13237                dlg.finished(false);
13238                return Err(common::Error::FieldClash(field));
13239            }
13240        }
13241
13242        let mut params = Params::with_capacity(3 + self._additional_params.len());
13243        params.push("name", self._name);
13244
13245        params.extend(self._additional_params.iter());
13246
13247        params.push("alt", "json");
13248        let mut url = self.hub._base_url.clone() + "v1/{+name}";
13249        if self._scopes.is_empty() {
13250            self._scopes
13251                .insert(Scope::CloudPlatform.as_ref().to_string());
13252        }
13253
13254        #[allow(clippy::single_element_loop)]
13255        for &(find_this, param_name) in [("{+name}", "name")].iter() {
13256            url = params.uri_replacement(url, param_name, find_this, true);
13257        }
13258        {
13259            let to_remove = ["name"];
13260            params.remove_params(&to_remove);
13261        }
13262
13263        let url = params.parse_with_url(&url);
13264
13265        loop {
13266            let token = match self
13267                .hub
13268                .auth
13269                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13270                .await
13271            {
13272                Ok(token) => token,
13273                Err(e) => match dlg.token(e) {
13274                    Ok(token) => token,
13275                    Err(e) => {
13276                        dlg.finished(false);
13277                        return Err(common::Error::MissingToken(e));
13278                    }
13279                },
13280            };
13281            let mut req_result = {
13282                let client = &self.hub.client;
13283                dlg.pre_request();
13284                let mut req_builder = hyper::Request::builder()
13285                    .method(hyper::Method::GET)
13286                    .uri(url.as_str())
13287                    .header(USER_AGENT, self.hub._user_agent.clone());
13288
13289                if let Some(token) = token.as_ref() {
13290                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13291                }
13292
13293                let request = req_builder
13294                    .header(CONTENT_LENGTH, 0_u64)
13295                    .body(common::to_body::<String>(None));
13296
13297                client.request(request.unwrap()).await
13298            };
13299
13300            match req_result {
13301                Err(err) => {
13302                    if let common::Retry::After(d) = dlg.http_error(&err) {
13303                        sleep(d).await;
13304                        continue;
13305                    }
13306                    dlg.finished(false);
13307                    return Err(common::Error::HttpError(err));
13308                }
13309                Ok(res) => {
13310                    let (mut parts, body) = res.into_parts();
13311                    let mut body = common::Body::new(body);
13312                    if !parts.status.is_success() {
13313                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13314                        let error = serde_json::from_str(&common::to_string(&bytes));
13315                        let response = common::to_response(parts, bytes.into());
13316
13317                        if let common::Retry::After(d) =
13318                            dlg.http_failure(&response, error.as_ref().ok())
13319                        {
13320                            sleep(d).await;
13321                            continue;
13322                        }
13323
13324                        dlg.finished(false);
13325
13326                        return Err(match error {
13327                            Ok(value) => common::Error::BadRequest(value),
13328                            _ => common::Error::Failure(response),
13329                        });
13330                    }
13331                    let response = {
13332                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13333                        let encoded = common::to_string(&bytes);
13334                        match serde_json::from_str(&encoded) {
13335                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13336                            Err(error) => {
13337                                dlg.response_json_decode_error(&encoded, &error);
13338                                return Err(common::Error::JsonDecodeError(
13339                                    encoded.to_string(),
13340                                    error,
13341                                ));
13342                            }
13343                        }
13344                    };
13345
13346                    dlg.finished(true);
13347                    return Ok(response);
13348                }
13349            }
13350        }
13351    }
13352
13353    /// Required. Connection name Format: projects/{project}/locations/{location}/connections/{connection}/connectionSchemaMetadata
13354    ///
13355    /// Sets the *name* path property to the given value.
13356    ///
13357    /// Even though the property as already been set when instantiating this call,
13358    /// we provide this method for API completeness.
13359    pub fn name(
13360        mut self,
13361        new_value: &str,
13362    ) -> ProjectLocationConnectionGetConnectionSchemaMetadataCall<'a, C> {
13363        self._name = new_value.to_string();
13364        self
13365    }
13366    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13367    /// while executing the actual API request.
13368    ///
13369    /// ````text
13370    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13371    /// ````
13372    ///
13373    /// Sets the *delegate* property to the given value.
13374    pub fn delegate(
13375        mut self,
13376        new_value: &'a mut dyn common::Delegate,
13377    ) -> ProjectLocationConnectionGetConnectionSchemaMetadataCall<'a, C> {
13378        self._delegate = Some(new_value);
13379        self
13380    }
13381
13382    /// Set any additional parameter of the query string used in the request.
13383    /// It should be used to set parameters which are not yet available through their own
13384    /// setters.
13385    ///
13386    /// Please note that this method must not be used to set any of the known parameters
13387    /// which have their own setter method. If done anyway, the request will fail.
13388    ///
13389    /// # Additional Parameters
13390    ///
13391    /// * *$.xgafv* (query-string) - V1 error format.
13392    /// * *access_token* (query-string) - OAuth access token.
13393    /// * *alt* (query-string) - Data format for response.
13394    /// * *callback* (query-string) - JSONP
13395    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13396    /// * *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.
13397    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13398    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13399    /// * *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.
13400    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13401    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13402    pub fn param<T>(
13403        mut self,
13404        name: T,
13405        value: T,
13406    ) -> ProjectLocationConnectionGetConnectionSchemaMetadataCall<'a, C>
13407    where
13408        T: AsRef<str>,
13409    {
13410        self._additional_params
13411            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13412        self
13413    }
13414
13415    /// Identifies the authorization scope for the method you are building.
13416    ///
13417    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13418    /// [`Scope::CloudPlatform`].
13419    ///
13420    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13421    /// tokens for more than one scope.
13422    ///
13423    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13424    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13425    /// sufficient, a read-write scope will do as well.
13426    pub fn add_scope<St>(
13427        mut self,
13428        scope: St,
13429    ) -> ProjectLocationConnectionGetConnectionSchemaMetadataCall<'a, C>
13430    where
13431        St: AsRef<str>,
13432    {
13433        self._scopes.insert(String::from(scope.as_ref()));
13434        self
13435    }
13436    /// Identifies the authorization scope(s) for the method you are building.
13437    ///
13438    /// See [`Self::add_scope()`] for details.
13439    pub fn add_scopes<I, St>(
13440        mut self,
13441        scopes: I,
13442    ) -> ProjectLocationConnectionGetConnectionSchemaMetadataCall<'a, C>
13443    where
13444        I: IntoIterator<Item = St>,
13445        St: AsRef<str>,
13446    {
13447        self._scopes
13448            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13449        self
13450    }
13451
13452    /// Removes all scopes, and no default scope will be used either.
13453    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13454    /// for details).
13455    pub fn clear_scopes(
13456        mut self,
13457    ) -> ProjectLocationConnectionGetConnectionSchemaMetadataCall<'a, C> {
13458        self._scopes.clear();
13459        self
13460    }
13461}
13462
13463/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
13464///
13465/// A builder for the *locations.connections.getIamPolicy* method supported by a *project* resource.
13466/// It is not used directly, but through a [`ProjectMethods`] instance.
13467///
13468/// # Example
13469///
13470/// Instantiate a resource method builder
13471///
13472/// ```test_harness,no_run
13473/// # extern crate hyper;
13474/// # extern crate hyper_rustls;
13475/// # extern crate google_connectors1 as connectors1;
13476/// # async fn dox() {
13477/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13478///
13479/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13480/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13481/// #     .with_native_roots()
13482/// #     .unwrap()
13483/// #     .https_only()
13484/// #     .enable_http2()
13485/// #     .build();
13486///
13487/// # let executor = hyper_util::rt::TokioExecutor::new();
13488/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13489/// #     secret,
13490/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13491/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13492/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13493/// #     ),
13494/// # ).build().await.unwrap();
13495///
13496/// # let client = hyper_util::client::legacy::Client::builder(
13497/// #     hyper_util::rt::TokioExecutor::new()
13498/// # )
13499/// # .build(
13500/// #     hyper_rustls::HttpsConnectorBuilder::new()
13501/// #         .with_native_roots()
13502/// #         .unwrap()
13503/// #         .https_or_http()
13504/// #         .enable_http2()
13505/// #         .build()
13506/// # );
13507/// # let mut hub = Connectors::new(client, auth);
13508/// // You can configure optional parameters by calling the respective setters at will, and
13509/// // execute the final call using `doit()`.
13510/// // Values shown here are possibly random and not representative !
13511/// let result = hub.projects().locations_connections_get_iam_policy("resource")
13512///              .options_requested_policy_version(-95)
13513///              .doit().await;
13514/// # }
13515/// ```
13516pub struct ProjectLocationConnectionGetIamPolicyCall<'a, C>
13517where
13518    C: 'a,
13519{
13520    hub: &'a Connectors<C>,
13521    _resource: String,
13522    _options_requested_policy_version: Option<i32>,
13523    _delegate: Option<&'a mut dyn common::Delegate>,
13524    _additional_params: HashMap<String, String>,
13525    _scopes: BTreeSet<String>,
13526}
13527
13528impl<'a, C> common::CallBuilder for ProjectLocationConnectionGetIamPolicyCall<'a, C> {}
13529
13530impl<'a, C> ProjectLocationConnectionGetIamPolicyCall<'a, C>
13531where
13532    C: common::Connector,
13533{
13534    /// Perform the operation you have build so far.
13535    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
13536        use std::borrow::Cow;
13537        use std::io::{Read, Seek};
13538
13539        use common::{url::Params, ToParts};
13540        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13541
13542        let mut dd = common::DefaultDelegate;
13543        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13544        dlg.begin(common::MethodInfo {
13545            id: "connectors.projects.locations.connections.getIamPolicy",
13546            http_method: hyper::Method::GET,
13547        });
13548
13549        for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
13550            if self._additional_params.contains_key(field) {
13551                dlg.finished(false);
13552                return Err(common::Error::FieldClash(field));
13553            }
13554        }
13555
13556        let mut params = Params::with_capacity(4 + self._additional_params.len());
13557        params.push("resource", self._resource);
13558        if let Some(value) = self._options_requested_policy_version.as_ref() {
13559            params.push("options.requestedPolicyVersion", value.to_string());
13560        }
13561
13562        params.extend(self._additional_params.iter());
13563
13564        params.push("alt", "json");
13565        let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
13566        if self._scopes.is_empty() {
13567            self._scopes
13568                .insert(Scope::CloudPlatform.as_ref().to_string());
13569        }
13570
13571        #[allow(clippy::single_element_loop)]
13572        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
13573            url = params.uri_replacement(url, param_name, find_this, true);
13574        }
13575        {
13576            let to_remove = ["resource"];
13577            params.remove_params(&to_remove);
13578        }
13579
13580        let url = params.parse_with_url(&url);
13581
13582        loop {
13583            let token = match self
13584                .hub
13585                .auth
13586                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13587                .await
13588            {
13589                Ok(token) => token,
13590                Err(e) => match dlg.token(e) {
13591                    Ok(token) => token,
13592                    Err(e) => {
13593                        dlg.finished(false);
13594                        return Err(common::Error::MissingToken(e));
13595                    }
13596                },
13597            };
13598            let mut req_result = {
13599                let client = &self.hub.client;
13600                dlg.pre_request();
13601                let mut req_builder = hyper::Request::builder()
13602                    .method(hyper::Method::GET)
13603                    .uri(url.as_str())
13604                    .header(USER_AGENT, self.hub._user_agent.clone());
13605
13606                if let Some(token) = token.as_ref() {
13607                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13608                }
13609
13610                let request = req_builder
13611                    .header(CONTENT_LENGTH, 0_u64)
13612                    .body(common::to_body::<String>(None));
13613
13614                client.request(request.unwrap()).await
13615            };
13616
13617            match req_result {
13618                Err(err) => {
13619                    if let common::Retry::After(d) = dlg.http_error(&err) {
13620                        sleep(d).await;
13621                        continue;
13622                    }
13623                    dlg.finished(false);
13624                    return Err(common::Error::HttpError(err));
13625                }
13626                Ok(res) => {
13627                    let (mut parts, body) = res.into_parts();
13628                    let mut body = common::Body::new(body);
13629                    if !parts.status.is_success() {
13630                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13631                        let error = serde_json::from_str(&common::to_string(&bytes));
13632                        let response = common::to_response(parts, bytes.into());
13633
13634                        if let common::Retry::After(d) =
13635                            dlg.http_failure(&response, error.as_ref().ok())
13636                        {
13637                            sleep(d).await;
13638                            continue;
13639                        }
13640
13641                        dlg.finished(false);
13642
13643                        return Err(match error {
13644                            Ok(value) => common::Error::BadRequest(value),
13645                            _ => common::Error::Failure(response),
13646                        });
13647                    }
13648                    let response = {
13649                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13650                        let encoded = common::to_string(&bytes);
13651                        match serde_json::from_str(&encoded) {
13652                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13653                            Err(error) => {
13654                                dlg.response_json_decode_error(&encoded, &error);
13655                                return Err(common::Error::JsonDecodeError(
13656                                    encoded.to_string(),
13657                                    error,
13658                                ));
13659                            }
13660                        }
13661                    };
13662
13663                    dlg.finished(true);
13664                    return Ok(response);
13665                }
13666            }
13667        }
13668    }
13669
13670    /// 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.
13671    ///
13672    /// Sets the *resource* path property to the given value.
13673    ///
13674    /// Even though the property as already been set when instantiating this call,
13675    /// we provide this method for API completeness.
13676    pub fn resource(mut self, new_value: &str) -> ProjectLocationConnectionGetIamPolicyCall<'a, C> {
13677        self._resource = new_value.to_string();
13678        self
13679    }
13680    /// 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).
13681    ///
13682    /// Sets the *options.requested policy version* query property to the given value.
13683    pub fn options_requested_policy_version(
13684        mut self,
13685        new_value: i32,
13686    ) -> ProjectLocationConnectionGetIamPolicyCall<'a, C> {
13687        self._options_requested_policy_version = Some(new_value);
13688        self
13689    }
13690    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13691    /// while executing the actual API request.
13692    ///
13693    /// ````text
13694    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13695    /// ````
13696    ///
13697    /// Sets the *delegate* property to the given value.
13698    pub fn delegate(
13699        mut self,
13700        new_value: &'a mut dyn common::Delegate,
13701    ) -> ProjectLocationConnectionGetIamPolicyCall<'a, C> {
13702        self._delegate = Some(new_value);
13703        self
13704    }
13705
13706    /// Set any additional parameter of the query string used in the request.
13707    /// It should be used to set parameters which are not yet available through their own
13708    /// setters.
13709    ///
13710    /// Please note that this method must not be used to set any of the known parameters
13711    /// which have their own setter method. If done anyway, the request will fail.
13712    ///
13713    /// # Additional Parameters
13714    ///
13715    /// * *$.xgafv* (query-string) - V1 error format.
13716    /// * *access_token* (query-string) - OAuth access token.
13717    /// * *alt* (query-string) - Data format for response.
13718    /// * *callback* (query-string) - JSONP
13719    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13720    /// * *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.
13721    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13722    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13723    /// * *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.
13724    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13725    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13726    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationConnectionGetIamPolicyCall<'a, C>
13727    where
13728        T: AsRef<str>,
13729    {
13730        self._additional_params
13731            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13732        self
13733    }
13734
13735    /// Identifies the authorization scope for the method you are building.
13736    ///
13737    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13738    /// [`Scope::CloudPlatform`].
13739    ///
13740    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13741    /// tokens for more than one scope.
13742    ///
13743    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13744    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13745    /// sufficient, a read-write scope will do as well.
13746    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionGetIamPolicyCall<'a, C>
13747    where
13748        St: AsRef<str>,
13749    {
13750        self._scopes.insert(String::from(scope.as_ref()));
13751        self
13752    }
13753    /// Identifies the authorization scope(s) for the method you are building.
13754    ///
13755    /// See [`Self::add_scope()`] for details.
13756    pub fn add_scopes<I, St>(
13757        mut self,
13758        scopes: I,
13759    ) -> ProjectLocationConnectionGetIamPolicyCall<'a, C>
13760    where
13761        I: IntoIterator<Item = St>,
13762        St: AsRef<str>,
13763    {
13764        self._scopes
13765            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13766        self
13767    }
13768
13769    /// Removes all scopes, and no default scope will be used either.
13770    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13771    /// for details).
13772    pub fn clear_scopes(mut self) -> ProjectLocationConnectionGetIamPolicyCall<'a, C> {
13773        self._scopes.clear();
13774        self
13775    }
13776}
13777
13778/// Lists Connections in a given project and location.
13779///
13780/// A builder for the *locations.connections.list* method supported by a *project* resource.
13781/// It is not used directly, but through a [`ProjectMethods`] instance.
13782///
13783/// # Example
13784///
13785/// Instantiate a resource method builder
13786///
13787/// ```test_harness,no_run
13788/// # extern crate hyper;
13789/// # extern crate hyper_rustls;
13790/// # extern crate google_connectors1 as connectors1;
13791/// # async fn dox() {
13792/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13793///
13794/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13795/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13796/// #     .with_native_roots()
13797/// #     .unwrap()
13798/// #     .https_only()
13799/// #     .enable_http2()
13800/// #     .build();
13801///
13802/// # let executor = hyper_util::rt::TokioExecutor::new();
13803/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13804/// #     secret,
13805/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13806/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13807/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13808/// #     ),
13809/// # ).build().await.unwrap();
13810///
13811/// # let client = hyper_util::client::legacy::Client::builder(
13812/// #     hyper_util::rt::TokioExecutor::new()
13813/// # )
13814/// # .build(
13815/// #     hyper_rustls::HttpsConnectorBuilder::new()
13816/// #         .with_native_roots()
13817/// #         .unwrap()
13818/// #         .https_or_http()
13819/// #         .enable_http2()
13820/// #         .build()
13821/// # );
13822/// # let mut hub = Connectors::new(client, auth);
13823/// // You can configure optional parameters by calling the respective setters at will, and
13824/// // execute the final call using `doit()`.
13825/// // Values shown here are possibly random and not representative !
13826/// let result = hub.projects().locations_connections_list("parent")
13827///              .view("dolor")
13828///              .page_token("duo")
13829///              .page_size(-76)
13830///              .order_by("vero")
13831///              .filter("invidunt")
13832///              .doit().await;
13833/// # }
13834/// ```
13835pub struct ProjectLocationConnectionListCall<'a, C>
13836where
13837    C: 'a,
13838{
13839    hub: &'a Connectors<C>,
13840    _parent: String,
13841    _view: Option<String>,
13842    _page_token: Option<String>,
13843    _page_size: Option<i32>,
13844    _order_by: Option<String>,
13845    _filter: Option<String>,
13846    _delegate: Option<&'a mut dyn common::Delegate>,
13847    _additional_params: HashMap<String, String>,
13848    _scopes: BTreeSet<String>,
13849}
13850
13851impl<'a, C> common::CallBuilder for ProjectLocationConnectionListCall<'a, C> {}
13852
13853impl<'a, C> ProjectLocationConnectionListCall<'a, C>
13854where
13855    C: common::Connector,
13856{
13857    /// Perform the operation you have build so far.
13858    pub async fn doit(mut self) -> common::Result<(common::Response, ListConnectionsResponse)> {
13859        use std::borrow::Cow;
13860        use std::io::{Read, Seek};
13861
13862        use common::{url::Params, ToParts};
13863        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13864
13865        let mut dd = common::DefaultDelegate;
13866        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13867        dlg.begin(common::MethodInfo {
13868            id: "connectors.projects.locations.connections.list",
13869            http_method: hyper::Method::GET,
13870        });
13871
13872        for &field in [
13873            "alt",
13874            "parent",
13875            "view",
13876            "pageToken",
13877            "pageSize",
13878            "orderBy",
13879            "filter",
13880        ]
13881        .iter()
13882        {
13883            if self._additional_params.contains_key(field) {
13884                dlg.finished(false);
13885                return Err(common::Error::FieldClash(field));
13886            }
13887        }
13888
13889        let mut params = Params::with_capacity(8 + self._additional_params.len());
13890        params.push("parent", self._parent);
13891        if let Some(value) = self._view.as_ref() {
13892            params.push("view", value);
13893        }
13894        if let Some(value) = self._page_token.as_ref() {
13895            params.push("pageToken", value);
13896        }
13897        if let Some(value) = self._page_size.as_ref() {
13898            params.push("pageSize", value.to_string());
13899        }
13900        if let Some(value) = self._order_by.as_ref() {
13901            params.push("orderBy", value);
13902        }
13903        if let Some(value) = self._filter.as_ref() {
13904            params.push("filter", value);
13905        }
13906
13907        params.extend(self._additional_params.iter());
13908
13909        params.push("alt", "json");
13910        let mut url = self.hub._base_url.clone() + "v1/{+parent}/connections";
13911        if self._scopes.is_empty() {
13912            self._scopes
13913                .insert(Scope::CloudPlatform.as_ref().to_string());
13914        }
13915
13916        #[allow(clippy::single_element_loop)]
13917        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
13918            url = params.uri_replacement(url, param_name, find_this, true);
13919        }
13920        {
13921            let to_remove = ["parent"];
13922            params.remove_params(&to_remove);
13923        }
13924
13925        let url = params.parse_with_url(&url);
13926
13927        loop {
13928            let token = match self
13929                .hub
13930                .auth
13931                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13932                .await
13933            {
13934                Ok(token) => token,
13935                Err(e) => match dlg.token(e) {
13936                    Ok(token) => token,
13937                    Err(e) => {
13938                        dlg.finished(false);
13939                        return Err(common::Error::MissingToken(e));
13940                    }
13941                },
13942            };
13943            let mut req_result = {
13944                let client = &self.hub.client;
13945                dlg.pre_request();
13946                let mut req_builder = hyper::Request::builder()
13947                    .method(hyper::Method::GET)
13948                    .uri(url.as_str())
13949                    .header(USER_AGENT, self.hub._user_agent.clone());
13950
13951                if let Some(token) = token.as_ref() {
13952                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13953                }
13954
13955                let request = req_builder
13956                    .header(CONTENT_LENGTH, 0_u64)
13957                    .body(common::to_body::<String>(None));
13958
13959                client.request(request.unwrap()).await
13960            };
13961
13962            match req_result {
13963                Err(err) => {
13964                    if let common::Retry::After(d) = dlg.http_error(&err) {
13965                        sleep(d).await;
13966                        continue;
13967                    }
13968                    dlg.finished(false);
13969                    return Err(common::Error::HttpError(err));
13970                }
13971                Ok(res) => {
13972                    let (mut parts, body) = res.into_parts();
13973                    let mut body = common::Body::new(body);
13974                    if !parts.status.is_success() {
13975                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13976                        let error = serde_json::from_str(&common::to_string(&bytes));
13977                        let response = common::to_response(parts, bytes.into());
13978
13979                        if let common::Retry::After(d) =
13980                            dlg.http_failure(&response, error.as_ref().ok())
13981                        {
13982                            sleep(d).await;
13983                            continue;
13984                        }
13985
13986                        dlg.finished(false);
13987
13988                        return Err(match error {
13989                            Ok(value) => common::Error::BadRequest(value),
13990                            _ => common::Error::Failure(response),
13991                        });
13992                    }
13993                    let response = {
13994                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13995                        let encoded = common::to_string(&bytes);
13996                        match serde_json::from_str(&encoded) {
13997                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13998                            Err(error) => {
13999                                dlg.response_json_decode_error(&encoded, &error);
14000                                return Err(common::Error::JsonDecodeError(
14001                                    encoded.to_string(),
14002                                    error,
14003                                ));
14004                            }
14005                        }
14006                    };
14007
14008                    dlg.finished(true);
14009                    return Ok(response);
14010                }
14011            }
14012        }
14013    }
14014
14015    /// Required. Parent resource of the Connection, of the form: `projects/*/locations/*`
14016    ///
14017    /// Sets the *parent* path property to the given value.
14018    ///
14019    /// Even though the property as already been set when instantiating this call,
14020    /// we provide this method for API completeness.
14021    pub fn parent(mut self, new_value: &str) -> ProjectLocationConnectionListCall<'a, C> {
14022        self._parent = new_value.to_string();
14023        self
14024    }
14025    /// Specifies which fields of the Connection are returned in the response. Defaults to `BASIC` view.
14026    ///
14027    /// Sets the *view* query property to the given value.
14028    pub fn view(mut self, new_value: &str) -> ProjectLocationConnectionListCall<'a, C> {
14029        self._view = Some(new_value.to_string());
14030        self
14031    }
14032    /// Page token.
14033    ///
14034    /// Sets the *page token* query property to the given value.
14035    pub fn page_token(mut self, new_value: &str) -> ProjectLocationConnectionListCall<'a, C> {
14036        self._page_token = Some(new_value.to_string());
14037        self
14038    }
14039    /// Page size.
14040    ///
14041    /// Sets the *page size* query property to the given value.
14042    pub fn page_size(mut self, new_value: i32) -> ProjectLocationConnectionListCall<'a, C> {
14043        self._page_size = Some(new_value);
14044        self
14045    }
14046    /// Order by parameters.
14047    ///
14048    /// Sets the *order by* query property to the given value.
14049    pub fn order_by(mut self, new_value: &str) -> ProjectLocationConnectionListCall<'a, C> {
14050        self._order_by = Some(new_value.to_string());
14051        self
14052    }
14053    /// Filter.
14054    ///
14055    /// Sets the *filter* query property to the given value.
14056    pub fn filter(mut self, new_value: &str) -> ProjectLocationConnectionListCall<'a, C> {
14057        self._filter = Some(new_value.to_string());
14058        self
14059    }
14060    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14061    /// while executing the actual API request.
14062    ///
14063    /// ````text
14064    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14065    /// ````
14066    ///
14067    /// Sets the *delegate* property to the given value.
14068    pub fn delegate(
14069        mut self,
14070        new_value: &'a mut dyn common::Delegate,
14071    ) -> ProjectLocationConnectionListCall<'a, C> {
14072        self._delegate = Some(new_value);
14073        self
14074    }
14075
14076    /// Set any additional parameter of the query string used in the request.
14077    /// It should be used to set parameters which are not yet available through their own
14078    /// setters.
14079    ///
14080    /// Please note that this method must not be used to set any of the known parameters
14081    /// which have their own setter method. If done anyway, the request will fail.
14082    ///
14083    /// # Additional Parameters
14084    ///
14085    /// * *$.xgafv* (query-string) - V1 error format.
14086    /// * *access_token* (query-string) - OAuth access token.
14087    /// * *alt* (query-string) - Data format for response.
14088    /// * *callback* (query-string) - JSONP
14089    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14090    /// * *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.
14091    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14092    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14093    /// * *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.
14094    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14095    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14096    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationConnectionListCall<'a, C>
14097    where
14098        T: AsRef<str>,
14099    {
14100        self._additional_params
14101            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14102        self
14103    }
14104
14105    /// Identifies the authorization scope for the method you are building.
14106    ///
14107    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14108    /// [`Scope::CloudPlatform`].
14109    ///
14110    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14111    /// tokens for more than one scope.
14112    ///
14113    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14114    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14115    /// sufficient, a read-write scope will do as well.
14116    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionListCall<'a, C>
14117    where
14118        St: AsRef<str>,
14119    {
14120        self._scopes.insert(String::from(scope.as_ref()));
14121        self
14122    }
14123    /// Identifies the authorization scope(s) for the method you are building.
14124    ///
14125    /// See [`Self::add_scope()`] for details.
14126    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationConnectionListCall<'a, C>
14127    where
14128        I: IntoIterator<Item = St>,
14129        St: AsRef<str>,
14130    {
14131        self._scopes
14132            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14133        self
14134    }
14135
14136    /// Removes all scopes, and no default scope will be used either.
14137    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14138    /// for details).
14139    pub fn clear_scopes(mut self) -> ProjectLocationConnectionListCall<'a, C> {
14140        self._scopes.clear();
14141        self
14142    }
14143}
14144
14145/// ListenEvent listens to the event.
14146///
14147/// A builder for the *locations.connections.listenEvent* method supported by a *project* resource.
14148/// It is not used directly, but through a [`ProjectMethods`] instance.
14149///
14150/// # Example
14151///
14152/// Instantiate a resource method builder
14153///
14154/// ```test_harness,no_run
14155/// # extern crate hyper;
14156/// # extern crate hyper_rustls;
14157/// # extern crate google_connectors1 as connectors1;
14158/// use connectors1::api::ListenEventRequest;
14159/// # async fn dox() {
14160/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14161///
14162/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14163/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14164/// #     .with_native_roots()
14165/// #     .unwrap()
14166/// #     .https_only()
14167/// #     .enable_http2()
14168/// #     .build();
14169///
14170/// # let executor = hyper_util::rt::TokioExecutor::new();
14171/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14172/// #     secret,
14173/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14174/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14175/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14176/// #     ),
14177/// # ).build().await.unwrap();
14178///
14179/// # let client = hyper_util::client::legacy::Client::builder(
14180/// #     hyper_util::rt::TokioExecutor::new()
14181/// # )
14182/// # .build(
14183/// #     hyper_rustls::HttpsConnectorBuilder::new()
14184/// #         .with_native_roots()
14185/// #         .unwrap()
14186/// #         .https_or_http()
14187/// #         .enable_http2()
14188/// #         .build()
14189/// # );
14190/// # let mut hub = Connectors::new(client, auth);
14191/// // As the method needs a request, you would usually fill it with the desired information
14192/// // into the respective structure. Some of the parts shown here might not be applicable !
14193/// // Values shown here are possibly random and not representative !
14194/// let mut req = ListenEventRequest::default();
14195///
14196/// // You can configure optional parameters by calling the respective setters at will, and
14197/// // execute the final call using `doit()`.
14198/// // Values shown here are possibly random and not representative !
14199/// let result = hub.projects().locations_connections_listen_event(req, "resourcePath")
14200///              .doit().await;
14201/// # }
14202/// ```
14203pub struct ProjectLocationConnectionListenEventCall<'a, C>
14204where
14205    C: 'a,
14206{
14207    hub: &'a Connectors<C>,
14208    _request: ListenEventRequest,
14209    _resource_path: String,
14210    _delegate: Option<&'a mut dyn common::Delegate>,
14211    _additional_params: HashMap<String, String>,
14212    _scopes: BTreeSet<String>,
14213}
14214
14215impl<'a, C> common::CallBuilder for ProjectLocationConnectionListenEventCall<'a, C> {}
14216
14217impl<'a, C> ProjectLocationConnectionListenEventCall<'a, C>
14218where
14219    C: common::Connector,
14220{
14221    /// Perform the operation you have build so far.
14222    pub async fn doit(mut self) -> common::Result<(common::Response, ListenEventResponse)> {
14223        use std::borrow::Cow;
14224        use std::io::{Read, Seek};
14225
14226        use common::{url::Params, ToParts};
14227        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14228
14229        let mut dd = common::DefaultDelegate;
14230        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14231        dlg.begin(common::MethodInfo {
14232            id: "connectors.projects.locations.connections.listenEvent",
14233            http_method: hyper::Method::POST,
14234        });
14235
14236        for &field in ["alt", "resourcePath"].iter() {
14237            if self._additional_params.contains_key(field) {
14238                dlg.finished(false);
14239                return Err(common::Error::FieldClash(field));
14240            }
14241        }
14242
14243        let mut params = Params::with_capacity(4 + self._additional_params.len());
14244        params.push("resourcePath", self._resource_path);
14245
14246        params.extend(self._additional_params.iter());
14247
14248        params.push("alt", "json");
14249        let mut url = self.hub._base_url.clone() + "v1/{+resourcePath}:listenEvent";
14250        if self._scopes.is_empty() {
14251            self._scopes
14252                .insert(Scope::CloudPlatform.as_ref().to_string());
14253        }
14254
14255        #[allow(clippy::single_element_loop)]
14256        for &(find_this, param_name) in [("{+resourcePath}", "resourcePath")].iter() {
14257            url = params.uri_replacement(url, param_name, find_this, true);
14258        }
14259        {
14260            let to_remove = ["resourcePath"];
14261            params.remove_params(&to_remove);
14262        }
14263
14264        let url = params.parse_with_url(&url);
14265
14266        let mut json_mime_type = mime::APPLICATION_JSON;
14267        let mut request_value_reader = {
14268            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14269            common::remove_json_null_values(&mut value);
14270            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14271            serde_json::to_writer(&mut dst, &value).unwrap();
14272            dst
14273        };
14274        let request_size = request_value_reader
14275            .seek(std::io::SeekFrom::End(0))
14276            .unwrap();
14277        request_value_reader
14278            .seek(std::io::SeekFrom::Start(0))
14279            .unwrap();
14280
14281        loop {
14282            let token = match self
14283                .hub
14284                .auth
14285                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14286                .await
14287            {
14288                Ok(token) => token,
14289                Err(e) => match dlg.token(e) {
14290                    Ok(token) => token,
14291                    Err(e) => {
14292                        dlg.finished(false);
14293                        return Err(common::Error::MissingToken(e));
14294                    }
14295                },
14296            };
14297            request_value_reader
14298                .seek(std::io::SeekFrom::Start(0))
14299                .unwrap();
14300            let mut req_result = {
14301                let client = &self.hub.client;
14302                dlg.pre_request();
14303                let mut req_builder = hyper::Request::builder()
14304                    .method(hyper::Method::POST)
14305                    .uri(url.as_str())
14306                    .header(USER_AGENT, self.hub._user_agent.clone());
14307
14308                if let Some(token) = token.as_ref() {
14309                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14310                }
14311
14312                let request = req_builder
14313                    .header(CONTENT_TYPE, json_mime_type.to_string())
14314                    .header(CONTENT_LENGTH, request_size as u64)
14315                    .body(common::to_body(
14316                        request_value_reader.get_ref().clone().into(),
14317                    ));
14318
14319                client.request(request.unwrap()).await
14320            };
14321
14322            match req_result {
14323                Err(err) => {
14324                    if let common::Retry::After(d) = dlg.http_error(&err) {
14325                        sleep(d).await;
14326                        continue;
14327                    }
14328                    dlg.finished(false);
14329                    return Err(common::Error::HttpError(err));
14330                }
14331                Ok(res) => {
14332                    let (mut parts, body) = res.into_parts();
14333                    let mut body = common::Body::new(body);
14334                    if !parts.status.is_success() {
14335                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14336                        let error = serde_json::from_str(&common::to_string(&bytes));
14337                        let response = common::to_response(parts, bytes.into());
14338
14339                        if let common::Retry::After(d) =
14340                            dlg.http_failure(&response, error.as_ref().ok())
14341                        {
14342                            sleep(d).await;
14343                            continue;
14344                        }
14345
14346                        dlg.finished(false);
14347
14348                        return Err(match error {
14349                            Ok(value) => common::Error::BadRequest(value),
14350                            _ => common::Error::Failure(response),
14351                        });
14352                    }
14353                    let response = {
14354                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14355                        let encoded = common::to_string(&bytes);
14356                        match serde_json::from_str(&encoded) {
14357                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14358                            Err(error) => {
14359                                dlg.response_json_decode_error(&encoded, &error);
14360                                return Err(common::Error::JsonDecodeError(
14361                                    encoded.to_string(),
14362                                    error,
14363                                ));
14364                            }
14365                        }
14366                    };
14367
14368                    dlg.finished(true);
14369                    return Ok(response);
14370                }
14371            }
14372        }
14373    }
14374
14375    ///
14376    /// Sets the *request* property to the given value.
14377    ///
14378    /// Even though the property as already been set when instantiating this call,
14379    /// we provide this method for API completeness.
14380    pub fn request(
14381        mut self,
14382        new_value: ListenEventRequest,
14383    ) -> ProjectLocationConnectionListenEventCall<'a, C> {
14384        self._request = new_value;
14385        self
14386    }
14387    /// Required. Resource path for request.
14388    ///
14389    /// Sets the *resource path* path property to the given value.
14390    ///
14391    /// Even though the property as already been set when instantiating this call,
14392    /// we provide this method for API completeness.
14393    pub fn resource_path(
14394        mut self,
14395        new_value: &str,
14396    ) -> ProjectLocationConnectionListenEventCall<'a, C> {
14397        self._resource_path = new_value.to_string();
14398        self
14399    }
14400    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14401    /// while executing the actual API request.
14402    ///
14403    /// ````text
14404    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14405    /// ````
14406    ///
14407    /// Sets the *delegate* property to the given value.
14408    pub fn delegate(
14409        mut self,
14410        new_value: &'a mut dyn common::Delegate,
14411    ) -> ProjectLocationConnectionListenEventCall<'a, C> {
14412        self._delegate = Some(new_value);
14413        self
14414    }
14415
14416    /// Set any additional parameter of the query string used in the request.
14417    /// It should be used to set parameters which are not yet available through their own
14418    /// setters.
14419    ///
14420    /// Please note that this method must not be used to set any of the known parameters
14421    /// which have their own setter method. If done anyway, the request will fail.
14422    ///
14423    /// # Additional Parameters
14424    ///
14425    /// * *$.xgafv* (query-string) - V1 error format.
14426    /// * *access_token* (query-string) - OAuth access token.
14427    /// * *alt* (query-string) - Data format for response.
14428    /// * *callback* (query-string) - JSONP
14429    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14430    /// * *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.
14431    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14432    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14433    /// * *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.
14434    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14435    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14436    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationConnectionListenEventCall<'a, C>
14437    where
14438        T: AsRef<str>,
14439    {
14440        self._additional_params
14441            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14442        self
14443    }
14444
14445    /// Identifies the authorization scope for the method you are building.
14446    ///
14447    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14448    /// [`Scope::CloudPlatform`].
14449    ///
14450    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14451    /// tokens for more than one scope.
14452    ///
14453    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14454    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14455    /// sufficient, a read-write scope will do as well.
14456    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionListenEventCall<'a, C>
14457    where
14458        St: AsRef<str>,
14459    {
14460        self._scopes.insert(String::from(scope.as_ref()));
14461        self
14462    }
14463    /// Identifies the authorization scope(s) for the method you are building.
14464    ///
14465    /// See [`Self::add_scope()`] for details.
14466    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationConnectionListenEventCall<'a, C>
14467    where
14468        I: IntoIterator<Item = St>,
14469        St: AsRef<str>,
14470    {
14471        self._scopes
14472            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14473        self
14474    }
14475
14476    /// Removes all scopes, and no default scope will be used either.
14477    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14478    /// for details).
14479    pub fn clear_scopes(mut self) -> ProjectLocationConnectionListenEventCall<'a, C> {
14480        self._scopes.clear();
14481        self
14482    }
14483}
14484
14485/// Updates the parameters of a single Connection.
14486///
14487/// A builder for the *locations.connections.patch* method supported by a *project* resource.
14488/// It is not used directly, but through a [`ProjectMethods`] instance.
14489///
14490/// # Example
14491///
14492/// Instantiate a resource method builder
14493///
14494/// ```test_harness,no_run
14495/// # extern crate hyper;
14496/// # extern crate hyper_rustls;
14497/// # extern crate google_connectors1 as connectors1;
14498/// use connectors1::api::Connection;
14499/// # async fn dox() {
14500/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14501///
14502/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14503/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14504/// #     .with_native_roots()
14505/// #     .unwrap()
14506/// #     .https_only()
14507/// #     .enable_http2()
14508/// #     .build();
14509///
14510/// # let executor = hyper_util::rt::TokioExecutor::new();
14511/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14512/// #     secret,
14513/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14514/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14515/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14516/// #     ),
14517/// # ).build().await.unwrap();
14518///
14519/// # let client = hyper_util::client::legacy::Client::builder(
14520/// #     hyper_util::rt::TokioExecutor::new()
14521/// # )
14522/// # .build(
14523/// #     hyper_rustls::HttpsConnectorBuilder::new()
14524/// #         .with_native_roots()
14525/// #         .unwrap()
14526/// #         .https_or_http()
14527/// #         .enable_http2()
14528/// #         .build()
14529/// # );
14530/// # let mut hub = Connectors::new(client, auth);
14531/// // As the method needs a request, you would usually fill it with the desired information
14532/// // into the respective structure. Some of the parts shown here might not be applicable !
14533/// // Values shown here are possibly random and not representative !
14534/// let mut req = Connection::default();
14535///
14536/// // You can configure optional parameters by calling the respective setters at will, and
14537/// // execute the final call using `doit()`.
14538/// // Values shown here are possibly random and not representative !
14539/// let result = hub.projects().locations_connections_patch(req, "name")
14540///              .update_mask(FieldMask::new::<&str>(&[]))
14541///              .doit().await;
14542/// # }
14543/// ```
14544pub struct ProjectLocationConnectionPatchCall<'a, C>
14545where
14546    C: 'a,
14547{
14548    hub: &'a Connectors<C>,
14549    _request: Connection,
14550    _name: String,
14551    _update_mask: Option<common::FieldMask>,
14552    _delegate: Option<&'a mut dyn common::Delegate>,
14553    _additional_params: HashMap<String, String>,
14554    _scopes: BTreeSet<String>,
14555}
14556
14557impl<'a, C> common::CallBuilder for ProjectLocationConnectionPatchCall<'a, C> {}
14558
14559impl<'a, C> ProjectLocationConnectionPatchCall<'a, C>
14560where
14561    C: common::Connector,
14562{
14563    /// Perform the operation you have build so far.
14564    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
14565        use std::borrow::Cow;
14566        use std::io::{Read, Seek};
14567
14568        use common::{url::Params, ToParts};
14569        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14570
14571        let mut dd = common::DefaultDelegate;
14572        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14573        dlg.begin(common::MethodInfo {
14574            id: "connectors.projects.locations.connections.patch",
14575            http_method: hyper::Method::PATCH,
14576        });
14577
14578        for &field in ["alt", "name", "updateMask"].iter() {
14579            if self._additional_params.contains_key(field) {
14580                dlg.finished(false);
14581                return Err(common::Error::FieldClash(field));
14582            }
14583        }
14584
14585        let mut params = Params::with_capacity(5 + self._additional_params.len());
14586        params.push("name", self._name);
14587        if let Some(value) = self._update_mask.as_ref() {
14588            params.push("updateMask", value.to_string());
14589        }
14590
14591        params.extend(self._additional_params.iter());
14592
14593        params.push("alt", "json");
14594        let mut url = self.hub._base_url.clone() + "v1/{+name}";
14595        if self._scopes.is_empty() {
14596            self._scopes
14597                .insert(Scope::CloudPlatform.as_ref().to_string());
14598        }
14599
14600        #[allow(clippy::single_element_loop)]
14601        for &(find_this, param_name) in [("{+name}", "name")].iter() {
14602            url = params.uri_replacement(url, param_name, find_this, true);
14603        }
14604        {
14605            let to_remove = ["name"];
14606            params.remove_params(&to_remove);
14607        }
14608
14609        let url = params.parse_with_url(&url);
14610
14611        let mut json_mime_type = mime::APPLICATION_JSON;
14612        let mut request_value_reader = {
14613            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14614            common::remove_json_null_values(&mut value);
14615            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14616            serde_json::to_writer(&mut dst, &value).unwrap();
14617            dst
14618        };
14619        let request_size = request_value_reader
14620            .seek(std::io::SeekFrom::End(0))
14621            .unwrap();
14622        request_value_reader
14623            .seek(std::io::SeekFrom::Start(0))
14624            .unwrap();
14625
14626        loop {
14627            let token = match self
14628                .hub
14629                .auth
14630                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14631                .await
14632            {
14633                Ok(token) => token,
14634                Err(e) => match dlg.token(e) {
14635                    Ok(token) => token,
14636                    Err(e) => {
14637                        dlg.finished(false);
14638                        return Err(common::Error::MissingToken(e));
14639                    }
14640                },
14641            };
14642            request_value_reader
14643                .seek(std::io::SeekFrom::Start(0))
14644                .unwrap();
14645            let mut req_result = {
14646                let client = &self.hub.client;
14647                dlg.pre_request();
14648                let mut req_builder = hyper::Request::builder()
14649                    .method(hyper::Method::PATCH)
14650                    .uri(url.as_str())
14651                    .header(USER_AGENT, self.hub._user_agent.clone());
14652
14653                if let Some(token) = token.as_ref() {
14654                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14655                }
14656
14657                let request = req_builder
14658                    .header(CONTENT_TYPE, json_mime_type.to_string())
14659                    .header(CONTENT_LENGTH, request_size as u64)
14660                    .body(common::to_body(
14661                        request_value_reader.get_ref().clone().into(),
14662                    ));
14663
14664                client.request(request.unwrap()).await
14665            };
14666
14667            match req_result {
14668                Err(err) => {
14669                    if let common::Retry::After(d) = dlg.http_error(&err) {
14670                        sleep(d).await;
14671                        continue;
14672                    }
14673                    dlg.finished(false);
14674                    return Err(common::Error::HttpError(err));
14675                }
14676                Ok(res) => {
14677                    let (mut parts, body) = res.into_parts();
14678                    let mut body = common::Body::new(body);
14679                    if !parts.status.is_success() {
14680                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14681                        let error = serde_json::from_str(&common::to_string(&bytes));
14682                        let response = common::to_response(parts, bytes.into());
14683
14684                        if let common::Retry::After(d) =
14685                            dlg.http_failure(&response, error.as_ref().ok())
14686                        {
14687                            sleep(d).await;
14688                            continue;
14689                        }
14690
14691                        dlg.finished(false);
14692
14693                        return Err(match error {
14694                            Ok(value) => common::Error::BadRequest(value),
14695                            _ => common::Error::Failure(response),
14696                        });
14697                    }
14698                    let response = {
14699                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14700                        let encoded = common::to_string(&bytes);
14701                        match serde_json::from_str(&encoded) {
14702                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14703                            Err(error) => {
14704                                dlg.response_json_decode_error(&encoded, &error);
14705                                return Err(common::Error::JsonDecodeError(
14706                                    encoded.to_string(),
14707                                    error,
14708                                ));
14709                            }
14710                        }
14711                    };
14712
14713                    dlg.finished(true);
14714                    return Ok(response);
14715                }
14716            }
14717        }
14718    }
14719
14720    ///
14721    /// Sets the *request* property to the given value.
14722    ///
14723    /// Even though the property as already been set when instantiating this call,
14724    /// we provide this method for API completeness.
14725    pub fn request(mut self, new_value: Connection) -> ProjectLocationConnectionPatchCall<'a, C> {
14726        self._request = new_value;
14727        self
14728    }
14729    /// Output only. Resource name of the Connection. Format: projects/{project}/locations/{location}/connections/{connection}
14730    ///
14731    /// Sets the *name* path property to the given value.
14732    ///
14733    /// Even though the property as already been set when instantiating this call,
14734    /// we provide this method for API completeness.
14735    pub fn name(mut self, new_value: &str) -> ProjectLocationConnectionPatchCall<'a, C> {
14736        self._name = new_value.to_string();
14737        self
14738    }
14739    /// Required. The list of fields to update. Fields are specified relative to the connection. A field will be overwritten if it is in the mask. The field mask must not be empty, and it must not contain fields that are immutable or only set by the server. You can modify only the fields listed below. To lock/unlock a connection: * `lock_config` To suspend/resume a connection: * `suspended` To update the connection details: * `description` * `labels` * `connector_version` * `config_variables` * `auth_config` * `destination_configs` * `node_config` * `log_config` * `ssl_config` * `eventing_enablement_type` * `eventing_config` * `auth_override_enabled` * `async_operations_enabled`
14740    ///
14741    /// Sets the *update mask* query property to the given value.
14742    pub fn update_mask(
14743        mut self,
14744        new_value: common::FieldMask,
14745    ) -> ProjectLocationConnectionPatchCall<'a, C> {
14746        self._update_mask = Some(new_value);
14747        self
14748    }
14749    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14750    /// while executing the actual API request.
14751    ///
14752    /// ````text
14753    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14754    /// ````
14755    ///
14756    /// Sets the *delegate* property to the given value.
14757    pub fn delegate(
14758        mut self,
14759        new_value: &'a mut dyn common::Delegate,
14760    ) -> ProjectLocationConnectionPatchCall<'a, C> {
14761        self._delegate = Some(new_value);
14762        self
14763    }
14764
14765    /// Set any additional parameter of the query string used in the request.
14766    /// It should be used to set parameters which are not yet available through their own
14767    /// setters.
14768    ///
14769    /// Please note that this method must not be used to set any of the known parameters
14770    /// which have their own setter method. If done anyway, the request will fail.
14771    ///
14772    /// # Additional Parameters
14773    ///
14774    /// * *$.xgafv* (query-string) - V1 error format.
14775    /// * *access_token* (query-string) - OAuth access token.
14776    /// * *alt* (query-string) - Data format for response.
14777    /// * *callback* (query-string) - JSONP
14778    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14779    /// * *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.
14780    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14781    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14782    /// * *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.
14783    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14784    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14785    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationConnectionPatchCall<'a, C>
14786    where
14787        T: AsRef<str>,
14788    {
14789        self._additional_params
14790            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14791        self
14792    }
14793
14794    /// Identifies the authorization scope for the method you are building.
14795    ///
14796    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14797    /// [`Scope::CloudPlatform`].
14798    ///
14799    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14800    /// tokens for more than one scope.
14801    ///
14802    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14803    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14804    /// sufficient, a read-write scope will do as well.
14805    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionPatchCall<'a, C>
14806    where
14807        St: AsRef<str>,
14808    {
14809        self._scopes.insert(String::from(scope.as_ref()));
14810        self
14811    }
14812    /// Identifies the authorization scope(s) for the method you are building.
14813    ///
14814    /// See [`Self::add_scope()`] for details.
14815    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationConnectionPatchCall<'a, C>
14816    where
14817        I: IntoIterator<Item = St>,
14818        St: AsRef<str>,
14819    {
14820        self._scopes
14821            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14822        self
14823    }
14824
14825    /// Removes all scopes, and no default scope will be used either.
14826    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14827    /// for details).
14828    pub fn clear_scopes(mut self) -> ProjectLocationConnectionPatchCall<'a, C> {
14829        self._scopes.clear();
14830        self
14831    }
14832}
14833
14834/// RepaiEventing tries to repair eventing related event subscriptions.
14835///
14836/// A builder for the *locations.connections.repairEventing* method supported by a *project* resource.
14837/// It is not used directly, but through a [`ProjectMethods`] instance.
14838///
14839/// # Example
14840///
14841/// Instantiate a resource method builder
14842///
14843/// ```test_harness,no_run
14844/// # extern crate hyper;
14845/// # extern crate hyper_rustls;
14846/// # extern crate google_connectors1 as connectors1;
14847/// use connectors1::api::RepairEventingRequest;
14848/// # async fn dox() {
14849/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14850///
14851/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14852/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14853/// #     .with_native_roots()
14854/// #     .unwrap()
14855/// #     .https_only()
14856/// #     .enable_http2()
14857/// #     .build();
14858///
14859/// # let executor = hyper_util::rt::TokioExecutor::new();
14860/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14861/// #     secret,
14862/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14863/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14864/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14865/// #     ),
14866/// # ).build().await.unwrap();
14867///
14868/// # let client = hyper_util::client::legacy::Client::builder(
14869/// #     hyper_util::rt::TokioExecutor::new()
14870/// # )
14871/// # .build(
14872/// #     hyper_rustls::HttpsConnectorBuilder::new()
14873/// #         .with_native_roots()
14874/// #         .unwrap()
14875/// #         .https_or_http()
14876/// #         .enable_http2()
14877/// #         .build()
14878/// # );
14879/// # let mut hub = Connectors::new(client, auth);
14880/// // As the method needs a request, you would usually fill it with the desired information
14881/// // into the respective structure. Some of the parts shown here might not be applicable !
14882/// // Values shown here are possibly random and not representative !
14883/// let mut req = RepairEventingRequest::default();
14884///
14885/// // You can configure optional parameters by calling the respective setters at will, and
14886/// // execute the final call using `doit()`.
14887/// // Values shown here are possibly random and not representative !
14888/// let result = hub.projects().locations_connections_repair_eventing(req, "name")
14889///              .doit().await;
14890/// # }
14891/// ```
14892pub struct ProjectLocationConnectionRepairEventingCall<'a, C>
14893where
14894    C: 'a,
14895{
14896    hub: &'a Connectors<C>,
14897    _request: RepairEventingRequest,
14898    _name: String,
14899    _delegate: Option<&'a mut dyn common::Delegate>,
14900    _additional_params: HashMap<String, String>,
14901    _scopes: BTreeSet<String>,
14902}
14903
14904impl<'a, C> common::CallBuilder for ProjectLocationConnectionRepairEventingCall<'a, C> {}
14905
14906impl<'a, C> ProjectLocationConnectionRepairEventingCall<'a, C>
14907where
14908    C: common::Connector,
14909{
14910    /// Perform the operation you have build so far.
14911    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
14912        use std::borrow::Cow;
14913        use std::io::{Read, Seek};
14914
14915        use common::{url::Params, ToParts};
14916        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14917
14918        let mut dd = common::DefaultDelegate;
14919        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14920        dlg.begin(common::MethodInfo {
14921            id: "connectors.projects.locations.connections.repairEventing",
14922            http_method: hyper::Method::POST,
14923        });
14924
14925        for &field in ["alt", "name"].iter() {
14926            if self._additional_params.contains_key(field) {
14927                dlg.finished(false);
14928                return Err(common::Error::FieldClash(field));
14929            }
14930        }
14931
14932        let mut params = Params::with_capacity(4 + self._additional_params.len());
14933        params.push("name", self._name);
14934
14935        params.extend(self._additional_params.iter());
14936
14937        params.push("alt", "json");
14938        let mut url = self.hub._base_url.clone() + "v1/{+name}:repairEventing";
14939        if self._scopes.is_empty() {
14940            self._scopes
14941                .insert(Scope::CloudPlatform.as_ref().to_string());
14942        }
14943
14944        #[allow(clippy::single_element_loop)]
14945        for &(find_this, param_name) in [("{+name}", "name")].iter() {
14946            url = params.uri_replacement(url, param_name, find_this, true);
14947        }
14948        {
14949            let to_remove = ["name"];
14950            params.remove_params(&to_remove);
14951        }
14952
14953        let url = params.parse_with_url(&url);
14954
14955        let mut json_mime_type = mime::APPLICATION_JSON;
14956        let mut request_value_reader = {
14957            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14958            common::remove_json_null_values(&mut value);
14959            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14960            serde_json::to_writer(&mut dst, &value).unwrap();
14961            dst
14962        };
14963        let request_size = request_value_reader
14964            .seek(std::io::SeekFrom::End(0))
14965            .unwrap();
14966        request_value_reader
14967            .seek(std::io::SeekFrom::Start(0))
14968            .unwrap();
14969
14970        loop {
14971            let token = match self
14972                .hub
14973                .auth
14974                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14975                .await
14976            {
14977                Ok(token) => token,
14978                Err(e) => match dlg.token(e) {
14979                    Ok(token) => token,
14980                    Err(e) => {
14981                        dlg.finished(false);
14982                        return Err(common::Error::MissingToken(e));
14983                    }
14984                },
14985            };
14986            request_value_reader
14987                .seek(std::io::SeekFrom::Start(0))
14988                .unwrap();
14989            let mut req_result = {
14990                let client = &self.hub.client;
14991                dlg.pre_request();
14992                let mut req_builder = hyper::Request::builder()
14993                    .method(hyper::Method::POST)
14994                    .uri(url.as_str())
14995                    .header(USER_AGENT, self.hub._user_agent.clone());
14996
14997                if let Some(token) = token.as_ref() {
14998                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14999                }
15000
15001                let request = req_builder
15002                    .header(CONTENT_TYPE, json_mime_type.to_string())
15003                    .header(CONTENT_LENGTH, request_size as u64)
15004                    .body(common::to_body(
15005                        request_value_reader.get_ref().clone().into(),
15006                    ));
15007
15008                client.request(request.unwrap()).await
15009            };
15010
15011            match req_result {
15012                Err(err) => {
15013                    if let common::Retry::After(d) = dlg.http_error(&err) {
15014                        sleep(d).await;
15015                        continue;
15016                    }
15017                    dlg.finished(false);
15018                    return Err(common::Error::HttpError(err));
15019                }
15020                Ok(res) => {
15021                    let (mut parts, body) = res.into_parts();
15022                    let mut body = common::Body::new(body);
15023                    if !parts.status.is_success() {
15024                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15025                        let error = serde_json::from_str(&common::to_string(&bytes));
15026                        let response = common::to_response(parts, bytes.into());
15027
15028                        if let common::Retry::After(d) =
15029                            dlg.http_failure(&response, error.as_ref().ok())
15030                        {
15031                            sleep(d).await;
15032                            continue;
15033                        }
15034
15035                        dlg.finished(false);
15036
15037                        return Err(match error {
15038                            Ok(value) => common::Error::BadRequest(value),
15039                            _ => common::Error::Failure(response),
15040                        });
15041                    }
15042                    let response = {
15043                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15044                        let encoded = common::to_string(&bytes);
15045                        match serde_json::from_str(&encoded) {
15046                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15047                            Err(error) => {
15048                                dlg.response_json_decode_error(&encoded, &error);
15049                                return Err(common::Error::JsonDecodeError(
15050                                    encoded.to_string(),
15051                                    error,
15052                                ));
15053                            }
15054                        }
15055                    };
15056
15057                    dlg.finished(true);
15058                    return Ok(response);
15059                }
15060            }
15061        }
15062    }
15063
15064    ///
15065    /// Sets the *request* property to the given value.
15066    ///
15067    /// Even though the property as already been set when instantiating this call,
15068    /// we provide this method for API completeness.
15069    pub fn request(
15070        mut self,
15071        new_value: RepairEventingRequest,
15072    ) -> ProjectLocationConnectionRepairEventingCall<'a, C> {
15073        self._request = new_value;
15074        self
15075    }
15076    /// Required. Resource name of the form: `projects/*/locations/*/connections/*`
15077    ///
15078    /// Sets the *name* path property to the given value.
15079    ///
15080    /// Even though the property as already been set when instantiating this call,
15081    /// we provide this method for API completeness.
15082    pub fn name(mut self, new_value: &str) -> ProjectLocationConnectionRepairEventingCall<'a, C> {
15083        self._name = new_value.to_string();
15084        self
15085    }
15086    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15087    /// while executing the actual API request.
15088    ///
15089    /// ````text
15090    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15091    /// ````
15092    ///
15093    /// Sets the *delegate* property to the given value.
15094    pub fn delegate(
15095        mut self,
15096        new_value: &'a mut dyn common::Delegate,
15097    ) -> ProjectLocationConnectionRepairEventingCall<'a, C> {
15098        self._delegate = Some(new_value);
15099        self
15100    }
15101
15102    /// Set any additional parameter of the query string used in the request.
15103    /// It should be used to set parameters which are not yet available through their own
15104    /// setters.
15105    ///
15106    /// Please note that this method must not be used to set any of the known parameters
15107    /// which have their own setter method. If done anyway, the request will fail.
15108    ///
15109    /// # Additional Parameters
15110    ///
15111    /// * *$.xgafv* (query-string) - V1 error format.
15112    /// * *access_token* (query-string) - OAuth access token.
15113    /// * *alt* (query-string) - Data format for response.
15114    /// * *callback* (query-string) - JSONP
15115    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15116    /// * *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.
15117    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15118    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15119    /// * *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.
15120    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15121    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15122    pub fn param<T>(
15123        mut self,
15124        name: T,
15125        value: T,
15126    ) -> ProjectLocationConnectionRepairEventingCall<'a, C>
15127    where
15128        T: AsRef<str>,
15129    {
15130        self._additional_params
15131            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15132        self
15133    }
15134
15135    /// Identifies the authorization scope for the method you are building.
15136    ///
15137    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15138    /// [`Scope::CloudPlatform`].
15139    ///
15140    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15141    /// tokens for more than one scope.
15142    ///
15143    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15144    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15145    /// sufficient, a read-write scope will do as well.
15146    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionRepairEventingCall<'a, C>
15147    where
15148        St: AsRef<str>,
15149    {
15150        self._scopes.insert(String::from(scope.as_ref()));
15151        self
15152    }
15153    /// Identifies the authorization scope(s) for the method you are building.
15154    ///
15155    /// See [`Self::add_scope()`] for details.
15156    pub fn add_scopes<I, St>(
15157        mut self,
15158        scopes: I,
15159    ) -> ProjectLocationConnectionRepairEventingCall<'a, C>
15160    where
15161        I: IntoIterator<Item = St>,
15162        St: AsRef<str>,
15163    {
15164        self._scopes
15165            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15166        self
15167    }
15168
15169    /// Removes all scopes, and no default scope will be used either.
15170    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15171    /// for details).
15172    pub fn clear_scopes(mut self) -> ProjectLocationConnectionRepairEventingCall<'a, C> {
15173        self._scopes.clear();
15174        self
15175    }
15176}
15177
15178/// Returns Top matching Connections for a given query.
15179///
15180/// A builder for the *locations.connections.search* method supported by a *project* resource.
15181/// It is not used directly, but through a [`ProjectMethods`] instance.
15182///
15183/// # Example
15184///
15185/// Instantiate a resource method builder
15186///
15187/// ```test_harness,no_run
15188/// # extern crate hyper;
15189/// # extern crate hyper_rustls;
15190/// # extern crate google_connectors1 as connectors1;
15191/// # async fn dox() {
15192/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15193///
15194/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15195/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15196/// #     .with_native_roots()
15197/// #     .unwrap()
15198/// #     .https_only()
15199/// #     .enable_http2()
15200/// #     .build();
15201///
15202/// # let executor = hyper_util::rt::TokioExecutor::new();
15203/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15204/// #     secret,
15205/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15206/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15207/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15208/// #     ),
15209/// # ).build().await.unwrap();
15210///
15211/// # let client = hyper_util::client::legacy::Client::builder(
15212/// #     hyper_util::rt::TokioExecutor::new()
15213/// # )
15214/// # .build(
15215/// #     hyper_rustls::HttpsConnectorBuilder::new()
15216/// #         .with_native_roots()
15217/// #         .unwrap()
15218/// #         .https_or_http()
15219/// #         .enable_http2()
15220/// #         .build()
15221/// # );
15222/// # let mut hub = Connectors::new(client, auth);
15223/// // You can configure optional parameters by calling the respective setters at will, and
15224/// // execute the final call using `doit()`.
15225/// // Values shown here are possibly random and not representative !
15226/// let result = hub.projects().locations_connections_search("name")
15227///              .query("diam")
15228///              .page_token("no")
15229///              .page_size(-100)
15230///              .doit().await;
15231/// # }
15232/// ```
15233pub struct ProjectLocationConnectionSearchCall<'a, C>
15234where
15235    C: 'a,
15236{
15237    hub: &'a Connectors<C>,
15238    _name: String,
15239    _query: Option<String>,
15240    _page_token: Option<String>,
15241    _page_size: Option<i32>,
15242    _delegate: Option<&'a mut dyn common::Delegate>,
15243    _additional_params: HashMap<String, String>,
15244    _scopes: BTreeSet<String>,
15245}
15246
15247impl<'a, C> common::CallBuilder for ProjectLocationConnectionSearchCall<'a, C> {}
15248
15249impl<'a, C> ProjectLocationConnectionSearchCall<'a, C>
15250where
15251    C: common::Connector,
15252{
15253    /// Perform the operation you have build so far.
15254    pub async fn doit(mut self) -> common::Result<(common::Response, SearchConnectionsResponse)> {
15255        use std::borrow::Cow;
15256        use std::io::{Read, Seek};
15257
15258        use common::{url::Params, ToParts};
15259        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15260
15261        let mut dd = common::DefaultDelegate;
15262        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15263        dlg.begin(common::MethodInfo {
15264            id: "connectors.projects.locations.connections.search",
15265            http_method: hyper::Method::GET,
15266        });
15267
15268        for &field in ["alt", "name", "query", "pageToken", "pageSize"].iter() {
15269            if self._additional_params.contains_key(field) {
15270                dlg.finished(false);
15271                return Err(common::Error::FieldClash(field));
15272            }
15273        }
15274
15275        let mut params = Params::with_capacity(6 + self._additional_params.len());
15276        params.push("name", self._name);
15277        if let Some(value) = self._query.as_ref() {
15278            params.push("query", value);
15279        }
15280        if let Some(value) = self._page_token.as_ref() {
15281            params.push("pageToken", value);
15282        }
15283        if let Some(value) = self._page_size.as_ref() {
15284            params.push("pageSize", value.to_string());
15285        }
15286
15287        params.extend(self._additional_params.iter());
15288
15289        params.push("alt", "json");
15290        let mut url = self.hub._base_url.clone() + "v1/{+name}:search";
15291        if self._scopes.is_empty() {
15292            self._scopes
15293                .insert(Scope::CloudPlatform.as_ref().to_string());
15294        }
15295
15296        #[allow(clippy::single_element_loop)]
15297        for &(find_this, param_name) in [("{+name}", "name")].iter() {
15298            url = params.uri_replacement(url, param_name, find_this, true);
15299        }
15300        {
15301            let to_remove = ["name"];
15302            params.remove_params(&to_remove);
15303        }
15304
15305        let url = params.parse_with_url(&url);
15306
15307        loop {
15308            let token = match self
15309                .hub
15310                .auth
15311                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15312                .await
15313            {
15314                Ok(token) => token,
15315                Err(e) => match dlg.token(e) {
15316                    Ok(token) => token,
15317                    Err(e) => {
15318                        dlg.finished(false);
15319                        return Err(common::Error::MissingToken(e));
15320                    }
15321                },
15322            };
15323            let mut req_result = {
15324                let client = &self.hub.client;
15325                dlg.pre_request();
15326                let mut req_builder = hyper::Request::builder()
15327                    .method(hyper::Method::GET)
15328                    .uri(url.as_str())
15329                    .header(USER_AGENT, self.hub._user_agent.clone());
15330
15331                if let Some(token) = token.as_ref() {
15332                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15333                }
15334
15335                let request = req_builder
15336                    .header(CONTENT_LENGTH, 0_u64)
15337                    .body(common::to_body::<String>(None));
15338
15339                client.request(request.unwrap()).await
15340            };
15341
15342            match req_result {
15343                Err(err) => {
15344                    if let common::Retry::After(d) = dlg.http_error(&err) {
15345                        sleep(d).await;
15346                        continue;
15347                    }
15348                    dlg.finished(false);
15349                    return Err(common::Error::HttpError(err));
15350                }
15351                Ok(res) => {
15352                    let (mut parts, body) = res.into_parts();
15353                    let mut body = common::Body::new(body);
15354                    if !parts.status.is_success() {
15355                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15356                        let error = serde_json::from_str(&common::to_string(&bytes));
15357                        let response = common::to_response(parts, bytes.into());
15358
15359                        if let common::Retry::After(d) =
15360                            dlg.http_failure(&response, error.as_ref().ok())
15361                        {
15362                            sleep(d).await;
15363                            continue;
15364                        }
15365
15366                        dlg.finished(false);
15367
15368                        return Err(match error {
15369                            Ok(value) => common::Error::BadRequest(value),
15370                            _ => common::Error::Failure(response),
15371                        });
15372                    }
15373                    let response = {
15374                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15375                        let encoded = common::to_string(&bytes);
15376                        match serde_json::from_str(&encoded) {
15377                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15378                            Err(error) => {
15379                                dlg.response_json_decode_error(&encoded, &error);
15380                                return Err(common::Error::JsonDecodeError(
15381                                    encoded.to_string(),
15382                                    error,
15383                                ));
15384                            }
15385                        }
15386                    };
15387
15388                    dlg.finished(true);
15389                    return Ok(response);
15390                }
15391            }
15392        }
15393    }
15394
15395    /// Required. Parent resource of the Connection, of the form: `projects/*/locations/*/connections`
15396    ///
15397    /// Sets the *name* path property to the given value.
15398    ///
15399    /// Even though the property as already been set when instantiating this call,
15400    /// we provide this method for API completeness.
15401    pub fn name(mut self, new_value: &str) -> ProjectLocationConnectionSearchCall<'a, C> {
15402        self._name = new_value.to_string();
15403        self
15404    }
15405    /// Required. The query against which the search needs to be done.
15406    ///
15407    /// Sets the *query* query property to the given value.
15408    pub fn query(mut self, new_value: &str) -> ProjectLocationConnectionSearchCall<'a, C> {
15409        self._query = Some(new_value.to_string());
15410        self
15411    }
15412    /// Optional. page_token
15413    ///
15414    /// Sets the *page token* query property to the given value.
15415    pub fn page_token(mut self, new_value: &str) -> ProjectLocationConnectionSearchCall<'a, C> {
15416        self._page_token = Some(new_value.to_string());
15417        self
15418    }
15419    /// Optional. The number of top matching connectors to return
15420    ///
15421    /// Sets the *page size* query property to the given value.
15422    pub fn page_size(mut self, new_value: i32) -> ProjectLocationConnectionSearchCall<'a, C> {
15423        self._page_size = Some(new_value);
15424        self
15425    }
15426    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15427    /// while executing the actual API request.
15428    ///
15429    /// ````text
15430    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15431    /// ````
15432    ///
15433    /// Sets the *delegate* property to the given value.
15434    pub fn delegate(
15435        mut self,
15436        new_value: &'a mut dyn common::Delegate,
15437    ) -> ProjectLocationConnectionSearchCall<'a, C> {
15438        self._delegate = Some(new_value);
15439        self
15440    }
15441
15442    /// Set any additional parameter of the query string used in the request.
15443    /// It should be used to set parameters which are not yet available through their own
15444    /// setters.
15445    ///
15446    /// Please note that this method must not be used to set any of the known parameters
15447    /// which have their own setter method. If done anyway, the request will fail.
15448    ///
15449    /// # Additional Parameters
15450    ///
15451    /// * *$.xgafv* (query-string) - V1 error format.
15452    /// * *access_token* (query-string) - OAuth access token.
15453    /// * *alt* (query-string) - Data format for response.
15454    /// * *callback* (query-string) - JSONP
15455    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15456    /// * *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.
15457    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15458    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15459    /// * *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.
15460    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15461    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15462    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationConnectionSearchCall<'a, C>
15463    where
15464        T: AsRef<str>,
15465    {
15466        self._additional_params
15467            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15468        self
15469    }
15470
15471    /// Identifies the authorization scope for the method you are building.
15472    ///
15473    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15474    /// [`Scope::CloudPlatform`].
15475    ///
15476    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15477    /// tokens for more than one scope.
15478    ///
15479    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15480    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15481    /// sufficient, a read-write scope will do as well.
15482    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionSearchCall<'a, C>
15483    where
15484        St: AsRef<str>,
15485    {
15486        self._scopes.insert(String::from(scope.as_ref()));
15487        self
15488    }
15489    /// Identifies the authorization scope(s) for the method you are building.
15490    ///
15491    /// See [`Self::add_scope()`] for details.
15492    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationConnectionSearchCall<'a, C>
15493    where
15494        I: IntoIterator<Item = St>,
15495        St: AsRef<str>,
15496    {
15497        self._scopes
15498            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15499        self
15500    }
15501
15502    /// Removes all scopes, and no default scope will be used either.
15503    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15504    /// for details).
15505    pub fn clear_scopes(mut self) -> ProjectLocationConnectionSearchCall<'a, C> {
15506        self._scopes.clear();
15507        self
15508    }
15509}
15510
15511/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
15512///
15513/// A builder for the *locations.connections.setIamPolicy* method supported by a *project* resource.
15514/// It is not used directly, but through a [`ProjectMethods`] instance.
15515///
15516/// # Example
15517///
15518/// Instantiate a resource method builder
15519///
15520/// ```test_harness,no_run
15521/// # extern crate hyper;
15522/// # extern crate hyper_rustls;
15523/// # extern crate google_connectors1 as connectors1;
15524/// use connectors1::api::SetIamPolicyRequest;
15525/// # async fn dox() {
15526/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15527///
15528/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15529/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15530/// #     .with_native_roots()
15531/// #     .unwrap()
15532/// #     .https_only()
15533/// #     .enable_http2()
15534/// #     .build();
15535///
15536/// # let executor = hyper_util::rt::TokioExecutor::new();
15537/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15538/// #     secret,
15539/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15540/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15541/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15542/// #     ),
15543/// # ).build().await.unwrap();
15544///
15545/// # let client = hyper_util::client::legacy::Client::builder(
15546/// #     hyper_util::rt::TokioExecutor::new()
15547/// # )
15548/// # .build(
15549/// #     hyper_rustls::HttpsConnectorBuilder::new()
15550/// #         .with_native_roots()
15551/// #         .unwrap()
15552/// #         .https_or_http()
15553/// #         .enable_http2()
15554/// #         .build()
15555/// # );
15556/// # let mut hub = Connectors::new(client, auth);
15557/// // As the method needs a request, you would usually fill it with the desired information
15558/// // into the respective structure. Some of the parts shown here might not be applicable !
15559/// // Values shown here are possibly random and not representative !
15560/// let mut req = SetIamPolicyRequest::default();
15561///
15562/// // You can configure optional parameters by calling the respective setters at will, and
15563/// // execute the final call using `doit()`.
15564/// // Values shown here are possibly random and not representative !
15565/// let result = hub.projects().locations_connections_set_iam_policy(req, "resource")
15566///              .doit().await;
15567/// # }
15568/// ```
15569pub struct ProjectLocationConnectionSetIamPolicyCall<'a, C>
15570where
15571    C: 'a,
15572{
15573    hub: &'a Connectors<C>,
15574    _request: SetIamPolicyRequest,
15575    _resource: String,
15576    _delegate: Option<&'a mut dyn common::Delegate>,
15577    _additional_params: HashMap<String, String>,
15578    _scopes: BTreeSet<String>,
15579}
15580
15581impl<'a, C> common::CallBuilder for ProjectLocationConnectionSetIamPolicyCall<'a, C> {}
15582
15583impl<'a, C> ProjectLocationConnectionSetIamPolicyCall<'a, C>
15584where
15585    C: common::Connector,
15586{
15587    /// Perform the operation you have build so far.
15588    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
15589        use std::borrow::Cow;
15590        use std::io::{Read, Seek};
15591
15592        use common::{url::Params, ToParts};
15593        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15594
15595        let mut dd = common::DefaultDelegate;
15596        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15597        dlg.begin(common::MethodInfo {
15598            id: "connectors.projects.locations.connections.setIamPolicy",
15599            http_method: hyper::Method::POST,
15600        });
15601
15602        for &field in ["alt", "resource"].iter() {
15603            if self._additional_params.contains_key(field) {
15604                dlg.finished(false);
15605                return Err(common::Error::FieldClash(field));
15606            }
15607        }
15608
15609        let mut params = Params::with_capacity(4 + self._additional_params.len());
15610        params.push("resource", self._resource);
15611
15612        params.extend(self._additional_params.iter());
15613
15614        params.push("alt", "json");
15615        let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
15616        if self._scopes.is_empty() {
15617            self._scopes
15618                .insert(Scope::CloudPlatform.as_ref().to_string());
15619        }
15620
15621        #[allow(clippy::single_element_loop)]
15622        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
15623            url = params.uri_replacement(url, param_name, find_this, true);
15624        }
15625        {
15626            let to_remove = ["resource"];
15627            params.remove_params(&to_remove);
15628        }
15629
15630        let url = params.parse_with_url(&url);
15631
15632        let mut json_mime_type = mime::APPLICATION_JSON;
15633        let mut request_value_reader = {
15634            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15635            common::remove_json_null_values(&mut value);
15636            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15637            serde_json::to_writer(&mut dst, &value).unwrap();
15638            dst
15639        };
15640        let request_size = request_value_reader
15641            .seek(std::io::SeekFrom::End(0))
15642            .unwrap();
15643        request_value_reader
15644            .seek(std::io::SeekFrom::Start(0))
15645            .unwrap();
15646
15647        loop {
15648            let token = match self
15649                .hub
15650                .auth
15651                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15652                .await
15653            {
15654                Ok(token) => token,
15655                Err(e) => match dlg.token(e) {
15656                    Ok(token) => token,
15657                    Err(e) => {
15658                        dlg.finished(false);
15659                        return Err(common::Error::MissingToken(e));
15660                    }
15661                },
15662            };
15663            request_value_reader
15664                .seek(std::io::SeekFrom::Start(0))
15665                .unwrap();
15666            let mut req_result = {
15667                let client = &self.hub.client;
15668                dlg.pre_request();
15669                let mut req_builder = hyper::Request::builder()
15670                    .method(hyper::Method::POST)
15671                    .uri(url.as_str())
15672                    .header(USER_AGENT, self.hub._user_agent.clone());
15673
15674                if let Some(token) = token.as_ref() {
15675                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15676                }
15677
15678                let request = req_builder
15679                    .header(CONTENT_TYPE, json_mime_type.to_string())
15680                    .header(CONTENT_LENGTH, request_size as u64)
15681                    .body(common::to_body(
15682                        request_value_reader.get_ref().clone().into(),
15683                    ));
15684
15685                client.request(request.unwrap()).await
15686            };
15687
15688            match req_result {
15689                Err(err) => {
15690                    if let common::Retry::After(d) = dlg.http_error(&err) {
15691                        sleep(d).await;
15692                        continue;
15693                    }
15694                    dlg.finished(false);
15695                    return Err(common::Error::HttpError(err));
15696                }
15697                Ok(res) => {
15698                    let (mut parts, body) = res.into_parts();
15699                    let mut body = common::Body::new(body);
15700                    if !parts.status.is_success() {
15701                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15702                        let error = serde_json::from_str(&common::to_string(&bytes));
15703                        let response = common::to_response(parts, bytes.into());
15704
15705                        if let common::Retry::After(d) =
15706                            dlg.http_failure(&response, error.as_ref().ok())
15707                        {
15708                            sleep(d).await;
15709                            continue;
15710                        }
15711
15712                        dlg.finished(false);
15713
15714                        return Err(match error {
15715                            Ok(value) => common::Error::BadRequest(value),
15716                            _ => common::Error::Failure(response),
15717                        });
15718                    }
15719                    let response = {
15720                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15721                        let encoded = common::to_string(&bytes);
15722                        match serde_json::from_str(&encoded) {
15723                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15724                            Err(error) => {
15725                                dlg.response_json_decode_error(&encoded, &error);
15726                                return Err(common::Error::JsonDecodeError(
15727                                    encoded.to_string(),
15728                                    error,
15729                                ));
15730                            }
15731                        }
15732                    };
15733
15734                    dlg.finished(true);
15735                    return Ok(response);
15736                }
15737            }
15738        }
15739    }
15740
15741    ///
15742    /// Sets the *request* property to the given value.
15743    ///
15744    /// Even though the property as already been set when instantiating this call,
15745    /// we provide this method for API completeness.
15746    pub fn request(
15747        mut self,
15748        new_value: SetIamPolicyRequest,
15749    ) -> ProjectLocationConnectionSetIamPolicyCall<'a, C> {
15750        self._request = new_value;
15751        self
15752    }
15753    /// 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.
15754    ///
15755    /// Sets the *resource* path property to the given value.
15756    ///
15757    /// Even though the property as already been set when instantiating this call,
15758    /// we provide this method for API completeness.
15759    pub fn resource(mut self, new_value: &str) -> ProjectLocationConnectionSetIamPolicyCall<'a, C> {
15760        self._resource = new_value.to_string();
15761        self
15762    }
15763    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15764    /// while executing the actual API request.
15765    ///
15766    /// ````text
15767    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15768    /// ````
15769    ///
15770    /// Sets the *delegate* property to the given value.
15771    pub fn delegate(
15772        mut self,
15773        new_value: &'a mut dyn common::Delegate,
15774    ) -> ProjectLocationConnectionSetIamPolicyCall<'a, C> {
15775        self._delegate = Some(new_value);
15776        self
15777    }
15778
15779    /// Set any additional parameter of the query string used in the request.
15780    /// It should be used to set parameters which are not yet available through their own
15781    /// setters.
15782    ///
15783    /// Please note that this method must not be used to set any of the known parameters
15784    /// which have their own setter method. If done anyway, the request will fail.
15785    ///
15786    /// # Additional Parameters
15787    ///
15788    /// * *$.xgafv* (query-string) - V1 error format.
15789    /// * *access_token* (query-string) - OAuth access token.
15790    /// * *alt* (query-string) - Data format for response.
15791    /// * *callback* (query-string) - JSONP
15792    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15793    /// * *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.
15794    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15795    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15796    /// * *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.
15797    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15798    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15799    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationConnectionSetIamPolicyCall<'a, C>
15800    where
15801        T: AsRef<str>,
15802    {
15803        self._additional_params
15804            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15805        self
15806    }
15807
15808    /// Identifies the authorization scope for the method you are building.
15809    ///
15810    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15811    /// [`Scope::CloudPlatform`].
15812    ///
15813    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15814    /// tokens for more than one scope.
15815    ///
15816    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15817    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15818    /// sufficient, a read-write scope will do as well.
15819    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionSetIamPolicyCall<'a, C>
15820    where
15821        St: AsRef<str>,
15822    {
15823        self._scopes.insert(String::from(scope.as_ref()));
15824        self
15825    }
15826    /// Identifies the authorization scope(s) for the method you are building.
15827    ///
15828    /// See [`Self::add_scope()`] for details.
15829    pub fn add_scopes<I, St>(
15830        mut self,
15831        scopes: I,
15832    ) -> ProjectLocationConnectionSetIamPolicyCall<'a, C>
15833    where
15834        I: IntoIterator<Item = St>,
15835        St: AsRef<str>,
15836    {
15837        self._scopes
15838            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15839        self
15840    }
15841
15842    /// Removes all scopes, and no default scope will be used either.
15843    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15844    /// for details).
15845    pub fn clear_scopes(mut self) -> ProjectLocationConnectionSetIamPolicyCall<'a, C> {
15846        self._scopes.clear();
15847        self
15848    }
15849}
15850
15851/// 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.
15852///
15853/// A builder for the *locations.connections.testIamPermissions* method supported by a *project* resource.
15854/// It is not used directly, but through a [`ProjectMethods`] instance.
15855///
15856/// # Example
15857///
15858/// Instantiate a resource method builder
15859///
15860/// ```test_harness,no_run
15861/// # extern crate hyper;
15862/// # extern crate hyper_rustls;
15863/// # extern crate google_connectors1 as connectors1;
15864/// use connectors1::api::TestIamPermissionsRequest;
15865/// # async fn dox() {
15866/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15867///
15868/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15869/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15870/// #     .with_native_roots()
15871/// #     .unwrap()
15872/// #     .https_only()
15873/// #     .enable_http2()
15874/// #     .build();
15875///
15876/// # let executor = hyper_util::rt::TokioExecutor::new();
15877/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15878/// #     secret,
15879/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15880/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15881/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15882/// #     ),
15883/// # ).build().await.unwrap();
15884///
15885/// # let client = hyper_util::client::legacy::Client::builder(
15886/// #     hyper_util::rt::TokioExecutor::new()
15887/// # )
15888/// # .build(
15889/// #     hyper_rustls::HttpsConnectorBuilder::new()
15890/// #         .with_native_roots()
15891/// #         .unwrap()
15892/// #         .https_or_http()
15893/// #         .enable_http2()
15894/// #         .build()
15895/// # );
15896/// # let mut hub = Connectors::new(client, auth);
15897/// // As the method needs a request, you would usually fill it with the desired information
15898/// // into the respective structure. Some of the parts shown here might not be applicable !
15899/// // Values shown here are possibly random and not representative !
15900/// let mut req = TestIamPermissionsRequest::default();
15901///
15902/// // You can configure optional parameters by calling the respective setters at will, and
15903/// // execute the final call using `doit()`.
15904/// // Values shown here are possibly random and not representative !
15905/// let result = hub.projects().locations_connections_test_iam_permissions(req, "resource")
15906///              .doit().await;
15907/// # }
15908/// ```
15909pub struct ProjectLocationConnectionTestIamPermissionCall<'a, C>
15910where
15911    C: 'a,
15912{
15913    hub: &'a Connectors<C>,
15914    _request: TestIamPermissionsRequest,
15915    _resource: String,
15916    _delegate: Option<&'a mut dyn common::Delegate>,
15917    _additional_params: HashMap<String, String>,
15918    _scopes: BTreeSet<String>,
15919}
15920
15921impl<'a, C> common::CallBuilder for ProjectLocationConnectionTestIamPermissionCall<'a, C> {}
15922
15923impl<'a, C> ProjectLocationConnectionTestIamPermissionCall<'a, C>
15924where
15925    C: common::Connector,
15926{
15927    /// Perform the operation you have build so far.
15928    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
15929        use std::borrow::Cow;
15930        use std::io::{Read, Seek};
15931
15932        use common::{url::Params, ToParts};
15933        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15934
15935        let mut dd = common::DefaultDelegate;
15936        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15937        dlg.begin(common::MethodInfo {
15938            id: "connectors.projects.locations.connections.testIamPermissions",
15939            http_method: hyper::Method::POST,
15940        });
15941
15942        for &field in ["alt", "resource"].iter() {
15943            if self._additional_params.contains_key(field) {
15944                dlg.finished(false);
15945                return Err(common::Error::FieldClash(field));
15946            }
15947        }
15948
15949        let mut params = Params::with_capacity(4 + self._additional_params.len());
15950        params.push("resource", self._resource);
15951
15952        params.extend(self._additional_params.iter());
15953
15954        params.push("alt", "json");
15955        let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
15956        if self._scopes.is_empty() {
15957            self._scopes
15958                .insert(Scope::CloudPlatform.as_ref().to_string());
15959        }
15960
15961        #[allow(clippy::single_element_loop)]
15962        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
15963            url = params.uri_replacement(url, param_name, find_this, true);
15964        }
15965        {
15966            let to_remove = ["resource"];
15967            params.remove_params(&to_remove);
15968        }
15969
15970        let url = params.parse_with_url(&url);
15971
15972        let mut json_mime_type = mime::APPLICATION_JSON;
15973        let mut request_value_reader = {
15974            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15975            common::remove_json_null_values(&mut value);
15976            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15977            serde_json::to_writer(&mut dst, &value).unwrap();
15978            dst
15979        };
15980        let request_size = request_value_reader
15981            .seek(std::io::SeekFrom::End(0))
15982            .unwrap();
15983        request_value_reader
15984            .seek(std::io::SeekFrom::Start(0))
15985            .unwrap();
15986
15987        loop {
15988            let token = match self
15989                .hub
15990                .auth
15991                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15992                .await
15993            {
15994                Ok(token) => token,
15995                Err(e) => match dlg.token(e) {
15996                    Ok(token) => token,
15997                    Err(e) => {
15998                        dlg.finished(false);
15999                        return Err(common::Error::MissingToken(e));
16000                    }
16001                },
16002            };
16003            request_value_reader
16004                .seek(std::io::SeekFrom::Start(0))
16005                .unwrap();
16006            let mut req_result = {
16007                let client = &self.hub.client;
16008                dlg.pre_request();
16009                let mut req_builder = hyper::Request::builder()
16010                    .method(hyper::Method::POST)
16011                    .uri(url.as_str())
16012                    .header(USER_AGENT, self.hub._user_agent.clone());
16013
16014                if let Some(token) = token.as_ref() {
16015                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16016                }
16017
16018                let request = req_builder
16019                    .header(CONTENT_TYPE, json_mime_type.to_string())
16020                    .header(CONTENT_LENGTH, request_size as u64)
16021                    .body(common::to_body(
16022                        request_value_reader.get_ref().clone().into(),
16023                    ));
16024
16025                client.request(request.unwrap()).await
16026            };
16027
16028            match req_result {
16029                Err(err) => {
16030                    if let common::Retry::After(d) = dlg.http_error(&err) {
16031                        sleep(d).await;
16032                        continue;
16033                    }
16034                    dlg.finished(false);
16035                    return Err(common::Error::HttpError(err));
16036                }
16037                Ok(res) => {
16038                    let (mut parts, body) = res.into_parts();
16039                    let mut body = common::Body::new(body);
16040                    if !parts.status.is_success() {
16041                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16042                        let error = serde_json::from_str(&common::to_string(&bytes));
16043                        let response = common::to_response(parts, bytes.into());
16044
16045                        if let common::Retry::After(d) =
16046                            dlg.http_failure(&response, error.as_ref().ok())
16047                        {
16048                            sleep(d).await;
16049                            continue;
16050                        }
16051
16052                        dlg.finished(false);
16053
16054                        return Err(match error {
16055                            Ok(value) => common::Error::BadRequest(value),
16056                            _ => common::Error::Failure(response),
16057                        });
16058                    }
16059                    let response = {
16060                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16061                        let encoded = common::to_string(&bytes);
16062                        match serde_json::from_str(&encoded) {
16063                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16064                            Err(error) => {
16065                                dlg.response_json_decode_error(&encoded, &error);
16066                                return Err(common::Error::JsonDecodeError(
16067                                    encoded.to_string(),
16068                                    error,
16069                                ));
16070                            }
16071                        }
16072                    };
16073
16074                    dlg.finished(true);
16075                    return Ok(response);
16076                }
16077            }
16078        }
16079    }
16080
16081    ///
16082    /// Sets the *request* property to the given value.
16083    ///
16084    /// Even though the property as already been set when instantiating this call,
16085    /// we provide this method for API completeness.
16086    pub fn request(
16087        mut self,
16088        new_value: TestIamPermissionsRequest,
16089    ) -> ProjectLocationConnectionTestIamPermissionCall<'a, C> {
16090        self._request = new_value;
16091        self
16092    }
16093    /// 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.
16094    ///
16095    /// Sets the *resource* path property to the given value.
16096    ///
16097    /// Even though the property as already been set when instantiating this call,
16098    /// we provide this method for API completeness.
16099    pub fn resource(
16100        mut self,
16101        new_value: &str,
16102    ) -> ProjectLocationConnectionTestIamPermissionCall<'a, C> {
16103        self._resource = new_value.to_string();
16104        self
16105    }
16106    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16107    /// while executing the actual API request.
16108    ///
16109    /// ````text
16110    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16111    /// ````
16112    ///
16113    /// Sets the *delegate* property to the given value.
16114    pub fn delegate(
16115        mut self,
16116        new_value: &'a mut dyn common::Delegate,
16117    ) -> ProjectLocationConnectionTestIamPermissionCall<'a, C> {
16118        self._delegate = Some(new_value);
16119        self
16120    }
16121
16122    /// Set any additional parameter of the query string used in the request.
16123    /// It should be used to set parameters which are not yet available through their own
16124    /// setters.
16125    ///
16126    /// Please note that this method must not be used to set any of the known parameters
16127    /// which have their own setter method. If done anyway, the request will fail.
16128    ///
16129    /// # Additional Parameters
16130    ///
16131    /// * *$.xgafv* (query-string) - V1 error format.
16132    /// * *access_token* (query-string) - OAuth access token.
16133    /// * *alt* (query-string) - Data format for response.
16134    /// * *callback* (query-string) - JSONP
16135    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16136    /// * *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.
16137    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16138    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16139    /// * *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.
16140    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16141    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16142    pub fn param<T>(
16143        mut self,
16144        name: T,
16145        value: T,
16146    ) -> ProjectLocationConnectionTestIamPermissionCall<'a, C>
16147    where
16148        T: AsRef<str>,
16149    {
16150        self._additional_params
16151            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16152        self
16153    }
16154
16155    /// Identifies the authorization scope for the method you are building.
16156    ///
16157    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16158    /// [`Scope::CloudPlatform`].
16159    ///
16160    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16161    /// tokens for more than one scope.
16162    ///
16163    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16164    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16165    /// sufficient, a read-write scope will do as well.
16166    pub fn add_scope<St>(
16167        mut self,
16168        scope: St,
16169    ) -> ProjectLocationConnectionTestIamPermissionCall<'a, C>
16170    where
16171        St: AsRef<str>,
16172    {
16173        self._scopes.insert(String::from(scope.as_ref()));
16174        self
16175    }
16176    /// Identifies the authorization scope(s) for the method you are building.
16177    ///
16178    /// See [`Self::add_scope()`] for details.
16179    pub fn add_scopes<I, St>(
16180        mut self,
16181        scopes: I,
16182    ) -> ProjectLocationConnectionTestIamPermissionCall<'a, C>
16183    where
16184        I: IntoIterator<Item = St>,
16185        St: AsRef<str>,
16186    {
16187        self._scopes
16188            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16189        self
16190    }
16191
16192    /// Removes all scopes, and no default scope will be used either.
16193    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16194    /// for details).
16195    pub fn clear_scopes(mut self) -> ProjectLocationConnectionTestIamPermissionCall<'a, C> {
16196        self._scopes.clear();
16197        self
16198    }
16199}
16200
16201/// Deletes a single CustomConnectorVersion.
16202///
16203/// A builder for the *locations.customConnectors.customConnectorVersions.delete* method supported by a *project* resource.
16204/// It is not used directly, but through a [`ProjectMethods`] instance.
16205///
16206/// # Example
16207///
16208/// Instantiate a resource method builder
16209///
16210/// ```test_harness,no_run
16211/// # extern crate hyper;
16212/// # extern crate hyper_rustls;
16213/// # extern crate google_connectors1 as connectors1;
16214/// # async fn dox() {
16215/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16216///
16217/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16218/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16219/// #     .with_native_roots()
16220/// #     .unwrap()
16221/// #     .https_only()
16222/// #     .enable_http2()
16223/// #     .build();
16224///
16225/// # let executor = hyper_util::rt::TokioExecutor::new();
16226/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16227/// #     secret,
16228/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16229/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16230/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16231/// #     ),
16232/// # ).build().await.unwrap();
16233///
16234/// # let client = hyper_util::client::legacy::Client::builder(
16235/// #     hyper_util::rt::TokioExecutor::new()
16236/// # )
16237/// # .build(
16238/// #     hyper_rustls::HttpsConnectorBuilder::new()
16239/// #         .with_native_roots()
16240/// #         .unwrap()
16241/// #         .https_or_http()
16242/// #         .enable_http2()
16243/// #         .build()
16244/// # );
16245/// # let mut hub = Connectors::new(client, auth);
16246/// // You can configure optional parameters by calling the respective setters at will, and
16247/// // execute the final call using `doit()`.
16248/// // Values shown here are possibly random and not representative !
16249/// let result = hub.projects().locations_custom_connectors_custom_connector_versions_delete("name")
16250///              .doit().await;
16251/// # }
16252/// ```
16253pub struct ProjectLocationCustomConnectorCustomConnectorVersionDeleteCall<'a, C>
16254where
16255    C: 'a,
16256{
16257    hub: &'a Connectors<C>,
16258    _name: String,
16259    _delegate: Option<&'a mut dyn common::Delegate>,
16260    _additional_params: HashMap<String, String>,
16261    _scopes: BTreeSet<String>,
16262}
16263
16264impl<'a, C> common::CallBuilder
16265    for ProjectLocationCustomConnectorCustomConnectorVersionDeleteCall<'a, C>
16266{
16267}
16268
16269impl<'a, C> ProjectLocationCustomConnectorCustomConnectorVersionDeleteCall<'a, C>
16270where
16271    C: common::Connector,
16272{
16273    /// Perform the operation you have build so far.
16274    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
16275        use std::borrow::Cow;
16276        use std::io::{Read, Seek};
16277
16278        use common::{url::Params, ToParts};
16279        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16280
16281        let mut dd = common::DefaultDelegate;
16282        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16283        dlg.begin(common::MethodInfo {
16284            id: "connectors.projects.locations.customConnectors.customConnectorVersions.delete",
16285            http_method: hyper::Method::DELETE,
16286        });
16287
16288        for &field in ["alt", "name"].iter() {
16289            if self._additional_params.contains_key(field) {
16290                dlg.finished(false);
16291                return Err(common::Error::FieldClash(field));
16292            }
16293        }
16294
16295        let mut params = Params::with_capacity(3 + self._additional_params.len());
16296        params.push("name", self._name);
16297
16298        params.extend(self._additional_params.iter());
16299
16300        params.push("alt", "json");
16301        let mut url = self.hub._base_url.clone() + "v1/{+name}";
16302        if self._scopes.is_empty() {
16303            self._scopes
16304                .insert(Scope::CloudPlatform.as_ref().to_string());
16305        }
16306
16307        #[allow(clippy::single_element_loop)]
16308        for &(find_this, param_name) in [("{+name}", "name")].iter() {
16309            url = params.uri_replacement(url, param_name, find_this, true);
16310        }
16311        {
16312            let to_remove = ["name"];
16313            params.remove_params(&to_remove);
16314        }
16315
16316        let url = params.parse_with_url(&url);
16317
16318        loop {
16319            let token = match self
16320                .hub
16321                .auth
16322                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16323                .await
16324            {
16325                Ok(token) => token,
16326                Err(e) => match dlg.token(e) {
16327                    Ok(token) => token,
16328                    Err(e) => {
16329                        dlg.finished(false);
16330                        return Err(common::Error::MissingToken(e));
16331                    }
16332                },
16333            };
16334            let mut req_result = {
16335                let client = &self.hub.client;
16336                dlg.pre_request();
16337                let mut req_builder = hyper::Request::builder()
16338                    .method(hyper::Method::DELETE)
16339                    .uri(url.as_str())
16340                    .header(USER_AGENT, self.hub._user_agent.clone());
16341
16342                if let Some(token) = token.as_ref() {
16343                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16344                }
16345
16346                let request = req_builder
16347                    .header(CONTENT_LENGTH, 0_u64)
16348                    .body(common::to_body::<String>(None));
16349
16350                client.request(request.unwrap()).await
16351            };
16352
16353            match req_result {
16354                Err(err) => {
16355                    if let common::Retry::After(d) = dlg.http_error(&err) {
16356                        sleep(d).await;
16357                        continue;
16358                    }
16359                    dlg.finished(false);
16360                    return Err(common::Error::HttpError(err));
16361                }
16362                Ok(res) => {
16363                    let (mut parts, body) = res.into_parts();
16364                    let mut body = common::Body::new(body);
16365                    if !parts.status.is_success() {
16366                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16367                        let error = serde_json::from_str(&common::to_string(&bytes));
16368                        let response = common::to_response(parts, bytes.into());
16369
16370                        if let common::Retry::After(d) =
16371                            dlg.http_failure(&response, error.as_ref().ok())
16372                        {
16373                            sleep(d).await;
16374                            continue;
16375                        }
16376
16377                        dlg.finished(false);
16378
16379                        return Err(match error {
16380                            Ok(value) => common::Error::BadRequest(value),
16381                            _ => common::Error::Failure(response),
16382                        });
16383                    }
16384                    let response = {
16385                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16386                        let encoded = common::to_string(&bytes);
16387                        match serde_json::from_str(&encoded) {
16388                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16389                            Err(error) => {
16390                                dlg.response_json_decode_error(&encoded, &error);
16391                                return Err(common::Error::JsonDecodeError(
16392                                    encoded.to_string(),
16393                                    error,
16394                                ));
16395                            }
16396                        }
16397                    };
16398
16399                    dlg.finished(true);
16400                    return Ok(response);
16401                }
16402            }
16403        }
16404    }
16405
16406    /// Required. Resource name of the form: `projects/{project}/locations/{location}/customConnectors/{custom_connector}/customConnectorVersions/{custom_connector_version}`
16407    ///
16408    /// Sets the *name* path property to the given value.
16409    ///
16410    /// Even though the property as already been set when instantiating this call,
16411    /// we provide this method for API completeness.
16412    pub fn name(
16413        mut self,
16414        new_value: &str,
16415    ) -> ProjectLocationCustomConnectorCustomConnectorVersionDeleteCall<'a, C> {
16416        self._name = new_value.to_string();
16417        self
16418    }
16419    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16420    /// while executing the actual API request.
16421    ///
16422    /// ````text
16423    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16424    /// ````
16425    ///
16426    /// Sets the *delegate* property to the given value.
16427    pub fn delegate(
16428        mut self,
16429        new_value: &'a mut dyn common::Delegate,
16430    ) -> ProjectLocationCustomConnectorCustomConnectorVersionDeleteCall<'a, C> {
16431        self._delegate = Some(new_value);
16432        self
16433    }
16434
16435    /// Set any additional parameter of the query string used in the request.
16436    /// It should be used to set parameters which are not yet available through their own
16437    /// setters.
16438    ///
16439    /// Please note that this method must not be used to set any of the known parameters
16440    /// which have their own setter method. If done anyway, the request will fail.
16441    ///
16442    /// # Additional Parameters
16443    ///
16444    /// * *$.xgafv* (query-string) - V1 error format.
16445    /// * *access_token* (query-string) - OAuth access token.
16446    /// * *alt* (query-string) - Data format for response.
16447    /// * *callback* (query-string) - JSONP
16448    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16449    /// * *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.
16450    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16451    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16452    /// * *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.
16453    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16454    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16455    pub fn param<T>(
16456        mut self,
16457        name: T,
16458        value: T,
16459    ) -> ProjectLocationCustomConnectorCustomConnectorVersionDeleteCall<'a, C>
16460    where
16461        T: AsRef<str>,
16462    {
16463        self._additional_params
16464            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16465        self
16466    }
16467
16468    /// Identifies the authorization scope for the method you are building.
16469    ///
16470    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16471    /// [`Scope::CloudPlatform`].
16472    ///
16473    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16474    /// tokens for more than one scope.
16475    ///
16476    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16477    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16478    /// sufficient, a read-write scope will do as well.
16479    pub fn add_scope<St>(
16480        mut self,
16481        scope: St,
16482    ) -> ProjectLocationCustomConnectorCustomConnectorVersionDeleteCall<'a, C>
16483    where
16484        St: AsRef<str>,
16485    {
16486        self._scopes.insert(String::from(scope.as_ref()));
16487        self
16488    }
16489    /// Identifies the authorization scope(s) for the method you are building.
16490    ///
16491    /// See [`Self::add_scope()`] for details.
16492    pub fn add_scopes<I, St>(
16493        mut self,
16494        scopes: I,
16495    ) -> ProjectLocationCustomConnectorCustomConnectorVersionDeleteCall<'a, C>
16496    where
16497        I: IntoIterator<Item = St>,
16498        St: AsRef<str>,
16499    {
16500        self._scopes
16501            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16502        self
16503    }
16504
16505    /// Removes all scopes, and no default scope will be used either.
16506    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16507    /// for details).
16508    pub fn clear_scopes(
16509        mut self,
16510    ) -> ProjectLocationCustomConnectorCustomConnectorVersionDeleteCall<'a, C> {
16511        self._scopes.clear();
16512        self
16513    }
16514}
16515
16516/// Deprecates a single CustomConnectorVersion.
16517///
16518/// A builder for the *locations.customConnectors.customConnectorVersions.deprecate* method supported by a *project* resource.
16519/// It is not used directly, but through a [`ProjectMethods`] instance.
16520///
16521/// # Example
16522///
16523/// Instantiate a resource method builder
16524///
16525/// ```test_harness,no_run
16526/// # extern crate hyper;
16527/// # extern crate hyper_rustls;
16528/// # extern crate google_connectors1 as connectors1;
16529/// use connectors1::api::DeprecateCustomConnectorVersionRequest;
16530/// # async fn dox() {
16531/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16532///
16533/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16534/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16535/// #     .with_native_roots()
16536/// #     .unwrap()
16537/// #     .https_only()
16538/// #     .enable_http2()
16539/// #     .build();
16540///
16541/// # let executor = hyper_util::rt::TokioExecutor::new();
16542/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16543/// #     secret,
16544/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16545/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16546/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16547/// #     ),
16548/// # ).build().await.unwrap();
16549///
16550/// # let client = hyper_util::client::legacy::Client::builder(
16551/// #     hyper_util::rt::TokioExecutor::new()
16552/// # )
16553/// # .build(
16554/// #     hyper_rustls::HttpsConnectorBuilder::new()
16555/// #         .with_native_roots()
16556/// #         .unwrap()
16557/// #         .https_or_http()
16558/// #         .enable_http2()
16559/// #         .build()
16560/// # );
16561/// # let mut hub = Connectors::new(client, auth);
16562/// // As the method needs a request, you would usually fill it with the desired information
16563/// // into the respective structure. Some of the parts shown here might not be applicable !
16564/// // Values shown here are possibly random and not representative !
16565/// let mut req = DeprecateCustomConnectorVersionRequest::default();
16566///
16567/// // You can configure optional parameters by calling the respective setters at will, and
16568/// // execute the final call using `doit()`.
16569/// // Values shown here are possibly random and not representative !
16570/// let result = hub.projects().locations_custom_connectors_custom_connector_versions_deprecate(req, "name")
16571///              .doit().await;
16572/// # }
16573/// ```
16574pub struct ProjectLocationCustomConnectorCustomConnectorVersionDeprecateCall<'a, C>
16575where
16576    C: 'a,
16577{
16578    hub: &'a Connectors<C>,
16579    _request: DeprecateCustomConnectorVersionRequest,
16580    _name: String,
16581    _delegate: Option<&'a mut dyn common::Delegate>,
16582    _additional_params: HashMap<String, String>,
16583    _scopes: BTreeSet<String>,
16584}
16585
16586impl<'a, C> common::CallBuilder
16587    for ProjectLocationCustomConnectorCustomConnectorVersionDeprecateCall<'a, C>
16588{
16589}
16590
16591impl<'a, C> ProjectLocationCustomConnectorCustomConnectorVersionDeprecateCall<'a, C>
16592where
16593    C: common::Connector,
16594{
16595    /// Perform the operation you have build so far.
16596    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
16597        use std::borrow::Cow;
16598        use std::io::{Read, Seek};
16599
16600        use common::{url::Params, ToParts};
16601        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16602
16603        let mut dd = common::DefaultDelegate;
16604        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16605        dlg.begin(common::MethodInfo {
16606            id: "connectors.projects.locations.customConnectors.customConnectorVersions.deprecate",
16607            http_method: hyper::Method::POST,
16608        });
16609
16610        for &field in ["alt", "name"].iter() {
16611            if self._additional_params.contains_key(field) {
16612                dlg.finished(false);
16613                return Err(common::Error::FieldClash(field));
16614            }
16615        }
16616
16617        let mut params = Params::with_capacity(4 + self._additional_params.len());
16618        params.push("name", self._name);
16619
16620        params.extend(self._additional_params.iter());
16621
16622        params.push("alt", "json");
16623        let mut url = self.hub._base_url.clone() + "v1/{+name}:deprecate";
16624        if self._scopes.is_empty() {
16625            self._scopes
16626                .insert(Scope::CloudPlatform.as_ref().to_string());
16627        }
16628
16629        #[allow(clippy::single_element_loop)]
16630        for &(find_this, param_name) in [("{+name}", "name")].iter() {
16631            url = params.uri_replacement(url, param_name, find_this, true);
16632        }
16633        {
16634            let to_remove = ["name"];
16635            params.remove_params(&to_remove);
16636        }
16637
16638        let url = params.parse_with_url(&url);
16639
16640        let mut json_mime_type = mime::APPLICATION_JSON;
16641        let mut request_value_reader = {
16642            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16643            common::remove_json_null_values(&mut value);
16644            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16645            serde_json::to_writer(&mut dst, &value).unwrap();
16646            dst
16647        };
16648        let request_size = request_value_reader
16649            .seek(std::io::SeekFrom::End(0))
16650            .unwrap();
16651        request_value_reader
16652            .seek(std::io::SeekFrom::Start(0))
16653            .unwrap();
16654
16655        loop {
16656            let token = match self
16657                .hub
16658                .auth
16659                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16660                .await
16661            {
16662                Ok(token) => token,
16663                Err(e) => match dlg.token(e) {
16664                    Ok(token) => token,
16665                    Err(e) => {
16666                        dlg.finished(false);
16667                        return Err(common::Error::MissingToken(e));
16668                    }
16669                },
16670            };
16671            request_value_reader
16672                .seek(std::io::SeekFrom::Start(0))
16673                .unwrap();
16674            let mut req_result = {
16675                let client = &self.hub.client;
16676                dlg.pre_request();
16677                let mut req_builder = hyper::Request::builder()
16678                    .method(hyper::Method::POST)
16679                    .uri(url.as_str())
16680                    .header(USER_AGENT, self.hub._user_agent.clone());
16681
16682                if let Some(token) = token.as_ref() {
16683                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16684                }
16685
16686                let request = req_builder
16687                    .header(CONTENT_TYPE, json_mime_type.to_string())
16688                    .header(CONTENT_LENGTH, request_size as u64)
16689                    .body(common::to_body(
16690                        request_value_reader.get_ref().clone().into(),
16691                    ));
16692
16693                client.request(request.unwrap()).await
16694            };
16695
16696            match req_result {
16697                Err(err) => {
16698                    if let common::Retry::After(d) = dlg.http_error(&err) {
16699                        sleep(d).await;
16700                        continue;
16701                    }
16702                    dlg.finished(false);
16703                    return Err(common::Error::HttpError(err));
16704                }
16705                Ok(res) => {
16706                    let (mut parts, body) = res.into_parts();
16707                    let mut body = common::Body::new(body);
16708                    if !parts.status.is_success() {
16709                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16710                        let error = serde_json::from_str(&common::to_string(&bytes));
16711                        let response = common::to_response(parts, bytes.into());
16712
16713                        if let common::Retry::After(d) =
16714                            dlg.http_failure(&response, error.as_ref().ok())
16715                        {
16716                            sleep(d).await;
16717                            continue;
16718                        }
16719
16720                        dlg.finished(false);
16721
16722                        return Err(match error {
16723                            Ok(value) => common::Error::BadRequest(value),
16724                            _ => common::Error::Failure(response),
16725                        });
16726                    }
16727                    let response = {
16728                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16729                        let encoded = common::to_string(&bytes);
16730                        match serde_json::from_str(&encoded) {
16731                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16732                            Err(error) => {
16733                                dlg.response_json_decode_error(&encoded, &error);
16734                                return Err(common::Error::JsonDecodeError(
16735                                    encoded.to_string(),
16736                                    error,
16737                                ));
16738                            }
16739                        }
16740                    };
16741
16742                    dlg.finished(true);
16743                    return Ok(response);
16744                }
16745            }
16746        }
16747    }
16748
16749    ///
16750    /// Sets the *request* property to the given value.
16751    ///
16752    /// Even though the property as already been set when instantiating this call,
16753    /// we provide this method for API completeness.
16754    pub fn request(
16755        mut self,
16756        new_value: DeprecateCustomConnectorVersionRequest,
16757    ) -> ProjectLocationCustomConnectorCustomConnectorVersionDeprecateCall<'a, C> {
16758        self._request = new_value;
16759        self
16760    }
16761    /// Required. Resource name of the form: `projects/{project}/locations/{location}/customConnectors/{custom_connector}/customConnectorVersions/{custom_connector_version}`
16762    ///
16763    /// Sets the *name* path property to the given value.
16764    ///
16765    /// Even though the property as already been set when instantiating this call,
16766    /// we provide this method for API completeness.
16767    pub fn name(
16768        mut self,
16769        new_value: &str,
16770    ) -> ProjectLocationCustomConnectorCustomConnectorVersionDeprecateCall<'a, C> {
16771        self._name = new_value.to_string();
16772        self
16773    }
16774    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16775    /// while executing the actual API request.
16776    ///
16777    /// ````text
16778    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16779    /// ````
16780    ///
16781    /// Sets the *delegate* property to the given value.
16782    pub fn delegate(
16783        mut self,
16784        new_value: &'a mut dyn common::Delegate,
16785    ) -> ProjectLocationCustomConnectorCustomConnectorVersionDeprecateCall<'a, C> {
16786        self._delegate = Some(new_value);
16787        self
16788    }
16789
16790    /// Set any additional parameter of the query string used in the request.
16791    /// It should be used to set parameters which are not yet available through their own
16792    /// setters.
16793    ///
16794    /// Please note that this method must not be used to set any of the known parameters
16795    /// which have their own setter method. If done anyway, the request will fail.
16796    ///
16797    /// # Additional Parameters
16798    ///
16799    /// * *$.xgafv* (query-string) - V1 error format.
16800    /// * *access_token* (query-string) - OAuth access token.
16801    /// * *alt* (query-string) - Data format for response.
16802    /// * *callback* (query-string) - JSONP
16803    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16804    /// * *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.
16805    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16806    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16807    /// * *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.
16808    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16809    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16810    pub fn param<T>(
16811        mut self,
16812        name: T,
16813        value: T,
16814    ) -> ProjectLocationCustomConnectorCustomConnectorVersionDeprecateCall<'a, C>
16815    where
16816        T: AsRef<str>,
16817    {
16818        self._additional_params
16819            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16820        self
16821    }
16822
16823    /// Identifies the authorization scope for the method you are building.
16824    ///
16825    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16826    /// [`Scope::CloudPlatform`].
16827    ///
16828    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16829    /// tokens for more than one scope.
16830    ///
16831    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16832    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16833    /// sufficient, a read-write scope will do as well.
16834    pub fn add_scope<St>(
16835        mut self,
16836        scope: St,
16837    ) -> ProjectLocationCustomConnectorCustomConnectorVersionDeprecateCall<'a, C>
16838    where
16839        St: AsRef<str>,
16840    {
16841        self._scopes.insert(String::from(scope.as_ref()));
16842        self
16843    }
16844    /// Identifies the authorization scope(s) for the method you are building.
16845    ///
16846    /// See [`Self::add_scope()`] for details.
16847    pub fn add_scopes<I, St>(
16848        mut self,
16849        scopes: I,
16850    ) -> ProjectLocationCustomConnectorCustomConnectorVersionDeprecateCall<'a, C>
16851    where
16852        I: IntoIterator<Item = St>,
16853        St: AsRef<str>,
16854    {
16855        self._scopes
16856            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16857        self
16858    }
16859
16860    /// Removes all scopes, and no default scope will be used either.
16861    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16862    /// for details).
16863    pub fn clear_scopes(
16864        mut self,
16865    ) -> ProjectLocationCustomConnectorCustomConnectorVersionDeprecateCall<'a, C> {
16866        self._scopes.clear();
16867        self
16868    }
16869}
16870
16871/// Publish request for the CustomConnectorVersion. Once approved, the CustomConnectorVersion will be published as PartnerConnector.
16872///
16873/// A builder for the *locations.customConnectors.customConnectorVersions.publish* method supported by a *project* resource.
16874/// It is not used directly, but through a [`ProjectMethods`] instance.
16875///
16876/// # Example
16877///
16878/// Instantiate a resource method builder
16879///
16880/// ```test_harness,no_run
16881/// # extern crate hyper;
16882/// # extern crate hyper_rustls;
16883/// # extern crate google_connectors1 as connectors1;
16884/// use connectors1::api::PublishCustomConnectorVersionRequest;
16885/// # async fn dox() {
16886/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16887///
16888/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16889/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16890/// #     .with_native_roots()
16891/// #     .unwrap()
16892/// #     .https_only()
16893/// #     .enable_http2()
16894/// #     .build();
16895///
16896/// # let executor = hyper_util::rt::TokioExecutor::new();
16897/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16898/// #     secret,
16899/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16900/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16901/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16902/// #     ),
16903/// # ).build().await.unwrap();
16904///
16905/// # let client = hyper_util::client::legacy::Client::builder(
16906/// #     hyper_util::rt::TokioExecutor::new()
16907/// # )
16908/// # .build(
16909/// #     hyper_rustls::HttpsConnectorBuilder::new()
16910/// #         .with_native_roots()
16911/// #         .unwrap()
16912/// #         .https_or_http()
16913/// #         .enable_http2()
16914/// #         .build()
16915/// # );
16916/// # let mut hub = Connectors::new(client, auth);
16917/// // As the method needs a request, you would usually fill it with the desired information
16918/// // into the respective structure. Some of the parts shown here might not be applicable !
16919/// // Values shown here are possibly random and not representative !
16920/// let mut req = PublishCustomConnectorVersionRequest::default();
16921///
16922/// // You can configure optional parameters by calling the respective setters at will, and
16923/// // execute the final call using `doit()`.
16924/// // Values shown here are possibly random and not representative !
16925/// let result = hub.projects().locations_custom_connectors_custom_connector_versions_publish(req, "name")
16926///              .doit().await;
16927/// # }
16928/// ```
16929pub struct ProjectLocationCustomConnectorCustomConnectorVersionPublishCall<'a, C>
16930where
16931    C: 'a,
16932{
16933    hub: &'a Connectors<C>,
16934    _request: PublishCustomConnectorVersionRequest,
16935    _name: String,
16936    _delegate: Option<&'a mut dyn common::Delegate>,
16937    _additional_params: HashMap<String, String>,
16938    _scopes: BTreeSet<String>,
16939}
16940
16941impl<'a, C> common::CallBuilder
16942    for ProjectLocationCustomConnectorCustomConnectorVersionPublishCall<'a, C>
16943{
16944}
16945
16946impl<'a, C> ProjectLocationCustomConnectorCustomConnectorVersionPublishCall<'a, C>
16947where
16948    C: common::Connector,
16949{
16950    /// Perform the operation you have build so far.
16951    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
16952        use std::borrow::Cow;
16953        use std::io::{Read, Seek};
16954
16955        use common::{url::Params, ToParts};
16956        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16957
16958        let mut dd = common::DefaultDelegate;
16959        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16960        dlg.begin(common::MethodInfo {
16961            id: "connectors.projects.locations.customConnectors.customConnectorVersions.publish",
16962            http_method: hyper::Method::POST,
16963        });
16964
16965        for &field in ["alt", "name"].iter() {
16966            if self._additional_params.contains_key(field) {
16967                dlg.finished(false);
16968                return Err(common::Error::FieldClash(field));
16969            }
16970        }
16971
16972        let mut params = Params::with_capacity(4 + self._additional_params.len());
16973        params.push("name", self._name);
16974
16975        params.extend(self._additional_params.iter());
16976
16977        params.push("alt", "json");
16978        let mut url = self.hub._base_url.clone() + "v1/{+name}:publish";
16979        if self._scopes.is_empty() {
16980            self._scopes
16981                .insert(Scope::CloudPlatform.as_ref().to_string());
16982        }
16983
16984        #[allow(clippy::single_element_loop)]
16985        for &(find_this, param_name) in [("{+name}", "name")].iter() {
16986            url = params.uri_replacement(url, param_name, find_this, true);
16987        }
16988        {
16989            let to_remove = ["name"];
16990            params.remove_params(&to_remove);
16991        }
16992
16993        let url = params.parse_with_url(&url);
16994
16995        let mut json_mime_type = mime::APPLICATION_JSON;
16996        let mut request_value_reader = {
16997            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16998            common::remove_json_null_values(&mut value);
16999            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17000            serde_json::to_writer(&mut dst, &value).unwrap();
17001            dst
17002        };
17003        let request_size = request_value_reader
17004            .seek(std::io::SeekFrom::End(0))
17005            .unwrap();
17006        request_value_reader
17007            .seek(std::io::SeekFrom::Start(0))
17008            .unwrap();
17009
17010        loop {
17011            let token = match self
17012                .hub
17013                .auth
17014                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17015                .await
17016            {
17017                Ok(token) => token,
17018                Err(e) => match dlg.token(e) {
17019                    Ok(token) => token,
17020                    Err(e) => {
17021                        dlg.finished(false);
17022                        return Err(common::Error::MissingToken(e));
17023                    }
17024                },
17025            };
17026            request_value_reader
17027                .seek(std::io::SeekFrom::Start(0))
17028                .unwrap();
17029            let mut req_result = {
17030                let client = &self.hub.client;
17031                dlg.pre_request();
17032                let mut req_builder = hyper::Request::builder()
17033                    .method(hyper::Method::POST)
17034                    .uri(url.as_str())
17035                    .header(USER_AGENT, self.hub._user_agent.clone());
17036
17037                if let Some(token) = token.as_ref() {
17038                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17039                }
17040
17041                let request = req_builder
17042                    .header(CONTENT_TYPE, json_mime_type.to_string())
17043                    .header(CONTENT_LENGTH, request_size as u64)
17044                    .body(common::to_body(
17045                        request_value_reader.get_ref().clone().into(),
17046                    ));
17047
17048                client.request(request.unwrap()).await
17049            };
17050
17051            match req_result {
17052                Err(err) => {
17053                    if let common::Retry::After(d) = dlg.http_error(&err) {
17054                        sleep(d).await;
17055                        continue;
17056                    }
17057                    dlg.finished(false);
17058                    return Err(common::Error::HttpError(err));
17059                }
17060                Ok(res) => {
17061                    let (mut parts, body) = res.into_parts();
17062                    let mut body = common::Body::new(body);
17063                    if !parts.status.is_success() {
17064                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17065                        let error = serde_json::from_str(&common::to_string(&bytes));
17066                        let response = common::to_response(parts, bytes.into());
17067
17068                        if let common::Retry::After(d) =
17069                            dlg.http_failure(&response, error.as_ref().ok())
17070                        {
17071                            sleep(d).await;
17072                            continue;
17073                        }
17074
17075                        dlg.finished(false);
17076
17077                        return Err(match error {
17078                            Ok(value) => common::Error::BadRequest(value),
17079                            _ => common::Error::Failure(response),
17080                        });
17081                    }
17082                    let response = {
17083                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17084                        let encoded = common::to_string(&bytes);
17085                        match serde_json::from_str(&encoded) {
17086                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17087                            Err(error) => {
17088                                dlg.response_json_decode_error(&encoded, &error);
17089                                return Err(common::Error::JsonDecodeError(
17090                                    encoded.to_string(),
17091                                    error,
17092                                ));
17093                            }
17094                        }
17095                    };
17096
17097                    dlg.finished(true);
17098                    return Ok(response);
17099                }
17100            }
17101        }
17102    }
17103
17104    ///
17105    /// Sets the *request* property to the given value.
17106    ///
17107    /// Even though the property as already been set when instantiating this call,
17108    /// we provide this method for API completeness.
17109    pub fn request(
17110        mut self,
17111        new_value: PublishCustomConnectorVersionRequest,
17112    ) -> ProjectLocationCustomConnectorCustomConnectorVersionPublishCall<'a, C> {
17113        self._request = new_value;
17114        self
17115    }
17116    /// Required. Resource name of the form: `projects/{project}/locations/{location}/customConnectors/{custom_connector}/customConnectorVersions/{custom_connector_version}`
17117    ///
17118    /// Sets the *name* path property to the given value.
17119    ///
17120    /// Even though the property as already been set when instantiating this call,
17121    /// we provide this method for API completeness.
17122    pub fn name(
17123        mut self,
17124        new_value: &str,
17125    ) -> ProjectLocationCustomConnectorCustomConnectorVersionPublishCall<'a, C> {
17126        self._name = new_value.to_string();
17127        self
17128    }
17129    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17130    /// while executing the actual API request.
17131    ///
17132    /// ````text
17133    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17134    /// ````
17135    ///
17136    /// Sets the *delegate* property to the given value.
17137    pub fn delegate(
17138        mut self,
17139        new_value: &'a mut dyn common::Delegate,
17140    ) -> ProjectLocationCustomConnectorCustomConnectorVersionPublishCall<'a, C> {
17141        self._delegate = Some(new_value);
17142        self
17143    }
17144
17145    /// Set any additional parameter of the query string used in the request.
17146    /// It should be used to set parameters which are not yet available through their own
17147    /// setters.
17148    ///
17149    /// Please note that this method must not be used to set any of the known parameters
17150    /// which have their own setter method. If done anyway, the request will fail.
17151    ///
17152    /// # Additional Parameters
17153    ///
17154    /// * *$.xgafv* (query-string) - V1 error format.
17155    /// * *access_token* (query-string) - OAuth access token.
17156    /// * *alt* (query-string) - Data format for response.
17157    /// * *callback* (query-string) - JSONP
17158    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17159    /// * *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.
17160    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17161    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17162    /// * *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.
17163    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17164    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17165    pub fn param<T>(
17166        mut self,
17167        name: T,
17168        value: T,
17169    ) -> ProjectLocationCustomConnectorCustomConnectorVersionPublishCall<'a, C>
17170    where
17171        T: AsRef<str>,
17172    {
17173        self._additional_params
17174            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17175        self
17176    }
17177
17178    /// Identifies the authorization scope for the method you are building.
17179    ///
17180    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17181    /// [`Scope::CloudPlatform`].
17182    ///
17183    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17184    /// tokens for more than one scope.
17185    ///
17186    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17187    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17188    /// sufficient, a read-write scope will do as well.
17189    pub fn add_scope<St>(
17190        mut self,
17191        scope: St,
17192    ) -> ProjectLocationCustomConnectorCustomConnectorVersionPublishCall<'a, C>
17193    where
17194        St: AsRef<str>,
17195    {
17196        self._scopes.insert(String::from(scope.as_ref()));
17197        self
17198    }
17199    /// Identifies the authorization scope(s) for the method you are building.
17200    ///
17201    /// See [`Self::add_scope()`] for details.
17202    pub fn add_scopes<I, St>(
17203        mut self,
17204        scopes: I,
17205    ) -> ProjectLocationCustomConnectorCustomConnectorVersionPublishCall<'a, C>
17206    where
17207        I: IntoIterator<Item = St>,
17208        St: AsRef<str>,
17209    {
17210        self._scopes
17211            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17212        self
17213    }
17214
17215    /// Removes all scopes, and no default scope will be used either.
17216    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17217    /// for details).
17218    pub fn clear_scopes(
17219        mut self,
17220    ) -> ProjectLocationCustomConnectorCustomConnectorVersionPublishCall<'a, C> {
17221        self._scopes.clear();
17222        self
17223    }
17224}
17225
17226/// Withdraw the publish request for the CustomConnectorVersion. This can only be used before the CustomConnectorVersion is published.
17227///
17228/// A builder for the *locations.customConnectors.customConnectorVersions.withdraw* method supported by a *project* resource.
17229/// It is not used directly, but through a [`ProjectMethods`] instance.
17230///
17231/// # Example
17232///
17233/// Instantiate a resource method builder
17234///
17235/// ```test_harness,no_run
17236/// # extern crate hyper;
17237/// # extern crate hyper_rustls;
17238/// # extern crate google_connectors1 as connectors1;
17239/// use connectors1::api::WithdrawCustomConnectorVersionRequest;
17240/// # async fn dox() {
17241/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17242///
17243/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17244/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17245/// #     .with_native_roots()
17246/// #     .unwrap()
17247/// #     .https_only()
17248/// #     .enable_http2()
17249/// #     .build();
17250///
17251/// # let executor = hyper_util::rt::TokioExecutor::new();
17252/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17253/// #     secret,
17254/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17255/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17256/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17257/// #     ),
17258/// # ).build().await.unwrap();
17259///
17260/// # let client = hyper_util::client::legacy::Client::builder(
17261/// #     hyper_util::rt::TokioExecutor::new()
17262/// # )
17263/// # .build(
17264/// #     hyper_rustls::HttpsConnectorBuilder::new()
17265/// #         .with_native_roots()
17266/// #         .unwrap()
17267/// #         .https_or_http()
17268/// #         .enable_http2()
17269/// #         .build()
17270/// # );
17271/// # let mut hub = Connectors::new(client, auth);
17272/// // As the method needs a request, you would usually fill it with the desired information
17273/// // into the respective structure. Some of the parts shown here might not be applicable !
17274/// // Values shown here are possibly random and not representative !
17275/// let mut req = WithdrawCustomConnectorVersionRequest::default();
17276///
17277/// // You can configure optional parameters by calling the respective setters at will, and
17278/// // execute the final call using `doit()`.
17279/// // Values shown here are possibly random and not representative !
17280/// let result = hub.projects().locations_custom_connectors_custom_connector_versions_withdraw(req, "name")
17281///              .doit().await;
17282/// # }
17283/// ```
17284pub struct ProjectLocationCustomConnectorCustomConnectorVersionWithdrawCall<'a, C>
17285where
17286    C: 'a,
17287{
17288    hub: &'a Connectors<C>,
17289    _request: WithdrawCustomConnectorVersionRequest,
17290    _name: String,
17291    _delegate: Option<&'a mut dyn common::Delegate>,
17292    _additional_params: HashMap<String, String>,
17293    _scopes: BTreeSet<String>,
17294}
17295
17296impl<'a, C> common::CallBuilder
17297    for ProjectLocationCustomConnectorCustomConnectorVersionWithdrawCall<'a, C>
17298{
17299}
17300
17301impl<'a, C> ProjectLocationCustomConnectorCustomConnectorVersionWithdrawCall<'a, C>
17302where
17303    C: common::Connector,
17304{
17305    /// Perform the operation you have build so far.
17306    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
17307        use std::borrow::Cow;
17308        use std::io::{Read, Seek};
17309
17310        use common::{url::Params, ToParts};
17311        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17312
17313        let mut dd = common::DefaultDelegate;
17314        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17315        dlg.begin(common::MethodInfo {
17316            id: "connectors.projects.locations.customConnectors.customConnectorVersions.withdraw",
17317            http_method: hyper::Method::POST,
17318        });
17319
17320        for &field in ["alt", "name"].iter() {
17321            if self._additional_params.contains_key(field) {
17322                dlg.finished(false);
17323                return Err(common::Error::FieldClash(field));
17324            }
17325        }
17326
17327        let mut params = Params::with_capacity(4 + self._additional_params.len());
17328        params.push("name", self._name);
17329
17330        params.extend(self._additional_params.iter());
17331
17332        params.push("alt", "json");
17333        let mut url = self.hub._base_url.clone() + "v1/{+name}:withdraw";
17334        if self._scopes.is_empty() {
17335            self._scopes
17336                .insert(Scope::CloudPlatform.as_ref().to_string());
17337        }
17338
17339        #[allow(clippy::single_element_loop)]
17340        for &(find_this, param_name) in [("{+name}", "name")].iter() {
17341            url = params.uri_replacement(url, param_name, find_this, true);
17342        }
17343        {
17344            let to_remove = ["name"];
17345            params.remove_params(&to_remove);
17346        }
17347
17348        let url = params.parse_with_url(&url);
17349
17350        let mut json_mime_type = mime::APPLICATION_JSON;
17351        let mut request_value_reader = {
17352            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17353            common::remove_json_null_values(&mut value);
17354            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17355            serde_json::to_writer(&mut dst, &value).unwrap();
17356            dst
17357        };
17358        let request_size = request_value_reader
17359            .seek(std::io::SeekFrom::End(0))
17360            .unwrap();
17361        request_value_reader
17362            .seek(std::io::SeekFrom::Start(0))
17363            .unwrap();
17364
17365        loop {
17366            let token = match self
17367                .hub
17368                .auth
17369                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17370                .await
17371            {
17372                Ok(token) => token,
17373                Err(e) => match dlg.token(e) {
17374                    Ok(token) => token,
17375                    Err(e) => {
17376                        dlg.finished(false);
17377                        return Err(common::Error::MissingToken(e));
17378                    }
17379                },
17380            };
17381            request_value_reader
17382                .seek(std::io::SeekFrom::Start(0))
17383                .unwrap();
17384            let mut req_result = {
17385                let client = &self.hub.client;
17386                dlg.pre_request();
17387                let mut req_builder = hyper::Request::builder()
17388                    .method(hyper::Method::POST)
17389                    .uri(url.as_str())
17390                    .header(USER_AGENT, self.hub._user_agent.clone());
17391
17392                if let Some(token) = token.as_ref() {
17393                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17394                }
17395
17396                let request = req_builder
17397                    .header(CONTENT_TYPE, json_mime_type.to_string())
17398                    .header(CONTENT_LENGTH, request_size as u64)
17399                    .body(common::to_body(
17400                        request_value_reader.get_ref().clone().into(),
17401                    ));
17402
17403                client.request(request.unwrap()).await
17404            };
17405
17406            match req_result {
17407                Err(err) => {
17408                    if let common::Retry::After(d) = dlg.http_error(&err) {
17409                        sleep(d).await;
17410                        continue;
17411                    }
17412                    dlg.finished(false);
17413                    return Err(common::Error::HttpError(err));
17414                }
17415                Ok(res) => {
17416                    let (mut parts, body) = res.into_parts();
17417                    let mut body = common::Body::new(body);
17418                    if !parts.status.is_success() {
17419                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17420                        let error = serde_json::from_str(&common::to_string(&bytes));
17421                        let response = common::to_response(parts, bytes.into());
17422
17423                        if let common::Retry::After(d) =
17424                            dlg.http_failure(&response, error.as_ref().ok())
17425                        {
17426                            sleep(d).await;
17427                            continue;
17428                        }
17429
17430                        dlg.finished(false);
17431
17432                        return Err(match error {
17433                            Ok(value) => common::Error::BadRequest(value),
17434                            _ => common::Error::Failure(response),
17435                        });
17436                    }
17437                    let response = {
17438                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17439                        let encoded = common::to_string(&bytes);
17440                        match serde_json::from_str(&encoded) {
17441                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17442                            Err(error) => {
17443                                dlg.response_json_decode_error(&encoded, &error);
17444                                return Err(common::Error::JsonDecodeError(
17445                                    encoded.to_string(),
17446                                    error,
17447                                ));
17448                            }
17449                        }
17450                    };
17451
17452                    dlg.finished(true);
17453                    return Ok(response);
17454                }
17455            }
17456        }
17457    }
17458
17459    ///
17460    /// Sets the *request* property to the given value.
17461    ///
17462    /// Even though the property as already been set when instantiating this call,
17463    /// we provide this method for API completeness.
17464    pub fn request(
17465        mut self,
17466        new_value: WithdrawCustomConnectorVersionRequest,
17467    ) -> ProjectLocationCustomConnectorCustomConnectorVersionWithdrawCall<'a, C> {
17468        self._request = new_value;
17469        self
17470    }
17471    /// Required. Resource name of the form: `projects/{project}/locations/{location}/customConnectors/{custom_connector}/customConnectorVersions/{custom_connector_version}`
17472    ///
17473    /// Sets the *name* path property to the given value.
17474    ///
17475    /// Even though the property as already been set when instantiating this call,
17476    /// we provide this method for API completeness.
17477    pub fn name(
17478        mut self,
17479        new_value: &str,
17480    ) -> ProjectLocationCustomConnectorCustomConnectorVersionWithdrawCall<'a, C> {
17481        self._name = new_value.to_string();
17482        self
17483    }
17484    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17485    /// while executing the actual API request.
17486    ///
17487    /// ````text
17488    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17489    /// ````
17490    ///
17491    /// Sets the *delegate* property to the given value.
17492    pub fn delegate(
17493        mut self,
17494        new_value: &'a mut dyn common::Delegate,
17495    ) -> ProjectLocationCustomConnectorCustomConnectorVersionWithdrawCall<'a, C> {
17496        self._delegate = Some(new_value);
17497        self
17498    }
17499
17500    /// Set any additional parameter of the query string used in the request.
17501    /// It should be used to set parameters which are not yet available through their own
17502    /// setters.
17503    ///
17504    /// Please note that this method must not be used to set any of the known parameters
17505    /// which have their own setter method. If done anyway, the request will fail.
17506    ///
17507    /// # Additional Parameters
17508    ///
17509    /// * *$.xgafv* (query-string) - V1 error format.
17510    /// * *access_token* (query-string) - OAuth access token.
17511    /// * *alt* (query-string) - Data format for response.
17512    /// * *callback* (query-string) - JSONP
17513    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17514    /// * *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.
17515    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17516    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17517    /// * *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.
17518    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17519    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17520    pub fn param<T>(
17521        mut self,
17522        name: T,
17523        value: T,
17524    ) -> ProjectLocationCustomConnectorCustomConnectorVersionWithdrawCall<'a, C>
17525    where
17526        T: AsRef<str>,
17527    {
17528        self._additional_params
17529            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17530        self
17531    }
17532
17533    /// Identifies the authorization scope for the method you are building.
17534    ///
17535    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17536    /// [`Scope::CloudPlatform`].
17537    ///
17538    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17539    /// tokens for more than one scope.
17540    ///
17541    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17542    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17543    /// sufficient, a read-write scope will do as well.
17544    pub fn add_scope<St>(
17545        mut self,
17546        scope: St,
17547    ) -> ProjectLocationCustomConnectorCustomConnectorVersionWithdrawCall<'a, C>
17548    where
17549        St: AsRef<str>,
17550    {
17551        self._scopes.insert(String::from(scope.as_ref()));
17552        self
17553    }
17554    /// Identifies the authorization scope(s) for the method you are building.
17555    ///
17556    /// See [`Self::add_scope()`] for details.
17557    pub fn add_scopes<I, St>(
17558        mut self,
17559        scopes: I,
17560    ) -> ProjectLocationCustomConnectorCustomConnectorVersionWithdrawCall<'a, C>
17561    where
17562        I: IntoIterator<Item = St>,
17563        St: AsRef<str>,
17564    {
17565        self._scopes
17566            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17567        self
17568    }
17569
17570    /// Removes all scopes, and no default scope will be used either.
17571    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17572    /// for details).
17573    pub fn clear_scopes(
17574        mut self,
17575    ) -> ProjectLocationCustomConnectorCustomConnectorVersionWithdrawCall<'a, C> {
17576        self._scopes.clear();
17577        self
17578    }
17579}
17580
17581/// Validates a Custom Connector Spec.
17582///
17583/// A builder for the *locations.customConnectors.validateCustomConnectorSpec* method supported by a *project* resource.
17584/// It is not used directly, but through a [`ProjectMethods`] instance.
17585///
17586/// # Example
17587///
17588/// Instantiate a resource method builder
17589///
17590/// ```test_harness,no_run
17591/// # extern crate hyper;
17592/// # extern crate hyper_rustls;
17593/// # extern crate google_connectors1 as connectors1;
17594/// use connectors1::api::ValidateCustomConnectorSpecRequest;
17595/// # async fn dox() {
17596/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17597///
17598/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17599/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17600/// #     .with_native_roots()
17601/// #     .unwrap()
17602/// #     .https_only()
17603/// #     .enable_http2()
17604/// #     .build();
17605///
17606/// # let executor = hyper_util::rt::TokioExecutor::new();
17607/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17608/// #     secret,
17609/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17610/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17611/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17612/// #     ),
17613/// # ).build().await.unwrap();
17614///
17615/// # let client = hyper_util::client::legacy::Client::builder(
17616/// #     hyper_util::rt::TokioExecutor::new()
17617/// # )
17618/// # .build(
17619/// #     hyper_rustls::HttpsConnectorBuilder::new()
17620/// #         .with_native_roots()
17621/// #         .unwrap()
17622/// #         .https_or_http()
17623/// #         .enable_http2()
17624/// #         .build()
17625/// # );
17626/// # let mut hub = Connectors::new(client, auth);
17627/// // As the method needs a request, you would usually fill it with the desired information
17628/// // into the respective structure. Some of the parts shown here might not be applicable !
17629/// // Values shown here are possibly random and not representative !
17630/// let mut req = ValidateCustomConnectorSpecRequest::default();
17631///
17632/// // You can configure optional parameters by calling the respective setters at will, and
17633/// // execute the final call using `doit()`.
17634/// // Values shown here are possibly random and not representative !
17635/// let result = hub.projects().locations_custom_connectors_validate_custom_connector_spec(req, "parent")
17636///              .doit().await;
17637/// # }
17638/// ```
17639pub struct ProjectLocationCustomConnectorValidateCustomConnectorSpecCall<'a, C>
17640where
17641    C: 'a,
17642{
17643    hub: &'a Connectors<C>,
17644    _request: ValidateCustomConnectorSpecRequest,
17645    _parent: String,
17646    _delegate: Option<&'a mut dyn common::Delegate>,
17647    _additional_params: HashMap<String, String>,
17648    _scopes: BTreeSet<String>,
17649}
17650
17651impl<'a, C> common::CallBuilder
17652    for ProjectLocationCustomConnectorValidateCustomConnectorSpecCall<'a, C>
17653{
17654}
17655
17656impl<'a, C> ProjectLocationCustomConnectorValidateCustomConnectorSpecCall<'a, C>
17657where
17658    C: common::Connector,
17659{
17660    /// Perform the operation you have build so far.
17661    pub async fn doit(
17662        mut self,
17663    ) -> common::Result<(common::Response, ValidateCustomConnectorSpecResponse)> {
17664        use std::borrow::Cow;
17665        use std::io::{Read, Seek};
17666
17667        use common::{url::Params, ToParts};
17668        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17669
17670        let mut dd = common::DefaultDelegate;
17671        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17672        dlg.begin(common::MethodInfo {
17673            id: "connectors.projects.locations.customConnectors.validateCustomConnectorSpec",
17674            http_method: hyper::Method::POST,
17675        });
17676
17677        for &field in ["alt", "parent"].iter() {
17678            if self._additional_params.contains_key(field) {
17679                dlg.finished(false);
17680                return Err(common::Error::FieldClash(field));
17681            }
17682        }
17683
17684        let mut params = Params::with_capacity(4 + self._additional_params.len());
17685        params.push("parent", self._parent);
17686
17687        params.extend(self._additional_params.iter());
17688
17689        params.push("alt", "json");
17690        let mut url = self.hub._base_url.clone()
17691            + "v1/{+parent}/customConnectors:validateCustomConnectorSpec";
17692        if self._scopes.is_empty() {
17693            self._scopes
17694                .insert(Scope::CloudPlatform.as_ref().to_string());
17695        }
17696
17697        #[allow(clippy::single_element_loop)]
17698        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
17699            url = params.uri_replacement(url, param_name, find_this, true);
17700        }
17701        {
17702            let to_remove = ["parent"];
17703            params.remove_params(&to_remove);
17704        }
17705
17706        let url = params.parse_with_url(&url);
17707
17708        let mut json_mime_type = mime::APPLICATION_JSON;
17709        let mut request_value_reader = {
17710            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17711            common::remove_json_null_values(&mut value);
17712            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17713            serde_json::to_writer(&mut dst, &value).unwrap();
17714            dst
17715        };
17716        let request_size = request_value_reader
17717            .seek(std::io::SeekFrom::End(0))
17718            .unwrap();
17719        request_value_reader
17720            .seek(std::io::SeekFrom::Start(0))
17721            .unwrap();
17722
17723        loop {
17724            let token = match self
17725                .hub
17726                .auth
17727                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17728                .await
17729            {
17730                Ok(token) => token,
17731                Err(e) => match dlg.token(e) {
17732                    Ok(token) => token,
17733                    Err(e) => {
17734                        dlg.finished(false);
17735                        return Err(common::Error::MissingToken(e));
17736                    }
17737                },
17738            };
17739            request_value_reader
17740                .seek(std::io::SeekFrom::Start(0))
17741                .unwrap();
17742            let mut req_result = {
17743                let client = &self.hub.client;
17744                dlg.pre_request();
17745                let mut req_builder = hyper::Request::builder()
17746                    .method(hyper::Method::POST)
17747                    .uri(url.as_str())
17748                    .header(USER_AGENT, self.hub._user_agent.clone());
17749
17750                if let Some(token) = token.as_ref() {
17751                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17752                }
17753
17754                let request = req_builder
17755                    .header(CONTENT_TYPE, json_mime_type.to_string())
17756                    .header(CONTENT_LENGTH, request_size as u64)
17757                    .body(common::to_body(
17758                        request_value_reader.get_ref().clone().into(),
17759                    ));
17760
17761                client.request(request.unwrap()).await
17762            };
17763
17764            match req_result {
17765                Err(err) => {
17766                    if let common::Retry::After(d) = dlg.http_error(&err) {
17767                        sleep(d).await;
17768                        continue;
17769                    }
17770                    dlg.finished(false);
17771                    return Err(common::Error::HttpError(err));
17772                }
17773                Ok(res) => {
17774                    let (mut parts, body) = res.into_parts();
17775                    let mut body = common::Body::new(body);
17776                    if !parts.status.is_success() {
17777                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17778                        let error = serde_json::from_str(&common::to_string(&bytes));
17779                        let response = common::to_response(parts, bytes.into());
17780
17781                        if let common::Retry::After(d) =
17782                            dlg.http_failure(&response, error.as_ref().ok())
17783                        {
17784                            sleep(d).await;
17785                            continue;
17786                        }
17787
17788                        dlg.finished(false);
17789
17790                        return Err(match error {
17791                            Ok(value) => common::Error::BadRequest(value),
17792                            _ => common::Error::Failure(response),
17793                        });
17794                    }
17795                    let response = {
17796                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17797                        let encoded = common::to_string(&bytes);
17798                        match serde_json::from_str(&encoded) {
17799                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17800                            Err(error) => {
17801                                dlg.response_json_decode_error(&encoded, &error);
17802                                return Err(common::Error::JsonDecodeError(
17803                                    encoded.to_string(),
17804                                    error,
17805                                ));
17806                            }
17807                        }
17808                    };
17809
17810                    dlg.finished(true);
17811                    return Ok(response);
17812                }
17813            }
17814        }
17815    }
17816
17817    ///
17818    /// Sets the *request* property to the given value.
17819    ///
17820    /// Even though the property as already been set when instantiating this call,
17821    /// we provide this method for API completeness.
17822    pub fn request(
17823        mut self,
17824        new_value: ValidateCustomConnectorSpecRequest,
17825    ) -> ProjectLocationCustomConnectorValidateCustomConnectorSpecCall<'a, C> {
17826        self._request = new_value;
17827        self
17828    }
17829    /// Required. Location at which the custom connector is being created.
17830    ///
17831    /// Sets the *parent* path property to the given value.
17832    ///
17833    /// Even though the property as already been set when instantiating this call,
17834    /// we provide this method for API completeness.
17835    pub fn parent(
17836        mut self,
17837        new_value: &str,
17838    ) -> ProjectLocationCustomConnectorValidateCustomConnectorSpecCall<'a, C> {
17839        self._parent = new_value.to_string();
17840        self
17841    }
17842    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17843    /// while executing the actual API request.
17844    ///
17845    /// ````text
17846    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17847    /// ````
17848    ///
17849    /// Sets the *delegate* property to the given value.
17850    pub fn delegate(
17851        mut self,
17852        new_value: &'a mut dyn common::Delegate,
17853    ) -> ProjectLocationCustomConnectorValidateCustomConnectorSpecCall<'a, C> {
17854        self._delegate = Some(new_value);
17855        self
17856    }
17857
17858    /// Set any additional parameter of the query string used in the request.
17859    /// It should be used to set parameters which are not yet available through their own
17860    /// setters.
17861    ///
17862    /// Please note that this method must not be used to set any of the known parameters
17863    /// which have their own setter method. If done anyway, the request will fail.
17864    ///
17865    /// # Additional Parameters
17866    ///
17867    /// * *$.xgafv* (query-string) - V1 error format.
17868    /// * *access_token* (query-string) - OAuth access token.
17869    /// * *alt* (query-string) - Data format for response.
17870    /// * *callback* (query-string) - JSONP
17871    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17872    /// * *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.
17873    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17874    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17875    /// * *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.
17876    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17877    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17878    pub fn param<T>(
17879        mut self,
17880        name: T,
17881        value: T,
17882    ) -> ProjectLocationCustomConnectorValidateCustomConnectorSpecCall<'a, C>
17883    where
17884        T: AsRef<str>,
17885    {
17886        self._additional_params
17887            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17888        self
17889    }
17890
17891    /// Identifies the authorization scope for the method you are building.
17892    ///
17893    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17894    /// [`Scope::CloudPlatform`].
17895    ///
17896    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17897    /// tokens for more than one scope.
17898    ///
17899    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17900    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17901    /// sufficient, a read-write scope will do as well.
17902    pub fn add_scope<St>(
17903        mut self,
17904        scope: St,
17905    ) -> ProjectLocationCustomConnectorValidateCustomConnectorSpecCall<'a, C>
17906    where
17907        St: AsRef<str>,
17908    {
17909        self._scopes.insert(String::from(scope.as_ref()));
17910        self
17911    }
17912    /// Identifies the authorization scope(s) for the method you are building.
17913    ///
17914    /// See [`Self::add_scope()`] for details.
17915    pub fn add_scopes<I, St>(
17916        mut self,
17917        scopes: I,
17918    ) -> ProjectLocationCustomConnectorValidateCustomConnectorSpecCall<'a, C>
17919    where
17920        I: IntoIterator<Item = St>,
17921        St: AsRef<str>,
17922    {
17923        self._scopes
17924            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17925        self
17926    }
17927
17928    /// Removes all scopes, and no default scope will be used either.
17929    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17930    /// for details).
17931    pub fn clear_scopes(
17932        mut self,
17933    ) -> ProjectLocationCustomConnectorValidateCustomConnectorSpecCall<'a, C> {
17934        self._scopes.clear();
17935        self
17936    }
17937}
17938
17939/// Creates a new EndpointAttachment in a given project and location.
17940///
17941/// A builder for the *locations.endpointAttachments.create* method supported by a *project* resource.
17942/// It is not used directly, but through a [`ProjectMethods`] instance.
17943///
17944/// # Example
17945///
17946/// Instantiate a resource method builder
17947///
17948/// ```test_harness,no_run
17949/// # extern crate hyper;
17950/// # extern crate hyper_rustls;
17951/// # extern crate google_connectors1 as connectors1;
17952/// use connectors1::api::EndpointAttachment;
17953/// # async fn dox() {
17954/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17955///
17956/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17957/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17958/// #     .with_native_roots()
17959/// #     .unwrap()
17960/// #     .https_only()
17961/// #     .enable_http2()
17962/// #     .build();
17963///
17964/// # let executor = hyper_util::rt::TokioExecutor::new();
17965/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17966/// #     secret,
17967/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17968/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17969/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17970/// #     ),
17971/// # ).build().await.unwrap();
17972///
17973/// # let client = hyper_util::client::legacy::Client::builder(
17974/// #     hyper_util::rt::TokioExecutor::new()
17975/// # )
17976/// # .build(
17977/// #     hyper_rustls::HttpsConnectorBuilder::new()
17978/// #         .with_native_roots()
17979/// #         .unwrap()
17980/// #         .https_or_http()
17981/// #         .enable_http2()
17982/// #         .build()
17983/// # );
17984/// # let mut hub = Connectors::new(client, auth);
17985/// // As the method needs a request, you would usually fill it with the desired information
17986/// // into the respective structure. Some of the parts shown here might not be applicable !
17987/// // Values shown here are possibly random and not representative !
17988/// let mut req = EndpointAttachment::default();
17989///
17990/// // You can configure optional parameters by calling the respective setters at will, and
17991/// // execute the final call using `doit()`.
17992/// // Values shown here are possibly random and not representative !
17993/// let result = hub.projects().locations_endpoint_attachments_create(req, "parent")
17994///              .endpoint_attachment_id("sed")
17995///              .doit().await;
17996/// # }
17997/// ```
17998pub struct ProjectLocationEndpointAttachmentCreateCall<'a, C>
17999where
18000    C: 'a,
18001{
18002    hub: &'a Connectors<C>,
18003    _request: EndpointAttachment,
18004    _parent: String,
18005    _endpoint_attachment_id: Option<String>,
18006    _delegate: Option<&'a mut dyn common::Delegate>,
18007    _additional_params: HashMap<String, String>,
18008    _scopes: BTreeSet<String>,
18009}
18010
18011impl<'a, C> common::CallBuilder for ProjectLocationEndpointAttachmentCreateCall<'a, C> {}
18012
18013impl<'a, C> ProjectLocationEndpointAttachmentCreateCall<'a, C>
18014where
18015    C: common::Connector,
18016{
18017    /// Perform the operation you have build so far.
18018    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
18019        use std::borrow::Cow;
18020        use std::io::{Read, Seek};
18021
18022        use common::{url::Params, ToParts};
18023        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18024
18025        let mut dd = common::DefaultDelegate;
18026        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18027        dlg.begin(common::MethodInfo {
18028            id: "connectors.projects.locations.endpointAttachments.create",
18029            http_method: hyper::Method::POST,
18030        });
18031
18032        for &field in ["alt", "parent", "endpointAttachmentId"].iter() {
18033            if self._additional_params.contains_key(field) {
18034                dlg.finished(false);
18035                return Err(common::Error::FieldClash(field));
18036            }
18037        }
18038
18039        let mut params = Params::with_capacity(5 + self._additional_params.len());
18040        params.push("parent", self._parent);
18041        if let Some(value) = self._endpoint_attachment_id.as_ref() {
18042            params.push("endpointAttachmentId", value);
18043        }
18044
18045        params.extend(self._additional_params.iter());
18046
18047        params.push("alt", "json");
18048        let mut url = self.hub._base_url.clone() + "v1/{+parent}/endpointAttachments";
18049        if self._scopes.is_empty() {
18050            self._scopes
18051                .insert(Scope::CloudPlatform.as_ref().to_string());
18052        }
18053
18054        #[allow(clippy::single_element_loop)]
18055        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
18056            url = params.uri_replacement(url, param_name, find_this, true);
18057        }
18058        {
18059            let to_remove = ["parent"];
18060            params.remove_params(&to_remove);
18061        }
18062
18063        let url = params.parse_with_url(&url);
18064
18065        let mut json_mime_type = mime::APPLICATION_JSON;
18066        let mut request_value_reader = {
18067            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18068            common::remove_json_null_values(&mut value);
18069            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18070            serde_json::to_writer(&mut dst, &value).unwrap();
18071            dst
18072        };
18073        let request_size = request_value_reader
18074            .seek(std::io::SeekFrom::End(0))
18075            .unwrap();
18076        request_value_reader
18077            .seek(std::io::SeekFrom::Start(0))
18078            .unwrap();
18079
18080        loop {
18081            let token = match self
18082                .hub
18083                .auth
18084                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18085                .await
18086            {
18087                Ok(token) => token,
18088                Err(e) => match dlg.token(e) {
18089                    Ok(token) => token,
18090                    Err(e) => {
18091                        dlg.finished(false);
18092                        return Err(common::Error::MissingToken(e));
18093                    }
18094                },
18095            };
18096            request_value_reader
18097                .seek(std::io::SeekFrom::Start(0))
18098                .unwrap();
18099            let mut req_result = {
18100                let client = &self.hub.client;
18101                dlg.pre_request();
18102                let mut req_builder = hyper::Request::builder()
18103                    .method(hyper::Method::POST)
18104                    .uri(url.as_str())
18105                    .header(USER_AGENT, self.hub._user_agent.clone());
18106
18107                if let Some(token) = token.as_ref() {
18108                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18109                }
18110
18111                let request = req_builder
18112                    .header(CONTENT_TYPE, json_mime_type.to_string())
18113                    .header(CONTENT_LENGTH, request_size as u64)
18114                    .body(common::to_body(
18115                        request_value_reader.get_ref().clone().into(),
18116                    ));
18117
18118                client.request(request.unwrap()).await
18119            };
18120
18121            match req_result {
18122                Err(err) => {
18123                    if let common::Retry::After(d) = dlg.http_error(&err) {
18124                        sleep(d).await;
18125                        continue;
18126                    }
18127                    dlg.finished(false);
18128                    return Err(common::Error::HttpError(err));
18129                }
18130                Ok(res) => {
18131                    let (mut parts, body) = res.into_parts();
18132                    let mut body = common::Body::new(body);
18133                    if !parts.status.is_success() {
18134                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18135                        let error = serde_json::from_str(&common::to_string(&bytes));
18136                        let response = common::to_response(parts, bytes.into());
18137
18138                        if let common::Retry::After(d) =
18139                            dlg.http_failure(&response, error.as_ref().ok())
18140                        {
18141                            sleep(d).await;
18142                            continue;
18143                        }
18144
18145                        dlg.finished(false);
18146
18147                        return Err(match error {
18148                            Ok(value) => common::Error::BadRequest(value),
18149                            _ => common::Error::Failure(response),
18150                        });
18151                    }
18152                    let response = {
18153                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18154                        let encoded = common::to_string(&bytes);
18155                        match serde_json::from_str(&encoded) {
18156                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18157                            Err(error) => {
18158                                dlg.response_json_decode_error(&encoded, &error);
18159                                return Err(common::Error::JsonDecodeError(
18160                                    encoded.to_string(),
18161                                    error,
18162                                ));
18163                            }
18164                        }
18165                    };
18166
18167                    dlg.finished(true);
18168                    return Ok(response);
18169                }
18170            }
18171        }
18172    }
18173
18174    ///
18175    /// Sets the *request* property to the given value.
18176    ///
18177    /// Even though the property as already been set when instantiating this call,
18178    /// we provide this method for API completeness.
18179    pub fn request(
18180        mut self,
18181        new_value: EndpointAttachment,
18182    ) -> ProjectLocationEndpointAttachmentCreateCall<'a, C> {
18183        self._request = new_value;
18184        self
18185    }
18186    /// Required. Parent resource of the EndpointAttachment, of the form: `projects/*/locations/*`
18187    ///
18188    /// Sets the *parent* path property to the given value.
18189    ///
18190    /// Even though the property as already been set when instantiating this call,
18191    /// we provide this method for API completeness.
18192    pub fn parent(mut self, new_value: &str) -> ProjectLocationEndpointAttachmentCreateCall<'a, C> {
18193        self._parent = new_value.to_string();
18194        self
18195    }
18196    /// Required. Identifier to assign to the EndpointAttachment. Must be unique within scope of the parent resource. The regex is: `^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`.
18197    ///
18198    /// Sets the *endpoint attachment id* query property to the given value.
18199    pub fn endpoint_attachment_id(
18200        mut self,
18201        new_value: &str,
18202    ) -> ProjectLocationEndpointAttachmentCreateCall<'a, C> {
18203        self._endpoint_attachment_id = Some(new_value.to_string());
18204        self
18205    }
18206    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18207    /// while executing the actual API request.
18208    ///
18209    /// ````text
18210    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18211    /// ````
18212    ///
18213    /// Sets the *delegate* property to the given value.
18214    pub fn delegate(
18215        mut self,
18216        new_value: &'a mut dyn common::Delegate,
18217    ) -> ProjectLocationEndpointAttachmentCreateCall<'a, C> {
18218        self._delegate = Some(new_value);
18219        self
18220    }
18221
18222    /// Set any additional parameter of the query string used in the request.
18223    /// It should be used to set parameters which are not yet available through their own
18224    /// setters.
18225    ///
18226    /// Please note that this method must not be used to set any of the known parameters
18227    /// which have their own setter method. If done anyway, the request will fail.
18228    ///
18229    /// # Additional Parameters
18230    ///
18231    /// * *$.xgafv* (query-string) - V1 error format.
18232    /// * *access_token* (query-string) - OAuth access token.
18233    /// * *alt* (query-string) - Data format for response.
18234    /// * *callback* (query-string) - JSONP
18235    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18236    /// * *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.
18237    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18238    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18239    /// * *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.
18240    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18241    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18242    pub fn param<T>(
18243        mut self,
18244        name: T,
18245        value: T,
18246    ) -> ProjectLocationEndpointAttachmentCreateCall<'a, C>
18247    where
18248        T: AsRef<str>,
18249    {
18250        self._additional_params
18251            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18252        self
18253    }
18254
18255    /// Identifies the authorization scope for the method you are building.
18256    ///
18257    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18258    /// [`Scope::CloudPlatform`].
18259    ///
18260    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18261    /// tokens for more than one scope.
18262    ///
18263    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18264    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18265    /// sufficient, a read-write scope will do as well.
18266    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEndpointAttachmentCreateCall<'a, C>
18267    where
18268        St: AsRef<str>,
18269    {
18270        self._scopes.insert(String::from(scope.as_ref()));
18271        self
18272    }
18273    /// Identifies the authorization scope(s) for the method you are building.
18274    ///
18275    /// See [`Self::add_scope()`] for details.
18276    pub fn add_scopes<I, St>(
18277        mut self,
18278        scopes: I,
18279    ) -> ProjectLocationEndpointAttachmentCreateCall<'a, C>
18280    where
18281        I: IntoIterator<Item = St>,
18282        St: AsRef<str>,
18283    {
18284        self._scopes
18285            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18286        self
18287    }
18288
18289    /// Removes all scopes, and no default scope will be used either.
18290    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18291    /// for details).
18292    pub fn clear_scopes(mut self) -> ProjectLocationEndpointAttachmentCreateCall<'a, C> {
18293        self._scopes.clear();
18294        self
18295    }
18296}
18297
18298/// Deletes a single EndpointAttachment.
18299///
18300/// A builder for the *locations.endpointAttachments.delete* method supported by a *project* resource.
18301/// It is not used directly, but through a [`ProjectMethods`] instance.
18302///
18303/// # Example
18304///
18305/// Instantiate a resource method builder
18306///
18307/// ```test_harness,no_run
18308/// # extern crate hyper;
18309/// # extern crate hyper_rustls;
18310/// # extern crate google_connectors1 as connectors1;
18311/// # async fn dox() {
18312/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18313///
18314/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18315/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18316/// #     .with_native_roots()
18317/// #     .unwrap()
18318/// #     .https_only()
18319/// #     .enable_http2()
18320/// #     .build();
18321///
18322/// # let executor = hyper_util::rt::TokioExecutor::new();
18323/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18324/// #     secret,
18325/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18326/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
18327/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
18328/// #     ),
18329/// # ).build().await.unwrap();
18330///
18331/// # let client = hyper_util::client::legacy::Client::builder(
18332/// #     hyper_util::rt::TokioExecutor::new()
18333/// # )
18334/// # .build(
18335/// #     hyper_rustls::HttpsConnectorBuilder::new()
18336/// #         .with_native_roots()
18337/// #         .unwrap()
18338/// #         .https_or_http()
18339/// #         .enable_http2()
18340/// #         .build()
18341/// # );
18342/// # let mut hub = Connectors::new(client, auth);
18343/// // You can configure optional parameters by calling the respective setters at will, and
18344/// // execute the final call using `doit()`.
18345/// // Values shown here are possibly random and not representative !
18346/// let result = hub.projects().locations_endpoint_attachments_delete("name")
18347///              .doit().await;
18348/// # }
18349/// ```
18350pub struct ProjectLocationEndpointAttachmentDeleteCall<'a, C>
18351where
18352    C: 'a,
18353{
18354    hub: &'a Connectors<C>,
18355    _name: String,
18356    _delegate: Option<&'a mut dyn common::Delegate>,
18357    _additional_params: HashMap<String, String>,
18358    _scopes: BTreeSet<String>,
18359}
18360
18361impl<'a, C> common::CallBuilder for ProjectLocationEndpointAttachmentDeleteCall<'a, C> {}
18362
18363impl<'a, C> ProjectLocationEndpointAttachmentDeleteCall<'a, C>
18364where
18365    C: common::Connector,
18366{
18367    /// Perform the operation you have build so far.
18368    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
18369        use std::borrow::Cow;
18370        use std::io::{Read, Seek};
18371
18372        use common::{url::Params, ToParts};
18373        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18374
18375        let mut dd = common::DefaultDelegate;
18376        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18377        dlg.begin(common::MethodInfo {
18378            id: "connectors.projects.locations.endpointAttachments.delete",
18379            http_method: hyper::Method::DELETE,
18380        });
18381
18382        for &field in ["alt", "name"].iter() {
18383            if self._additional_params.contains_key(field) {
18384                dlg.finished(false);
18385                return Err(common::Error::FieldClash(field));
18386            }
18387        }
18388
18389        let mut params = Params::with_capacity(3 + self._additional_params.len());
18390        params.push("name", self._name);
18391
18392        params.extend(self._additional_params.iter());
18393
18394        params.push("alt", "json");
18395        let mut url = self.hub._base_url.clone() + "v1/{+name}";
18396        if self._scopes.is_empty() {
18397            self._scopes
18398                .insert(Scope::CloudPlatform.as_ref().to_string());
18399        }
18400
18401        #[allow(clippy::single_element_loop)]
18402        for &(find_this, param_name) in [("{+name}", "name")].iter() {
18403            url = params.uri_replacement(url, param_name, find_this, true);
18404        }
18405        {
18406            let to_remove = ["name"];
18407            params.remove_params(&to_remove);
18408        }
18409
18410        let url = params.parse_with_url(&url);
18411
18412        loop {
18413            let token = match self
18414                .hub
18415                .auth
18416                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18417                .await
18418            {
18419                Ok(token) => token,
18420                Err(e) => match dlg.token(e) {
18421                    Ok(token) => token,
18422                    Err(e) => {
18423                        dlg.finished(false);
18424                        return Err(common::Error::MissingToken(e));
18425                    }
18426                },
18427            };
18428            let mut req_result = {
18429                let client = &self.hub.client;
18430                dlg.pre_request();
18431                let mut req_builder = hyper::Request::builder()
18432                    .method(hyper::Method::DELETE)
18433                    .uri(url.as_str())
18434                    .header(USER_AGENT, self.hub._user_agent.clone());
18435
18436                if let Some(token) = token.as_ref() {
18437                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18438                }
18439
18440                let request = req_builder
18441                    .header(CONTENT_LENGTH, 0_u64)
18442                    .body(common::to_body::<String>(None));
18443
18444                client.request(request.unwrap()).await
18445            };
18446
18447            match req_result {
18448                Err(err) => {
18449                    if let common::Retry::After(d) = dlg.http_error(&err) {
18450                        sleep(d).await;
18451                        continue;
18452                    }
18453                    dlg.finished(false);
18454                    return Err(common::Error::HttpError(err));
18455                }
18456                Ok(res) => {
18457                    let (mut parts, body) = res.into_parts();
18458                    let mut body = common::Body::new(body);
18459                    if !parts.status.is_success() {
18460                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18461                        let error = serde_json::from_str(&common::to_string(&bytes));
18462                        let response = common::to_response(parts, bytes.into());
18463
18464                        if let common::Retry::After(d) =
18465                            dlg.http_failure(&response, error.as_ref().ok())
18466                        {
18467                            sleep(d).await;
18468                            continue;
18469                        }
18470
18471                        dlg.finished(false);
18472
18473                        return Err(match error {
18474                            Ok(value) => common::Error::BadRequest(value),
18475                            _ => common::Error::Failure(response),
18476                        });
18477                    }
18478                    let response = {
18479                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18480                        let encoded = common::to_string(&bytes);
18481                        match serde_json::from_str(&encoded) {
18482                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18483                            Err(error) => {
18484                                dlg.response_json_decode_error(&encoded, &error);
18485                                return Err(common::Error::JsonDecodeError(
18486                                    encoded.to_string(),
18487                                    error,
18488                                ));
18489                            }
18490                        }
18491                    };
18492
18493                    dlg.finished(true);
18494                    return Ok(response);
18495                }
18496            }
18497        }
18498    }
18499
18500    /// Required. Resource name of the form: `projects/*/locations/*/endpointAttachments/*`
18501    ///
18502    /// Sets the *name* path property to the given value.
18503    ///
18504    /// Even though the property as already been set when instantiating this call,
18505    /// we provide this method for API completeness.
18506    pub fn name(mut self, new_value: &str) -> ProjectLocationEndpointAttachmentDeleteCall<'a, C> {
18507        self._name = new_value.to_string();
18508        self
18509    }
18510    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18511    /// while executing the actual API request.
18512    ///
18513    /// ````text
18514    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18515    /// ````
18516    ///
18517    /// Sets the *delegate* property to the given value.
18518    pub fn delegate(
18519        mut self,
18520        new_value: &'a mut dyn common::Delegate,
18521    ) -> ProjectLocationEndpointAttachmentDeleteCall<'a, C> {
18522        self._delegate = Some(new_value);
18523        self
18524    }
18525
18526    /// Set any additional parameter of the query string used in the request.
18527    /// It should be used to set parameters which are not yet available through their own
18528    /// setters.
18529    ///
18530    /// Please note that this method must not be used to set any of the known parameters
18531    /// which have their own setter method. If done anyway, the request will fail.
18532    ///
18533    /// # Additional Parameters
18534    ///
18535    /// * *$.xgafv* (query-string) - V1 error format.
18536    /// * *access_token* (query-string) - OAuth access token.
18537    /// * *alt* (query-string) - Data format for response.
18538    /// * *callback* (query-string) - JSONP
18539    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18540    /// * *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.
18541    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18542    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18543    /// * *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.
18544    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18545    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18546    pub fn param<T>(
18547        mut self,
18548        name: T,
18549        value: T,
18550    ) -> ProjectLocationEndpointAttachmentDeleteCall<'a, C>
18551    where
18552        T: AsRef<str>,
18553    {
18554        self._additional_params
18555            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18556        self
18557    }
18558
18559    /// Identifies the authorization scope for the method you are building.
18560    ///
18561    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18562    /// [`Scope::CloudPlatform`].
18563    ///
18564    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18565    /// tokens for more than one scope.
18566    ///
18567    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18568    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18569    /// sufficient, a read-write scope will do as well.
18570    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEndpointAttachmentDeleteCall<'a, C>
18571    where
18572        St: AsRef<str>,
18573    {
18574        self._scopes.insert(String::from(scope.as_ref()));
18575        self
18576    }
18577    /// Identifies the authorization scope(s) for the method you are building.
18578    ///
18579    /// See [`Self::add_scope()`] for details.
18580    pub fn add_scopes<I, St>(
18581        mut self,
18582        scopes: I,
18583    ) -> ProjectLocationEndpointAttachmentDeleteCall<'a, C>
18584    where
18585        I: IntoIterator<Item = St>,
18586        St: AsRef<str>,
18587    {
18588        self._scopes
18589            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18590        self
18591    }
18592
18593    /// Removes all scopes, and no default scope will be used either.
18594    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18595    /// for details).
18596    pub fn clear_scopes(mut self) -> ProjectLocationEndpointAttachmentDeleteCall<'a, C> {
18597        self._scopes.clear();
18598        self
18599    }
18600}
18601
18602/// Gets details of a single EndpointAttachment.
18603///
18604/// A builder for the *locations.endpointAttachments.get* method supported by a *project* resource.
18605/// It is not used directly, but through a [`ProjectMethods`] instance.
18606///
18607/// # Example
18608///
18609/// Instantiate a resource method builder
18610///
18611/// ```test_harness,no_run
18612/// # extern crate hyper;
18613/// # extern crate hyper_rustls;
18614/// # extern crate google_connectors1 as connectors1;
18615/// # async fn dox() {
18616/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18617///
18618/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18619/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18620/// #     .with_native_roots()
18621/// #     .unwrap()
18622/// #     .https_only()
18623/// #     .enable_http2()
18624/// #     .build();
18625///
18626/// # let executor = hyper_util::rt::TokioExecutor::new();
18627/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18628/// #     secret,
18629/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18630/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
18631/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
18632/// #     ),
18633/// # ).build().await.unwrap();
18634///
18635/// # let client = hyper_util::client::legacy::Client::builder(
18636/// #     hyper_util::rt::TokioExecutor::new()
18637/// # )
18638/// # .build(
18639/// #     hyper_rustls::HttpsConnectorBuilder::new()
18640/// #         .with_native_roots()
18641/// #         .unwrap()
18642/// #         .https_or_http()
18643/// #         .enable_http2()
18644/// #         .build()
18645/// # );
18646/// # let mut hub = Connectors::new(client, auth);
18647/// // You can configure optional parameters by calling the respective setters at will, and
18648/// // execute the final call using `doit()`.
18649/// // Values shown here are possibly random and not representative !
18650/// let result = hub.projects().locations_endpoint_attachments_get("name")
18651///              .view("gubergren")
18652///              .doit().await;
18653/// # }
18654/// ```
18655pub struct ProjectLocationEndpointAttachmentGetCall<'a, C>
18656where
18657    C: 'a,
18658{
18659    hub: &'a Connectors<C>,
18660    _name: String,
18661    _view: Option<String>,
18662    _delegate: Option<&'a mut dyn common::Delegate>,
18663    _additional_params: HashMap<String, String>,
18664    _scopes: BTreeSet<String>,
18665}
18666
18667impl<'a, C> common::CallBuilder for ProjectLocationEndpointAttachmentGetCall<'a, C> {}
18668
18669impl<'a, C> ProjectLocationEndpointAttachmentGetCall<'a, C>
18670where
18671    C: common::Connector,
18672{
18673    /// Perform the operation you have build so far.
18674    pub async fn doit(mut self) -> common::Result<(common::Response, EndpointAttachment)> {
18675        use std::borrow::Cow;
18676        use std::io::{Read, Seek};
18677
18678        use common::{url::Params, ToParts};
18679        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18680
18681        let mut dd = common::DefaultDelegate;
18682        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18683        dlg.begin(common::MethodInfo {
18684            id: "connectors.projects.locations.endpointAttachments.get",
18685            http_method: hyper::Method::GET,
18686        });
18687
18688        for &field in ["alt", "name", "view"].iter() {
18689            if self._additional_params.contains_key(field) {
18690                dlg.finished(false);
18691                return Err(common::Error::FieldClash(field));
18692            }
18693        }
18694
18695        let mut params = Params::with_capacity(4 + self._additional_params.len());
18696        params.push("name", self._name);
18697        if let Some(value) = self._view.as_ref() {
18698            params.push("view", value);
18699        }
18700
18701        params.extend(self._additional_params.iter());
18702
18703        params.push("alt", "json");
18704        let mut url = self.hub._base_url.clone() + "v1/{+name}";
18705        if self._scopes.is_empty() {
18706            self._scopes
18707                .insert(Scope::CloudPlatform.as_ref().to_string());
18708        }
18709
18710        #[allow(clippy::single_element_loop)]
18711        for &(find_this, param_name) in [("{+name}", "name")].iter() {
18712            url = params.uri_replacement(url, param_name, find_this, true);
18713        }
18714        {
18715            let to_remove = ["name"];
18716            params.remove_params(&to_remove);
18717        }
18718
18719        let url = params.parse_with_url(&url);
18720
18721        loop {
18722            let token = match self
18723                .hub
18724                .auth
18725                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18726                .await
18727            {
18728                Ok(token) => token,
18729                Err(e) => match dlg.token(e) {
18730                    Ok(token) => token,
18731                    Err(e) => {
18732                        dlg.finished(false);
18733                        return Err(common::Error::MissingToken(e));
18734                    }
18735                },
18736            };
18737            let mut req_result = {
18738                let client = &self.hub.client;
18739                dlg.pre_request();
18740                let mut req_builder = hyper::Request::builder()
18741                    .method(hyper::Method::GET)
18742                    .uri(url.as_str())
18743                    .header(USER_AGENT, self.hub._user_agent.clone());
18744
18745                if let Some(token) = token.as_ref() {
18746                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18747                }
18748
18749                let request = req_builder
18750                    .header(CONTENT_LENGTH, 0_u64)
18751                    .body(common::to_body::<String>(None));
18752
18753                client.request(request.unwrap()).await
18754            };
18755
18756            match req_result {
18757                Err(err) => {
18758                    if let common::Retry::After(d) = dlg.http_error(&err) {
18759                        sleep(d).await;
18760                        continue;
18761                    }
18762                    dlg.finished(false);
18763                    return Err(common::Error::HttpError(err));
18764                }
18765                Ok(res) => {
18766                    let (mut parts, body) = res.into_parts();
18767                    let mut body = common::Body::new(body);
18768                    if !parts.status.is_success() {
18769                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18770                        let error = serde_json::from_str(&common::to_string(&bytes));
18771                        let response = common::to_response(parts, bytes.into());
18772
18773                        if let common::Retry::After(d) =
18774                            dlg.http_failure(&response, error.as_ref().ok())
18775                        {
18776                            sleep(d).await;
18777                            continue;
18778                        }
18779
18780                        dlg.finished(false);
18781
18782                        return Err(match error {
18783                            Ok(value) => common::Error::BadRequest(value),
18784                            _ => common::Error::Failure(response),
18785                        });
18786                    }
18787                    let response = {
18788                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18789                        let encoded = common::to_string(&bytes);
18790                        match serde_json::from_str(&encoded) {
18791                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18792                            Err(error) => {
18793                                dlg.response_json_decode_error(&encoded, &error);
18794                                return Err(common::Error::JsonDecodeError(
18795                                    encoded.to_string(),
18796                                    error,
18797                                ));
18798                            }
18799                        }
18800                    };
18801
18802                    dlg.finished(true);
18803                    return Ok(response);
18804                }
18805            }
18806        }
18807    }
18808
18809    /// Required. Resource name of the form: `projects/*/locations/*/endpointAttachments/*`
18810    ///
18811    /// Sets the *name* path property to the given value.
18812    ///
18813    /// Even though the property as already been set when instantiating this call,
18814    /// we provide this method for API completeness.
18815    pub fn name(mut self, new_value: &str) -> ProjectLocationEndpointAttachmentGetCall<'a, C> {
18816        self._name = new_value.to_string();
18817        self
18818    }
18819    /// Optional. Specifies which fields of the EndpointAttachment are returned in the response. Defaults to `ENDPOINT_ATTACHMENT_VIEW_BASIC` view.
18820    ///
18821    /// Sets the *view* query property to the given value.
18822    pub fn view(mut self, new_value: &str) -> ProjectLocationEndpointAttachmentGetCall<'a, C> {
18823        self._view = Some(new_value.to_string());
18824        self
18825    }
18826    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18827    /// while executing the actual API request.
18828    ///
18829    /// ````text
18830    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18831    /// ````
18832    ///
18833    /// Sets the *delegate* property to the given value.
18834    pub fn delegate(
18835        mut self,
18836        new_value: &'a mut dyn common::Delegate,
18837    ) -> ProjectLocationEndpointAttachmentGetCall<'a, C> {
18838        self._delegate = Some(new_value);
18839        self
18840    }
18841
18842    /// Set any additional parameter of the query string used in the request.
18843    /// It should be used to set parameters which are not yet available through their own
18844    /// setters.
18845    ///
18846    /// Please note that this method must not be used to set any of the known parameters
18847    /// which have their own setter method. If done anyway, the request will fail.
18848    ///
18849    /// # Additional Parameters
18850    ///
18851    /// * *$.xgafv* (query-string) - V1 error format.
18852    /// * *access_token* (query-string) - OAuth access token.
18853    /// * *alt* (query-string) - Data format for response.
18854    /// * *callback* (query-string) - JSONP
18855    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18856    /// * *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.
18857    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18858    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18859    /// * *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.
18860    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18861    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18862    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEndpointAttachmentGetCall<'a, C>
18863    where
18864        T: AsRef<str>,
18865    {
18866        self._additional_params
18867            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18868        self
18869    }
18870
18871    /// Identifies the authorization scope for the method you are building.
18872    ///
18873    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18874    /// [`Scope::CloudPlatform`].
18875    ///
18876    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18877    /// tokens for more than one scope.
18878    ///
18879    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18880    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18881    /// sufficient, a read-write scope will do as well.
18882    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEndpointAttachmentGetCall<'a, C>
18883    where
18884        St: AsRef<str>,
18885    {
18886        self._scopes.insert(String::from(scope.as_ref()));
18887        self
18888    }
18889    /// Identifies the authorization scope(s) for the method you are building.
18890    ///
18891    /// See [`Self::add_scope()`] for details.
18892    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEndpointAttachmentGetCall<'a, C>
18893    where
18894        I: IntoIterator<Item = St>,
18895        St: AsRef<str>,
18896    {
18897        self._scopes
18898            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18899        self
18900    }
18901
18902    /// Removes all scopes, and no default scope will be used either.
18903    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18904    /// for details).
18905    pub fn clear_scopes(mut self) -> ProjectLocationEndpointAttachmentGetCall<'a, C> {
18906        self._scopes.clear();
18907        self
18908    }
18909}
18910
18911/// List EndpointAttachments in a given project
18912///
18913/// A builder for the *locations.endpointAttachments.list* method supported by a *project* resource.
18914/// It is not used directly, but through a [`ProjectMethods`] instance.
18915///
18916/// # Example
18917///
18918/// Instantiate a resource method builder
18919///
18920/// ```test_harness,no_run
18921/// # extern crate hyper;
18922/// # extern crate hyper_rustls;
18923/// # extern crate google_connectors1 as connectors1;
18924/// # async fn dox() {
18925/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18926///
18927/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18928/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18929/// #     .with_native_roots()
18930/// #     .unwrap()
18931/// #     .https_only()
18932/// #     .enable_http2()
18933/// #     .build();
18934///
18935/// # let executor = hyper_util::rt::TokioExecutor::new();
18936/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18937/// #     secret,
18938/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18939/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
18940/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
18941/// #     ),
18942/// # ).build().await.unwrap();
18943///
18944/// # let client = hyper_util::client::legacy::Client::builder(
18945/// #     hyper_util::rt::TokioExecutor::new()
18946/// # )
18947/// # .build(
18948/// #     hyper_rustls::HttpsConnectorBuilder::new()
18949/// #         .with_native_roots()
18950/// #         .unwrap()
18951/// #         .https_or_http()
18952/// #         .enable_http2()
18953/// #         .build()
18954/// # );
18955/// # let mut hub = Connectors::new(client, auth);
18956/// // You can configure optional parameters by calling the respective setters at will, and
18957/// // execute the final call using `doit()`.
18958/// // Values shown here are possibly random and not representative !
18959/// let result = hub.projects().locations_endpoint_attachments_list("parent")
18960///              .view("accusam")
18961///              .page_token("voluptua.")
18962///              .page_size(-34)
18963///              .order_by("dolore")
18964///              .filter("dolore")
18965///              .doit().await;
18966/// # }
18967/// ```
18968pub struct ProjectLocationEndpointAttachmentListCall<'a, C>
18969where
18970    C: 'a,
18971{
18972    hub: &'a Connectors<C>,
18973    _parent: String,
18974    _view: Option<String>,
18975    _page_token: Option<String>,
18976    _page_size: Option<i32>,
18977    _order_by: Option<String>,
18978    _filter: Option<String>,
18979    _delegate: Option<&'a mut dyn common::Delegate>,
18980    _additional_params: HashMap<String, String>,
18981    _scopes: BTreeSet<String>,
18982}
18983
18984impl<'a, C> common::CallBuilder for ProjectLocationEndpointAttachmentListCall<'a, C> {}
18985
18986impl<'a, C> ProjectLocationEndpointAttachmentListCall<'a, C>
18987where
18988    C: common::Connector,
18989{
18990    /// Perform the operation you have build so far.
18991    pub async fn doit(
18992        mut self,
18993    ) -> common::Result<(common::Response, ListEndpointAttachmentsResponse)> {
18994        use std::borrow::Cow;
18995        use std::io::{Read, Seek};
18996
18997        use common::{url::Params, ToParts};
18998        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18999
19000        let mut dd = common::DefaultDelegate;
19001        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19002        dlg.begin(common::MethodInfo {
19003            id: "connectors.projects.locations.endpointAttachments.list",
19004            http_method: hyper::Method::GET,
19005        });
19006
19007        for &field in [
19008            "alt",
19009            "parent",
19010            "view",
19011            "pageToken",
19012            "pageSize",
19013            "orderBy",
19014            "filter",
19015        ]
19016        .iter()
19017        {
19018            if self._additional_params.contains_key(field) {
19019                dlg.finished(false);
19020                return Err(common::Error::FieldClash(field));
19021            }
19022        }
19023
19024        let mut params = Params::with_capacity(8 + self._additional_params.len());
19025        params.push("parent", self._parent);
19026        if let Some(value) = self._view.as_ref() {
19027            params.push("view", value);
19028        }
19029        if let Some(value) = self._page_token.as_ref() {
19030            params.push("pageToken", value);
19031        }
19032        if let Some(value) = self._page_size.as_ref() {
19033            params.push("pageSize", value.to_string());
19034        }
19035        if let Some(value) = self._order_by.as_ref() {
19036            params.push("orderBy", value);
19037        }
19038        if let Some(value) = self._filter.as_ref() {
19039            params.push("filter", value);
19040        }
19041
19042        params.extend(self._additional_params.iter());
19043
19044        params.push("alt", "json");
19045        let mut url = self.hub._base_url.clone() + "v1/{+parent}/endpointAttachments";
19046        if self._scopes.is_empty() {
19047            self._scopes
19048                .insert(Scope::CloudPlatform.as_ref().to_string());
19049        }
19050
19051        #[allow(clippy::single_element_loop)]
19052        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
19053            url = params.uri_replacement(url, param_name, find_this, true);
19054        }
19055        {
19056            let to_remove = ["parent"];
19057            params.remove_params(&to_remove);
19058        }
19059
19060        let url = params.parse_with_url(&url);
19061
19062        loop {
19063            let token = match self
19064                .hub
19065                .auth
19066                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19067                .await
19068            {
19069                Ok(token) => token,
19070                Err(e) => match dlg.token(e) {
19071                    Ok(token) => token,
19072                    Err(e) => {
19073                        dlg.finished(false);
19074                        return Err(common::Error::MissingToken(e));
19075                    }
19076                },
19077            };
19078            let mut req_result = {
19079                let client = &self.hub.client;
19080                dlg.pre_request();
19081                let mut req_builder = hyper::Request::builder()
19082                    .method(hyper::Method::GET)
19083                    .uri(url.as_str())
19084                    .header(USER_AGENT, self.hub._user_agent.clone());
19085
19086                if let Some(token) = token.as_ref() {
19087                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19088                }
19089
19090                let request = req_builder
19091                    .header(CONTENT_LENGTH, 0_u64)
19092                    .body(common::to_body::<String>(None));
19093
19094                client.request(request.unwrap()).await
19095            };
19096
19097            match req_result {
19098                Err(err) => {
19099                    if let common::Retry::After(d) = dlg.http_error(&err) {
19100                        sleep(d).await;
19101                        continue;
19102                    }
19103                    dlg.finished(false);
19104                    return Err(common::Error::HttpError(err));
19105                }
19106                Ok(res) => {
19107                    let (mut parts, body) = res.into_parts();
19108                    let mut body = common::Body::new(body);
19109                    if !parts.status.is_success() {
19110                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19111                        let error = serde_json::from_str(&common::to_string(&bytes));
19112                        let response = common::to_response(parts, bytes.into());
19113
19114                        if let common::Retry::After(d) =
19115                            dlg.http_failure(&response, error.as_ref().ok())
19116                        {
19117                            sleep(d).await;
19118                            continue;
19119                        }
19120
19121                        dlg.finished(false);
19122
19123                        return Err(match error {
19124                            Ok(value) => common::Error::BadRequest(value),
19125                            _ => common::Error::Failure(response),
19126                        });
19127                    }
19128                    let response = {
19129                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19130                        let encoded = common::to_string(&bytes);
19131                        match serde_json::from_str(&encoded) {
19132                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19133                            Err(error) => {
19134                                dlg.response_json_decode_error(&encoded, &error);
19135                                return Err(common::Error::JsonDecodeError(
19136                                    encoded.to_string(),
19137                                    error,
19138                                ));
19139                            }
19140                        }
19141                    };
19142
19143                    dlg.finished(true);
19144                    return Ok(response);
19145                }
19146            }
19147        }
19148    }
19149
19150    /// Required. Parent resource od the EndpointAttachment, of the form: `projects/*/locations/*`
19151    ///
19152    /// Sets the *parent* path property to the given value.
19153    ///
19154    /// Even though the property as already been set when instantiating this call,
19155    /// we provide this method for API completeness.
19156    pub fn parent(mut self, new_value: &str) -> ProjectLocationEndpointAttachmentListCall<'a, C> {
19157        self._parent = new_value.to_string();
19158        self
19159    }
19160    /// Optional. Specifies which fields of the EndpointAttachment are returned in the response. Defaults to `ENDPOINT_ATTACHMENT_VIEW_BASIC` view.
19161    ///
19162    /// Sets the *view* query property to the given value.
19163    pub fn view(mut self, new_value: &str) -> ProjectLocationEndpointAttachmentListCall<'a, C> {
19164        self._view = Some(new_value.to_string());
19165        self
19166    }
19167    /// Page token.
19168    ///
19169    /// Sets the *page token* query property to the given value.
19170    pub fn page_token(
19171        mut self,
19172        new_value: &str,
19173    ) -> ProjectLocationEndpointAttachmentListCall<'a, C> {
19174        self._page_token = Some(new_value.to_string());
19175        self
19176    }
19177    /// Page size.
19178    ///
19179    /// Sets the *page size* query property to the given value.
19180    pub fn page_size(mut self, new_value: i32) -> ProjectLocationEndpointAttachmentListCall<'a, C> {
19181        self._page_size = Some(new_value);
19182        self
19183    }
19184    /// Order by parameters.
19185    ///
19186    /// Sets the *order by* query property to the given value.
19187    pub fn order_by(mut self, new_value: &str) -> ProjectLocationEndpointAttachmentListCall<'a, C> {
19188        self._order_by = Some(new_value.to_string());
19189        self
19190    }
19191    /// Filter.
19192    ///
19193    /// Sets the *filter* query property to the given value.
19194    pub fn filter(mut self, new_value: &str) -> ProjectLocationEndpointAttachmentListCall<'a, C> {
19195        self._filter = Some(new_value.to_string());
19196        self
19197    }
19198    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19199    /// while executing the actual API request.
19200    ///
19201    /// ````text
19202    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19203    /// ````
19204    ///
19205    /// Sets the *delegate* property to the given value.
19206    pub fn delegate(
19207        mut self,
19208        new_value: &'a mut dyn common::Delegate,
19209    ) -> ProjectLocationEndpointAttachmentListCall<'a, C> {
19210        self._delegate = Some(new_value);
19211        self
19212    }
19213
19214    /// Set any additional parameter of the query string used in the request.
19215    /// It should be used to set parameters which are not yet available through their own
19216    /// setters.
19217    ///
19218    /// Please note that this method must not be used to set any of the known parameters
19219    /// which have their own setter method. If done anyway, the request will fail.
19220    ///
19221    /// # Additional Parameters
19222    ///
19223    /// * *$.xgafv* (query-string) - V1 error format.
19224    /// * *access_token* (query-string) - OAuth access token.
19225    /// * *alt* (query-string) - Data format for response.
19226    /// * *callback* (query-string) - JSONP
19227    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19228    /// * *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.
19229    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19230    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19231    /// * *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.
19232    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19233    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19234    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEndpointAttachmentListCall<'a, C>
19235    where
19236        T: AsRef<str>,
19237    {
19238        self._additional_params
19239            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19240        self
19241    }
19242
19243    /// Identifies the authorization scope for the method you are building.
19244    ///
19245    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19246    /// [`Scope::CloudPlatform`].
19247    ///
19248    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19249    /// tokens for more than one scope.
19250    ///
19251    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19252    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19253    /// sufficient, a read-write scope will do as well.
19254    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEndpointAttachmentListCall<'a, C>
19255    where
19256        St: AsRef<str>,
19257    {
19258        self._scopes.insert(String::from(scope.as_ref()));
19259        self
19260    }
19261    /// Identifies the authorization scope(s) for the method you are building.
19262    ///
19263    /// See [`Self::add_scope()`] for details.
19264    pub fn add_scopes<I, St>(
19265        mut self,
19266        scopes: I,
19267    ) -> ProjectLocationEndpointAttachmentListCall<'a, C>
19268    where
19269        I: IntoIterator<Item = St>,
19270        St: AsRef<str>,
19271    {
19272        self._scopes
19273            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19274        self
19275    }
19276
19277    /// Removes all scopes, and no default scope will be used either.
19278    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19279    /// for details).
19280    pub fn clear_scopes(mut self) -> ProjectLocationEndpointAttachmentListCall<'a, C> {
19281        self._scopes.clear();
19282        self
19283    }
19284}
19285
19286/// Updates the parameters of a single EndpointAttachment.
19287///
19288/// A builder for the *locations.endpointAttachments.patch* method supported by a *project* resource.
19289/// It is not used directly, but through a [`ProjectMethods`] instance.
19290///
19291/// # Example
19292///
19293/// Instantiate a resource method builder
19294///
19295/// ```test_harness,no_run
19296/// # extern crate hyper;
19297/// # extern crate hyper_rustls;
19298/// # extern crate google_connectors1 as connectors1;
19299/// use connectors1::api::EndpointAttachment;
19300/// # async fn dox() {
19301/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19302///
19303/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19304/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19305/// #     .with_native_roots()
19306/// #     .unwrap()
19307/// #     .https_only()
19308/// #     .enable_http2()
19309/// #     .build();
19310///
19311/// # let executor = hyper_util::rt::TokioExecutor::new();
19312/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19313/// #     secret,
19314/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19315/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
19316/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
19317/// #     ),
19318/// # ).build().await.unwrap();
19319///
19320/// # let client = hyper_util::client::legacy::Client::builder(
19321/// #     hyper_util::rt::TokioExecutor::new()
19322/// # )
19323/// # .build(
19324/// #     hyper_rustls::HttpsConnectorBuilder::new()
19325/// #         .with_native_roots()
19326/// #         .unwrap()
19327/// #         .https_or_http()
19328/// #         .enable_http2()
19329/// #         .build()
19330/// # );
19331/// # let mut hub = Connectors::new(client, auth);
19332/// // As the method needs a request, you would usually fill it with the desired information
19333/// // into the respective structure. Some of the parts shown here might not be applicable !
19334/// // Values shown here are possibly random and not representative !
19335/// let mut req = EndpointAttachment::default();
19336///
19337/// // You can configure optional parameters by calling the respective setters at will, and
19338/// // execute the final call using `doit()`.
19339/// // Values shown here are possibly random and not representative !
19340/// let result = hub.projects().locations_endpoint_attachments_patch(req, "name")
19341///              .update_mask(FieldMask::new::<&str>(&[]))
19342///              .doit().await;
19343/// # }
19344/// ```
19345pub struct ProjectLocationEndpointAttachmentPatchCall<'a, C>
19346where
19347    C: 'a,
19348{
19349    hub: &'a Connectors<C>,
19350    _request: EndpointAttachment,
19351    _name: String,
19352    _update_mask: Option<common::FieldMask>,
19353    _delegate: Option<&'a mut dyn common::Delegate>,
19354    _additional_params: HashMap<String, String>,
19355    _scopes: BTreeSet<String>,
19356}
19357
19358impl<'a, C> common::CallBuilder for ProjectLocationEndpointAttachmentPatchCall<'a, C> {}
19359
19360impl<'a, C> ProjectLocationEndpointAttachmentPatchCall<'a, C>
19361where
19362    C: common::Connector,
19363{
19364    /// Perform the operation you have build so far.
19365    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
19366        use std::borrow::Cow;
19367        use std::io::{Read, Seek};
19368
19369        use common::{url::Params, ToParts};
19370        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19371
19372        let mut dd = common::DefaultDelegate;
19373        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19374        dlg.begin(common::MethodInfo {
19375            id: "connectors.projects.locations.endpointAttachments.patch",
19376            http_method: hyper::Method::PATCH,
19377        });
19378
19379        for &field in ["alt", "name", "updateMask"].iter() {
19380            if self._additional_params.contains_key(field) {
19381                dlg.finished(false);
19382                return Err(common::Error::FieldClash(field));
19383            }
19384        }
19385
19386        let mut params = Params::with_capacity(5 + self._additional_params.len());
19387        params.push("name", self._name);
19388        if let Some(value) = self._update_mask.as_ref() {
19389            params.push("updateMask", value.to_string());
19390        }
19391
19392        params.extend(self._additional_params.iter());
19393
19394        params.push("alt", "json");
19395        let mut url = self.hub._base_url.clone() + "v1/{+name}";
19396        if self._scopes.is_empty() {
19397            self._scopes
19398                .insert(Scope::CloudPlatform.as_ref().to_string());
19399        }
19400
19401        #[allow(clippy::single_element_loop)]
19402        for &(find_this, param_name) in [("{+name}", "name")].iter() {
19403            url = params.uri_replacement(url, param_name, find_this, true);
19404        }
19405        {
19406            let to_remove = ["name"];
19407            params.remove_params(&to_remove);
19408        }
19409
19410        let url = params.parse_with_url(&url);
19411
19412        let mut json_mime_type = mime::APPLICATION_JSON;
19413        let mut request_value_reader = {
19414            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19415            common::remove_json_null_values(&mut value);
19416            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19417            serde_json::to_writer(&mut dst, &value).unwrap();
19418            dst
19419        };
19420        let request_size = request_value_reader
19421            .seek(std::io::SeekFrom::End(0))
19422            .unwrap();
19423        request_value_reader
19424            .seek(std::io::SeekFrom::Start(0))
19425            .unwrap();
19426
19427        loop {
19428            let token = match self
19429                .hub
19430                .auth
19431                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19432                .await
19433            {
19434                Ok(token) => token,
19435                Err(e) => match dlg.token(e) {
19436                    Ok(token) => token,
19437                    Err(e) => {
19438                        dlg.finished(false);
19439                        return Err(common::Error::MissingToken(e));
19440                    }
19441                },
19442            };
19443            request_value_reader
19444                .seek(std::io::SeekFrom::Start(0))
19445                .unwrap();
19446            let mut req_result = {
19447                let client = &self.hub.client;
19448                dlg.pre_request();
19449                let mut req_builder = hyper::Request::builder()
19450                    .method(hyper::Method::PATCH)
19451                    .uri(url.as_str())
19452                    .header(USER_AGENT, self.hub._user_agent.clone());
19453
19454                if let Some(token) = token.as_ref() {
19455                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19456                }
19457
19458                let request = req_builder
19459                    .header(CONTENT_TYPE, json_mime_type.to_string())
19460                    .header(CONTENT_LENGTH, request_size as u64)
19461                    .body(common::to_body(
19462                        request_value_reader.get_ref().clone().into(),
19463                    ));
19464
19465                client.request(request.unwrap()).await
19466            };
19467
19468            match req_result {
19469                Err(err) => {
19470                    if let common::Retry::After(d) = dlg.http_error(&err) {
19471                        sleep(d).await;
19472                        continue;
19473                    }
19474                    dlg.finished(false);
19475                    return Err(common::Error::HttpError(err));
19476                }
19477                Ok(res) => {
19478                    let (mut parts, body) = res.into_parts();
19479                    let mut body = common::Body::new(body);
19480                    if !parts.status.is_success() {
19481                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19482                        let error = serde_json::from_str(&common::to_string(&bytes));
19483                        let response = common::to_response(parts, bytes.into());
19484
19485                        if let common::Retry::After(d) =
19486                            dlg.http_failure(&response, error.as_ref().ok())
19487                        {
19488                            sleep(d).await;
19489                            continue;
19490                        }
19491
19492                        dlg.finished(false);
19493
19494                        return Err(match error {
19495                            Ok(value) => common::Error::BadRequest(value),
19496                            _ => common::Error::Failure(response),
19497                        });
19498                    }
19499                    let response = {
19500                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19501                        let encoded = common::to_string(&bytes);
19502                        match serde_json::from_str(&encoded) {
19503                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19504                            Err(error) => {
19505                                dlg.response_json_decode_error(&encoded, &error);
19506                                return Err(common::Error::JsonDecodeError(
19507                                    encoded.to_string(),
19508                                    error,
19509                                ));
19510                            }
19511                        }
19512                    };
19513
19514                    dlg.finished(true);
19515                    return Ok(response);
19516                }
19517            }
19518        }
19519    }
19520
19521    ///
19522    /// Sets the *request* property to the given value.
19523    ///
19524    /// Even though the property as already been set when instantiating this call,
19525    /// we provide this method for API completeness.
19526    pub fn request(
19527        mut self,
19528        new_value: EndpointAttachment,
19529    ) -> ProjectLocationEndpointAttachmentPatchCall<'a, C> {
19530        self._request = new_value;
19531        self
19532    }
19533    /// Output only. Resource name of the Endpoint Attachment. Format: projects/{project}/locations/{location}/endpointAttachments/{endpoint_attachment}
19534    ///
19535    /// Sets the *name* path property to the given value.
19536    ///
19537    /// Even though the property as already been set when instantiating this call,
19538    /// we provide this method for API completeness.
19539    pub fn name(mut self, new_value: &str) -> ProjectLocationEndpointAttachmentPatchCall<'a, C> {
19540        self._name = new_value.to_string();
19541        self
19542    }
19543    /// Required. The list of fields to update. Fields are specified relative to the endpointAttachment. A field will be overwritten if it is in the mask. You can modify only the fields listed below. To update the endpointAttachment details: * `description` * `labels`
19544    ///
19545    /// Sets the *update mask* query property to the given value.
19546    pub fn update_mask(
19547        mut self,
19548        new_value: common::FieldMask,
19549    ) -> ProjectLocationEndpointAttachmentPatchCall<'a, C> {
19550        self._update_mask = Some(new_value);
19551        self
19552    }
19553    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19554    /// while executing the actual API request.
19555    ///
19556    /// ````text
19557    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19558    /// ````
19559    ///
19560    /// Sets the *delegate* property to the given value.
19561    pub fn delegate(
19562        mut self,
19563        new_value: &'a mut dyn common::Delegate,
19564    ) -> ProjectLocationEndpointAttachmentPatchCall<'a, C> {
19565        self._delegate = Some(new_value);
19566        self
19567    }
19568
19569    /// Set any additional parameter of the query string used in the request.
19570    /// It should be used to set parameters which are not yet available through their own
19571    /// setters.
19572    ///
19573    /// Please note that this method must not be used to set any of the known parameters
19574    /// which have their own setter method. If done anyway, the request will fail.
19575    ///
19576    /// # Additional Parameters
19577    ///
19578    /// * *$.xgafv* (query-string) - V1 error format.
19579    /// * *access_token* (query-string) - OAuth access token.
19580    /// * *alt* (query-string) - Data format for response.
19581    /// * *callback* (query-string) - JSONP
19582    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19583    /// * *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.
19584    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19585    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19586    /// * *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.
19587    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19588    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19589    pub fn param<T>(
19590        mut self,
19591        name: T,
19592        value: T,
19593    ) -> ProjectLocationEndpointAttachmentPatchCall<'a, C>
19594    where
19595        T: AsRef<str>,
19596    {
19597        self._additional_params
19598            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19599        self
19600    }
19601
19602    /// Identifies the authorization scope for the method you are building.
19603    ///
19604    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19605    /// [`Scope::CloudPlatform`].
19606    ///
19607    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19608    /// tokens for more than one scope.
19609    ///
19610    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19611    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19612    /// sufficient, a read-write scope will do as well.
19613    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEndpointAttachmentPatchCall<'a, C>
19614    where
19615        St: AsRef<str>,
19616    {
19617        self._scopes.insert(String::from(scope.as_ref()));
19618        self
19619    }
19620    /// Identifies the authorization scope(s) for the method you are building.
19621    ///
19622    /// See [`Self::add_scope()`] for details.
19623    pub fn add_scopes<I, St>(
19624        mut self,
19625        scopes: I,
19626    ) -> ProjectLocationEndpointAttachmentPatchCall<'a, C>
19627    where
19628        I: IntoIterator<Item = St>,
19629        St: AsRef<str>,
19630    {
19631        self._scopes
19632            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19633        self
19634    }
19635
19636    /// Removes all scopes, and no default scope will be used either.
19637    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19638    /// for details).
19639    pub fn clear_scopes(mut self) -> ProjectLocationEndpointAttachmentPatchCall<'a, C> {
19640        self._scopes.clear();
19641        self
19642    }
19643}
19644
19645/// Creates a new CustomConnectorVersion in a given project and location.
19646///
19647/// A builder for the *locations.global.customConnectors.customConnectorVersions.create* method supported by a *project* resource.
19648/// It is not used directly, but through a [`ProjectMethods`] instance.
19649///
19650/// # Example
19651///
19652/// Instantiate a resource method builder
19653///
19654/// ```test_harness,no_run
19655/// # extern crate hyper;
19656/// # extern crate hyper_rustls;
19657/// # extern crate google_connectors1 as connectors1;
19658/// use connectors1::api::CustomConnectorVersion;
19659/// # async fn dox() {
19660/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19661///
19662/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19663/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19664/// #     .with_native_roots()
19665/// #     .unwrap()
19666/// #     .https_only()
19667/// #     .enable_http2()
19668/// #     .build();
19669///
19670/// # let executor = hyper_util::rt::TokioExecutor::new();
19671/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19672/// #     secret,
19673/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19674/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
19675/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
19676/// #     ),
19677/// # ).build().await.unwrap();
19678///
19679/// # let client = hyper_util::client::legacy::Client::builder(
19680/// #     hyper_util::rt::TokioExecutor::new()
19681/// # )
19682/// # .build(
19683/// #     hyper_rustls::HttpsConnectorBuilder::new()
19684/// #         .with_native_roots()
19685/// #         .unwrap()
19686/// #         .https_or_http()
19687/// #         .enable_http2()
19688/// #         .build()
19689/// # );
19690/// # let mut hub = Connectors::new(client, auth);
19691/// // As the method needs a request, you would usually fill it with the desired information
19692/// // into the respective structure. Some of the parts shown here might not be applicable !
19693/// // Values shown here are possibly random and not representative !
19694/// let mut req = CustomConnectorVersion::default();
19695///
19696/// // You can configure optional parameters by calling the respective setters at will, and
19697/// // execute the final call using `doit()`.
19698/// // Values shown here are possibly random and not representative !
19699/// let result = hub.projects().locations_global_custom_connectors_custom_connector_versions_create(req, "parent")
19700///              .custom_connector_version_id("ea")
19701///              .doit().await;
19702/// # }
19703/// ```
19704pub struct ProjectLocationGlobalCustomConnectorCustomConnectorVersionCreateCall<'a, C>
19705where
19706    C: 'a,
19707{
19708    hub: &'a Connectors<C>,
19709    _request: CustomConnectorVersion,
19710    _parent: String,
19711    _custom_connector_version_id: Option<String>,
19712    _delegate: Option<&'a mut dyn common::Delegate>,
19713    _additional_params: HashMap<String, String>,
19714    _scopes: BTreeSet<String>,
19715}
19716
19717impl<'a, C> common::CallBuilder
19718    for ProjectLocationGlobalCustomConnectorCustomConnectorVersionCreateCall<'a, C>
19719{
19720}
19721
19722impl<'a, C> ProjectLocationGlobalCustomConnectorCustomConnectorVersionCreateCall<'a, C>
19723where
19724    C: common::Connector,
19725{
19726    /// Perform the operation you have build so far.
19727    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
19728        use std::borrow::Cow;
19729        use std::io::{Read, Seek};
19730
19731        use common::{url::Params, ToParts};
19732        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19733
19734        let mut dd = common::DefaultDelegate;
19735        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19736        dlg.begin(common::MethodInfo { id: "connectors.projects.locations.global.customConnectors.customConnectorVersions.create",
19737                               http_method: hyper::Method::POST });
19738
19739        for &field in ["alt", "parent", "customConnectorVersionId"].iter() {
19740            if self._additional_params.contains_key(field) {
19741                dlg.finished(false);
19742                return Err(common::Error::FieldClash(field));
19743            }
19744        }
19745
19746        let mut params = Params::with_capacity(5 + self._additional_params.len());
19747        params.push("parent", self._parent);
19748        if let Some(value) = self._custom_connector_version_id.as_ref() {
19749            params.push("customConnectorVersionId", value);
19750        }
19751
19752        params.extend(self._additional_params.iter());
19753
19754        params.push("alt", "json");
19755        let mut url = self.hub._base_url.clone() + "v1/{+parent}/customConnectorVersions";
19756        if self._scopes.is_empty() {
19757            self._scopes
19758                .insert(Scope::CloudPlatform.as_ref().to_string());
19759        }
19760
19761        #[allow(clippy::single_element_loop)]
19762        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
19763            url = params.uri_replacement(url, param_name, find_this, true);
19764        }
19765        {
19766            let to_remove = ["parent"];
19767            params.remove_params(&to_remove);
19768        }
19769
19770        let url = params.parse_with_url(&url);
19771
19772        let mut json_mime_type = mime::APPLICATION_JSON;
19773        let mut request_value_reader = {
19774            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19775            common::remove_json_null_values(&mut value);
19776            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19777            serde_json::to_writer(&mut dst, &value).unwrap();
19778            dst
19779        };
19780        let request_size = request_value_reader
19781            .seek(std::io::SeekFrom::End(0))
19782            .unwrap();
19783        request_value_reader
19784            .seek(std::io::SeekFrom::Start(0))
19785            .unwrap();
19786
19787        loop {
19788            let token = match self
19789                .hub
19790                .auth
19791                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19792                .await
19793            {
19794                Ok(token) => token,
19795                Err(e) => match dlg.token(e) {
19796                    Ok(token) => token,
19797                    Err(e) => {
19798                        dlg.finished(false);
19799                        return Err(common::Error::MissingToken(e));
19800                    }
19801                },
19802            };
19803            request_value_reader
19804                .seek(std::io::SeekFrom::Start(0))
19805                .unwrap();
19806            let mut req_result = {
19807                let client = &self.hub.client;
19808                dlg.pre_request();
19809                let mut req_builder = hyper::Request::builder()
19810                    .method(hyper::Method::POST)
19811                    .uri(url.as_str())
19812                    .header(USER_AGENT, self.hub._user_agent.clone());
19813
19814                if let Some(token) = token.as_ref() {
19815                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19816                }
19817
19818                let request = req_builder
19819                    .header(CONTENT_TYPE, json_mime_type.to_string())
19820                    .header(CONTENT_LENGTH, request_size as u64)
19821                    .body(common::to_body(
19822                        request_value_reader.get_ref().clone().into(),
19823                    ));
19824
19825                client.request(request.unwrap()).await
19826            };
19827
19828            match req_result {
19829                Err(err) => {
19830                    if let common::Retry::After(d) = dlg.http_error(&err) {
19831                        sleep(d).await;
19832                        continue;
19833                    }
19834                    dlg.finished(false);
19835                    return Err(common::Error::HttpError(err));
19836                }
19837                Ok(res) => {
19838                    let (mut parts, body) = res.into_parts();
19839                    let mut body = common::Body::new(body);
19840                    if !parts.status.is_success() {
19841                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19842                        let error = serde_json::from_str(&common::to_string(&bytes));
19843                        let response = common::to_response(parts, bytes.into());
19844
19845                        if let common::Retry::After(d) =
19846                            dlg.http_failure(&response, error.as_ref().ok())
19847                        {
19848                            sleep(d).await;
19849                            continue;
19850                        }
19851
19852                        dlg.finished(false);
19853
19854                        return Err(match error {
19855                            Ok(value) => common::Error::BadRequest(value),
19856                            _ => common::Error::Failure(response),
19857                        });
19858                    }
19859                    let response = {
19860                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19861                        let encoded = common::to_string(&bytes);
19862                        match serde_json::from_str(&encoded) {
19863                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19864                            Err(error) => {
19865                                dlg.response_json_decode_error(&encoded, &error);
19866                                return Err(common::Error::JsonDecodeError(
19867                                    encoded.to_string(),
19868                                    error,
19869                                ));
19870                            }
19871                        }
19872                    };
19873
19874                    dlg.finished(true);
19875                    return Ok(response);
19876                }
19877            }
19878        }
19879    }
19880
19881    ///
19882    /// Sets the *request* property to the given value.
19883    ///
19884    /// Even though the property as already been set when instantiating this call,
19885    /// we provide this method for API completeness.
19886    pub fn request(
19887        mut self,
19888        new_value: CustomConnectorVersion,
19889    ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionCreateCall<'a, C> {
19890        self._request = new_value;
19891        self
19892    }
19893    /// Required. Parent resource of the CreateCustomConnector, of the form: `projects/{project}/locations/{location}/customConnectors/{custom_connector}`
19894    ///
19895    /// Sets the *parent* path property to the given value.
19896    ///
19897    /// Even though the property as already been set when instantiating this call,
19898    /// we provide this method for API completeness.
19899    pub fn parent(
19900        mut self,
19901        new_value: &str,
19902    ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionCreateCall<'a, C> {
19903        self._parent = new_value.to_string();
19904        self
19905    }
19906    /// Required. Identifier to assign to the CreateCustomConnectorVersion. Must be unique within scope of the parent resource.
19907    ///
19908    /// Sets the *custom connector version id* query property to the given value.
19909    pub fn custom_connector_version_id(
19910        mut self,
19911        new_value: &str,
19912    ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionCreateCall<'a, C> {
19913        self._custom_connector_version_id = Some(new_value.to_string());
19914        self
19915    }
19916    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19917    /// while executing the actual API request.
19918    ///
19919    /// ````text
19920    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19921    /// ````
19922    ///
19923    /// Sets the *delegate* property to the given value.
19924    pub fn delegate(
19925        mut self,
19926        new_value: &'a mut dyn common::Delegate,
19927    ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionCreateCall<'a, C> {
19928        self._delegate = Some(new_value);
19929        self
19930    }
19931
19932    /// Set any additional parameter of the query string used in the request.
19933    /// It should be used to set parameters which are not yet available through their own
19934    /// setters.
19935    ///
19936    /// Please note that this method must not be used to set any of the known parameters
19937    /// which have their own setter method. If done anyway, the request will fail.
19938    ///
19939    /// # Additional Parameters
19940    ///
19941    /// * *$.xgafv* (query-string) - V1 error format.
19942    /// * *access_token* (query-string) - OAuth access token.
19943    /// * *alt* (query-string) - Data format for response.
19944    /// * *callback* (query-string) - JSONP
19945    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19946    /// * *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.
19947    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19948    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19949    /// * *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.
19950    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19951    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19952    pub fn param<T>(
19953        mut self,
19954        name: T,
19955        value: T,
19956    ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionCreateCall<'a, C>
19957    where
19958        T: AsRef<str>,
19959    {
19960        self._additional_params
19961            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19962        self
19963    }
19964
19965    /// Identifies the authorization scope for the method you are building.
19966    ///
19967    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19968    /// [`Scope::CloudPlatform`].
19969    ///
19970    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19971    /// tokens for more than one scope.
19972    ///
19973    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19974    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19975    /// sufficient, a read-write scope will do as well.
19976    pub fn add_scope<St>(
19977        mut self,
19978        scope: St,
19979    ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionCreateCall<'a, C>
19980    where
19981        St: AsRef<str>,
19982    {
19983        self._scopes.insert(String::from(scope.as_ref()));
19984        self
19985    }
19986    /// Identifies the authorization scope(s) for the method you are building.
19987    ///
19988    /// See [`Self::add_scope()`] for details.
19989    pub fn add_scopes<I, St>(
19990        mut self,
19991        scopes: I,
19992    ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionCreateCall<'a, C>
19993    where
19994        I: IntoIterator<Item = St>,
19995        St: AsRef<str>,
19996    {
19997        self._scopes
19998            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19999        self
20000    }
20001
20002    /// Removes all scopes, and no default scope will be used either.
20003    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20004    /// for details).
20005    pub fn clear_scopes(
20006        mut self,
20007    ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionCreateCall<'a, C> {
20008        self._scopes.clear();
20009        self
20010    }
20011}
20012
20013/// Gets details of a single CustomConnectorVersion.
20014///
20015/// A builder for the *locations.global.customConnectors.customConnectorVersions.get* method supported by a *project* resource.
20016/// It is not used directly, but through a [`ProjectMethods`] instance.
20017///
20018/// # Example
20019///
20020/// Instantiate a resource method builder
20021///
20022/// ```test_harness,no_run
20023/// # extern crate hyper;
20024/// # extern crate hyper_rustls;
20025/// # extern crate google_connectors1 as connectors1;
20026/// # async fn dox() {
20027/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20028///
20029/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20030/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20031/// #     .with_native_roots()
20032/// #     .unwrap()
20033/// #     .https_only()
20034/// #     .enable_http2()
20035/// #     .build();
20036///
20037/// # let executor = hyper_util::rt::TokioExecutor::new();
20038/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20039/// #     secret,
20040/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20041/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
20042/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
20043/// #     ),
20044/// # ).build().await.unwrap();
20045///
20046/// # let client = hyper_util::client::legacy::Client::builder(
20047/// #     hyper_util::rt::TokioExecutor::new()
20048/// # )
20049/// # .build(
20050/// #     hyper_rustls::HttpsConnectorBuilder::new()
20051/// #         .with_native_roots()
20052/// #         .unwrap()
20053/// #         .https_or_http()
20054/// #         .enable_http2()
20055/// #         .build()
20056/// # );
20057/// # let mut hub = Connectors::new(client, auth);
20058/// // You can configure optional parameters by calling the respective setters at will, and
20059/// // execute the final call using `doit()`.
20060/// // Values shown here are possibly random and not representative !
20061/// let result = hub.projects().locations_global_custom_connectors_custom_connector_versions_get("name")
20062///              .doit().await;
20063/// # }
20064/// ```
20065pub struct ProjectLocationGlobalCustomConnectorCustomConnectorVersionGetCall<'a, C>
20066where
20067    C: 'a,
20068{
20069    hub: &'a Connectors<C>,
20070    _name: String,
20071    _delegate: Option<&'a mut dyn common::Delegate>,
20072    _additional_params: HashMap<String, String>,
20073    _scopes: BTreeSet<String>,
20074}
20075
20076impl<'a, C> common::CallBuilder
20077    for ProjectLocationGlobalCustomConnectorCustomConnectorVersionGetCall<'a, C>
20078{
20079}
20080
20081impl<'a, C> ProjectLocationGlobalCustomConnectorCustomConnectorVersionGetCall<'a, C>
20082where
20083    C: common::Connector,
20084{
20085    /// Perform the operation you have build so far.
20086    pub async fn doit(mut self) -> common::Result<(common::Response, CustomConnectorVersion)> {
20087        use std::borrow::Cow;
20088        use std::io::{Read, Seek};
20089
20090        use common::{url::Params, ToParts};
20091        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20092
20093        let mut dd = common::DefaultDelegate;
20094        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20095        dlg.begin(common::MethodInfo {
20096            id: "connectors.projects.locations.global.customConnectors.customConnectorVersions.get",
20097            http_method: hyper::Method::GET,
20098        });
20099
20100        for &field in ["alt", "name"].iter() {
20101            if self._additional_params.contains_key(field) {
20102                dlg.finished(false);
20103                return Err(common::Error::FieldClash(field));
20104            }
20105        }
20106
20107        let mut params = Params::with_capacity(3 + self._additional_params.len());
20108        params.push("name", self._name);
20109
20110        params.extend(self._additional_params.iter());
20111
20112        params.push("alt", "json");
20113        let mut url = self.hub._base_url.clone() + "v1/{+name}";
20114        if self._scopes.is_empty() {
20115            self._scopes
20116                .insert(Scope::CloudPlatform.as_ref().to_string());
20117        }
20118
20119        #[allow(clippy::single_element_loop)]
20120        for &(find_this, param_name) in [("{+name}", "name")].iter() {
20121            url = params.uri_replacement(url, param_name, find_this, true);
20122        }
20123        {
20124            let to_remove = ["name"];
20125            params.remove_params(&to_remove);
20126        }
20127
20128        let url = params.parse_with_url(&url);
20129
20130        loop {
20131            let token = match self
20132                .hub
20133                .auth
20134                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20135                .await
20136            {
20137                Ok(token) => token,
20138                Err(e) => match dlg.token(e) {
20139                    Ok(token) => token,
20140                    Err(e) => {
20141                        dlg.finished(false);
20142                        return Err(common::Error::MissingToken(e));
20143                    }
20144                },
20145            };
20146            let mut req_result = {
20147                let client = &self.hub.client;
20148                dlg.pre_request();
20149                let mut req_builder = hyper::Request::builder()
20150                    .method(hyper::Method::GET)
20151                    .uri(url.as_str())
20152                    .header(USER_AGENT, self.hub._user_agent.clone());
20153
20154                if let Some(token) = token.as_ref() {
20155                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20156                }
20157
20158                let request = req_builder
20159                    .header(CONTENT_LENGTH, 0_u64)
20160                    .body(common::to_body::<String>(None));
20161
20162                client.request(request.unwrap()).await
20163            };
20164
20165            match req_result {
20166                Err(err) => {
20167                    if let common::Retry::After(d) = dlg.http_error(&err) {
20168                        sleep(d).await;
20169                        continue;
20170                    }
20171                    dlg.finished(false);
20172                    return Err(common::Error::HttpError(err));
20173                }
20174                Ok(res) => {
20175                    let (mut parts, body) = res.into_parts();
20176                    let mut body = common::Body::new(body);
20177                    if !parts.status.is_success() {
20178                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20179                        let error = serde_json::from_str(&common::to_string(&bytes));
20180                        let response = common::to_response(parts, bytes.into());
20181
20182                        if let common::Retry::After(d) =
20183                            dlg.http_failure(&response, error.as_ref().ok())
20184                        {
20185                            sleep(d).await;
20186                            continue;
20187                        }
20188
20189                        dlg.finished(false);
20190
20191                        return Err(match error {
20192                            Ok(value) => common::Error::BadRequest(value),
20193                            _ => common::Error::Failure(response),
20194                        });
20195                    }
20196                    let response = {
20197                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20198                        let encoded = common::to_string(&bytes);
20199                        match serde_json::from_str(&encoded) {
20200                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20201                            Err(error) => {
20202                                dlg.response_json_decode_error(&encoded, &error);
20203                                return Err(common::Error::JsonDecodeError(
20204                                    encoded.to_string(),
20205                                    error,
20206                                ));
20207                            }
20208                        }
20209                    };
20210
20211                    dlg.finished(true);
20212                    return Ok(response);
20213                }
20214            }
20215        }
20216    }
20217
20218    /// Required. Resource name of the form: `projects/*/locations/{location}/customConnectors/*/customConnectorVersions/*`
20219    ///
20220    /// Sets the *name* path property to the given value.
20221    ///
20222    /// Even though the property as already been set when instantiating this call,
20223    /// we provide this method for API completeness.
20224    pub fn name(
20225        mut self,
20226        new_value: &str,
20227    ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionGetCall<'a, C> {
20228        self._name = new_value.to_string();
20229        self
20230    }
20231    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20232    /// while executing the actual API request.
20233    ///
20234    /// ````text
20235    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20236    /// ````
20237    ///
20238    /// Sets the *delegate* property to the given value.
20239    pub fn delegate(
20240        mut self,
20241        new_value: &'a mut dyn common::Delegate,
20242    ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionGetCall<'a, C> {
20243        self._delegate = Some(new_value);
20244        self
20245    }
20246
20247    /// Set any additional parameter of the query string used in the request.
20248    /// It should be used to set parameters which are not yet available through their own
20249    /// setters.
20250    ///
20251    /// Please note that this method must not be used to set any of the known parameters
20252    /// which have their own setter method. If done anyway, the request will fail.
20253    ///
20254    /// # Additional Parameters
20255    ///
20256    /// * *$.xgafv* (query-string) - V1 error format.
20257    /// * *access_token* (query-string) - OAuth access token.
20258    /// * *alt* (query-string) - Data format for response.
20259    /// * *callback* (query-string) - JSONP
20260    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20261    /// * *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.
20262    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20263    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20264    /// * *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.
20265    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20266    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20267    pub fn param<T>(
20268        mut self,
20269        name: T,
20270        value: T,
20271    ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionGetCall<'a, C>
20272    where
20273        T: AsRef<str>,
20274    {
20275        self._additional_params
20276            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20277        self
20278    }
20279
20280    /// Identifies the authorization scope for the method you are building.
20281    ///
20282    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20283    /// [`Scope::CloudPlatform`].
20284    ///
20285    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20286    /// tokens for more than one scope.
20287    ///
20288    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20289    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20290    /// sufficient, a read-write scope will do as well.
20291    pub fn add_scope<St>(
20292        mut self,
20293        scope: St,
20294    ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionGetCall<'a, C>
20295    where
20296        St: AsRef<str>,
20297    {
20298        self._scopes.insert(String::from(scope.as_ref()));
20299        self
20300    }
20301    /// Identifies the authorization scope(s) for the method you are building.
20302    ///
20303    /// See [`Self::add_scope()`] for details.
20304    pub fn add_scopes<I, St>(
20305        mut self,
20306        scopes: I,
20307    ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionGetCall<'a, C>
20308    where
20309        I: IntoIterator<Item = St>,
20310        St: AsRef<str>,
20311    {
20312        self._scopes
20313            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20314        self
20315    }
20316
20317    /// Removes all scopes, and no default scope will be used either.
20318    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20319    /// for details).
20320    pub fn clear_scopes(
20321        mut self,
20322    ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionGetCall<'a, C> {
20323        self._scopes.clear();
20324        self
20325    }
20326}
20327
20328/// List CustomConnectorVersions in a given project
20329///
20330/// A builder for the *locations.global.customConnectors.customConnectorVersions.list* method supported by a *project* resource.
20331/// It is not used directly, but through a [`ProjectMethods`] instance.
20332///
20333/// # Example
20334///
20335/// Instantiate a resource method builder
20336///
20337/// ```test_harness,no_run
20338/// # extern crate hyper;
20339/// # extern crate hyper_rustls;
20340/// # extern crate google_connectors1 as connectors1;
20341/// # async fn dox() {
20342/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20343///
20344/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20345/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20346/// #     .with_native_roots()
20347/// #     .unwrap()
20348/// #     .https_only()
20349/// #     .enable_http2()
20350/// #     .build();
20351///
20352/// # let executor = hyper_util::rt::TokioExecutor::new();
20353/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20354/// #     secret,
20355/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20356/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
20357/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
20358/// #     ),
20359/// # ).build().await.unwrap();
20360///
20361/// # let client = hyper_util::client::legacy::Client::builder(
20362/// #     hyper_util::rt::TokioExecutor::new()
20363/// # )
20364/// # .build(
20365/// #     hyper_rustls::HttpsConnectorBuilder::new()
20366/// #         .with_native_roots()
20367/// #         .unwrap()
20368/// #         .https_or_http()
20369/// #         .enable_http2()
20370/// #         .build()
20371/// # );
20372/// # let mut hub = Connectors::new(client, auth);
20373/// // You can configure optional parameters by calling the respective setters at will, and
20374/// // execute the final call using `doit()`.
20375/// // Values shown here are possibly random and not representative !
20376/// let result = hub.projects().locations_global_custom_connectors_custom_connector_versions_list("parent")
20377///              .page_token("invidunt")
20378///              .page_size(-11)
20379///              .doit().await;
20380/// # }
20381/// ```
20382pub struct ProjectLocationGlobalCustomConnectorCustomConnectorVersionListCall<'a, C>
20383where
20384    C: 'a,
20385{
20386    hub: &'a Connectors<C>,
20387    _parent: String,
20388    _page_token: Option<String>,
20389    _page_size: Option<i32>,
20390    _delegate: Option<&'a mut dyn common::Delegate>,
20391    _additional_params: HashMap<String, String>,
20392    _scopes: BTreeSet<String>,
20393}
20394
20395impl<'a, C> common::CallBuilder
20396    for ProjectLocationGlobalCustomConnectorCustomConnectorVersionListCall<'a, C>
20397{
20398}
20399
20400impl<'a, C> ProjectLocationGlobalCustomConnectorCustomConnectorVersionListCall<'a, C>
20401where
20402    C: common::Connector,
20403{
20404    /// Perform the operation you have build so far.
20405    pub async fn doit(
20406        mut self,
20407    ) -> common::Result<(common::Response, ListCustomConnectorVersionsResponse)> {
20408        use std::borrow::Cow;
20409        use std::io::{Read, Seek};
20410
20411        use common::{url::Params, ToParts};
20412        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20413
20414        let mut dd = common::DefaultDelegate;
20415        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20416        dlg.begin(common::MethodInfo { id: "connectors.projects.locations.global.customConnectors.customConnectorVersions.list",
20417                               http_method: hyper::Method::GET });
20418
20419        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
20420            if self._additional_params.contains_key(field) {
20421                dlg.finished(false);
20422                return Err(common::Error::FieldClash(field));
20423            }
20424        }
20425
20426        let mut params = Params::with_capacity(5 + self._additional_params.len());
20427        params.push("parent", self._parent);
20428        if let Some(value) = self._page_token.as_ref() {
20429            params.push("pageToken", value);
20430        }
20431        if let Some(value) = self._page_size.as_ref() {
20432            params.push("pageSize", value.to_string());
20433        }
20434
20435        params.extend(self._additional_params.iter());
20436
20437        params.push("alt", "json");
20438        let mut url = self.hub._base_url.clone() + "v1/{+parent}/customConnectorVersions";
20439        if self._scopes.is_empty() {
20440            self._scopes
20441                .insert(Scope::CloudPlatform.as_ref().to_string());
20442        }
20443
20444        #[allow(clippy::single_element_loop)]
20445        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
20446            url = params.uri_replacement(url, param_name, find_this, true);
20447        }
20448        {
20449            let to_remove = ["parent"];
20450            params.remove_params(&to_remove);
20451        }
20452
20453        let url = params.parse_with_url(&url);
20454
20455        loop {
20456            let token = match self
20457                .hub
20458                .auth
20459                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20460                .await
20461            {
20462                Ok(token) => token,
20463                Err(e) => match dlg.token(e) {
20464                    Ok(token) => token,
20465                    Err(e) => {
20466                        dlg.finished(false);
20467                        return Err(common::Error::MissingToken(e));
20468                    }
20469                },
20470            };
20471            let mut req_result = {
20472                let client = &self.hub.client;
20473                dlg.pre_request();
20474                let mut req_builder = hyper::Request::builder()
20475                    .method(hyper::Method::GET)
20476                    .uri(url.as_str())
20477                    .header(USER_AGENT, self.hub._user_agent.clone());
20478
20479                if let Some(token) = token.as_ref() {
20480                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20481                }
20482
20483                let request = req_builder
20484                    .header(CONTENT_LENGTH, 0_u64)
20485                    .body(common::to_body::<String>(None));
20486
20487                client.request(request.unwrap()).await
20488            };
20489
20490            match req_result {
20491                Err(err) => {
20492                    if let common::Retry::After(d) = dlg.http_error(&err) {
20493                        sleep(d).await;
20494                        continue;
20495                    }
20496                    dlg.finished(false);
20497                    return Err(common::Error::HttpError(err));
20498                }
20499                Ok(res) => {
20500                    let (mut parts, body) = res.into_parts();
20501                    let mut body = common::Body::new(body);
20502                    if !parts.status.is_success() {
20503                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20504                        let error = serde_json::from_str(&common::to_string(&bytes));
20505                        let response = common::to_response(parts, bytes.into());
20506
20507                        if let common::Retry::After(d) =
20508                            dlg.http_failure(&response, error.as_ref().ok())
20509                        {
20510                            sleep(d).await;
20511                            continue;
20512                        }
20513
20514                        dlg.finished(false);
20515
20516                        return Err(match error {
20517                            Ok(value) => common::Error::BadRequest(value),
20518                            _ => common::Error::Failure(response),
20519                        });
20520                    }
20521                    let response = {
20522                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20523                        let encoded = common::to_string(&bytes);
20524                        match serde_json::from_str(&encoded) {
20525                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20526                            Err(error) => {
20527                                dlg.response_json_decode_error(&encoded, &error);
20528                                return Err(common::Error::JsonDecodeError(
20529                                    encoded.to_string(),
20530                                    error,
20531                                ));
20532                            }
20533                        }
20534                    };
20535
20536                    dlg.finished(true);
20537                    return Ok(response);
20538                }
20539            }
20540        }
20541    }
20542
20543    /// Required. Parent resource of the connectors, of the form: `projects/*/locations/{location}/customConnectors/*/customConnectorVersions/*`
20544    ///
20545    /// Sets the *parent* path property to the given value.
20546    ///
20547    /// Even though the property as already been set when instantiating this call,
20548    /// we provide this method for API completeness.
20549    pub fn parent(
20550        mut self,
20551        new_value: &str,
20552    ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionListCall<'a, C> {
20553        self._parent = new_value.to_string();
20554        self
20555    }
20556    /// Page token.
20557    ///
20558    /// Sets the *page token* query property to the given value.
20559    pub fn page_token(
20560        mut self,
20561        new_value: &str,
20562    ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionListCall<'a, C> {
20563        self._page_token = Some(new_value.to_string());
20564        self
20565    }
20566    /// Page size.
20567    ///
20568    /// Sets the *page size* query property to the given value.
20569    pub fn page_size(
20570        mut self,
20571        new_value: i32,
20572    ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionListCall<'a, C> {
20573        self._page_size = Some(new_value);
20574        self
20575    }
20576    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20577    /// while executing the actual API request.
20578    ///
20579    /// ````text
20580    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20581    /// ````
20582    ///
20583    /// Sets the *delegate* property to the given value.
20584    pub fn delegate(
20585        mut self,
20586        new_value: &'a mut dyn common::Delegate,
20587    ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionListCall<'a, C> {
20588        self._delegate = Some(new_value);
20589        self
20590    }
20591
20592    /// Set any additional parameter of the query string used in the request.
20593    /// It should be used to set parameters which are not yet available through their own
20594    /// setters.
20595    ///
20596    /// Please note that this method must not be used to set any of the known parameters
20597    /// which have their own setter method. If done anyway, the request will fail.
20598    ///
20599    /// # Additional Parameters
20600    ///
20601    /// * *$.xgafv* (query-string) - V1 error format.
20602    /// * *access_token* (query-string) - OAuth access token.
20603    /// * *alt* (query-string) - Data format for response.
20604    /// * *callback* (query-string) - JSONP
20605    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20606    /// * *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.
20607    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20608    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20609    /// * *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.
20610    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20611    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20612    pub fn param<T>(
20613        mut self,
20614        name: T,
20615        value: T,
20616    ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionListCall<'a, C>
20617    where
20618        T: AsRef<str>,
20619    {
20620        self._additional_params
20621            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20622        self
20623    }
20624
20625    /// Identifies the authorization scope for the method you are building.
20626    ///
20627    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20628    /// [`Scope::CloudPlatform`].
20629    ///
20630    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20631    /// tokens for more than one scope.
20632    ///
20633    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20634    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20635    /// sufficient, a read-write scope will do as well.
20636    pub fn add_scope<St>(
20637        mut self,
20638        scope: St,
20639    ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionListCall<'a, C>
20640    where
20641        St: AsRef<str>,
20642    {
20643        self._scopes.insert(String::from(scope.as_ref()));
20644        self
20645    }
20646    /// Identifies the authorization scope(s) for the method you are building.
20647    ///
20648    /// See [`Self::add_scope()`] for details.
20649    pub fn add_scopes<I, St>(
20650        mut self,
20651        scopes: I,
20652    ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionListCall<'a, C>
20653    where
20654        I: IntoIterator<Item = St>,
20655        St: AsRef<str>,
20656    {
20657        self._scopes
20658            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20659        self
20660    }
20661
20662    /// Removes all scopes, and no default scope will be used either.
20663    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20664    /// for details).
20665    pub fn clear_scopes(
20666        mut self,
20667    ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionListCall<'a, C> {
20668        self._scopes.clear();
20669        self
20670    }
20671}
20672
20673/// Creates a new CustomConnector in a given project and location.
20674///
20675/// A builder for the *locations.global.customConnectors.create* method supported by a *project* resource.
20676/// It is not used directly, but through a [`ProjectMethods`] instance.
20677///
20678/// # Example
20679///
20680/// Instantiate a resource method builder
20681///
20682/// ```test_harness,no_run
20683/// # extern crate hyper;
20684/// # extern crate hyper_rustls;
20685/// # extern crate google_connectors1 as connectors1;
20686/// use connectors1::api::CustomConnector;
20687/// # async fn dox() {
20688/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20689///
20690/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20691/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20692/// #     .with_native_roots()
20693/// #     .unwrap()
20694/// #     .https_only()
20695/// #     .enable_http2()
20696/// #     .build();
20697///
20698/// # let executor = hyper_util::rt::TokioExecutor::new();
20699/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20700/// #     secret,
20701/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20702/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
20703/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
20704/// #     ),
20705/// # ).build().await.unwrap();
20706///
20707/// # let client = hyper_util::client::legacy::Client::builder(
20708/// #     hyper_util::rt::TokioExecutor::new()
20709/// # )
20710/// # .build(
20711/// #     hyper_rustls::HttpsConnectorBuilder::new()
20712/// #         .with_native_roots()
20713/// #         .unwrap()
20714/// #         .https_or_http()
20715/// #         .enable_http2()
20716/// #         .build()
20717/// # );
20718/// # let mut hub = Connectors::new(client, auth);
20719/// // As the method needs a request, you would usually fill it with the desired information
20720/// // into the respective structure. Some of the parts shown here might not be applicable !
20721/// // Values shown here are possibly random and not representative !
20722/// let mut req = CustomConnector::default();
20723///
20724/// // You can configure optional parameters by calling the respective setters at will, and
20725/// // execute the final call using `doit()`.
20726/// // Values shown here are possibly random and not representative !
20727/// let result = hub.projects().locations_global_custom_connectors_create(req, "parent")
20728///              .custom_connector_id("At")
20729///              .doit().await;
20730/// # }
20731/// ```
20732pub struct ProjectLocationGlobalCustomConnectorCreateCall<'a, C>
20733where
20734    C: 'a,
20735{
20736    hub: &'a Connectors<C>,
20737    _request: CustomConnector,
20738    _parent: String,
20739    _custom_connector_id: Option<String>,
20740    _delegate: Option<&'a mut dyn common::Delegate>,
20741    _additional_params: HashMap<String, String>,
20742    _scopes: BTreeSet<String>,
20743}
20744
20745impl<'a, C> common::CallBuilder for ProjectLocationGlobalCustomConnectorCreateCall<'a, C> {}
20746
20747impl<'a, C> ProjectLocationGlobalCustomConnectorCreateCall<'a, C>
20748where
20749    C: common::Connector,
20750{
20751    /// Perform the operation you have build so far.
20752    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
20753        use std::borrow::Cow;
20754        use std::io::{Read, Seek};
20755
20756        use common::{url::Params, ToParts};
20757        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20758
20759        let mut dd = common::DefaultDelegate;
20760        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20761        dlg.begin(common::MethodInfo {
20762            id: "connectors.projects.locations.global.customConnectors.create",
20763            http_method: hyper::Method::POST,
20764        });
20765
20766        for &field in ["alt", "parent", "customConnectorId"].iter() {
20767            if self._additional_params.contains_key(field) {
20768                dlg.finished(false);
20769                return Err(common::Error::FieldClash(field));
20770            }
20771        }
20772
20773        let mut params = Params::with_capacity(5 + self._additional_params.len());
20774        params.push("parent", self._parent);
20775        if let Some(value) = self._custom_connector_id.as_ref() {
20776            params.push("customConnectorId", value);
20777        }
20778
20779        params.extend(self._additional_params.iter());
20780
20781        params.push("alt", "json");
20782        let mut url = self.hub._base_url.clone() + "v1/{+parent}/customConnectors";
20783        if self._scopes.is_empty() {
20784            self._scopes
20785                .insert(Scope::CloudPlatform.as_ref().to_string());
20786        }
20787
20788        #[allow(clippy::single_element_loop)]
20789        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
20790            url = params.uri_replacement(url, param_name, find_this, true);
20791        }
20792        {
20793            let to_remove = ["parent"];
20794            params.remove_params(&to_remove);
20795        }
20796
20797        let url = params.parse_with_url(&url);
20798
20799        let mut json_mime_type = mime::APPLICATION_JSON;
20800        let mut request_value_reader = {
20801            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20802            common::remove_json_null_values(&mut value);
20803            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20804            serde_json::to_writer(&mut dst, &value).unwrap();
20805            dst
20806        };
20807        let request_size = request_value_reader
20808            .seek(std::io::SeekFrom::End(0))
20809            .unwrap();
20810        request_value_reader
20811            .seek(std::io::SeekFrom::Start(0))
20812            .unwrap();
20813
20814        loop {
20815            let token = match self
20816                .hub
20817                .auth
20818                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20819                .await
20820            {
20821                Ok(token) => token,
20822                Err(e) => match dlg.token(e) {
20823                    Ok(token) => token,
20824                    Err(e) => {
20825                        dlg.finished(false);
20826                        return Err(common::Error::MissingToken(e));
20827                    }
20828                },
20829            };
20830            request_value_reader
20831                .seek(std::io::SeekFrom::Start(0))
20832                .unwrap();
20833            let mut req_result = {
20834                let client = &self.hub.client;
20835                dlg.pre_request();
20836                let mut req_builder = hyper::Request::builder()
20837                    .method(hyper::Method::POST)
20838                    .uri(url.as_str())
20839                    .header(USER_AGENT, self.hub._user_agent.clone());
20840
20841                if let Some(token) = token.as_ref() {
20842                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20843                }
20844
20845                let request = req_builder
20846                    .header(CONTENT_TYPE, json_mime_type.to_string())
20847                    .header(CONTENT_LENGTH, request_size as u64)
20848                    .body(common::to_body(
20849                        request_value_reader.get_ref().clone().into(),
20850                    ));
20851
20852                client.request(request.unwrap()).await
20853            };
20854
20855            match req_result {
20856                Err(err) => {
20857                    if let common::Retry::After(d) = dlg.http_error(&err) {
20858                        sleep(d).await;
20859                        continue;
20860                    }
20861                    dlg.finished(false);
20862                    return Err(common::Error::HttpError(err));
20863                }
20864                Ok(res) => {
20865                    let (mut parts, body) = res.into_parts();
20866                    let mut body = common::Body::new(body);
20867                    if !parts.status.is_success() {
20868                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20869                        let error = serde_json::from_str(&common::to_string(&bytes));
20870                        let response = common::to_response(parts, bytes.into());
20871
20872                        if let common::Retry::After(d) =
20873                            dlg.http_failure(&response, error.as_ref().ok())
20874                        {
20875                            sleep(d).await;
20876                            continue;
20877                        }
20878
20879                        dlg.finished(false);
20880
20881                        return Err(match error {
20882                            Ok(value) => common::Error::BadRequest(value),
20883                            _ => common::Error::Failure(response),
20884                        });
20885                    }
20886                    let response = {
20887                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20888                        let encoded = common::to_string(&bytes);
20889                        match serde_json::from_str(&encoded) {
20890                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20891                            Err(error) => {
20892                                dlg.response_json_decode_error(&encoded, &error);
20893                                return Err(common::Error::JsonDecodeError(
20894                                    encoded.to_string(),
20895                                    error,
20896                                ));
20897                            }
20898                        }
20899                    };
20900
20901                    dlg.finished(true);
20902                    return Ok(response);
20903                }
20904            }
20905        }
20906    }
20907
20908    ///
20909    /// Sets the *request* property to the given value.
20910    ///
20911    /// Even though the property as already been set when instantiating this call,
20912    /// we provide this method for API completeness.
20913    pub fn request(
20914        mut self,
20915        new_value: CustomConnector,
20916    ) -> ProjectLocationGlobalCustomConnectorCreateCall<'a, C> {
20917        self._request = new_value;
20918        self
20919    }
20920    /// Required. Parent resource of the CreateCustomConnector, of the form: `projects/{project}/locations/*`
20921    ///
20922    /// Sets the *parent* path property to the given value.
20923    ///
20924    /// Even though the property as already been set when instantiating this call,
20925    /// we provide this method for API completeness.
20926    pub fn parent(
20927        mut self,
20928        new_value: &str,
20929    ) -> ProjectLocationGlobalCustomConnectorCreateCall<'a, C> {
20930        self._parent = new_value.to_string();
20931        self
20932    }
20933    /// Required. Identifier to assign to the CreateCustomConnector. Must be unique within scope of the parent resource.
20934    ///
20935    /// Sets the *custom connector id* query property to the given value.
20936    pub fn custom_connector_id(
20937        mut self,
20938        new_value: &str,
20939    ) -> ProjectLocationGlobalCustomConnectorCreateCall<'a, C> {
20940        self._custom_connector_id = Some(new_value.to_string());
20941        self
20942    }
20943    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20944    /// while executing the actual API request.
20945    ///
20946    /// ````text
20947    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20948    /// ````
20949    ///
20950    /// Sets the *delegate* property to the given value.
20951    pub fn delegate(
20952        mut self,
20953        new_value: &'a mut dyn common::Delegate,
20954    ) -> ProjectLocationGlobalCustomConnectorCreateCall<'a, C> {
20955        self._delegate = Some(new_value);
20956        self
20957    }
20958
20959    /// Set any additional parameter of the query string used in the request.
20960    /// It should be used to set parameters which are not yet available through their own
20961    /// setters.
20962    ///
20963    /// Please note that this method must not be used to set any of the known parameters
20964    /// which have their own setter method. If done anyway, the request will fail.
20965    ///
20966    /// # Additional Parameters
20967    ///
20968    /// * *$.xgafv* (query-string) - V1 error format.
20969    /// * *access_token* (query-string) - OAuth access token.
20970    /// * *alt* (query-string) - Data format for response.
20971    /// * *callback* (query-string) - JSONP
20972    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20973    /// * *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.
20974    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20975    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20976    /// * *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.
20977    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20978    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20979    pub fn param<T>(
20980        mut self,
20981        name: T,
20982        value: T,
20983    ) -> ProjectLocationGlobalCustomConnectorCreateCall<'a, C>
20984    where
20985        T: AsRef<str>,
20986    {
20987        self._additional_params
20988            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20989        self
20990    }
20991
20992    /// Identifies the authorization scope for the method you are building.
20993    ///
20994    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20995    /// [`Scope::CloudPlatform`].
20996    ///
20997    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20998    /// tokens for more than one scope.
20999    ///
21000    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21001    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21002    /// sufficient, a read-write scope will do as well.
21003    pub fn add_scope<St>(
21004        mut self,
21005        scope: St,
21006    ) -> ProjectLocationGlobalCustomConnectorCreateCall<'a, C>
21007    where
21008        St: AsRef<str>,
21009    {
21010        self._scopes.insert(String::from(scope.as_ref()));
21011        self
21012    }
21013    /// Identifies the authorization scope(s) for the method you are building.
21014    ///
21015    /// See [`Self::add_scope()`] for details.
21016    pub fn add_scopes<I, St>(
21017        mut self,
21018        scopes: I,
21019    ) -> ProjectLocationGlobalCustomConnectorCreateCall<'a, C>
21020    where
21021        I: IntoIterator<Item = St>,
21022        St: AsRef<str>,
21023    {
21024        self._scopes
21025            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21026        self
21027    }
21028
21029    /// Removes all scopes, and no default scope will be used either.
21030    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21031    /// for details).
21032    pub fn clear_scopes(mut self) -> ProjectLocationGlobalCustomConnectorCreateCall<'a, C> {
21033        self._scopes.clear();
21034        self
21035    }
21036}
21037
21038/// Deletes a single CustomConnector.
21039///
21040/// A builder for the *locations.global.customConnectors.delete* method supported by a *project* resource.
21041/// It is not used directly, but through a [`ProjectMethods`] instance.
21042///
21043/// # Example
21044///
21045/// Instantiate a resource method builder
21046///
21047/// ```test_harness,no_run
21048/// # extern crate hyper;
21049/// # extern crate hyper_rustls;
21050/// # extern crate google_connectors1 as connectors1;
21051/// # async fn dox() {
21052/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21053///
21054/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21055/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21056/// #     .with_native_roots()
21057/// #     .unwrap()
21058/// #     .https_only()
21059/// #     .enable_http2()
21060/// #     .build();
21061///
21062/// # let executor = hyper_util::rt::TokioExecutor::new();
21063/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21064/// #     secret,
21065/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21066/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
21067/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
21068/// #     ),
21069/// # ).build().await.unwrap();
21070///
21071/// # let client = hyper_util::client::legacy::Client::builder(
21072/// #     hyper_util::rt::TokioExecutor::new()
21073/// # )
21074/// # .build(
21075/// #     hyper_rustls::HttpsConnectorBuilder::new()
21076/// #         .with_native_roots()
21077/// #         .unwrap()
21078/// #         .https_or_http()
21079/// #         .enable_http2()
21080/// #         .build()
21081/// # );
21082/// # let mut hub = Connectors::new(client, auth);
21083/// // You can configure optional parameters by calling the respective setters at will, and
21084/// // execute the final call using `doit()`.
21085/// // Values shown here are possibly random and not representative !
21086/// let result = hub.projects().locations_global_custom_connectors_delete("name")
21087///              .force(false)
21088///              .doit().await;
21089/// # }
21090/// ```
21091pub struct ProjectLocationGlobalCustomConnectorDeleteCall<'a, C>
21092where
21093    C: 'a,
21094{
21095    hub: &'a Connectors<C>,
21096    _name: String,
21097    _force: Option<bool>,
21098    _delegate: Option<&'a mut dyn common::Delegate>,
21099    _additional_params: HashMap<String, String>,
21100    _scopes: BTreeSet<String>,
21101}
21102
21103impl<'a, C> common::CallBuilder for ProjectLocationGlobalCustomConnectorDeleteCall<'a, C> {}
21104
21105impl<'a, C> ProjectLocationGlobalCustomConnectorDeleteCall<'a, C>
21106where
21107    C: common::Connector,
21108{
21109    /// Perform the operation you have build so far.
21110    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
21111        use std::borrow::Cow;
21112        use std::io::{Read, Seek};
21113
21114        use common::{url::Params, ToParts};
21115        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21116
21117        let mut dd = common::DefaultDelegate;
21118        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21119        dlg.begin(common::MethodInfo {
21120            id: "connectors.projects.locations.global.customConnectors.delete",
21121            http_method: hyper::Method::DELETE,
21122        });
21123
21124        for &field in ["alt", "name", "force"].iter() {
21125            if self._additional_params.contains_key(field) {
21126                dlg.finished(false);
21127                return Err(common::Error::FieldClash(field));
21128            }
21129        }
21130
21131        let mut params = Params::with_capacity(4 + self._additional_params.len());
21132        params.push("name", self._name);
21133        if let Some(value) = self._force.as_ref() {
21134            params.push("force", value.to_string());
21135        }
21136
21137        params.extend(self._additional_params.iter());
21138
21139        params.push("alt", "json");
21140        let mut url = self.hub._base_url.clone() + "v1/{+name}";
21141        if self._scopes.is_empty() {
21142            self._scopes
21143                .insert(Scope::CloudPlatform.as_ref().to_string());
21144        }
21145
21146        #[allow(clippy::single_element_loop)]
21147        for &(find_this, param_name) in [("{+name}", "name")].iter() {
21148            url = params.uri_replacement(url, param_name, find_this, true);
21149        }
21150        {
21151            let to_remove = ["name"];
21152            params.remove_params(&to_remove);
21153        }
21154
21155        let url = params.parse_with_url(&url);
21156
21157        loop {
21158            let token = match self
21159                .hub
21160                .auth
21161                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21162                .await
21163            {
21164                Ok(token) => token,
21165                Err(e) => match dlg.token(e) {
21166                    Ok(token) => token,
21167                    Err(e) => {
21168                        dlg.finished(false);
21169                        return Err(common::Error::MissingToken(e));
21170                    }
21171                },
21172            };
21173            let mut req_result = {
21174                let client = &self.hub.client;
21175                dlg.pre_request();
21176                let mut req_builder = hyper::Request::builder()
21177                    .method(hyper::Method::DELETE)
21178                    .uri(url.as_str())
21179                    .header(USER_AGENT, self.hub._user_agent.clone());
21180
21181                if let Some(token) = token.as_ref() {
21182                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21183                }
21184
21185                let request = req_builder
21186                    .header(CONTENT_LENGTH, 0_u64)
21187                    .body(common::to_body::<String>(None));
21188
21189                client.request(request.unwrap()).await
21190            };
21191
21192            match req_result {
21193                Err(err) => {
21194                    if let common::Retry::After(d) = dlg.http_error(&err) {
21195                        sleep(d).await;
21196                        continue;
21197                    }
21198                    dlg.finished(false);
21199                    return Err(common::Error::HttpError(err));
21200                }
21201                Ok(res) => {
21202                    let (mut parts, body) = res.into_parts();
21203                    let mut body = common::Body::new(body);
21204                    if !parts.status.is_success() {
21205                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21206                        let error = serde_json::from_str(&common::to_string(&bytes));
21207                        let response = common::to_response(parts, bytes.into());
21208
21209                        if let common::Retry::After(d) =
21210                            dlg.http_failure(&response, error.as_ref().ok())
21211                        {
21212                            sleep(d).await;
21213                            continue;
21214                        }
21215
21216                        dlg.finished(false);
21217
21218                        return Err(match error {
21219                            Ok(value) => common::Error::BadRequest(value),
21220                            _ => common::Error::Failure(response),
21221                        });
21222                    }
21223                    let response = {
21224                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21225                        let encoded = common::to_string(&bytes);
21226                        match serde_json::from_str(&encoded) {
21227                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21228                            Err(error) => {
21229                                dlg.response_json_decode_error(&encoded, &error);
21230                                return Err(common::Error::JsonDecodeError(
21231                                    encoded.to_string(),
21232                                    error,
21233                                ));
21234                            }
21235                        }
21236                    };
21237
21238                    dlg.finished(true);
21239                    return Ok(response);
21240                }
21241            }
21242        }
21243    }
21244
21245    /// Required. Resource name of the form: `projects/{project}/locations/{location}/customConnectors/{connector}`
21246    ///
21247    /// Sets the *name* path property to the given value.
21248    ///
21249    /// Even though the property as already been set when instantiating this call,
21250    /// we provide this method for API completeness.
21251    pub fn name(
21252        mut self,
21253        new_value: &str,
21254    ) -> ProjectLocationGlobalCustomConnectorDeleteCall<'a, C> {
21255        self._name = new_value.to_string();
21256        self
21257    }
21258    /// Optional. If set to true, any customConnectorVersion which is a child resource will also be deleted. https://aip.dev/135#cascading-delete
21259    ///
21260    /// Sets the *force* query property to the given value.
21261    pub fn force(
21262        mut self,
21263        new_value: bool,
21264    ) -> ProjectLocationGlobalCustomConnectorDeleteCall<'a, C> {
21265        self._force = Some(new_value);
21266        self
21267    }
21268    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21269    /// while executing the actual API request.
21270    ///
21271    /// ````text
21272    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21273    /// ````
21274    ///
21275    /// Sets the *delegate* property to the given value.
21276    pub fn delegate(
21277        mut self,
21278        new_value: &'a mut dyn common::Delegate,
21279    ) -> ProjectLocationGlobalCustomConnectorDeleteCall<'a, C> {
21280        self._delegate = Some(new_value);
21281        self
21282    }
21283
21284    /// Set any additional parameter of the query string used in the request.
21285    /// It should be used to set parameters which are not yet available through their own
21286    /// setters.
21287    ///
21288    /// Please note that this method must not be used to set any of the known parameters
21289    /// which have their own setter method. If done anyway, the request will fail.
21290    ///
21291    /// # Additional Parameters
21292    ///
21293    /// * *$.xgafv* (query-string) - V1 error format.
21294    /// * *access_token* (query-string) - OAuth access token.
21295    /// * *alt* (query-string) - Data format for response.
21296    /// * *callback* (query-string) - JSONP
21297    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21298    /// * *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.
21299    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21300    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21301    /// * *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.
21302    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21303    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21304    pub fn param<T>(
21305        mut self,
21306        name: T,
21307        value: T,
21308    ) -> ProjectLocationGlobalCustomConnectorDeleteCall<'a, C>
21309    where
21310        T: AsRef<str>,
21311    {
21312        self._additional_params
21313            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21314        self
21315    }
21316
21317    /// Identifies the authorization scope for the method you are building.
21318    ///
21319    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21320    /// [`Scope::CloudPlatform`].
21321    ///
21322    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21323    /// tokens for more than one scope.
21324    ///
21325    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21326    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21327    /// sufficient, a read-write scope will do as well.
21328    pub fn add_scope<St>(
21329        mut self,
21330        scope: St,
21331    ) -> ProjectLocationGlobalCustomConnectorDeleteCall<'a, C>
21332    where
21333        St: AsRef<str>,
21334    {
21335        self._scopes.insert(String::from(scope.as_ref()));
21336        self
21337    }
21338    /// Identifies the authorization scope(s) for the method you are building.
21339    ///
21340    /// See [`Self::add_scope()`] for details.
21341    pub fn add_scopes<I, St>(
21342        mut self,
21343        scopes: I,
21344    ) -> ProjectLocationGlobalCustomConnectorDeleteCall<'a, C>
21345    where
21346        I: IntoIterator<Item = St>,
21347        St: AsRef<str>,
21348    {
21349        self._scopes
21350            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21351        self
21352    }
21353
21354    /// Removes all scopes, and no default scope will be used either.
21355    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21356    /// for details).
21357    pub fn clear_scopes(mut self) -> ProjectLocationGlobalCustomConnectorDeleteCall<'a, C> {
21358        self._scopes.clear();
21359        self
21360    }
21361}
21362
21363/// Gets details of a single CustomConnector.
21364///
21365/// A builder for the *locations.global.customConnectors.get* method supported by a *project* resource.
21366/// It is not used directly, but through a [`ProjectMethods`] instance.
21367///
21368/// # Example
21369///
21370/// Instantiate a resource method builder
21371///
21372/// ```test_harness,no_run
21373/// # extern crate hyper;
21374/// # extern crate hyper_rustls;
21375/// # extern crate google_connectors1 as connectors1;
21376/// # async fn dox() {
21377/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21378///
21379/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21380/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21381/// #     .with_native_roots()
21382/// #     .unwrap()
21383/// #     .https_only()
21384/// #     .enable_http2()
21385/// #     .build();
21386///
21387/// # let executor = hyper_util::rt::TokioExecutor::new();
21388/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21389/// #     secret,
21390/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21391/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
21392/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
21393/// #     ),
21394/// # ).build().await.unwrap();
21395///
21396/// # let client = hyper_util::client::legacy::Client::builder(
21397/// #     hyper_util::rt::TokioExecutor::new()
21398/// # )
21399/// # .build(
21400/// #     hyper_rustls::HttpsConnectorBuilder::new()
21401/// #         .with_native_roots()
21402/// #         .unwrap()
21403/// #         .https_or_http()
21404/// #         .enable_http2()
21405/// #         .build()
21406/// # );
21407/// # let mut hub = Connectors::new(client, auth);
21408/// // You can configure optional parameters by calling the respective setters at will, and
21409/// // execute the final call using `doit()`.
21410/// // Values shown here are possibly random and not representative !
21411/// let result = hub.projects().locations_global_custom_connectors_get("name")
21412///              .doit().await;
21413/// # }
21414/// ```
21415pub struct ProjectLocationGlobalCustomConnectorGetCall<'a, C>
21416where
21417    C: 'a,
21418{
21419    hub: &'a Connectors<C>,
21420    _name: String,
21421    _delegate: Option<&'a mut dyn common::Delegate>,
21422    _additional_params: HashMap<String, String>,
21423    _scopes: BTreeSet<String>,
21424}
21425
21426impl<'a, C> common::CallBuilder for ProjectLocationGlobalCustomConnectorGetCall<'a, C> {}
21427
21428impl<'a, C> ProjectLocationGlobalCustomConnectorGetCall<'a, C>
21429where
21430    C: common::Connector,
21431{
21432    /// Perform the operation you have build so far.
21433    pub async fn doit(mut self) -> common::Result<(common::Response, CustomConnector)> {
21434        use std::borrow::Cow;
21435        use std::io::{Read, Seek};
21436
21437        use common::{url::Params, ToParts};
21438        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21439
21440        let mut dd = common::DefaultDelegate;
21441        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21442        dlg.begin(common::MethodInfo {
21443            id: "connectors.projects.locations.global.customConnectors.get",
21444            http_method: hyper::Method::GET,
21445        });
21446
21447        for &field in ["alt", "name"].iter() {
21448            if self._additional_params.contains_key(field) {
21449                dlg.finished(false);
21450                return Err(common::Error::FieldClash(field));
21451            }
21452        }
21453
21454        let mut params = Params::with_capacity(3 + self._additional_params.len());
21455        params.push("name", self._name);
21456
21457        params.extend(self._additional_params.iter());
21458
21459        params.push("alt", "json");
21460        let mut url = self.hub._base_url.clone() + "v1/{+name}";
21461        if self._scopes.is_empty() {
21462            self._scopes
21463                .insert(Scope::CloudPlatform.as_ref().to_string());
21464        }
21465
21466        #[allow(clippy::single_element_loop)]
21467        for &(find_this, param_name) in [("{+name}", "name")].iter() {
21468            url = params.uri_replacement(url, param_name, find_this, true);
21469        }
21470        {
21471            let to_remove = ["name"];
21472            params.remove_params(&to_remove);
21473        }
21474
21475        let url = params.parse_with_url(&url);
21476
21477        loop {
21478            let token = match self
21479                .hub
21480                .auth
21481                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21482                .await
21483            {
21484                Ok(token) => token,
21485                Err(e) => match dlg.token(e) {
21486                    Ok(token) => token,
21487                    Err(e) => {
21488                        dlg.finished(false);
21489                        return Err(common::Error::MissingToken(e));
21490                    }
21491                },
21492            };
21493            let mut req_result = {
21494                let client = &self.hub.client;
21495                dlg.pre_request();
21496                let mut req_builder = hyper::Request::builder()
21497                    .method(hyper::Method::GET)
21498                    .uri(url.as_str())
21499                    .header(USER_AGENT, self.hub._user_agent.clone());
21500
21501                if let Some(token) = token.as_ref() {
21502                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21503                }
21504
21505                let request = req_builder
21506                    .header(CONTENT_LENGTH, 0_u64)
21507                    .body(common::to_body::<String>(None));
21508
21509                client.request(request.unwrap()).await
21510            };
21511
21512            match req_result {
21513                Err(err) => {
21514                    if let common::Retry::After(d) = dlg.http_error(&err) {
21515                        sleep(d).await;
21516                        continue;
21517                    }
21518                    dlg.finished(false);
21519                    return Err(common::Error::HttpError(err));
21520                }
21521                Ok(res) => {
21522                    let (mut parts, body) = res.into_parts();
21523                    let mut body = common::Body::new(body);
21524                    if !parts.status.is_success() {
21525                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21526                        let error = serde_json::from_str(&common::to_string(&bytes));
21527                        let response = common::to_response(parts, bytes.into());
21528
21529                        if let common::Retry::After(d) =
21530                            dlg.http_failure(&response, error.as_ref().ok())
21531                        {
21532                            sleep(d).await;
21533                            continue;
21534                        }
21535
21536                        dlg.finished(false);
21537
21538                        return Err(match error {
21539                            Ok(value) => common::Error::BadRequest(value),
21540                            _ => common::Error::Failure(response),
21541                        });
21542                    }
21543                    let response = {
21544                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21545                        let encoded = common::to_string(&bytes);
21546                        match serde_json::from_str(&encoded) {
21547                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21548                            Err(error) => {
21549                                dlg.response_json_decode_error(&encoded, &error);
21550                                return Err(common::Error::JsonDecodeError(
21551                                    encoded.to_string(),
21552                                    error,
21553                                ));
21554                            }
21555                        }
21556                    };
21557
21558                    dlg.finished(true);
21559                    return Ok(response);
21560                }
21561            }
21562        }
21563    }
21564
21565    /// Required. Resource name of the form: `projects/*/locations/*/customConnectors/*`
21566    ///
21567    /// Sets the *name* path property to the given value.
21568    ///
21569    /// Even though the property as already been set when instantiating this call,
21570    /// we provide this method for API completeness.
21571    pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalCustomConnectorGetCall<'a, C> {
21572        self._name = new_value.to_string();
21573        self
21574    }
21575    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21576    /// while executing the actual API request.
21577    ///
21578    /// ````text
21579    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21580    /// ````
21581    ///
21582    /// Sets the *delegate* property to the given value.
21583    pub fn delegate(
21584        mut self,
21585        new_value: &'a mut dyn common::Delegate,
21586    ) -> ProjectLocationGlobalCustomConnectorGetCall<'a, C> {
21587        self._delegate = Some(new_value);
21588        self
21589    }
21590
21591    /// Set any additional parameter of the query string used in the request.
21592    /// It should be used to set parameters which are not yet available through their own
21593    /// setters.
21594    ///
21595    /// Please note that this method must not be used to set any of the known parameters
21596    /// which have their own setter method. If done anyway, the request will fail.
21597    ///
21598    /// # Additional Parameters
21599    ///
21600    /// * *$.xgafv* (query-string) - V1 error format.
21601    /// * *access_token* (query-string) - OAuth access token.
21602    /// * *alt* (query-string) - Data format for response.
21603    /// * *callback* (query-string) - JSONP
21604    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21605    /// * *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.
21606    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21607    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21608    /// * *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.
21609    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21610    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21611    pub fn param<T>(
21612        mut self,
21613        name: T,
21614        value: T,
21615    ) -> ProjectLocationGlobalCustomConnectorGetCall<'a, C>
21616    where
21617        T: AsRef<str>,
21618    {
21619        self._additional_params
21620            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21621        self
21622    }
21623
21624    /// Identifies the authorization scope for the method you are building.
21625    ///
21626    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21627    /// [`Scope::CloudPlatform`].
21628    ///
21629    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21630    /// tokens for more than one scope.
21631    ///
21632    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21633    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21634    /// sufficient, a read-write scope will do as well.
21635    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalCustomConnectorGetCall<'a, C>
21636    where
21637        St: AsRef<str>,
21638    {
21639        self._scopes.insert(String::from(scope.as_ref()));
21640        self
21641    }
21642    /// Identifies the authorization scope(s) for the method you are building.
21643    ///
21644    /// See [`Self::add_scope()`] for details.
21645    pub fn add_scopes<I, St>(
21646        mut self,
21647        scopes: I,
21648    ) -> ProjectLocationGlobalCustomConnectorGetCall<'a, C>
21649    where
21650        I: IntoIterator<Item = St>,
21651        St: AsRef<str>,
21652    {
21653        self._scopes
21654            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21655        self
21656    }
21657
21658    /// Removes all scopes, and no default scope will be used either.
21659    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21660    /// for details).
21661    pub fn clear_scopes(mut self) -> ProjectLocationGlobalCustomConnectorGetCall<'a, C> {
21662        self._scopes.clear();
21663        self
21664    }
21665}
21666
21667/// List CustomConnectorVersions in a given project
21668///
21669/// A builder for the *locations.global.customConnectors.list* method supported by a *project* resource.
21670/// It is not used directly, but through a [`ProjectMethods`] instance.
21671///
21672/// # Example
21673///
21674/// Instantiate a resource method builder
21675///
21676/// ```test_harness,no_run
21677/// # extern crate hyper;
21678/// # extern crate hyper_rustls;
21679/// # extern crate google_connectors1 as connectors1;
21680/// # async fn dox() {
21681/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21682///
21683/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21684/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21685/// #     .with_native_roots()
21686/// #     .unwrap()
21687/// #     .https_only()
21688/// #     .enable_http2()
21689/// #     .build();
21690///
21691/// # let executor = hyper_util::rt::TokioExecutor::new();
21692/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21693/// #     secret,
21694/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21695/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
21696/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
21697/// #     ),
21698/// # ).build().await.unwrap();
21699///
21700/// # let client = hyper_util::client::legacy::Client::builder(
21701/// #     hyper_util::rt::TokioExecutor::new()
21702/// # )
21703/// # .build(
21704/// #     hyper_rustls::HttpsConnectorBuilder::new()
21705/// #         .with_native_roots()
21706/// #         .unwrap()
21707/// #         .https_or_http()
21708/// #         .enable_http2()
21709/// #         .build()
21710/// # );
21711/// # let mut hub = Connectors::new(client, auth);
21712/// // You can configure optional parameters by calling the respective setters at will, and
21713/// // execute the final call using `doit()`.
21714/// // Values shown here are possibly random and not representative !
21715/// let result = hub.projects().locations_global_custom_connectors_list("parent")
21716///              .page_token("aliquyam")
21717///              .page_size(-5)
21718///              .filter("et")
21719///              .doit().await;
21720/// # }
21721/// ```
21722pub struct ProjectLocationGlobalCustomConnectorListCall<'a, C>
21723where
21724    C: 'a,
21725{
21726    hub: &'a Connectors<C>,
21727    _parent: String,
21728    _page_token: Option<String>,
21729    _page_size: Option<i32>,
21730    _filter: Option<String>,
21731    _delegate: Option<&'a mut dyn common::Delegate>,
21732    _additional_params: HashMap<String, String>,
21733    _scopes: BTreeSet<String>,
21734}
21735
21736impl<'a, C> common::CallBuilder for ProjectLocationGlobalCustomConnectorListCall<'a, C> {}
21737
21738impl<'a, C> ProjectLocationGlobalCustomConnectorListCall<'a, C>
21739where
21740    C: common::Connector,
21741{
21742    /// Perform the operation you have build so far.
21743    pub async fn doit(
21744        mut self,
21745    ) -> common::Result<(common::Response, ListCustomConnectorsResponse)> {
21746        use std::borrow::Cow;
21747        use std::io::{Read, Seek};
21748
21749        use common::{url::Params, ToParts};
21750        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21751
21752        let mut dd = common::DefaultDelegate;
21753        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21754        dlg.begin(common::MethodInfo {
21755            id: "connectors.projects.locations.global.customConnectors.list",
21756            http_method: hyper::Method::GET,
21757        });
21758
21759        for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
21760            if self._additional_params.contains_key(field) {
21761                dlg.finished(false);
21762                return Err(common::Error::FieldClash(field));
21763            }
21764        }
21765
21766        let mut params = Params::with_capacity(6 + self._additional_params.len());
21767        params.push("parent", self._parent);
21768        if let Some(value) = self._page_token.as_ref() {
21769            params.push("pageToken", value);
21770        }
21771        if let Some(value) = self._page_size.as_ref() {
21772            params.push("pageSize", value.to_string());
21773        }
21774        if let Some(value) = self._filter.as_ref() {
21775            params.push("filter", value);
21776        }
21777
21778        params.extend(self._additional_params.iter());
21779
21780        params.push("alt", "json");
21781        let mut url = self.hub._base_url.clone() + "v1/{+parent}/customConnectors";
21782        if self._scopes.is_empty() {
21783            self._scopes
21784                .insert(Scope::CloudPlatform.as_ref().to_string());
21785        }
21786
21787        #[allow(clippy::single_element_loop)]
21788        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
21789            url = params.uri_replacement(url, param_name, find_this, true);
21790        }
21791        {
21792            let to_remove = ["parent"];
21793            params.remove_params(&to_remove);
21794        }
21795
21796        let url = params.parse_with_url(&url);
21797
21798        loop {
21799            let token = match self
21800                .hub
21801                .auth
21802                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21803                .await
21804            {
21805                Ok(token) => token,
21806                Err(e) => match dlg.token(e) {
21807                    Ok(token) => token,
21808                    Err(e) => {
21809                        dlg.finished(false);
21810                        return Err(common::Error::MissingToken(e));
21811                    }
21812                },
21813            };
21814            let mut req_result = {
21815                let client = &self.hub.client;
21816                dlg.pre_request();
21817                let mut req_builder = hyper::Request::builder()
21818                    .method(hyper::Method::GET)
21819                    .uri(url.as_str())
21820                    .header(USER_AGENT, self.hub._user_agent.clone());
21821
21822                if let Some(token) = token.as_ref() {
21823                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21824                }
21825
21826                let request = req_builder
21827                    .header(CONTENT_LENGTH, 0_u64)
21828                    .body(common::to_body::<String>(None));
21829
21830                client.request(request.unwrap()).await
21831            };
21832
21833            match req_result {
21834                Err(err) => {
21835                    if let common::Retry::After(d) = dlg.http_error(&err) {
21836                        sleep(d).await;
21837                        continue;
21838                    }
21839                    dlg.finished(false);
21840                    return Err(common::Error::HttpError(err));
21841                }
21842                Ok(res) => {
21843                    let (mut parts, body) = res.into_parts();
21844                    let mut body = common::Body::new(body);
21845                    if !parts.status.is_success() {
21846                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21847                        let error = serde_json::from_str(&common::to_string(&bytes));
21848                        let response = common::to_response(parts, bytes.into());
21849
21850                        if let common::Retry::After(d) =
21851                            dlg.http_failure(&response, error.as_ref().ok())
21852                        {
21853                            sleep(d).await;
21854                            continue;
21855                        }
21856
21857                        dlg.finished(false);
21858
21859                        return Err(match error {
21860                            Ok(value) => common::Error::BadRequest(value),
21861                            _ => common::Error::Failure(response),
21862                        });
21863                    }
21864                    let response = {
21865                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21866                        let encoded = common::to_string(&bytes);
21867                        match serde_json::from_str(&encoded) {
21868                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21869                            Err(error) => {
21870                                dlg.response_json_decode_error(&encoded, &error);
21871                                return Err(common::Error::JsonDecodeError(
21872                                    encoded.to_string(),
21873                                    error,
21874                                ));
21875                            }
21876                        }
21877                    };
21878
21879                    dlg.finished(true);
21880                    return Ok(response);
21881                }
21882            }
21883        }
21884    }
21885
21886    /// Required. Parent resource of the custom connectors, of the form: `projects/*/locations/*` Only global location is supported for CustomConnector resource.
21887    ///
21888    /// Sets the *parent* path property to the given value.
21889    ///
21890    /// Even though the property as already been set when instantiating this call,
21891    /// we provide this method for API completeness.
21892    pub fn parent(
21893        mut self,
21894        new_value: &str,
21895    ) -> ProjectLocationGlobalCustomConnectorListCall<'a, C> {
21896        self._parent = new_value.to_string();
21897        self
21898    }
21899    /// Page token.
21900    ///
21901    /// Sets the *page token* query property to the given value.
21902    pub fn page_token(
21903        mut self,
21904        new_value: &str,
21905    ) -> ProjectLocationGlobalCustomConnectorListCall<'a, C> {
21906        self._page_token = Some(new_value.to_string());
21907        self
21908    }
21909    /// Page size.
21910    ///
21911    /// Sets the *page size* query property to the given value.
21912    pub fn page_size(
21913        mut self,
21914        new_value: i32,
21915    ) -> ProjectLocationGlobalCustomConnectorListCall<'a, C> {
21916        self._page_size = Some(new_value);
21917        self
21918    }
21919    /// Filter string.
21920    ///
21921    /// Sets the *filter* query property to the given value.
21922    pub fn filter(
21923        mut self,
21924        new_value: &str,
21925    ) -> ProjectLocationGlobalCustomConnectorListCall<'a, C> {
21926        self._filter = Some(new_value.to_string());
21927        self
21928    }
21929    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21930    /// while executing the actual API request.
21931    ///
21932    /// ````text
21933    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21934    /// ````
21935    ///
21936    /// Sets the *delegate* property to the given value.
21937    pub fn delegate(
21938        mut self,
21939        new_value: &'a mut dyn common::Delegate,
21940    ) -> ProjectLocationGlobalCustomConnectorListCall<'a, C> {
21941        self._delegate = Some(new_value);
21942        self
21943    }
21944
21945    /// Set any additional parameter of the query string used in the request.
21946    /// It should be used to set parameters which are not yet available through their own
21947    /// setters.
21948    ///
21949    /// Please note that this method must not be used to set any of the known parameters
21950    /// which have their own setter method. If done anyway, the request will fail.
21951    ///
21952    /// # Additional Parameters
21953    ///
21954    /// * *$.xgafv* (query-string) - V1 error format.
21955    /// * *access_token* (query-string) - OAuth access token.
21956    /// * *alt* (query-string) - Data format for response.
21957    /// * *callback* (query-string) - JSONP
21958    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21959    /// * *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.
21960    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21961    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21962    /// * *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.
21963    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21964    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21965    pub fn param<T>(
21966        mut self,
21967        name: T,
21968        value: T,
21969    ) -> ProjectLocationGlobalCustomConnectorListCall<'a, C>
21970    where
21971        T: AsRef<str>,
21972    {
21973        self._additional_params
21974            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21975        self
21976    }
21977
21978    /// Identifies the authorization scope for the method you are building.
21979    ///
21980    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21981    /// [`Scope::CloudPlatform`].
21982    ///
21983    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21984    /// tokens for more than one scope.
21985    ///
21986    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21987    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21988    /// sufficient, a read-write scope will do as well.
21989    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalCustomConnectorListCall<'a, C>
21990    where
21991        St: AsRef<str>,
21992    {
21993        self._scopes.insert(String::from(scope.as_ref()));
21994        self
21995    }
21996    /// Identifies the authorization scope(s) for the method you are building.
21997    ///
21998    /// See [`Self::add_scope()`] for details.
21999    pub fn add_scopes<I, St>(
22000        mut self,
22001        scopes: I,
22002    ) -> ProjectLocationGlobalCustomConnectorListCall<'a, C>
22003    where
22004        I: IntoIterator<Item = St>,
22005        St: AsRef<str>,
22006    {
22007        self._scopes
22008            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22009        self
22010    }
22011
22012    /// Removes all scopes, and no default scope will be used either.
22013    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22014    /// for details).
22015    pub fn clear_scopes(mut self) -> ProjectLocationGlobalCustomConnectorListCall<'a, C> {
22016        self._scopes.clear();
22017        self
22018    }
22019}
22020
22021/// Updates the parameters of a CustomConnector.
22022///
22023/// A builder for the *locations.global.customConnectors.patch* method supported by a *project* resource.
22024/// It is not used directly, but through a [`ProjectMethods`] instance.
22025///
22026/// # Example
22027///
22028/// Instantiate a resource method builder
22029///
22030/// ```test_harness,no_run
22031/// # extern crate hyper;
22032/// # extern crate hyper_rustls;
22033/// # extern crate google_connectors1 as connectors1;
22034/// use connectors1::api::CustomConnector;
22035/// # async fn dox() {
22036/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22037///
22038/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22039/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22040/// #     .with_native_roots()
22041/// #     .unwrap()
22042/// #     .https_only()
22043/// #     .enable_http2()
22044/// #     .build();
22045///
22046/// # let executor = hyper_util::rt::TokioExecutor::new();
22047/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22048/// #     secret,
22049/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22050/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
22051/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
22052/// #     ),
22053/// # ).build().await.unwrap();
22054///
22055/// # let client = hyper_util::client::legacy::Client::builder(
22056/// #     hyper_util::rt::TokioExecutor::new()
22057/// # )
22058/// # .build(
22059/// #     hyper_rustls::HttpsConnectorBuilder::new()
22060/// #         .with_native_roots()
22061/// #         .unwrap()
22062/// #         .https_or_http()
22063/// #         .enable_http2()
22064/// #         .build()
22065/// # );
22066/// # let mut hub = Connectors::new(client, auth);
22067/// // As the method needs a request, you would usually fill it with the desired information
22068/// // into the respective structure. Some of the parts shown here might not be applicable !
22069/// // Values shown here are possibly random and not representative !
22070/// let mut req = CustomConnector::default();
22071///
22072/// // You can configure optional parameters by calling the respective setters at will, and
22073/// // execute the final call using `doit()`.
22074/// // Values shown here are possibly random and not representative !
22075/// let result = hub.projects().locations_global_custom_connectors_patch(req, "name")
22076///              .update_mask(FieldMask::new::<&str>(&[]))
22077///              .doit().await;
22078/// # }
22079/// ```
22080pub struct ProjectLocationGlobalCustomConnectorPatchCall<'a, C>
22081where
22082    C: 'a,
22083{
22084    hub: &'a Connectors<C>,
22085    _request: CustomConnector,
22086    _name: String,
22087    _update_mask: Option<common::FieldMask>,
22088    _delegate: Option<&'a mut dyn common::Delegate>,
22089    _additional_params: HashMap<String, String>,
22090    _scopes: BTreeSet<String>,
22091}
22092
22093impl<'a, C> common::CallBuilder for ProjectLocationGlobalCustomConnectorPatchCall<'a, C> {}
22094
22095impl<'a, C> ProjectLocationGlobalCustomConnectorPatchCall<'a, C>
22096where
22097    C: common::Connector,
22098{
22099    /// Perform the operation you have build so far.
22100    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
22101        use std::borrow::Cow;
22102        use std::io::{Read, Seek};
22103
22104        use common::{url::Params, ToParts};
22105        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22106
22107        let mut dd = common::DefaultDelegate;
22108        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22109        dlg.begin(common::MethodInfo {
22110            id: "connectors.projects.locations.global.customConnectors.patch",
22111            http_method: hyper::Method::PATCH,
22112        });
22113
22114        for &field in ["alt", "name", "updateMask"].iter() {
22115            if self._additional_params.contains_key(field) {
22116                dlg.finished(false);
22117                return Err(common::Error::FieldClash(field));
22118            }
22119        }
22120
22121        let mut params = Params::with_capacity(5 + self._additional_params.len());
22122        params.push("name", self._name);
22123        if let Some(value) = self._update_mask.as_ref() {
22124            params.push("updateMask", value.to_string());
22125        }
22126
22127        params.extend(self._additional_params.iter());
22128
22129        params.push("alt", "json");
22130        let mut url = self.hub._base_url.clone() + "v1/{+name}";
22131        if self._scopes.is_empty() {
22132            self._scopes
22133                .insert(Scope::CloudPlatform.as_ref().to_string());
22134        }
22135
22136        #[allow(clippy::single_element_loop)]
22137        for &(find_this, param_name) in [("{+name}", "name")].iter() {
22138            url = params.uri_replacement(url, param_name, find_this, true);
22139        }
22140        {
22141            let to_remove = ["name"];
22142            params.remove_params(&to_remove);
22143        }
22144
22145        let url = params.parse_with_url(&url);
22146
22147        let mut json_mime_type = mime::APPLICATION_JSON;
22148        let mut request_value_reader = {
22149            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22150            common::remove_json_null_values(&mut value);
22151            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22152            serde_json::to_writer(&mut dst, &value).unwrap();
22153            dst
22154        };
22155        let request_size = request_value_reader
22156            .seek(std::io::SeekFrom::End(0))
22157            .unwrap();
22158        request_value_reader
22159            .seek(std::io::SeekFrom::Start(0))
22160            .unwrap();
22161
22162        loop {
22163            let token = match self
22164                .hub
22165                .auth
22166                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22167                .await
22168            {
22169                Ok(token) => token,
22170                Err(e) => match dlg.token(e) {
22171                    Ok(token) => token,
22172                    Err(e) => {
22173                        dlg.finished(false);
22174                        return Err(common::Error::MissingToken(e));
22175                    }
22176                },
22177            };
22178            request_value_reader
22179                .seek(std::io::SeekFrom::Start(0))
22180                .unwrap();
22181            let mut req_result = {
22182                let client = &self.hub.client;
22183                dlg.pre_request();
22184                let mut req_builder = hyper::Request::builder()
22185                    .method(hyper::Method::PATCH)
22186                    .uri(url.as_str())
22187                    .header(USER_AGENT, self.hub._user_agent.clone());
22188
22189                if let Some(token) = token.as_ref() {
22190                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22191                }
22192
22193                let request = req_builder
22194                    .header(CONTENT_TYPE, json_mime_type.to_string())
22195                    .header(CONTENT_LENGTH, request_size as u64)
22196                    .body(common::to_body(
22197                        request_value_reader.get_ref().clone().into(),
22198                    ));
22199
22200                client.request(request.unwrap()).await
22201            };
22202
22203            match req_result {
22204                Err(err) => {
22205                    if let common::Retry::After(d) = dlg.http_error(&err) {
22206                        sleep(d).await;
22207                        continue;
22208                    }
22209                    dlg.finished(false);
22210                    return Err(common::Error::HttpError(err));
22211                }
22212                Ok(res) => {
22213                    let (mut parts, body) = res.into_parts();
22214                    let mut body = common::Body::new(body);
22215                    if !parts.status.is_success() {
22216                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22217                        let error = serde_json::from_str(&common::to_string(&bytes));
22218                        let response = common::to_response(parts, bytes.into());
22219
22220                        if let common::Retry::After(d) =
22221                            dlg.http_failure(&response, error.as_ref().ok())
22222                        {
22223                            sleep(d).await;
22224                            continue;
22225                        }
22226
22227                        dlg.finished(false);
22228
22229                        return Err(match error {
22230                            Ok(value) => common::Error::BadRequest(value),
22231                            _ => common::Error::Failure(response),
22232                        });
22233                    }
22234                    let response = {
22235                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22236                        let encoded = common::to_string(&bytes);
22237                        match serde_json::from_str(&encoded) {
22238                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22239                            Err(error) => {
22240                                dlg.response_json_decode_error(&encoded, &error);
22241                                return Err(common::Error::JsonDecodeError(
22242                                    encoded.to_string(),
22243                                    error,
22244                                ));
22245                            }
22246                        }
22247                    };
22248
22249                    dlg.finished(true);
22250                    return Ok(response);
22251                }
22252            }
22253        }
22254    }
22255
22256    ///
22257    /// Sets the *request* property to the given value.
22258    ///
22259    /// Even though the property as already been set when instantiating this call,
22260    /// we provide this method for API completeness.
22261    pub fn request(
22262        mut self,
22263        new_value: CustomConnector,
22264    ) -> ProjectLocationGlobalCustomConnectorPatchCall<'a, C> {
22265        self._request = new_value;
22266        self
22267    }
22268    /// Identifier. Resource name of the CustomConnector. Format: projects/{project}/locations/{location}/customConnectors/{connector}
22269    ///
22270    /// Sets the *name* path property to the given value.
22271    ///
22272    /// Even though the property as already been set when instantiating this call,
22273    /// we provide this method for API completeness.
22274    pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalCustomConnectorPatchCall<'a, C> {
22275        self._name = new_value.to_string();
22276        self
22277    }
22278    /// Required. Field mask is used to specify the fields to be overwritten in the Connector resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. Set the mask as "*" for full replacement, which means all fields will be overwritten.
22279    ///
22280    /// Sets the *update mask* query property to the given value.
22281    pub fn update_mask(
22282        mut self,
22283        new_value: common::FieldMask,
22284    ) -> ProjectLocationGlobalCustomConnectorPatchCall<'a, C> {
22285        self._update_mask = Some(new_value);
22286        self
22287    }
22288    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22289    /// while executing the actual API request.
22290    ///
22291    /// ````text
22292    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22293    /// ````
22294    ///
22295    /// Sets the *delegate* property to the given value.
22296    pub fn delegate(
22297        mut self,
22298        new_value: &'a mut dyn common::Delegate,
22299    ) -> ProjectLocationGlobalCustomConnectorPatchCall<'a, C> {
22300        self._delegate = Some(new_value);
22301        self
22302    }
22303
22304    /// Set any additional parameter of the query string used in the request.
22305    /// It should be used to set parameters which are not yet available through their own
22306    /// setters.
22307    ///
22308    /// Please note that this method must not be used to set any of the known parameters
22309    /// which have their own setter method. If done anyway, the request will fail.
22310    ///
22311    /// # Additional Parameters
22312    ///
22313    /// * *$.xgafv* (query-string) - V1 error format.
22314    /// * *access_token* (query-string) - OAuth access token.
22315    /// * *alt* (query-string) - Data format for response.
22316    /// * *callback* (query-string) - JSONP
22317    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22318    /// * *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.
22319    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22320    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22321    /// * *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.
22322    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22323    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22324    pub fn param<T>(
22325        mut self,
22326        name: T,
22327        value: T,
22328    ) -> ProjectLocationGlobalCustomConnectorPatchCall<'a, C>
22329    where
22330        T: AsRef<str>,
22331    {
22332        self._additional_params
22333            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22334        self
22335    }
22336
22337    /// Identifies the authorization scope for the method you are building.
22338    ///
22339    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22340    /// [`Scope::CloudPlatform`].
22341    ///
22342    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22343    /// tokens for more than one scope.
22344    ///
22345    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22346    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22347    /// sufficient, a read-write scope will do as well.
22348    pub fn add_scope<St>(
22349        mut self,
22350        scope: St,
22351    ) -> ProjectLocationGlobalCustomConnectorPatchCall<'a, C>
22352    where
22353        St: AsRef<str>,
22354    {
22355        self._scopes.insert(String::from(scope.as_ref()));
22356        self
22357    }
22358    /// Identifies the authorization scope(s) for the method you are building.
22359    ///
22360    /// See [`Self::add_scope()`] for details.
22361    pub fn add_scopes<I, St>(
22362        mut self,
22363        scopes: I,
22364    ) -> ProjectLocationGlobalCustomConnectorPatchCall<'a, C>
22365    where
22366        I: IntoIterator<Item = St>,
22367        St: AsRef<str>,
22368    {
22369        self._scopes
22370            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22371        self
22372    }
22373
22374    /// Removes all scopes, and no default scope will be used either.
22375    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22376    /// for details).
22377    pub fn clear_scopes(mut self) -> ProjectLocationGlobalCustomConnectorPatchCall<'a, C> {
22378        self._scopes.clear();
22379        self
22380    }
22381}
22382
22383/// Creates a new ManagedZone in a given project and location.
22384///
22385/// A builder for the *locations.global.managedZones.create* method supported by a *project* resource.
22386/// It is not used directly, but through a [`ProjectMethods`] instance.
22387///
22388/// # Example
22389///
22390/// Instantiate a resource method builder
22391///
22392/// ```test_harness,no_run
22393/// # extern crate hyper;
22394/// # extern crate hyper_rustls;
22395/// # extern crate google_connectors1 as connectors1;
22396/// use connectors1::api::ManagedZone;
22397/// # async fn dox() {
22398/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22399///
22400/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22401/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22402/// #     .with_native_roots()
22403/// #     .unwrap()
22404/// #     .https_only()
22405/// #     .enable_http2()
22406/// #     .build();
22407///
22408/// # let executor = hyper_util::rt::TokioExecutor::new();
22409/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22410/// #     secret,
22411/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22412/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
22413/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
22414/// #     ),
22415/// # ).build().await.unwrap();
22416///
22417/// # let client = hyper_util::client::legacy::Client::builder(
22418/// #     hyper_util::rt::TokioExecutor::new()
22419/// # )
22420/// # .build(
22421/// #     hyper_rustls::HttpsConnectorBuilder::new()
22422/// #         .with_native_roots()
22423/// #         .unwrap()
22424/// #         .https_or_http()
22425/// #         .enable_http2()
22426/// #         .build()
22427/// # );
22428/// # let mut hub = Connectors::new(client, auth);
22429/// // As the method needs a request, you would usually fill it with the desired information
22430/// // into the respective structure. Some of the parts shown here might not be applicable !
22431/// // Values shown here are possibly random and not representative !
22432/// let mut req = ManagedZone::default();
22433///
22434/// // You can configure optional parameters by calling the respective setters at will, and
22435/// // execute the final call using `doit()`.
22436/// // Values shown here are possibly random and not representative !
22437/// let result = hub.projects().locations_global_managed_zones_create(req, "parent")
22438///              .managed_zone_id("est")
22439///              .doit().await;
22440/// # }
22441/// ```
22442pub struct ProjectLocationGlobalManagedZoneCreateCall<'a, C>
22443where
22444    C: 'a,
22445{
22446    hub: &'a Connectors<C>,
22447    _request: ManagedZone,
22448    _parent: String,
22449    _managed_zone_id: Option<String>,
22450    _delegate: Option<&'a mut dyn common::Delegate>,
22451    _additional_params: HashMap<String, String>,
22452    _scopes: BTreeSet<String>,
22453}
22454
22455impl<'a, C> common::CallBuilder for ProjectLocationGlobalManagedZoneCreateCall<'a, C> {}
22456
22457impl<'a, C> ProjectLocationGlobalManagedZoneCreateCall<'a, C>
22458where
22459    C: common::Connector,
22460{
22461    /// Perform the operation you have build so far.
22462    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
22463        use std::borrow::Cow;
22464        use std::io::{Read, Seek};
22465
22466        use common::{url::Params, ToParts};
22467        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22468
22469        let mut dd = common::DefaultDelegate;
22470        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22471        dlg.begin(common::MethodInfo {
22472            id: "connectors.projects.locations.global.managedZones.create",
22473            http_method: hyper::Method::POST,
22474        });
22475
22476        for &field in ["alt", "parent", "managedZoneId"].iter() {
22477            if self._additional_params.contains_key(field) {
22478                dlg.finished(false);
22479                return Err(common::Error::FieldClash(field));
22480            }
22481        }
22482
22483        let mut params = Params::with_capacity(5 + self._additional_params.len());
22484        params.push("parent", self._parent);
22485        if let Some(value) = self._managed_zone_id.as_ref() {
22486            params.push("managedZoneId", value);
22487        }
22488
22489        params.extend(self._additional_params.iter());
22490
22491        params.push("alt", "json");
22492        let mut url = self.hub._base_url.clone() + "v1/{+parent}/managedZones";
22493        if self._scopes.is_empty() {
22494            self._scopes
22495                .insert(Scope::CloudPlatform.as_ref().to_string());
22496        }
22497
22498        #[allow(clippy::single_element_loop)]
22499        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
22500            url = params.uri_replacement(url, param_name, find_this, true);
22501        }
22502        {
22503            let to_remove = ["parent"];
22504            params.remove_params(&to_remove);
22505        }
22506
22507        let url = params.parse_with_url(&url);
22508
22509        let mut json_mime_type = mime::APPLICATION_JSON;
22510        let mut request_value_reader = {
22511            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22512            common::remove_json_null_values(&mut value);
22513            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22514            serde_json::to_writer(&mut dst, &value).unwrap();
22515            dst
22516        };
22517        let request_size = request_value_reader
22518            .seek(std::io::SeekFrom::End(0))
22519            .unwrap();
22520        request_value_reader
22521            .seek(std::io::SeekFrom::Start(0))
22522            .unwrap();
22523
22524        loop {
22525            let token = match self
22526                .hub
22527                .auth
22528                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22529                .await
22530            {
22531                Ok(token) => token,
22532                Err(e) => match dlg.token(e) {
22533                    Ok(token) => token,
22534                    Err(e) => {
22535                        dlg.finished(false);
22536                        return Err(common::Error::MissingToken(e));
22537                    }
22538                },
22539            };
22540            request_value_reader
22541                .seek(std::io::SeekFrom::Start(0))
22542                .unwrap();
22543            let mut req_result = {
22544                let client = &self.hub.client;
22545                dlg.pre_request();
22546                let mut req_builder = hyper::Request::builder()
22547                    .method(hyper::Method::POST)
22548                    .uri(url.as_str())
22549                    .header(USER_AGENT, self.hub._user_agent.clone());
22550
22551                if let Some(token) = token.as_ref() {
22552                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22553                }
22554
22555                let request = req_builder
22556                    .header(CONTENT_TYPE, json_mime_type.to_string())
22557                    .header(CONTENT_LENGTH, request_size as u64)
22558                    .body(common::to_body(
22559                        request_value_reader.get_ref().clone().into(),
22560                    ));
22561
22562                client.request(request.unwrap()).await
22563            };
22564
22565            match req_result {
22566                Err(err) => {
22567                    if let common::Retry::After(d) = dlg.http_error(&err) {
22568                        sleep(d).await;
22569                        continue;
22570                    }
22571                    dlg.finished(false);
22572                    return Err(common::Error::HttpError(err));
22573                }
22574                Ok(res) => {
22575                    let (mut parts, body) = res.into_parts();
22576                    let mut body = common::Body::new(body);
22577                    if !parts.status.is_success() {
22578                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22579                        let error = serde_json::from_str(&common::to_string(&bytes));
22580                        let response = common::to_response(parts, bytes.into());
22581
22582                        if let common::Retry::After(d) =
22583                            dlg.http_failure(&response, error.as_ref().ok())
22584                        {
22585                            sleep(d).await;
22586                            continue;
22587                        }
22588
22589                        dlg.finished(false);
22590
22591                        return Err(match error {
22592                            Ok(value) => common::Error::BadRequest(value),
22593                            _ => common::Error::Failure(response),
22594                        });
22595                    }
22596                    let response = {
22597                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22598                        let encoded = common::to_string(&bytes);
22599                        match serde_json::from_str(&encoded) {
22600                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22601                            Err(error) => {
22602                                dlg.response_json_decode_error(&encoded, &error);
22603                                return Err(common::Error::JsonDecodeError(
22604                                    encoded.to_string(),
22605                                    error,
22606                                ));
22607                            }
22608                        }
22609                    };
22610
22611                    dlg.finished(true);
22612                    return Ok(response);
22613                }
22614            }
22615        }
22616    }
22617
22618    ///
22619    /// Sets the *request* property to the given value.
22620    ///
22621    /// Even though the property as already been set when instantiating this call,
22622    /// we provide this method for API completeness.
22623    pub fn request(
22624        mut self,
22625        new_value: ManagedZone,
22626    ) -> ProjectLocationGlobalManagedZoneCreateCall<'a, C> {
22627        self._request = new_value;
22628        self
22629    }
22630    /// Required. Parent resource of the ManagedZone, of the form: `projects/*/locations/global`
22631    ///
22632    /// Sets the *parent* path property to the given value.
22633    ///
22634    /// Even though the property as already been set when instantiating this call,
22635    /// we provide this method for API completeness.
22636    pub fn parent(mut self, new_value: &str) -> ProjectLocationGlobalManagedZoneCreateCall<'a, C> {
22637        self._parent = new_value.to_string();
22638        self
22639    }
22640    /// Required. Identifier to assign to the ManagedZone. Must be unique within scope of the parent resource.
22641    ///
22642    /// Sets the *managed zone id* query property to the given value.
22643    pub fn managed_zone_id(
22644        mut self,
22645        new_value: &str,
22646    ) -> ProjectLocationGlobalManagedZoneCreateCall<'a, C> {
22647        self._managed_zone_id = Some(new_value.to_string());
22648        self
22649    }
22650    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22651    /// while executing the actual API request.
22652    ///
22653    /// ````text
22654    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22655    /// ````
22656    ///
22657    /// Sets the *delegate* property to the given value.
22658    pub fn delegate(
22659        mut self,
22660        new_value: &'a mut dyn common::Delegate,
22661    ) -> ProjectLocationGlobalManagedZoneCreateCall<'a, C> {
22662        self._delegate = Some(new_value);
22663        self
22664    }
22665
22666    /// Set any additional parameter of the query string used in the request.
22667    /// It should be used to set parameters which are not yet available through their own
22668    /// setters.
22669    ///
22670    /// Please note that this method must not be used to set any of the known parameters
22671    /// which have their own setter method. If done anyway, the request will fail.
22672    ///
22673    /// # Additional Parameters
22674    ///
22675    /// * *$.xgafv* (query-string) - V1 error format.
22676    /// * *access_token* (query-string) - OAuth access token.
22677    /// * *alt* (query-string) - Data format for response.
22678    /// * *callback* (query-string) - JSONP
22679    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22680    /// * *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.
22681    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22682    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22683    /// * *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.
22684    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22685    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22686    pub fn param<T>(
22687        mut self,
22688        name: T,
22689        value: T,
22690    ) -> ProjectLocationGlobalManagedZoneCreateCall<'a, C>
22691    where
22692        T: AsRef<str>,
22693    {
22694        self._additional_params
22695            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22696        self
22697    }
22698
22699    /// Identifies the authorization scope for the method you are building.
22700    ///
22701    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22702    /// [`Scope::CloudPlatform`].
22703    ///
22704    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22705    /// tokens for more than one scope.
22706    ///
22707    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22708    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22709    /// sufficient, a read-write scope will do as well.
22710    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalManagedZoneCreateCall<'a, C>
22711    where
22712        St: AsRef<str>,
22713    {
22714        self._scopes.insert(String::from(scope.as_ref()));
22715        self
22716    }
22717    /// Identifies the authorization scope(s) for the method you are building.
22718    ///
22719    /// See [`Self::add_scope()`] for details.
22720    pub fn add_scopes<I, St>(
22721        mut self,
22722        scopes: I,
22723    ) -> ProjectLocationGlobalManagedZoneCreateCall<'a, C>
22724    where
22725        I: IntoIterator<Item = St>,
22726        St: AsRef<str>,
22727    {
22728        self._scopes
22729            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22730        self
22731    }
22732
22733    /// Removes all scopes, and no default scope will be used either.
22734    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22735    /// for details).
22736    pub fn clear_scopes(mut self) -> ProjectLocationGlobalManagedZoneCreateCall<'a, C> {
22737        self._scopes.clear();
22738        self
22739    }
22740}
22741
22742/// Deletes a single ManagedZone.
22743///
22744/// A builder for the *locations.global.managedZones.delete* method supported by a *project* resource.
22745/// It is not used directly, but through a [`ProjectMethods`] instance.
22746///
22747/// # Example
22748///
22749/// Instantiate a resource method builder
22750///
22751/// ```test_harness,no_run
22752/// # extern crate hyper;
22753/// # extern crate hyper_rustls;
22754/// # extern crate google_connectors1 as connectors1;
22755/// # async fn dox() {
22756/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22757///
22758/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22759/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22760/// #     .with_native_roots()
22761/// #     .unwrap()
22762/// #     .https_only()
22763/// #     .enable_http2()
22764/// #     .build();
22765///
22766/// # let executor = hyper_util::rt::TokioExecutor::new();
22767/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22768/// #     secret,
22769/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22770/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
22771/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
22772/// #     ),
22773/// # ).build().await.unwrap();
22774///
22775/// # let client = hyper_util::client::legacy::Client::builder(
22776/// #     hyper_util::rt::TokioExecutor::new()
22777/// # )
22778/// # .build(
22779/// #     hyper_rustls::HttpsConnectorBuilder::new()
22780/// #         .with_native_roots()
22781/// #         .unwrap()
22782/// #         .https_or_http()
22783/// #         .enable_http2()
22784/// #         .build()
22785/// # );
22786/// # let mut hub = Connectors::new(client, auth);
22787/// // You can configure optional parameters by calling the respective setters at will, and
22788/// // execute the final call using `doit()`.
22789/// // Values shown here are possibly random and not representative !
22790/// let result = hub.projects().locations_global_managed_zones_delete("name")
22791///              .doit().await;
22792/// # }
22793/// ```
22794pub struct ProjectLocationGlobalManagedZoneDeleteCall<'a, C>
22795where
22796    C: 'a,
22797{
22798    hub: &'a Connectors<C>,
22799    _name: String,
22800    _delegate: Option<&'a mut dyn common::Delegate>,
22801    _additional_params: HashMap<String, String>,
22802    _scopes: BTreeSet<String>,
22803}
22804
22805impl<'a, C> common::CallBuilder for ProjectLocationGlobalManagedZoneDeleteCall<'a, C> {}
22806
22807impl<'a, C> ProjectLocationGlobalManagedZoneDeleteCall<'a, C>
22808where
22809    C: common::Connector,
22810{
22811    /// Perform the operation you have build so far.
22812    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
22813        use std::borrow::Cow;
22814        use std::io::{Read, Seek};
22815
22816        use common::{url::Params, ToParts};
22817        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22818
22819        let mut dd = common::DefaultDelegate;
22820        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22821        dlg.begin(common::MethodInfo {
22822            id: "connectors.projects.locations.global.managedZones.delete",
22823            http_method: hyper::Method::DELETE,
22824        });
22825
22826        for &field in ["alt", "name"].iter() {
22827            if self._additional_params.contains_key(field) {
22828                dlg.finished(false);
22829                return Err(common::Error::FieldClash(field));
22830            }
22831        }
22832
22833        let mut params = Params::with_capacity(3 + self._additional_params.len());
22834        params.push("name", self._name);
22835
22836        params.extend(self._additional_params.iter());
22837
22838        params.push("alt", "json");
22839        let mut url = self.hub._base_url.clone() + "v1/{+name}";
22840        if self._scopes.is_empty() {
22841            self._scopes
22842                .insert(Scope::CloudPlatform.as_ref().to_string());
22843        }
22844
22845        #[allow(clippy::single_element_loop)]
22846        for &(find_this, param_name) in [("{+name}", "name")].iter() {
22847            url = params.uri_replacement(url, param_name, find_this, true);
22848        }
22849        {
22850            let to_remove = ["name"];
22851            params.remove_params(&to_remove);
22852        }
22853
22854        let url = params.parse_with_url(&url);
22855
22856        loop {
22857            let token = match self
22858                .hub
22859                .auth
22860                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22861                .await
22862            {
22863                Ok(token) => token,
22864                Err(e) => match dlg.token(e) {
22865                    Ok(token) => token,
22866                    Err(e) => {
22867                        dlg.finished(false);
22868                        return Err(common::Error::MissingToken(e));
22869                    }
22870                },
22871            };
22872            let mut req_result = {
22873                let client = &self.hub.client;
22874                dlg.pre_request();
22875                let mut req_builder = hyper::Request::builder()
22876                    .method(hyper::Method::DELETE)
22877                    .uri(url.as_str())
22878                    .header(USER_AGENT, self.hub._user_agent.clone());
22879
22880                if let Some(token) = token.as_ref() {
22881                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22882                }
22883
22884                let request = req_builder
22885                    .header(CONTENT_LENGTH, 0_u64)
22886                    .body(common::to_body::<String>(None));
22887
22888                client.request(request.unwrap()).await
22889            };
22890
22891            match req_result {
22892                Err(err) => {
22893                    if let common::Retry::After(d) = dlg.http_error(&err) {
22894                        sleep(d).await;
22895                        continue;
22896                    }
22897                    dlg.finished(false);
22898                    return Err(common::Error::HttpError(err));
22899                }
22900                Ok(res) => {
22901                    let (mut parts, body) = res.into_parts();
22902                    let mut body = common::Body::new(body);
22903                    if !parts.status.is_success() {
22904                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22905                        let error = serde_json::from_str(&common::to_string(&bytes));
22906                        let response = common::to_response(parts, bytes.into());
22907
22908                        if let common::Retry::After(d) =
22909                            dlg.http_failure(&response, error.as_ref().ok())
22910                        {
22911                            sleep(d).await;
22912                            continue;
22913                        }
22914
22915                        dlg.finished(false);
22916
22917                        return Err(match error {
22918                            Ok(value) => common::Error::BadRequest(value),
22919                            _ => common::Error::Failure(response),
22920                        });
22921                    }
22922                    let response = {
22923                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22924                        let encoded = common::to_string(&bytes);
22925                        match serde_json::from_str(&encoded) {
22926                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22927                            Err(error) => {
22928                                dlg.response_json_decode_error(&encoded, &error);
22929                                return Err(common::Error::JsonDecodeError(
22930                                    encoded.to_string(),
22931                                    error,
22932                                ));
22933                            }
22934                        }
22935                    };
22936
22937                    dlg.finished(true);
22938                    return Ok(response);
22939                }
22940            }
22941        }
22942    }
22943
22944    /// Required. Resource name of the form: `projects/*/locations/global/managedZones/*`
22945    ///
22946    /// Sets the *name* path property to the given value.
22947    ///
22948    /// Even though the property as already been set when instantiating this call,
22949    /// we provide this method for API completeness.
22950    pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalManagedZoneDeleteCall<'a, C> {
22951        self._name = new_value.to_string();
22952        self
22953    }
22954    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22955    /// while executing the actual API request.
22956    ///
22957    /// ````text
22958    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22959    /// ````
22960    ///
22961    /// Sets the *delegate* property to the given value.
22962    pub fn delegate(
22963        mut self,
22964        new_value: &'a mut dyn common::Delegate,
22965    ) -> ProjectLocationGlobalManagedZoneDeleteCall<'a, C> {
22966        self._delegate = Some(new_value);
22967        self
22968    }
22969
22970    /// Set any additional parameter of the query string used in the request.
22971    /// It should be used to set parameters which are not yet available through their own
22972    /// setters.
22973    ///
22974    /// Please note that this method must not be used to set any of the known parameters
22975    /// which have their own setter method. If done anyway, the request will fail.
22976    ///
22977    /// # Additional Parameters
22978    ///
22979    /// * *$.xgafv* (query-string) - V1 error format.
22980    /// * *access_token* (query-string) - OAuth access token.
22981    /// * *alt* (query-string) - Data format for response.
22982    /// * *callback* (query-string) - JSONP
22983    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22984    /// * *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.
22985    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22986    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22987    /// * *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.
22988    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22989    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22990    pub fn param<T>(
22991        mut self,
22992        name: T,
22993        value: T,
22994    ) -> ProjectLocationGlobalManagedZoneDeleteCall<'a, C>
22995    where
22996        T: AsRef<str>,
22997    {
22998        self._additional_params
22999            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23000        self
23001    }
23002
23003    /// Identifies the authorization scope for the method you are building.
23004    ///
23005    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23006    /// [`Scope::CloudPlatform`].
23007    ///
23008    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23009    /// tokens for more than one scope.
23010    ///
23011    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23012    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23013    /// sufficient, a read-write scope will do as well.
23014    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalManagedZoneDeleteCall<'a, C>
23015    where
23016        St: AsRef<str>,
23017    {
23018        self._scopes.insert(String::from(scope.as_ref()));
23019        self
23020    }
23021    /// Identifies the authorization scope(s) for the method you are building.
23022    ///
23023    /// See [`Self::add_scope()`] for details.
23024    pub fn add_scopes<I, St>(
23025        mut self,
23026        scopes: I,
23027    ) -> ProjectLocationGlobalManagedZoneDeleteCall<'a, C>
23028    where
23029        I: IntoIterator<Item = St>,
23030        St: AsRef<str>,
23031    {
23032        self._scopes
23033            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23034        self
23035    }
23036
23037    /// Removes all scopes, and no default scope will be used either.
23038    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23039    /// for details).
23040    pub fn clear_scopes(mut self) -> ProjectLocationGlobalManagedZoneDeleteCall<'a, C> {
23041        self._scopes.clear();
23042        self
23043    }
23044}
23045
23046/// Gets details of a single ManagedZone.
23047///
23048/// A builder for the *locations.global.managedZones.get* method supported by a *project* resource.
23049/// It is not used directly, but through a [`ProjectMethods`] instance.
23050///
23051/// # Example
23052///
23053/// Instantiate a resource method builder
23054///
23055/// ```test_harness,no_run
23056/// # extern crate hyper;
23057/// # extern crate hyper_rustls;
23058/// # extern crate google_connectors1 as connectors1;
23059/// # async fn dox() {
23060/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23061///
23062/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23063/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23064/// #     .with_native_roots()
23065/// #     .unwrap()
23066/// #     .https_only()
23067/// #     .enable_http2()
23068/// #     .build();
23069///
23070/// # let executor = hyper_util::rt::TokioExecutor::new();
23071/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23072/// #     secret,
23073/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23074/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
23075/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
23076/// #     ),
23077/// # ).build().await.unwrap();
23078///
23079/// # let client = hyper_util::client::legacy::Client::builder(
23080/// #     hyper_util::rt::TokioExecutor::new()
23081/// # )
23082/// # .build(
23083/// #     hyper_rustls::HttpsConnectorBuilder::new()
23084/// #         .with_native_roots()
23085/// #         .unwrap()
23086/// #         .https_or_http()
23087/// #         .enable_http2()
23088/// #         .build()
23089/// # );
23090/// # let mut hub = Connectors::new(client, auth);
23091/// // You can configure optional parameters by calling the respective setters at will, and
23092/// // execute the final call using `doit()`.
23093/// // Values shown here are possibly random and not representative !
23094/// let result = hub.projects().locations_global_managed_zones_get("name")
23095///              .doit().await;
23096/// # }
23097/// ```
23098pub struct ProjectLocationGlobalManagedZoneGetCall<'a, C>
23099where
23100    C: 'a,
23101{
23102    hub: &'a Connectors<C>,
23103    _name: String,
23104    _delegate: Option<&'a mut dyn common::Delegate>,
23105    _additional_params: HashMap<String, String>,
23106    _scopes: BTreeSet<String>,
23107}
23108
23109impl<'a, C> common::CallBuilder for ProjectLocationGlobalManagedZoneGetCall<'a, C> {}
23110
23111impl<'a, C> ProjectLocationGlobalManagedZoneGetCall<'a, C>
23112where
23113    C: common::Connector,
23114{
23115    /// Perform the operation you have build so far.
23116    pub async fn doit(mut self) -> common::Result<(common::Response, ManagedZone)> {
23117        use std::borrow::Cow;
23118        use std::io::{Read, Seek};
23119
23120        use common::{url::Params, ToParts};
23121        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23122
23123        let mut dd = common::DefaultDelegate;
23124        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23125        dlg.begin(common::MethodInfo {
23126            id: "connectors.projects.locations.global.managedZones.get",
23127            http_method: hyper::Method::GET,
23128        });
23129
23130        for &field in ["alt", "name"].iter() {
23131            if self._additional_params.contains_key(field) {
23132                dlg.finished(false);
23133                return Err(common::Error::FieldClash(field));
23134            }
23135        }
23136
23137        let mut params = Params::with_capacity(3 + self._additional_params.len());
23138        params.push("name", self._name);
23139
23140        params.extend(self._additional_params.iter());
23141
23142        params.push("alt", "json");
23143        let mut url = self.hub._base_url.clone() + "v1/{+name}";
23144        if self._scopes.is_empty() {
23145            self._scopes
23146                .insert(Scope::CloudPlatform.as_ref().to_string());
23147        }
23148
23149        #[allow(clippy::single_element_loop)]
23150        for &(find_this, param_name) in [("{+name}", "name")].iter() {
23151            url = params.uri_replacement(url, param_name, find_this, true);
23152        }
23153        {
23154            let to_remove = ["name"];
23155            params.remove_params(&to_remove);
23156        }
23157
23158        let url = params.parse_with_url(&url);
23159
23160        loop {
23161            let token = match self
23162                .hub
23163                .auth
23164                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23165                .await
23166            {
23167                Ok(token) => token,
23168                Err(e) => match dlg.token(e) {
23169                    Ok(token) => token,
23170                    Err(e) => {
23171                        dlg.finished(false);
23172                        return Err(common::Error::MissingToken(e));
23173                    }
23174                },
23175            };
23176            let mut req_result = {
23177                let client = &self.hub.client;
23178                dlg.pre_request();
23179                let mut req_builder = hyper::Request::builder()
23180                    .method(hyper::Method::GET)
23181                    .uri(url.as_str())
23182                    .header(USER_AGENT, self.hub._user_agent.clone());
23183
23184                if let Some(token) = token.as_ref() {
23185                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23186                }
23187
23188                let request = req_builder
23189                    .header(CONTENT_LENGTH, 0_u64)
23190                    .body(common::to_body::<String>(None));
23191
23192                client.request(request.unwrap()).await
23193            };
23194
23195            match req_result {
23196                Err(err) => {
23197                    if let common::Retry::After(d) = dlg.http_error(&err) {
23198                        sleep(d).await;
23199                        continue;
23200                    }
23201                    dlg.finished(false);
23202                    return Err(common::Error::HttpError(err));
23203                }
23204                Ok(res) => {
23205                    let (mut parts, body) = res.into_parts();
23206                    let mut body = common::Body::new(body);
23207                    if !parts.status.is_success() {
23208                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23209                        let error = serde_json::from_str(&common::to_string(&bytes));
23210                        let response = common::to_response(parts, bytes.into());
23211
23212                        if let common::Retry::After(d) =
23213                            dlg.http_failure(&response, error.as_ref().ok())
23214                        {
23215                            sleep(d).await;
23216                            continue;
23217                        }
23218
23219                        dlg.finished(false);
23220
23221                        return Err(match error {
23222                            Ok(value) => common::Error::BadRequest(value),
23223                            _ => common::Error::Failure(response),
23224                        });
23225                    }
23226                    let response = {
23227                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23228                        let encoded = common::to_string(&bytes);
23229                        match serde_json::from_str(&encoded) {
23230                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23231                            Err(error) => {
23232                                dlg.response_json_decode_error(&encoded, &error);
23233                                return Err(common::Error::JsonDecodeError(
23234                                    encoded.to_string(),
23235                                    error,
23236                                ));
23237                            }
23238                        }
23239                    };
23240
23241                    dlg.finished(true);
23242                    return Ok(response);
23243                }
23244            }
23245        }
23246    }
23247
23248    /// Required. Resource name of the form: `projects/*/locations/global/managedZones/*`
23249    ///
23250    /// Sets the *name* path property to the given value.
23251    ///
23252    /// Even though the property as already been set when instantiating this call,
23253    /// we provide this method for API completeness.
23254    pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalManagedZoneGetCall<'a, C> {
23255        self._name = new_value.to_string();
23256        self
23257    }
23258    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23259    /// while executing the actual API request.
23260    ///
23261    /// ````text
23262    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23263    /// ````
23264    ///
23265    /// Sets the *delegate* property to the given value.
23266    pub fn delegate(
23267        mut self,
23268        new_value: &'a mut dyn common::Delegate,
23269    ) -> ProjectLocationGlobalManagedZoneGetCall<'a, C> {
23270        self._delegate = Some(new_value);
23271        self
23272    }
23273
23274    /// Set any additional parameter of the query string used in the request.
23275    /// It should be used to set parameters which are not yet available through their own
23276    /// setters.
23277    ///
23278    /// Please note that this method must not be used to set any of the known parameters
23279    /// which have their own setter method. If done anyway, the request will fail.
23280    ///
23281    /// # Additional Parameters
23282    ///
23283    /// * *$.xgafv* (query-string) - V1 error format.
23284    /// * *access_token* (query-string) - OAuth access token.
23285    /// * *alt* (query-string) - Data format for response.
23286    /// * *callback* (query-string) - JSONP
23287    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23288    /// * *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.
23289    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23290    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23291    /// * *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.
23292    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23293    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23294    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalManagedZoneGetCall<'a, C>
23295    where
23296        T: AsRef<str>,
23297    {
23298        self._additional_params
23299            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23300        self
23301    }
23302
23303    /// Identifies the authorization scope for the method you are building.
23304    ///
23305    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23306    /// [`Scope::CloudPlatform`].
23307    ///
23308    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23309    /// tokens for more than one scope.
23310    ///
23311    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23312    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23313    /// sufficient, a read-write scope will do as well.
23314    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalManagedZoneGetCall<'a, C>
23315    where
23316        St: AsRef<str>,
23317    {
23318        self._scopes.insert(String::from(scope.as_ref()));
23319        self
23320    }
23321    /// Identifies the authorization scope(s) for the method you are building.
23322    ///
23323    /// See [`Self::add_scope()`] for details.
23324    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalManagedZoneGetCall<'a, C>
23325    where
23326        I: IntoIterator<Item = St>,
23327        St: AsRef<str>,
23328    {
23329        self._scopes
23330            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23331        self
23332    }
23333
23334    /// Removes all scopes, and no default scope will be used either.
23335    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23336    /// for details).
23337    pub fn clear_scopes(mut self) -> ProjectLocationGlobalManagedZoneGetCall<'a, C> {
23338        self._scopes.clear();
23339        self
23340    }
23341}
23342
23343/// List ManagedZones in a given project
23344///
23345/// A builder for the *locations.global.managedZones.list* method supported by a *project* resource.
23346/// It is not used directly, but through a [`ProjectMethods`] instance.
23347///
23348/// # Example
23349///
23350/// Instantiate a resource method builder
23351///
23352/// ```test_harness,no_run
23353/// # extern crate hyper;
23354/// # extern crate hyper_rustls;
23355/// # extern crate google_connectors1 as connectors1;
23356/// # async fn dox() {
23357/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23358///
23359/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23360/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23361/// #     .with_native_roots()
23362/// #     .unwrap()
23363/// #     .https_only()
23364/// #     .enable_http2()
23365/// #     .build();
23366///
23367/// # let executor = hyper_util::rt::TokioExecutor::new();
23368/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23369/// #     secret,
23370/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23371/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
23372/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
23373/// #     ),
23374/// # ).build().await.unwrap();
23375///
23376/// # let client = hyper_util::client::legacy::Client::builder(
23377/// #     hyper_util::rt::TokioExecutor::new()
23378/// # )
23379/// # .build(
23380/// #     hyper_rustls::HttpsConnectorBuilder::new()
23381/// #         .with_native_roots()
23382/// #         .unwrap()
23383/// #         .https_or_http()
23384/// #         .enable_http2()
23385/// #         .build()
23386/// # );
23387/// # let mut hub = Connectors::new(client, auth);
23388/// // You can configure optional parameters by calling the respective setters at will, and
23389/// // execute the final call using `doit()`.
23390/// // Values shown here are possibly random and not representative !
23391/// let result = hub.projects().locations_global_managed_zones_list("parent")
23392///              .return_partial_success(true)
23393///              .page_token("et")
23394///              .page_size(-93)
23395///              .order_by("no")
23396///              .filter("et")
23397///              .doit().await;
23398/// # }
23399/// ```
23400pub struct ProjectLocationGlobalManagedZoneListCall<'a, C>
23401where
23402    C: 'a,
23403{
23404    hub: &'a Connectors<C>,
23405    _parent: String,
23406    _return_partial_success: Option<bool>,
23407    _page_token: Option<String>,
23408    _page_size: Option<i32>,
23409    _order_by: Option<String>,
23410    _filter: Option<String>,
23411    _delegate: Option<&'a mut dyn common::Delegate>,
23412    _additional_params: HashMap<String, String>,
23413    _scopes: BTreeSet<String>,
23414}
23415
23416impl<'a, C> common::CallBuilder for ProjectLocationGlobalManagedZoneListCall<'a, C> {}
23417
23418impl<'a, C> ProjectLocationGlobalManagedZoneListCall<'a, C>
23419where
23420    C: common::Connector,
23421{
23422    /// Perform the operation you have build so far.
23423    pub async fn doit(mut self) -> common::Result<(common::Response, ListManagedZonesResponse)> {
23424        use std::borrow::Cow;
23425        use std::io::{Read, Seek};
23426
23427        use common::{url::Params, ToParts};
23428        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23429
23430        let mut dd = common::DefaultDelegate;
23431        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23432        dlg.begin(common::MethodInfo {
23433            id: "connectors.projects.locations.global.managedZones.list",
23434            http_method: hyper::Method::GET,
23435        });
23436
23437        for &field in [
23438            "alt",
23439            "parent",
23440            "returnPartialSuccess",
23441            "pageToken",
23442            "pageSize",
23443            "orderBy",
23444            "filter",
23445        ]
23446        .iter()
23447        {
23448            if self._additional_params.contains_key(field) {
23449                dlg.finished(false);
23450                return Err(common::Error::FieldClash(field));
23451            }
23452        }
23453
23454        let mut params = Params::with_capacity(8 + self._additional_params.len());
23455        params.push("parent", self._parent);
23456        if let Some(value) = self._return_partial_success.as_ref() {
23457            params.push("returnPartialSuccess", value.to_string());
23458        }
23459        if let Some(value) = self._page_token.as_ref() {
23460            params.push("pageToken", value);
23461        }
23462        if let Some(value) = self._page_size.as_ref() {
23463            params.push("pageSize", value.to_string());
23464        }
23465        if let Some(value) = self._order_by.as_ref() {
23466            params.push("orderBy", value);
23467        }
23468        if let Some(value) = self._filter.as_ref() {
23469            params.push("filter", value);
23470        }
23471
23472        params.extend(self._additional_params.iter());
23473
23474        params.push("alt", "json");
23475        let mut url = self.hub._base_url.clone() + "v1/{+parent}/managedZones";
23476        if self._scopes.is_empty() {
23477            self._scopes
23478                .insert(Scope::CloudPlatform.as_ref().to_string());
23479        }
23480
23481        #[allow(clippy::single_element_loop)]
23482        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
23483            url = params.uri_replacement(url, param_name, find_this, true);
23484        }
23485        {
23486            let to_remove = ["parent"];
23487            params.remove_params(&to_remove);
23488        }
23489
23490        let url = params.parse_with_url(&url);
23491
23492        loop {
23493            let token = match self
23494                .hub
23495                .auth
23496                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23497                .await
23498            {
23499                Ok(token) => token,
23500                Err(e) => match dlg.token(e) {
23501                    Ok(token) => token,
23502                    Err(e) => {
23503                        dlg.finished(false);
23504                        return Err(common::Error::MissingToken(e));
23505                    }
23506                },
23507            };
23508            let mut req_result = {
23509                let client = &self.hub.client;
23510                dlg.pre_request();
23511                let mut req_builder = hyper::Request::builder()
23512                    .method(hyper::Method::GET)
23513                    .uri(url.as_str())
23514                    .header(USER_AGENT, self.hub._user_agent.clone());
23515
23516                if let Some(token) = token.as_ref() {
23517                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23518                }
23519
23520                let request = req_builder
23521                    .header(CONTENT_LENGTH, 0_u64)
23522                    .body(common::to_body::<String>(None));
23523
23524                client.request(request.unwrap()).await
23525            };
23526
23527            match req_result {
23528                Err(err) => {
23529                    if let common::Retry::After(d) = dlg.http_error(&err) {
23530                        sleep(d).await;
23531                        continue;
23532                    }
23533                    dlg.finished(false);
23534                    return Err(common::Error::HttpError(err));
23535                }
23536                Ok(res) => {
23537                    let (mut parts, body) = res.into_parts();
23538                    let mut body = common::Body::new(body);
23539                    if !parts.status.is_success() {
23540                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23541                        let error = serde_json::from_str(&common::to_string(&bytes));
23542                        let response = common::to_response(parts, bytes.into());
23543
23544                        if let common::Retry::After(d) =
23545                            dlg.http_failure(&response, error.as_ref().ok())
23546                        {
23547                            sleep(d).await;
23548                            continue;
23549                        }
23550
23551                        dlg.finished(false);
23552
23553                        return Err(match error {
23554                            Ok(value) => common::Error::BadRequest(value),
23555                            _ => common::Error::Failure(response),
23556                        });
23557                    }
23558                    let response = {
23559                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23560                        let encoded = common::to_string(&bytes);
23561                        match serde_json::from_str(&encoded) {
23562                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23563                            Err(error) => {
23564                                dlg.response_json_decode_error(&encoded, &error);
23565                                return Err(common::Error::JsonDecodeError(
23566                                    encoded.to_string(),
23567                                    error,
23568                                ));
23569                            }
23570                        }
23571                    };
23572
23573                    dlg.finished(true);
23574                    return Ok(response);
23575                }
23576            }
23577        }
23578    }
23579
23580    /// Required. Parent resource of the Managed Zone, of the form: `projects/*/locations/global`
23581    ///
23582    /// Sets the *parent* path property to the given value.
23583    ///
23584    /// Even though the property as already been set when instantiating this call,
23585    /// we provide this method for API completeness.
23586    pub fn parent(mut self, new_value: &str) -> ProjectLocationGlobalManagedZoneListCall<'a, C> {
23587        self._parent = new_value.to_string();
23588        self
23589    }
23590    /// Optional. If true, allow partial responses for multi-regional Aggregated List requests.
23591    ///
23592    /// Sets the *return partial success* query property to the given value.
23593    pub fn return_partial_success(
23594        mut self,
23595        new_value: bool,
23596    ) -> ProjectLocationGlobalManagedZoneListCall<'a, C> {
23597        self._return_partial_success = Some(new_value);
23598        self
23599    }
23600    /// Page token.
23601    ///
23602    /// Sets the *page token* query property to the given value.
23603    pub fn page_token(
23604        mut self,
23605        new_value: &str,
23606    ) -> ProjectLocationGlobalManagedZoneListCall<'a, C> {
23607        self._page_token = Some(new_value.to_string());
23608        self
23609    }
23610    /// Page size.
23611    ///
23612    /// Sets the *page size* query property to the given value.
23613    pub fn page_size(mut self, new_value: i32) -> ProjectLocationGlobalManagedZoneListCall<'a, C> {
23614        self._page_size = Some(new_value);
23615        self
23616    }
23617    /// Order by parameters.
23618    ///
23619    /// Sets the *order by* query property to the given value.
23620    pub fn order_by(mut self, new_value: &str) -> ProjectLocationGlobalManagedZoneListCall<'a, C> {
23621        self._order_by = Some(new_value.to_string());
23622        self
23623    }
23624    /// Filter.
23625    ///
23626    /// Sets the *filter* query property to the given value.
23627    pub fn filter(mut self, new_value: &str) -> ProjectLocationGlobalManagedZoneListCall<'a, C> {
23628        self._filter = Some(new_value.to_string());
23629        self
23630    }
23631    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23632    /// while executing the actual API request.
23633    ///
23634    /// ````text
23635    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23636    /// ````
23637    ///
23638    /// Sets the *delegate* property to the given value.
23639    pub fn delegate(
23640        mut self,
23641        new_value: &'a mut dyn common::Delegate,
23642    ) -> ProjectLocationGlobalManagedZoneListCall<'a, C> {
23643        self._delegate = Some(new_value);
23644        self
23645    }
23646
23647    /// Set any additional parameter of the query string used in the request.
23648    /// It should be used to set parameters which are not yet available through their own
23649    /// setters.
23650    ///
23651    /// Please note that this method must not be used to set any of the known parameters
23652    /// which have their own setter method. If done anyway, the request will fail.
23653    ///
23654    /// # Additional Parameters
23655    ///
23656    /// * *$.xgafv* (query-string) - V1 error format.
23657    /// * *access_token* (query-string) - OAuth access token.
23658    /// * *alt* (query-string) - Data format for response.
23659    /// * *callback* (query-string) - JSONP
23660    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23661    /// * *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.
23662    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23663    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23664    /// * *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.
23665    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23666    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23667    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalManagedZoneListCall<'a, C>
23668    where
23669        T: AsRef<str>,
23670    {
23671        self._additional_params
23672            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23673        self
23674    }
23675
23676    /// Identifies the authorization scope for the method you are building.
23677    ///
23678    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23679    /// [`Scope::CloudPlatform`].
23680    ///
23681    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23682    /// tokens for more than one scope.
23683    ///
23684    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23685    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23686    /// sufficient, a read-write scope will do as well.
23687    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalManagedZoneListCall<'a, C>
23688    where
23689        St: AsRef<str>,
23690    {
23691        self._scopes.insert(String::from(scope.as_ref()));
23692        self
23693    }
23694    /// Identifies the authorization scope(s) for the method you are building.
23695    ///
23696    /// See [`Self::add_scope()`] for details.
23697    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalManagedZoneListCall<'a, C>
23698    where
23699        I: IntoIterator<Item = St>,
23700        St: AsRef<str>,
23701    {
23702        self._scopes
23703            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23704        self
23705    }
23706
23707    /// Removes all scopes, and no default scope will be used either.
23708    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23709    /// for details).
23710    pub fn clear_scopes(mut self) -> ProjectLocationGlobalManagedZoneListCall<'a, C> {
23711        self._scopes.clear();
23712        self
23713    }
23714}
23715
23716/// Updates the parameters of a single ManagedZone.
23717///
23718/// A builder for the *locations.global.managedZones.patch* method supported by a *project* resource.
23719/// It is not used directly, but through a [`ProjectMethods`] instance.
23720///
23721/// # Example
23722///
23723/// Instantiate a resource method builder
23724///
23725/// ```test_harness,no_run
23726/// # extern crate hyper;
23727/// # extern crate hyper_rustls;
23728/// # extern crate google_connectors1 as connectors1;
23729/// use connectors1::api::ManagedZone;
23730/// # async fn dox() {
23731/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23732///
23733/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23734/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23735/// #     .with_native_roots()
23736/// #     .unwrap()
23737/// #     .https_only()
23738/// #     .enable_http2()
23739/// #     .build();
23740///
23741/// # let executor = hyper_util::rt::TokioExecutor::new();
23742/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23743/// #     secret,
23744/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23745/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
23746/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
23747/// #     ),
23748/// # ).build().await.unwrap();
23749///
23750/// # let client = hyper_util::client::legacy::Client::builder(
23751/// #     hyper_util::rt::TokioExecutor::new()
23752/// # )
23753/// # .build(
23754/// #     hyper_rustls::HttpsConnectorBuilder::new()
23755/// #         .with_native_roots()
23756/// #         .unwrap()
23757/// #         .https_or_http()
23758/// #         .enable_http2()
23759/// #         .build()
23760/// # );
23761/// # let mut hub = Connectors::new(client, auth);
23762/// // As the method needs a request, you would usually fill it with the desired information
23763/// // into the respective structure. Some of the parts shown here might not be applicable !
23764/// // Values shown here are possibly random and not representative !
23765/// let mut req = ManagedZone::default();
23766///
23767/// // You can configure optional parameters by calling the respective setters at will, and
23768/// // execute the final call using `doit()`.
23769/// // Values shown here are possibly random and not representative !
23770/// let result = hub.projects().locations_global_managed_zones_patch(req, "name")
23771///              .update_mask(FieldMask::new::<&str>(&[]))
23772///              .doit().await;
23773/// # }
23774/// ```
23775pub struct ProjectLocationGlobalManagedZonePatchCall<'a, C>
23776where
23777    C: 'a,
23778{
23779    hub: &'a Connectors<C>,
23780    _request: ManagedZone,
23781    _name: String,
23782    _update_mask: Option<common::FieldMask>,
23783    _delegate: Option<&'a mut dyn common::Delegate>,
23784    _additional_params: HashMap<String, String>,
23785    _scopes: BTreeSet<String>,
23786}
23787
23788impl<'a, C> common::CallBuilder for ProjectLocationGlobalManagedZonePatchCall<'a, C> {}
23789
23790impl<'a, C> ProjectLocationGlobalManagedZonePatchCall<'a, C>
23791where
23792    C: common::Connector,
23793{
23794    /// Perform the operation you have build so far.
23795    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
23796        use std::borrow::Cow;
23797        use std::io::{Read, Seek};
23798
23799        use common::{url::Params, ToParts};
23800        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23801
23802        let mut dd = common::DefaultDelegate;
23803        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23804        dlg.begin(common::MethodInfo {
23805            id: "connectors.projects.locations.global.managedZones.patch",
23806            http_method: hyper::Method::PATCH,
23807        });
23808
23809        for &field in ["alt", "name", "updateMask"].iter() {
23810            if self._additional_params.contains_key(field) {
23811                dlg.finished(false);
23812                return Err(common::Error::FieldClash(field));
23813            }
23814        }
23815
23816        let mut params = Params::with_capacity(5 + self._additional_params.len());
23817        params.push("name", self._name);
23818        if let Some(value) = self._update_mask.as_ref() {
23819            params.push("updateMask", value.to_string());
23820        }
23821
23822        params.extend(self._additional_params.iter());
23823
23824        params.push("alt", "json");
23825        let mut url = self.hub._base_url.clone() + "v1/{+name}";
23826        if self._scopes.is_empty() {
23827            self._scopes
23828                .insert(Scope::CloudPlatform.as_ref().to_string());
23829        }
23830
23831        #[allow(clippy::single_element_loop)]
23832        for &(find_this, param_name) in [("{+name}", "name")].iter() {
23833            url = params.uri_replacement(url, param_name, find_this, true);
23834        }
23835        {
23836            let to_remove = ["name"];
23837            params.remove_params(&to_remove);
23838        }
23839
23840        let url = params.parse_with_url(&url);
23841
23842        let mut json_mime_type = mime::APPLICATION_JSON;
23843        let mut request_value_reader = {
23844            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23845            common::remove_json_null_values(&mut value);
23846            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23847            serde_json::to_writer(&mut dst, &value).unwrap();
23848            dst
23849        };
23850        let request_size = request_value_reader
23851            .seek(std::io::SeekFrom::End(0))
23852            .unwrap();
23853        request_value_reader
23854            .seek(std::io::SeekFrom::Start(0))
23855            .unwrap();
23856
23857        loop {
23858            let token = match self
23859                .hub
23860                .auth
23861                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23862                .await
23863            {
23864                Ok(token) => token,
23865                Err(e) => match dlg.token(e) {
23866                    Ok(token) => token,
23867                    Err(e) => {
23868                        dlg.finished(false);
23869                        return Err(common::Error::MissingToken(e));
23870                    }
23871                },
23872            };
23873            request_value_reader
23874                .seek(std::io::SeekFrom::Start(0))
23875                .unwrap();
23876            let mut req_result = {
23877                let client = &self.hub.client;
23878                dlg.pre_request();
23879                let mut req_builder = hyper::Request::builder()
23880                    .method(hyper::Method::PATCH)
23881                    .uri(url.as_str())
23882                    .header(USER_AGENT, self.hub._user_agent.clone());
23883
23884                if let Some(token) = token.as_ref() {
23885                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23886                }
23887
23888                let request = req_builder
23889                    .header(CONTENT_TYPE, json_mime_type.to_string())
23890                    .header(CONTENT_LENGTH, request_size as u64)
23891                    .body(common::to_body(
23892                        request_value_reader.get_ref().clone().into(),
23893                    ));
23894
23895                client.request(request.unwrap()).await
23896            };
23897
23898            match req_result {
23899                Err(err) => {
23900                    if let common::Retry::After(d) = dlg.http_error(&err) {
23901                        sleep(d).await;
23902                        continue;
23903                    }
23904                    dlg.finished(false);
23905                    return Err(common::Error::HttpError(err));
23906                }
23907                Ok(res) => {
23908                    let (mut parts, body) = res.into_parts();
23909                    let mut body = common::Body::new(body);
23910                    if !parts.status.is_success() {
23911                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23912                        let error = serde_json::from_str(&common::to_string(&bytes));
23913                        let response = common::to_response(parts, bytes.into());
23914
23915                        if let common::Retry::After(d) =
23916                            dlg.http_failure(&response, error.as_ref().ok())
23917                        {
23918                            sleep(d).await;
23919                            continue;
23920                        }
23921
23922                        dlg.finished(false);
23923
23924                        return Err(match error {
23925                            Ok(value) => common::Error::BadRequest(value),
23926                            _ => common::Error::Failure(response),
23927                        });
23928                    }
23929                    let response = {
23930                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23931                        let encoded = common::to_string(&bytes);
23932                        match serde_json::from_str(&encoded) {
23933                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23934                            Err(error) => {
23935                                dlg.response_json_decode_error(&encoded, &error);
23936                                return Err(common::Error::JsonDecodeError(
23937                                    encoded.to_string(),
23938                                    error,
23939                                ));
23940                            }
23941                        }
23942                    };
23943
23944                    dlg.finished(true);
23945                    return Ok(response);
23946                }
23947            }
23948        }
23949    }
23950
23951    ///
23952    /// Sets the *request* property to the given value.
23953    ///
23954    /// Even though the property as already been set when instantiating this call,
23955    /// we provide this method for API completeness.
23956    pub fn request(
23957        mut self,
23958        new_value: ManagedZone,
23959    ) -> ProjectLocationGlobalManagedZonePatchCall<'a, C> {
23960        self._request = new_value;
23961        self
23962    }
23963    /// Output only. Resource name of the Managed Zone. Format: projects/{project}/locations/global/managedZones/{managed_zone}
23964    ///
23965    /// Sets the *name* path property to the given value.
23966    ///
23967    /// Even though the property as already been set when instantiating this call,
23968    /// we provide this method for API completeness.
23969    pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalManagedZonePatchCall<'a, C> {
23970        self._name = new_value.to_string();
23971        self
23972    }
23973    /// Required. The list of fields to update. Fields are specified relative to the managedZone. A field will be overwritten if it is in the mask. You can modify only the fields listed below. To update the managedZone details: * `description` * `labels` * `target_project` * `target_network`
23974    ///
23975    /// Sets the *update mask* query property to the given value.
23976    pub fn update_mask(
23977        mut self,
23978        new_value: common::FieldMask,
23979    ) -> ProjectLocationGlobalManagedZonePatchCall<'a, C> {
23980        self._update_mask = Some(new_value);
23981        self
23982    }
23983    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23984    /// while executing the actual API request.
23985    ///
23986    /// ````text
23987    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23988    /// ````
23989    ///
23990    /// Sets the *delegate* property to the given value.
23991    pub fn delegate(
23992        mut self,
23993        new_value: &'a mut dyn common::Delegate,
23994    ) -> ProjectLocationGlobalManagedZonePatchCall<'a, C> {
23995        self._delegate = Some(new_value);
23996        self
23997    }
23998
23999    /// Set any additional parameter of the query string used in the request.
24000    /// It should be used to set parameters which are not yet available through their own
24001    /// setters.
24002    ///
24003    /// Please note that this method must not be used to set any of the known parameters
24004    /// which have their own setter method. If done anyway, the request will fail.
24005    ///
24006    /// # Additional Parameters
24007    ///
24008    /// * *$.xgafv* (query-string) - V1 error format.
24009    /// * *access_token* (query-string) - OAuth access token.
24010    /// * *alt* (query-string) - Data format for response.
24011    /// * *callback* (query-string) - JSONP
24012    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24013    /// * *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.
24014    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24015    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24016    /// * *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.
24017    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24018    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24019    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalManagedZonePatchCall<'a, C>
24020    where
24021        T: AsRef<str>,
24022    {
24023        self._additional_params
24024            .insert(name.as_ref().to_string(), value.as_ref().to_string());
24025        self
24026    }
24027
24028    /// Identifies the authorization scope for the method you are building.
24029    ///
24030    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24031    /// [`Scope::CloudPlatform`].
24032    ///
24033    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24034    /// tokens for more than one scope.
24035    ///
24036    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24037    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24038    /// sufficient, a read-write scope will do as well.
24039    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalManagedZonePatchCall<'a, C>
24040    where
24041        St: AsRef<str>,
24042    {
24043        self._scopes.insert(String::from(scope.as_ref()));
24044        self
24045    }
24046    /// Identifies the authorization scope(s) for the method you are building.
24047    ///
24048    /// See [`Self::add_scope()`] for details.
24049    pub fn add_scopes<I, St>(
24050        mut self,
24051        scopes: I,
24052    ) -> ProjectLocationGlobalManagedZonePatchCall<'a, C>
24053    where
24054        I: IntoIterator<Item = St>,
24055        St: AsRef<str>,
24056    {
24057        self._scopes
24058            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24059        self
24060    }
24061
24062    /// Removes all scopes, and no default scope will be used either.
24063    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24064    /// for details).
24065    pub fn clear_scopes(mut self) -> ProjectLocationGlobalManagedZonePatchCall<'a, C> {
24066        self._scopes.clear();
24067        self
24068    }
24069}
24070
24071/// GetGlobalSettings gets settings of a project. GlobalSettings is a singleton resource.
24072///
24073/// A builder for the *locations.global.getSettings* method supported by a *project* resource.
24074/// It is not used directly, but through a [`ProjectMethods`] instance.
24075///
24076/// # Example
24077///
24078/// Instantiate a resource method builder
24079///
24080/// ```test_harness,no_run
24081/// # extern crate hyper;
24082/// # extern crate hyper_rustls;
24083/// # extern crate google_connectors1 as connectors1;
24084/// # async fn dox() {
24085/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24086///
24087/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24088/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24089/// #     .with_native_roots()
24090/// #     .unwrap()
24091/// #     .https_only()
24092/// #     .enable_http2()
24093/// #     .build();
24094///
24095/// # let executor = hyper_util::rt::TokioExecutor::new();
24096/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24097/// #     secret,
24098/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24099/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
24100/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
24101/// #     ),
24102/// # ).build().await.unwrap();
24103///
24104/// # let client = hyper_util::client::legacy::Client::builder(
24105/// #     hyper_util::rt::TokioExecutor::new()
24106/// # )
24107/// # .build(
24108/// #     hyper_rustls::HttpsConnectorBuilder::new()
24109/// #         .with_native_roots()
24110/// #         .unwrap()
24111/// #         .https_or_http()
24112/// #         .enable_http2()
24113/// #         .build()
24114/// # );
24115/// # let mut hub = Connectors::new(client, auth);
24116/// // You can configure optional parameters by calling the respective setters at will, and
24117/// // execute the final call using `doit()`.
24118/// // Values shown here are possibly random and not representative !
24119/// let result = hub.projects().locations_global_get_settings("name")
24120///              .doit().await;
24121/// # }
24122/// ```
24123pub struct ProjectLocationGlobalGetSettingCall<'a, C>
24124where
24125    C: 'a,
24126{
24127    hub: &'a Connectors<C>,
24128    _name: String,
24129    _delegate: Option<&'a mut dyn common::Delegate>,
24130    _additional_params: HashMap<String, String>,
24131    _scopes: BTreeSet<String>,
24132}
24133
24134impl<'a, C> common::CallBuilder for ProjectLocationGlobalGetSettingCall<'a, C> {}
24135
24136impl<'a, C> ProjectLocationGlobalGetSettingCall<'a, C>
24137where
24138    C: common::Connector,
24139{
24140    /// Perform the operation you have build so far.
24141    pub async fn doit(mut self) -> common::Result<(common::Response, Settings)> {
24142        use std::borrow::Cow;
24143        use std::io::{Read, Seek};
24144
24145        use common::{url::Params, ToParts};
24146        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24147
24148        let mut dd = common::DefaultDelegate;
24149        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24150        dlg.begin(common::MethodInfo {
24151            id: "connectors.projects.locations.global.getSettings",
24152            http_method: hyper::Method::GET,
24153        });
24154
24155        for &field in ["alt", "name"].iter() {
24156            if self._additional_params.contains_key(field) {
24157                dlg.finished(false);
24158                return Err(common::Error::FieldClash(field));
24159            }
24160        }
24161
24162        let mut params = Params::with_capacity(3 + self._additional_params.len());
24163        params.push("name", self._name);
24164
24165        params.extend(self._additional_params.iter());
24166
24167        params.push("alt", "json");
24168        let mut url = self.hub._base_url.clone() + "v1/{+name}";
24169        if self._scopes.is_empty() {
24170            self._scopes
24171                .insert(Scope::CloudPlatform.as_ref().to_string());
24172        }
24173
24174        #[allow(clippy::single_element_loop)]
24175        for &(find_this, param_name) in [("{+name}", "name")].iter() {
24176            url = params.uri_replacement(url, param_name, find_this, true);
24177        }
24178        {
24179            let to_remove = ["name"];
24180            params.remove_params(&to_remove);
24181        }
24182
24183        let url = params.parse_with_url(&url);
24184
24185        loop {
24186            let token = match self
24187                .hub
24188                .auth
24189                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24190                .await
24191            {
24192                Ok(token) => token,
24193                Err(e) => match dlg.token(e) {
24194                    Ok(token) => token,
24195                    Err(e) => {
24196                        dlg.finished(false);
24197                        return Err(common::Error::MissingToken(e));
24198                    }
24199                },
24200            };
24201            let mut req_result = {
24202                let client = &self.hub.client;
24203                dlg.pre_request();
24204                let mut req_builder = hyper::Request::builder()
24205                    .method(hyper::Method::GET)
24206                    .uri(url.as_str())
24207                    .header(USER_AGENT, self.hub._user_agent.clone());
24208
24209                if let Some(token) = token.as_ref() {
24210                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24211                }
24212
24213                let request = req_builder
24214                    .header(CONTENT_LENGTH, 0_u64)
24215                    .body(common::to_body::<String>(None));
24216
24217                client.request(request.unwrap()).await
24218            };
24219
24220            match req_result {
24221                Err(err) => {
24222                    if let common::Retry::After(d) = dlg.http_error(&err) {
24223                        sleep(d).await;
24224                        continue;
24225                    }
24226                    dlg.finished(false);
24227                    return Err(common::Error::HttpError(err));
24228                }
24229                Ok(res) => {
24230                    let (mut parts, body) = res.into_parts();
24231                    let mut body = common::Body::new(body);
24232                    if !parts.status.is_success() {
24233                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24234                        let error = serde_json::from_str(&common::to_string(&bytes));
24235                        let response = common::to_response(parts, bytes.into());
24236
24237                        if let common::Retry::After(d) =
24238                            dlg.http_failure(&response, error.as_ref().ok())
24239                        {
24240                            sleep(d).await;
24241                            continue;
24242                        }
24243
24244                        dlg.finished(false);
24245
24246                        return Err(match error {
24247                            Ok(value) => common::Error::BadRequest(value),
24248                            _ => common::Error::Failure(response),
24249                        });
24250                    }
24251                    let response = {
24252                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24253                        let encoded = common::to_string(&bytes);
24254                        match serde_json::from_str(&encoded) {
24255                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24256                            Err(error) => {
24257                                dlg.response_json_decode_error(&encoded, &error);
24258                                return Err(common::Error::JsonDecodeError(
24259                                    encoded.to_string(),
24260                                    error,
24261                                ));
24262                            }
24263                        }
24264                    };
24265
24266                    dlg.finished(true);
24267                    return Ok(response);
24268                }
24269            }
24270        }
24271    }
24272
24273    /// Required. The resource name of the Settings.
24274    ///
24275    /// Sets the *name* path property to the given value.
24276    ///
24277    /// Even though the property as already been set when instantiating this call,
24278    /// we provide this method for API completeness.
24279    pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalGetSettingCall<'a, C> {
24280        self._name = new_value.to_string();
24281        self
24282    }
24283    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24284    /// while executing the actual API request.
24285    ///
24286    /// ````text
24287    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24288    /// ````
24289    ///
24290    /// Sets the *delegate* property to the given value.
24291    pub fn delegate(
24292        mut self,
24293        new_value: &'a mut dyn common::Delegate,
24294    ) -> ProjectLocationGlobalGetSettingCall<'a, C> {
24295        self._delegate = Some(new_value);
24296        self
24297    }
24298
24299    /// Set any additional parameter of the query string used in the request.
24300    /// It should be used to set parameters which are not yet available through their own
24301    /// setters.
24302    ///
24303    /// Please note that this method must not be used to set any of the known parameters
24304    /// which have their own setter method. If done anyway, the request will fail.
24305    ///
24306    /// # Additional Parameters
24307    ///
24308    /// * *$.xgafv* (query-string) - V1 error format.
24309    /// * *access_token* (query-string) - OAuth access token.
24310    /// * *alt* (query-string) - Data format for response.
24311    /// * *callback* (query-string) - JSONP
24312    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24313    /// * *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.
24314    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24315    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24316    /// * *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.
24317    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24318    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24319    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalGetSettingCall<'a, C>
24320    where
24321        T: AsRef<str>,
24322    {
24323        self._additional_params
24324            .insert(name.as_ref().to_string(), value.as_ref().to_string());
24325        self
24326    }
24327
24328    /// Identifies the authorization scope for the method you are building.
24329    ///
24330    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24331    /// [`Scope::CloudPlatform`].
24332    ///
24333    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24334    /// tokens for more than one scope.
24335    ///
24336    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24337    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24338    /// sufficient, a read-write scope will do as well.
24339    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalGetSettingCall<'a, C>
24340    where
24341        St: AsRef<str>,
24342    {
24343        self._scopes.insert(String::from(scope.as_ref()));
24344        self
24345    }
24346    /// Identifies the authorization scope(s) for the method you are building.
24347    ///
24348    /// See [`Self::add_scope()`] for details.
24349    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalGetSettingCall<'a, C>
24350    where
24351        I: IntoIterator<Item = St>,
24352        St: AsRef<str>,
24353    {
24354        self._scopes
24355            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24356        self
24357    }
24358
24359    /// Removes all scopes, and no default scope will be used either.
24360    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24361    /// for details).
24362    pub fn clear_scopes(mut self) -> ProjectLocationGlobalGetSettingCall<'a, C> {
24363        self._scopes.clear();
24364        self
24365    }
24366}
24367
24368/// Update the global settings of a project.
24369///
24370/// A builder for the *locations.global.updateSettings* method supported by a *project* resource.
24371/// It is not used directly, but through a [`ProjectMethods`] instance.
24372///
24373/// # Example
24374///
24375/// Instantiate a resource method builder
24376///
24377/// ```test_harness,no_run
24378/// # extern crate hyper;
24379/// # extern crate hyper_rustls;
24380/// # extern crate google_connectors1 as connectors1;
24381/// use connectors1::api::Settings;
24382/// # async fn dox() {
24383/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24384///
24385/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24386/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24387/// #     .with_native_roots()
24388/// #     .unwrap()
24389/// #     .https_only()
24390/// #     .enable_http2()
24391/// #     .build();
24392///
24393/// # let executor = hyper_util::rt::TokioExecutor::new();
24394/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24395/// #     secret,
24396/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24397/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
24398/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
24399/// #     ),
24400/// # ).build().await.unwrap();
24401///
24402/// # let client = hyper_util::client::legacy::Client::builder(
24403/// #     hyper_util::rt::TokioExecutor::new()
24404/// # )
24405/// # .build(
24406/// #     hyper_rustls::HttpsConnectorBuilder::new()
24407/// #         .with_native_roots()
24408/// #         .unwrap()
24409/// #         .https_or_http()
24410/// #         .enable_http2()
24411/// #         .build()
24412/// # );
24413/// # let mut hub = Connectors::new(client, auth);
24414/// // As the method needs a request, you would usually fill it with the desired information
24415/// // into the respective structure. Some of the parts shown here might not be applicable !
24416/// // Values shown here are possibly random and not representative !
24417/// let mut req = Settings::default();
24418///
24419/// // You can configure optional parameters by calling the respective setters at will, and
24420/// // execute the final call using `doit()`.
24421/// // Values shown here are possibly random and not representative !
24422/// let result = hub.projects().locations_global_update_settings(req, "name")
24423///              .update_mask(FieldMask::new::<&str>(&[]))
24424///              .doit().await;
24425/// # }
24426/// ```
24427pub struct ProjectLocationGlobalUpdateSettingCall<'a, C>
24428where
24429    C: 'a,
24430{
24431    hub: &'a Connectors<C>,
24432    _request: Settings,
24433    _name: String,
24434    _update_mask: Option<common::FieldMask>,
24435    _delegate: Option<&'a mut dyn common::Delegate>,
24436    _additional_params: HashMap<String, String>,
24437    _scopes: BTreeSet<String>,
24438}
24439
24440impl<'a, C> common::CallBuilder for ProjectLocationGlobalUpdateSettingCall<'a, C> {}
24441
24442impl<'a, C> ProjectLocationGlobalUpdateSettingCall<'a, C>
24443where
24444    C: common::Connector,
24445{
24446    /// Perform the operation you have build so far.
24447    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
24448        use std::borrow::Cow;
24449        use std::io::{Read, Seek};
24450
24451        use common::{url::Params, ToParts};
24452        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24453
24454        let mut dd = common::DefaultDelegate;
24455        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24456        dlg.begin(common::MethodInfo {
24457            id: "connectors.projects.locations.global.updateSettings",
24458            http_method: hyper::Method::PATCH,
24459        });
24460
24461        for &field in ["alt", "name", "updateMask"].iter() {
24462            if self._additional_params.contains_key(field) {
24463                dlg.finished(false);
24464                return Err(common::Error::FieldClash(field));
24465            }
24466        }
24467
24468        let mut params = Params::with_capacity(5 + self._additional_params.len());
24469        params.push("name", self._name);
24470        if let Some(value) = self._update_mask.as_ref() {
24471            params.push("updateMask", value.to_string());
24472        }
24473
24474        params.extend(self._additional_params.iter());
24475
24476        params.push("alt", "json");
24477        let mut url = self.hub._base_url.clone() + "v1/{+name}";
24478        if self._scopes.is_empty() {
24479            self._scopes
24480                .insert(Scope::CloudPlatform.as_ref().to_string());
24481        }
24482
24483        #[allow(clippy::single_element_loop)]
24484        for &(find_this, param_name) in [("{+name}", "name")].iter() {
24485            url = params.uri_replacement(url, param_name, find_this, true);
24486        }
24487        {
24488            let to_remove = ["name"];
24489            params.remove_params(&to_remove);
24490        }
24491
24492        let url = params.parse_with_url(&url);
24493
24494        let mut json_mime_type = mime::APPLICATION_JSON;
24495        let mut request_value_reader = {
24496            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
24497            common::remove_json_null_values(&mut value);
24498            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
24499            serde_json::to_writer(&mut dst, &value).unwrap();
24500            dst
24501        };
24502        let request_size = request_value_reader
24503            .seek(std::io::SeekFrom::End(0))
24504            .unwrap();
24505        request_value_reader
24506            .seek(std::io::SeekFrom::Start(0))
24507            .unwrap();
24508
24509        loop {
24510            let token = match self
24511                .hub
24512                .auth
24513                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24514                .await
24515            {
24516                Ok(token) => token,
24517                Err(e) => match dlg.token(e) {
24518                    Ok(token) => token,
24519                    Err(e) => {
24520                        dlg.finished(false);
24521                        return Err(common::Error::MissingToken(e));
24522                    }
24523                },
24524            };
24525            request_value_reader
24526                .seek(std::io::SeekFrom::Start(0))
24527                .unwrap();
24528            let mut req_result = {
24529                let client = &self.hub.client;
24530                dlg.pre_request();
24531                let mut req_builder = hyper::Request::builder()
24532                    .method(hyper::Method::PATCH)
24533                    .uri(url.as_str())
24534                    .header(USER_AGENT, self.hub._user_agent.clone());
24535
24536                if let Some(token) = token.as_ref() {
24537                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24538                }
24539
24540                let request = req_builder
24541                    .header(CONTENT_TYPE, json_mime_type.to_string())
24542                    .header(CONTENT_LENGTH, request_size as u64)
24543                    .body(common::to_body(
24544                        request_value_reader.get_ref().clone().into(),
24545                    ));
24546
24547                client.request(request.unwrap()).await
24548            };
24549
24550            match req_result {
24551                Err(err) => {
24552                    if let common::Retry::After(d) = dlg.http_error(&err) {
24553                        sleep(d).await;
24554                        continue;
24555                    }
24556                    dlg.finished(false);
24557                    return Err(common::Error::HttpError(err));
24558                }
24559                Ok(res) => {
24560                    let (mut parts, body) = res.into_parts();
24561                    let mut body = common::Body::new(body);
24562                    if !parts.status.is_success() {
24563                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24564                        let error = serde_json::from_str(&common::to_string(&bytes));
24565                        let response = common::to_response(parts, bytes.into());
24566
24567                        if let common::Retry::After(d) =
24568                            dlg.http_failure(&response, error.as_ref().ok())
24569                        {
24570                            sleep(d).await;
24571                            continue;
24572                        }
24573
24574                        dlg.finished(false);
24575
24576                        return Err(match error {
24577                            Ok(value) => common::Error::BadRequest(value),
24578                            _ => common::Error::Failure(response),
24579                        });
24580                    }
24581                    let response = {
24582                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24583                        let encoded = common::to_string(&bytes);
24584                        match serde_json::from_str(&encoded) {
24585                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24586                            Err(error) => {
24587                                dlg.response_json_decode_error(&encoded, &error);
24588                                return Err(common::Error::JsonDecodeError(
24589                                    encoded.to_string(),
24590                                    error,
24591                                ));
24592                            }
24593                        }
24594                    };
24595
24596                    dlg.finished(true);
24597                    return Ok(response);
24598                }
24599            }
24600        }
24601    }
24602
24603    ///
24604    /// Sets the *request* property to the given value.
24605    ///
24606    /// Even though the property as already been set when instantiating this call,
24607    /// we provide this method for API completeness.
24608    pub fn request(mut self, new_value: Settings) -> ProjectLocationGlobalUpdateSettingCall<'a, C> {
24609        self._request = new_value;
24610        self
24611    }
24612    /// Output only. Resource name of the Connection. Format: projects/{project}/locations/global/settings}
24613    ///
24614    /// Sets the *name* path property to the given value.
24615    ///
24616    /// Even though the property as already been set when instantiating this call,
24617    /// we provide this method for API completeness.
24618    pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalUpdateSettingCall<'a, C> {
24619        self._name = new_value.to_string();
24620        self
24621    }
24622    /// Required. The list of fields to update.
24623    ///
24624    /// Sets the *update mask* query property to the given value.
24625    pub fn update_mask(
24626        mut self,
24627        new_value: common::FieldMask,
24628    ) -> ProjectLocationGlobalUpdateSettingCall<'a, C> {
24629        self._update_mask = Some(new_value);
24630        self
24631    }
24632    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24633    /// while executing the actual API request.
24634    ///
24635    /// ````text
24636    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24637    /// ````
24638    ///
24639    /// Sets the *delegate* property to the given value.
24640    pub fn delegate(
24641        mut self,
24642        new_value: &'a mut dyn common::Delegate,
24643    ) -> ProjectLocationGlobalUpdateSettingCall<'a, C> {
24644        self._delegate = Some(new_value);
24645        self
24646    }
24647
24648    /// Set any additional parameter of the query string used in the request.
24649    /// It should be used to set parameters which are not yet available through their own
24650    /// setters.
24651    ///
24652    /// Please note that this method must not be used to set any of the known parameters
24653    /// which have their own setter method. If done anyway, the request will fail.
24654    ///
24655    /// # Additional Parameters
24656    ///
24657    /// * *$.xgafv* (query-string) - V1 error format.
24658    /// * *access_token* (query-string) - OAuth access token.
24659    /// * *alt* (query-string) - Data format for response.
24660    /// * *callback* (query-string) - JSONP
24661    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24662    /// * *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.
24663    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24664    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24665    /// * *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.
24666    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24667    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24668    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalUpdateSettingCall<'a, C>
24669    where
24670        T: AsRef<str>,
24671    {
24672        self._additional_params
24673            .insert(name.as_ref().to_string(), value.as_ref().to_string());
24674        self
24675    }
24676
24677    /// Identifies the authorization scope for the method you are building.
24678    ///
24679    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24680    /// [`Scope::CloudPlatform`].
24681    ///
24682    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24683    /// tokens for more than one scope.
24684    ///
24685    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24686    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24687    /// sufficient, a read-write scope will do as well.
24688    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalUpdateSettingCall<'a, C>
24689    where
24690        St: AsRef<str>,
24691    {
24692        self._scopes.insert(String::from(scope.as_ref()));
24693        self
24694    }
24695    /// Identifies the authorization scope(s) for the method you are building.
24696    ///
24697    /// See [`Self::add_scope()`] for details.
24698    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalUpdateSettingCall<'a, C>
24699    where
24700        I: IntoIterator<Item = St>,
24701        St: AsRef<str>,
24702    {
24703        self._scopes
24704            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24705        self
24706    }
24707
24708    /// Removes all scopes, and no default scope will be used either.
24709    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24710    /// for details).
24711    pub fn clear_scopes(mut self) -> ProjectLocationGlobalUpdateSettingCall<'a, C> {
24712        self._scopes.clear();
24713        self
24714    }
24715}
24716
24717/// 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`.
24718///
24719/// A builder for the *locations.operations.cancel* method supported by a *project* resource.
24720/// It is not used directly, but through a [`ProjectMethods`] instance.
24721///
24722/// # Example
24723///
24724/// Instantiate a resource method builder
24725///
24726/// ```test_harness,no_run
24727/// # extern crate hyper;
24728/// # extern crate hyper_rustls;
24729/// # extern crate google_connectors1 as connectors1;
24730/// use connectors1::api::CancelOperationRequest;
24731/// # async fn dox() {
24732/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24733///
24734/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24735/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24736/// #     .with_native_roots()
24737/// #     .unwrap()
24738/// #     .https_only()
24739/// #     .enable_http2()
24740/// #     .build();
24741///
24742/// # let executor = hyper_util::rt::TokioExecutor::new();
24743/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24744/// #     secret,
24745/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24746/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
24747/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
24748/// #     ),
24749/// # ).build().await.unwrap();
24750///
24751/// # let client = hyper_util::client::legacy::Client::builder(
24752/// #     hyper_util::rt::TokioExecutor::new()
24753/// # )
24754/// # .build(
24755/// #     hyper_rustls::HttpsConnectorBuilder::new()
24756/// #         .with_native_roots()
24757/// #         .unwrap()
24758/// #         .https_or_http()
24759/// #         .enable_http2()
24760/// #         .build()
24761/// # );
24762/// # let mut hub = Connectors::new(client, auth);
24763/// // As the method needs a request, you would usually fill it with the desired information
24764/// // into the respective structure. Some of the parts shown here might not be applicable !
24765/// // Values shown here are possibly random and not representative !
24766/// let mut req = CancelOperationRequest::default();
24767///
24768/// // You can configure optional parameters by calling the respective setters at will, and
24769/// // execute the final call using `doit()`.
24770/// // Values shown here are possibly random and not representative !
24771/// let result = hub.projects().locations_operations_cancel(req, "name")
24772///              .doit().await;
24773/// # }
24774/// ```
24775pub struct ProjectLocationOperationCancelCall<'a, C>
24776where
24777    C: 'a,
24778{
24779    hub: &'a Connectors<C>,
24780    _request: CancelOperationRequest,
24781    _name: String,
24782    _delegate: Option<&'a mut dyn common::Delegate>,
24783    _additional_params: HashMap<String, String>,
24784    _scopes: BTreeSet<String>,
24785}
24786
24787impl<'a, C> common::CallBuilder for ProjectLocationOperationCancelCall<'a, C> {}
24788
24789impl<'a, C> ProjectLocationOperationCancelCall<'a, C>
24790where
24791    C: common::Connector,
24792{
24793    /// Perform the operation you have build so far.
24794    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
24795        use std::borrow::Cow;
24796        use std::io::{Read, Seek};
24797
24798        use common::{url::Params, ToParts};
24799        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24800
24801        let mut dd = common::DefaultDelegate;
24802        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24803        dlg.begin(common::MethodInfo {
24804            id: "connectors.projects.locations.operations.cancel",
24805            http_method: hyper::Method::POST,
24806        });
24807
24808        for &field in ["alt", "name"].iter() {
24809            if self._additional_params.contains_key(field) {
24810                dlg.finished(false);
24811                return Err(common::Error::FieldClash(field));
24812            }
24813        }
24814
24815        let mut params = Params::with_capacity(4 + self._additional_params.len());
24816        params.push("name", self._name);
24817
24818        params.extend(self._additional_params.iter());
24819
24820        params.push("alt", "json");
24821        let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
24822        if self._scopes.is_empty() {
24823            self._scopes
24824                .insert(Scope::CloudPlatform.as_ref().to_string());
24825        }
24826
24827        #[allow(clippy::single_element_loop)]
24828        for &(find_this, param_name) in [("{+name}", "name")].iter() {
24829            url = params.uri_replacement(url, param_name, find_this, true);
24830        }
24831        {
24832            let to_remove = ["name"];
24833            params.remove_params(&to_remove);
24834        }
24835
24836        let url = params.parse_with_url(&url);
24837
24838        let mut json_mime_type = mime::APPLICATION_JSON;
24839        let mut request_value_reader = {
24840            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
24841            common::remove_json_null_values(&mut value);
24842            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
24843            serde_json::to_writer(&mut dst, &value).unwrap();
24844            dst
24845        };
24846        let request_size = request_value_reader
24847            .seek(std::io::SeekFrom::End(0))
24848            .unwrap();
24849        request_value_reader
24850            .seek(std::io::SeekFrom::Start(0))
24851            .unwrap();
24852
24853        loop {
24854            let token = match self
24855                .hub
24856                .auth
24857                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24858                .await
24859            {
24860                Ok(token) => token,
24861                Err(e) => match dlg.token(e) {
24862                    Ok(token) => token,
24863                    Err(e) => {
24864                        dlg.finished(false);
24865                        return Err(common::Error::MissingToken(e));
24866                    }
24867                },
24868            };
24869            request_value_reader
24870                .seek(std::io::SeekFrom::Start(0))
24871                .unwrap();
24872            let mut req_result = {
24873                let client = &self.hub.client;
24874                dlg.pre_request();
24875                let mut req_builder = hyper::Request::builder()
24876                    .method(hyper::Method::POST)
24877                    .uri(url.as_str())
24878                    .header(USER_AGENT, self.hub._user_agent.clone());
24879
24880                if let Some(token) = token.as_ref() {
24881                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24882                }
24883
24884                let request = req_builder
24885                    .header(CONTENT_TYPE, json_mime_type.to_string())
24886                    .header(CONTENT_LENGTH, request_size as u64)
24887                    .body(common::to_body(
24888                        request_value_reader.get_ref().clone().into(),
24889                    ));
24890
24891                client.request(request.unwrap()).await
24892            };
24893
24894            match req_result {
24895                Err(err) => {
24896                    if let common::Retry::After(d) = dlg.http_error(&err) {
24897                        sleep(d).await;
24898                        continue;
24899                    }
24900                    dlg.finished(false);
24901                    return Err(common::Error::HttpError(err));
24902                }
24903                Ok(res) => {
24904                    let (mut parts, body) = res.into_parts();
24905                    let mut body = common::Body::new(body);
24906                    if !parts.status.is_success() {
24907                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24908                        let error = serde_json::from_str(&common::to_string(&bytes));
24909                        let response = common::to_response(parts, bytes.into());
24910
24911                        if let common::Retry::After(d) =
24912                            dlg.http_failure(&response, error.as_ref().ok())
24913                        {
24914                            sleep(d).await;
24915                            continue;
24916                        }
24917
24918                        dlg.finished(false);
24919
24920                        return Err(match error {
24921                            Ok(value) => common::Error::BadRequest(value),
24922                            _ => common::Error::Failure(response),
24923                        });
24924                    }
24925                    let response = {
24926                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24927                        let encoded = common::to_string(&bytes);
24928                        match serde_json::from_str(&encoded) {
24929                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24930                            Err(error) => {
24931                                dlg.response_json_decode_error(&encoded, &error);
24932                                return Err(common::Error::JsonDecodeError(
24933                                    encoded.to_string(),
24934                                    error,
24935                                ));
24936                            }
24937                        }
24938                    };
24939
24940                    dlg.finished(true);
24941                    return Ok(response);
24942                }
24943            }
24944        }
24945    }
24946
24947    ///
24948    /// Sets the *request* property to the given value.
24949    ///
24950    /// Even though the property as already been set when instantiating this call,
24951    /// we provide this method for API completeness.
24952    pub fn request(
24953        mut self,
24954        new_value: CancelOperationRequest,
24955    ) -> ProjectLocationOperationCancelCall<'a, C> {
24956        self._request = new_value;
24957        self
24958    }
24959    /// The name of the operation resource to be cancelled.
24960    ///
24961    /// Sets the *name* path property to the given value.
24962    ///
24963    /// Even though the property as already been set when instantiating this call,
24964    /// we provide this method for API completeness.
24965    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationCancelCall<'a, C> {
24966        self._name = new_value.to_string();
24967        self
24968    }
24969    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24970    /// while executing the actual API request.
24971    ///
24972    /// ````text
24973    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24974    /// ````
24975    ///
24976    /// Sets the *delegate* property to the given value.
24977    pub fn delegate(
24978        mut self,
24979        new_value: &'a mut dyn common::Delegate,
24980    ) -> ProjectLocationOperationCancelCall<'a, C> {
24981        self._delegate = Some(new_value);
24982        self
24983    }
24984
24985    /// Set any additional parameter of the query string used in the request.
24986    /// It should be used to set parameters which are not yet available through their own
24987    /// setters.
24988    ///
24989    /// Please note that this method must not be used to set any of the known parameters
24990    /// which have their own setter method. If done anyway, the request will fail.
24991    ///
24992    /// # Additional Parameters
24993    ///
24994    /// * *$.xgafv* (query-string) - V1 error format.
24995    /// * *access_token* (query-string) - OAuth access token.
24996    /// * *alt* (query-string) - Data format for response.
24997    /// * *callback* (query-string) - JSONP
24998    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24999    /// * *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.
25000    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25001    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25002    /// * *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.
25003    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25004    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25005    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationCancelCall<'a, C>
25006    where
25007        T: AsRef<str>,
25008    {
25009        self._additional_params
25010            .insert(name.as_ref().to_string(), value.as_ref().to_string());
25011        self
25012    }
25013
25014    /// Identifies the authorization scope for the method you are building.
25015    ///
25016    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25017    /// [`Scope::CloudPlatform`].
25018    ///
25019    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25020    /// tokens for more than one scope.
25021    ///
25022    /// Usually there is more than one suitable scope to authorize an operation, some of which may
25023    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25024    /// sufficient, a read-write scope will do as well.
25025    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationCancelCall<'a, C>
25026    where
25027        St: AsRef<str>,
25028    {
25029        self._scopes.insert(String::from(scope.as_ref()));
25030        self
25031    }
25032    /// Identifies the authorization scope(s) for the method you are building.
25033    ///
25034    /// See [`Self::add_scope()`] for details.
25035    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationCancelCall<'a, C>
25036    where
25037        I: IntoIterator<Item = St>,
25038        St: AsRef<str>,
25039    {
25040        self._scopes
25041            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25042        self
25043    }
25044
25045    /// Removes all scopes, and no default scope will be used either.
25046    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25047    /// for details).
25048    pub fn clear_scopes(mut self) -> ProjectLocationOperationCancelCall<'a, C> {
25049        self._scopes.clear();
25050        self
25051    }
25052}
25053
25054/// 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`.
25055///
25056/// A builder for the *locations.operations.delete* method supported by a *project* resource.
25057/// It is not used directly, but through a [`ProjectMethods`] instance.
25058///
25059/// # Example
25060///
25061/// Instantiate a resource method builder
25062///
25063/// ```test_harness,no_run
25064/// # extern crate hyper;
25065/// # extern crate hyper_rustls;
25066/// # extern crate google_connectors1 as connectors1;
25067/// # async fn dox() {
25068/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25069///
25070/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25071/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
25072/// #     .with_native_roots()
25073/// #     .unwrap()
25074/// #     .https_only()
25075/// #     .enable_http2()
25076/// #     .build();
25077///
25078/// # let executor = hyper_util::rt::TokioExecutor::new();
25079/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
25080/// #     secret,
25081/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25082/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
25083/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
25084/// #     ),
25085/// # ).build().await.unwrap();
25086///
25087/// # let client = hyper_util::client::legacy::Client::builder(
25088/// #     hyper_util::rt::TokioExecutor::new()
25089/// # )
25090/// # .build(
25091/// #     hyper_rustls::HttpsConnectorBuilder::new()
25092/// #         .with_native_roots()
25093/// #         .unwrap()
25094/// #         .https_or_http()
25095/// #         .enable_http2()
25096/// #         .build()
25097/// # );
25098/// # let mut hub = Connectors::new(client, auth);
25099/// // You can configure optional parameters by calling the respective setters at will, and
25100/// // execute the final call using `doit()`.
25101/// // Values shown here are possibly random and not representative !
25102/// let result = hub.projects().locations_operations_delete("name")
25103///              .doit().await;
25104/// # }
25105/// ```
25106pub struct ProjectLocationOperationDeleteCall<'a, C>
25107where
25108    C: 'a,
25109{
25110    hub: &'a Connectors<C>,
25111    _name: String,
25112    _delegate: Option<&'a mut dyn common::Delegate>,
25113    _additional_params: HashMap<String, String>,
25114    _scopes: BTreeSet<String>,
25115}
25116
25117impl<'a, C> common::CallBuilder for ProjectLocationOperationDeleteCall<'a, C> {}
25118
25119impl<'a, C> ProjectLocationOperationDeleteCall<'a, C>
25120where
25121    C: common::Connector,
25122{
25123    /// Perform the operation you have build so far.
25124    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
25125        use std::borrow::Cow;
25126        use std::io::{Read, Seek};
25127
25128        use common::{url::Params, ToParts};
25129        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25130
25131        let mut dd = common::DefaultDelegate;
25132        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25133        dlg.begin(common::MethodInfo {
25134            id: "connectors.projects.locations.operations.delete",
25135            http_method: hyper::Method::DELETE,
25136        });
25137
25138        for &field in ["alt", "name"].iter() {
25139            if self._additional_params.contains_key(field) {
25140                dlg.finished(false);
25141                return Err(common::Error::FieldClash(field));
25142            }
25143        }
25144
25145        let mut params = Params::with_capacity(3 + self._additional_params.len());
25146        params.push("name", self._name);
25147
25148        params.extend(self._additional_params.iter());
25149
25150        params.push("alt", "json");
25151        let mut url = self.hub._base_url.clone() + "v1/{+name}";
25152        if self._scopes.is_empty() {
25153            self._scopes
25154                .insert(Scope::CloudPlatform.as_ref().to_string());
25155        }
25156
25157        #[allow(clippy::single_element_loop)]
25158        for &(find_this, param_name) in [("{+name}", "name")].iter() {
25159            url = params.uri_replacement(url, param_name, find_this, true);
25160        }
25161        {
25162            let to_remove = ["name"];
25163            params.remove_params(&to_remove);
25164        }
25165
25166        let url = params.parse_with_url(&url);
25167
25168        loop {
25169            let token = match self
25170                .hub
25171                .auth
25172                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25173                .await
25174            {
25175                Ok(token) => token,
25176                Err(e) => match dlg.token(e) {
25177                    Ok(token) => token,
25178                    Err(e) => {
25179                        dlg.finished(false);
25180                        return Err(common::Error::MissingToken(e));
25181                    }
25182                },
25183            };
25184            let mut req_result = {
25185                let client = &self.hub.client;
25186                dlg.pre_request();
25187                let mut req_builder = hyper::Request::builder()
25188                    .method(hyper::Method::DELETE)
25189                    .uri(url.as_str())
25190                    .header(USER_AGENT, self.hub._user_agent.clone());
25191
25192                if let Some(token) = token.as_ref() {
25193                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25194                }
25195
25196                let request = req_builder
25197                    .header(CONTENT_LENGTH, 0_u64)
25198                    .body(common::to_body::<String>(None));
25199
25200                client.request(request.unwrap()).await
25201            };
25202
25203            match req_result {
25204                Err(err) => {
25205                    if let common::Retry::After(d) = dlg.http_error(&err) {
25206                        sleep(d).await;
25207                        continue;
25208                    }
25209                    dlg.finished(false);
25210                    return Err(common::Error::HttpError(err));
25211                }
25212                Ok(res) => {
25213                    let (mut parts, body) = res.into_parts();
25214                    let mut body = common::Body::new(body);
25215                    if !parts.status.is_success() {
25216                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25217                        let error = serde_json::from_str(&common::to_string(&bytes));
25218                        let response = common::to_response(parts, bytes.into());
25219
25220                        if let common::Retry::After(d) =
25221                            dlg.http_failure(&response, error.as_ref().ok())
25222                        {
25223                            sleep(d).await;
25224                            continue;
25225                        }
25226
25227                        dlg.finished(false);
25228
25229                        return Err(match error {
25230                            Ok(value) => common::Error::BadRequest(value),
25231                            _ => common::Error::Failure(response),
25232                        });
25233                    }
25234                    let response = {
25235                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25236                        let encoded = common::to_string(&bytes);
25237                        match serde_json::from_str(&encoded) {
25238                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25239                            Err(error) => {
25240                                dlg.response_json_decode_error(&encoded, &error);
25241                                return Err(common::Error::JsonDecodeError(
25242                                    encoded.to_string(),
25243                                    error,
25244                                ));
25245                            }
25246                        }
25247                    };
25248
25249                    dlg.finished(true);
25250                    return Ok(response);
25251                }
25252            }
25253        }
25254    }
25255
25256    /// The name of the operation resource to be deleted.
25257    ///
25258    /// Sets the *name* path property to the given value.
25259    ///
25260    /// Even though the property as already been set when instantiating this call,
25261    /// we provide this method for API completeness.
25262    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationDeleteCall<'a, C> {
25263        self._name = new_value.to_string();
25264        self
25265    }
25266    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25267    /// while executing the actual API request.
25268    ///
25269    /// ````text
25270    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
25271    /// ````
25272    ///
25273    /// Sets the *delegate* property to the given value.
25274    pub fn delegate(
25275        mut self,
25276        new_value: &'a mut dyn common::Delegate,
25277    ) -> ProjectLocationOperationDeleteCall<'a, C> {
25278        self._delegate = Some(new_value);
25279        self
25280    }
25281
25282    /// Set any additional parameter of the query string used in the request.
25283    /// It should be used to set parameters which are not yet available through their own
25284    /// setters.
25285    ///
25286    /// Please note that this method must not be used to set any of the known parameters
25287    /// which have their own setter method. If done anyway, the request will fail.
25288    ///
25289    /// # Additional Parameters
25290    ///
25291    /// * *$.xgafv* (query-string) - V1 error format.
25292    /// * *access_token* (query-string) - OAuth access token.
25293    /// * *alt* (query-string) - Data format for response.
25294    /// * *callback* (query-string) - JSONP
25295    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25296    /// * *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.
25297    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25298    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25299    /// * *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.
25300    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25301    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25302    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationDeleteCall<'a, C>
25303    where
25304        T: AsRef<str>,
25305    {
25306        self._additional_params
25307            .insert(name.as_ref().to_string(), value.as_ref().to_string());
25308        self
25309    }
25310
25311    /// Identifies the authorization scope for the method you are building.
25312    ///
25313    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25314    /// [`Scope::CloudPlatform`].
25315    ///
25316    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25317    /// tokens for more than one scope.
25318    ///
25319    /// Usually there is more than one suitable scope to authorize an operation, some of which may
25320    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25321    /// sufficient, a read-write scope will do as well.
25322    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationDeleteCall<'a, C>
25323    where
25324        St: AsRef<str>,
25325    {
25326        self._scopes.insert(String::from(scope.as_ref()));
25327        self
25328    }
25329    /// Identifies the authorization scope(s) for the method you are building.
25330    ///
25331    /// See [`Self::add_scope()`] for details.
25332    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationDeleteCall<'a, C>
25333    where
25334        I: IntoIterator<Item = St>,
25335        St: AsRef<str>,
25336    {
25337        self._scopes
25338            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25339        self
25340    }
25341
25342    /// Removes all scopes, and no default scope will be used either.
25343    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25344    /// for details).
25345    pub fn clear_scopes(mut self) -> ProjectLocationOperationDeleteCall<'a, C> {
25346        self._scopes.clear();
25347        self
25348    }
25349}
25350
25351/// 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.
25352///
25353/// A builder for the *locations.operations.get* method supported by a *project* resource.
25354/// It is not used directly, but through a [`ProjectMethods`] instance.
25355///
25356/// # Example
25357///
25358/// Instantiate a resource method builder
25359///
25360/// ```test_harness,no_run
25361/// # extern crate hyper;
25362/// # extern crate hyper_rustls;
25363/// # extern crate google_connectors1 as connectors1;
25364/// # async fn dox() {
25365/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25366///
25367/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25368/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
25369/// #     .with_native_roots()
25370/// #     .unwrap()
25371/// #     .https_only()
25372/// #     .enable_http2()
25373/// #     .build();
25374///
25375/// # let executor = hyper_util::rt::TokioExecutor::new();
25376/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
25377/// #     secret,
25378/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25379/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
25380/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
25381/// #     ),
25382/// # ).build().await.unwrap();
25383///
25384/// # let client = hyper_util::client::legacy::Client::builder(
25385/// #     hyper_util::rt::TokioExecutor::new()
25386/// # )
25387/// # .build(
25388/// #     hyper_rustls::HttpsConnectorBuilder::new()
25389/// #         .with_native_roots()
25390/// #         .unwrap()
25391/// #         .https_or_http()
25392/// #         .enable_http2()
25393/// #         .build()
25394/// # );
25395/// # let mut hub = Connectors::new(client, auth);
25396/// // You can configure optional parameters by calling the respective setters at will, and
25397/// // execute the final call using `doit()`.
25398/// // Values shown here are possibly random and not representative !
25399/// let result = hub.projects().locations_operations_get("name")
25400///              .doit().await;
25401/// # }
25402/// ```
25403pub struct ProjectLocationOperationGetCall<'a, C>
25404where
25405    C: 'a,
25406{
25407    hub: &'a Connectors<C>,
25408    _name: String,
25409    _delegate: Option<&'a mut dyn common::Delegate>,
25410    _additional_params: HashMap<String, String>,
25411    _scopes: BTreeSet<String>,
25412}
25413
25414impl<'a, C> common::CallBuilder for ProjectLocationOperationGetCall<'a, C> {}
25415
25416impl<'a, C> ProjectLocationOperationGetCall<'a, C>
25417where
25418    C: common::Connector,
25419{
25420    /// Perform the operation you have build so far.
25421    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
25422        use std::borrow::Cow;
25423        use std::io::{Read, Seek};
25424
25425        use common::{url::Params, ToParts};
25426        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25427
25428        let mut dd = common::DefaultDelegate;
25429        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25430        dlg.begin(common::MethodInfo {
25431            id: "connectors.projects.locations.operations.get",
25432            http_method: hyper::Method::GET,
25433        });
25434
25435        for &field in ["alt", "name"].iter() {
25436            if self._additional_params.contains_key(field) {
25437                dlg.finished(false);
25438                return Err(common::Error::FieldClash(field));
25439            }
25440        }
25441
25442        let mut params = Params::with_capacity(3 + self._additional_params.len());
25443        params.push("name", self._name);
25444
25445        params.extend(self._additional_params.iter());
25446
25447        params.push("alt", "json");
25448        let mut url = self.hub._base_url.clone() + "v1/{+name}";
25449        if self._scopes.is_empty() {
25450            self._scopes
25451                .insert(Scope::CloudPlatform.as_ref().to_string());
25452        }
25453
25454        #[allow(clippy::single_element_loop)]
25455        for &(find_this, param_name) in [("{+name}", "name")].iter() {
25456            url = params.uri_replacement(url, param_name, find_this, true);
25457        }
25458        {
25459            let to_remove = ["name"];
25460            params.remove_params(&to_remove);
25461        }
25462
25463        let url = params.parse_with_url(&url);
25464
25465        loop {
25466            let token = match self
25467                .hub
25468                .auth
25469                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25470                .await
25471            {
25472                Ok(token) => token,
25473                Err(e) => match dlg.token(e) {
25474                    Ok(token) => token,
25475                    Err(e) => {
25476                        dlg.finished(false);
25477                        return Err(common::Error::MissingToken(e));
25478                    }
25479                },
25480            };
25481            let mut req_result = {
25482                let client = &self.hub.client;
25483                dlg.pre_request();
25484                let mut req_builder = hyper::Request::builder()
25485                    .method(hyper::Method::GET)
25486                    .uri(url.as_str())
25487                    .header(USER_AGENT, self.hub._user_agent.clone());
25488
25489                if let Some(token) = token.as_ref() {
25490                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25491                }
25492
25493                let request = req_builder
25494                    .header(CONTENT_LENGTH, 0_u64)
25495                    .body(common::to_body::<String>(None));
25496
25497                client.request(request.unwrap()).await
25498            };
25499
25500            match req_result {
25501                Err(err) => {
25502                    if let common::Retry::After(d) = dlg.http_error(&err) {
25503                        sleep(d).await;
25504                        continue;
25505                    }
25506                    dlg.finished(false);
25507                    return Err(common::Error::HttpError(err));
25508                }
25509                Ok(res) => {
25510                    let (mut parts, body) = res.into_parts();
25511                    let mut body = common::Body::new(body);
25512                    if !parts.status.is_success() {
25513                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25514                        let error = serde_json::from_str(&common::to_string(&bytes));
25515                        let response = common::to_response(parts, bytes.into());
25516
25517                        if let common::Retry::After(d) =
25518                            dlg.http_failure(&response, error.as_ref().ok())
25519                        {
25520                            sleep(d).await;
25521                            continue;
25522                        }
25523
25524                        dlg.finished(false);
25525
25526                        return Err(match error {
25527                            Ok(value) => common::Error::BadRequest(value),
25528                            _ => common::Error::Failure(response),
25529                        });
25530                    }
25531                    let response = {
25532                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25533                        let encoded = common::to_string(&bytes);
25534                        match serde_json::from_str(&encoded) {
25535                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25536                            Err(error) => {
25537                                dlg.response_json_decode_error(&encoded, &error);
25538                                return Err(common::Error::JsonDecodeError(
25539                                    encoded.to_string(),
25540                                    error,
25541                                ));
25542                            }
25543                        }
25544                    };
25545
25546                    dlg.finished(true);
25547                    return Ok(response);
25548                }
25549            }
25550        }
25551    }
25552
25553    /// The name of the operation resource.
25554    ///
25555    /// Sets the *name* path property to the given value.
25556    ///
25557    /// Even though the property as already been set when instantiating this call,
25558    /// we provide this method for API completeness.
25559    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
25560        self._name = new_value.to_string();
25561        self
25562    }
25563    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25564    /// while executing the actual API request.
25565    ///
25566    /// ````text
25567    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
25568    /// ````
25569    ///
25570    /// Sets the *delegate* property to the given value.
25571    pub fn delegate(
25572        mut self,
25573        new_value: &'a mut dyn common::Delegate,
25574    ) -> ProjectLocationOperationGetCall<'a, C> {
25575        self._delegate = Some(new_value);
25576        self
25577    }
25578
25579    /// Set any additional parameter of the query string used in the request.
25580    /// It should be used to set parameters which are not yet available through their own
25581    /// setters.
25582    ///
25583    /// Please note that this method must not be used to set any of the known parameters
25584    /// which have their own setter method. If done anyway, the request will fail.
25585    ///
25586    /// # Additional Parameters
25587    ///
25588    /// * *$.xgafv* (query-string) - V1 error format.
25589    /// * *access_token* (query-string) - OAuth access token.
25590    /// * *alt* (query-string) - Data format for response.
25591    /// * *callback* (query-string) - JSONP
25592    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25593    /// * *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.
25594    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25595    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25596    /// * *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.
25597    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25598    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25599    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationGetCall<'a, C>
25600    where
25601        T: AsRef<str>,
25602    {
25603        self._additional_params
25604            .insert(name.as_ref().to_string(), value.as_ref().to_string());
25605        self
25606    }
25607
25608    /// Identifies the authorization scope for the method you are building.
25609    ///
25610    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25611    /// [`Scope::CloudPlatform`].
25612    ///
25613    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25614    /// tokens for more than one scope.
25615    ///
25616    /// Usually there is more than one suitable scope to authorize an operation, some of which may
25617    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25618    /// sufficient, a read-write scope will do as well.
25619    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationGetCall<'a, C>
25620    where
25621        St: AsRef<str>,
25622    {
25623        self._scopes.insert(String::from(scope.as_ref()));
25624        self
25625    }
25626    /// Identifies the authorization scope(s) for the method you are building.
25627    ///
25628    /// See [`Self::add_scope()`] for details.
25629    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationGetCall<'a, C>
25630    where
25631        I: IntoIterator<Item = St>,
25632        St: AsRef<str>,
25633    {
25634        self._scopes
25635            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25636        self
25637    }
25638
25639    /// Removes all scopes, and no default scope will be used either.
25640    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25641    /// for details).
25642    pub fn clear_scopes(mut self) -> ProjectLocationOperationGetCall<'a, C> {
25643        self._scopes.clear();
25644        self
25645    }
25646}
25647
25648/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
25649///
25650/// A builder for the *locations.operations.list* method supported by a *project* resource.
25651/// It is not used directly, but through a [`ProjectMethods`] instance.
25652///
25653/// # Example
25654///
25655/// Instantiate a resource method builder
25656///
25657/// ```test_harness,no_run
25658/// # extern crate hyper;
25659/// # extern crate hyper_rustls;
25660/// # extern crate google_connectors1 as connectors1;
25661/// # async fn dox() {
25662/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25663///
25664/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25665/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
25666/// #     .with_native_roots()
25667/// #     .unwrap()
25668/// #     .https_only()
25669/// #     .enable_http2()
25670/// #     .build();
25671///
25672/// # let executor = hyper_util::rt::TokioExecutor::new();
25673/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
25674/// #     secret,
25675/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25676/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
25677/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
25678/// #     ),
25679/// # ).build().await.unwrap();
25680///
25681/// # let client = hyper_util::client::legacy::Client::builder(
25682/// #     hyper_util::rt::TokioExecutor::new()
25683/// # )
25684/// # .build(
25685/// #     hyper_rustls::HttpsConnectorBuilder::new()
25686/// #         .with_native_roots()
25687/// #         .unwrap()
25688/// #         .https_or_http()
25689/// #         .enable_http2()
25690/// #         .build()
25691/// # );
25692/// # let mut hub = Connectors::new(client, auth);
25693/// // You can configure optional parameters by calling the respective setters at will, and
25694/// // execute the final call using `doit()`.
25695/// // Values shown here are possibly random and not representative !
25696/// let result = hub.projects().locations_operations_list("name")
25697///              .return_partial_success(true)
25698///              .page_token("sadipscing")
25699///              .page_size(-31)
25700///              .filter("aliquyam")
25701///              .doit().await;
25702/// # }
25703/// ```
25704pub struct ProjectLocationOperationListCall<'a, C>
25705where
25706    C: 'a,
25707{
25708    hub: &'a Connectors<C>,
25709    _name: String,
25710    _return_partial_success: Option<bool>,
25711    _page_token: Option<String>,
25712    _page_size: Option<i32>,
25713    _filter: Option<String>,
25714    _delegate: Option<&'a mut dyn common::Delegate>,
25715    _additional_params: HashMap<String, String>,
25716    _scopes: BTreeSet<String>,
25717}
25718
25719impl<'a, C> common::CallBuilder for ProjectLocationOperationListCall<'a, C> {}
25720
25721impl<'a, C> ProjectLocationOperationListCall<'a, C>
25722where
25723    C: common::Connector,
25724{
25725    /// Perform the operation you have build so far.
25726    pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
25727        use std::borrow::Cow;
25728        use std::io::{Read, Seek};
25729
25730        use common::{url::Params, ToParts};
25731        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25732
25733        let mut dd = common::DefaultDelegate;
25734        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25735        dlg.begin(common::MethodInfo {
25736            id: "connectors.projects.locations.operations.list",
25737            http_method: hyper::Method::GET,
25738        });
25739
25740        for &field in [
25741            "alt",
25742            "name",
25743            "returnPartialSuccess",
25744            "pageToken",
25745            "pageSize",
25746            "filter",
25747        ]
25748        .iter()
25749        {
25750            if self._additional_params.contains_key(field) {
25751                dlg.finished(false);
25752                return Err(common::Error::FieldClash(field));
25753            }
25754        }
25755
25756        let mut params = Params::with_capacity(7 + self._additional_params.len());
25757        params.push("name", self._name);
25758        if let Some(value) = self._return_partial_success.as_ref() {
25759            params.push("returnPartialSuccess", value.to_string());
25760        }
25761        if let Some(value) = self._page_token.as_ref() {
25762            params.push("pageToken", value);
25763        }
25764        if let Some(value) = self._page_size.as_ref() {
25765            params.push("pageSize", value.to_string());
25766        }
25767        if let Some(value) = self._filter.as_ref() {
25768            params.push("filter", value);
25769        }
25770
25771        params.extend(self._additional_params.iter());
25772
25773        params.push("alt", "json");
25774        let mut url = self.hub._base_url.clone() + "v1/{+name}/operations";
25775        if self._scopes.is_empty() {
25776            self._scopes
25777                .insert(Scope::CloudPlatform.as_ref().to_string());
25778        }
25779
25780        #[allow(clippy::single_element_loop)]
25781        for &(find_this, param_name) in [("{+name}", "name")].iter() {
25782            url = params.uri_replacement(url, param_name, find_this, true);
25783        }
25784        {
25785            let to_remove = ["name"];
25786            params.remove_params(&to_remove);
25787        }
25788
25789        let url = params.parse_with_url(&url);
25790
25791        loop {
25792            let token = match self
25793                .hub
25794                .auth
25795                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25796                .await
25797            {
25798                Ok(token) => token,
25799                Err(e) => match dlg.token(e) {
25800                    Ok(token) => token,
25801                    Err(e) => {
25802                        dlg.finished(false);
25803                        return Err(common::Error::MissingToken(e));
25804                    }
25805                },
25806            };
25807            let mut req_result = {
25808                let client = &self.hub.client;
25809                dlg.pre_request();
25810                let mut req_builder = hyper::Request::builder()
25811                    .method(hyper::Method::GET)
25812                    .uri(url.as_str())
25813                    .header(USER_AGENT, self.hub._user_agent.clone());
25814
25815                if let Some(token) = token.as_ref() {
25816                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25817                }
25818
25819                let request = req_builder
25820                    .header(CONTENT_LENGTH, 0_u64)
25821                    .body(common::to_body::<String>(None));
25822
25823                client.request(request.unwrap()).await
25824            };
25825
25826            match req_result {
25827                Err(err) => {
25828                    if let common::Retry::After(d) = dlg.http_error(&err) {
25829                        sleep(d).await;
25830                        continue;
25831                    }
25832                    dlg.finished(false);
25833                    return Err(common::Error::HttpError(err));
25834                }
25835                Ok(res) => {
25836                    let (mut parts, body) = res.into_parts();
25837                    let mut body = common::Body::new(body);
25838                    if !parts.status.is_success() {
25839                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25840                        let error = serde_json::from_str(&common::to_string(&bytes));
25841                        let response = common::to_response(parts, bytes.into());
25842
25843                        if let common::Retry::After(d) =
25844                            dlg.http_failure(&response, error.as_ref().ok())
25845                        {
25846                            sleep(d).await;
25847                            continue;
25848                        }
25849
25850                        dlg.finished(false);
25851
25852                        return Err(match error {
25853                            Ok(value) => common::Error::BadRequest(value),
25854                            _ => common::Error::Failure(response),
25855                        });
25856                    }
25857                    let response = {
25858                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25859                        let encoded = common::to_string(&bytes);
25860                        match serde_json::from_str(&encoded) {
25861                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25862                            Err(error) => {
25863                                dlg.response_json_decode_error(&encoded, &error);
25864                                return Err(common::Error::JsonDecodeError(
25865                                    encoded.to_string(),
25866                                    error,
25867                                ));
25868                            }
25869                        }
25870                    };
25871
25872                    dlg.finished(true);
25873                    return Ok(response);
25874                }
25875            }
25876        }
25877    }
25878
25879    /// The name of the operation's parent resource.
25880    ///
25881    /// Sets the *name* path property to the given value.
25882    ///
25883    /// Even though the property as already been set when instantiating this call,
25884    /// we provide this method for API completeness.
25885    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
25886        self._name = new_value.to_string();
25887        self
25888    }
25889    /// 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 e.g. when `parent` is set to `"projects/example/locations/-"`. This field is not by default supported and will result in an `UNIMPLEMENTED` error if set unless explicitly documented otherwise in service or product specific documentation.
25890    ///
25891    /// Sets the *return partial success* query property to the given value.
25892    pub fn return_partial_success(
25893        mut self,
25894        new_value: bool,
25895    ) -> ProjectLocationOperationListCall<'a, C> {
25896        self._return_partial_success = Some(new_value);
25897        self
25898    }
25899    /// The standard list page token.
25900    ///
25901    /// Sets the *page token* query property to the given value.
25902    pub fn page_token(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
25903        self._page_token = Some(new_value.to_string());
25904        self
25905    }
25906    /// The standard list page size.
25907    ///
25908    /// Sets the *page size* query property to the given value.
25909    pub fn page_size(mut self, new_value: i32) -> ProjectLocationOperationListCall<'a, C> {
25910        self._page_size = Some(new_value);
25911        self
25912    }
25913    /// The standard list filter.
25914    ///
25915    /// Sets the *filter* query property to the given value.
25916    pub fn filter(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
25917        self._filter = Some(new_value.to_string());
25918        self
25919    }
25920    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25921    /// while executing the actual API request.
25922    ///
25923    /// ````text
25924    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
25925    /// ````
25926    ///
25927    /// Sets the *delegate* property to the given value.
25928    pub fn delegate(
25929        mut self,
25930        new_value: &'a mut dyn common::Delegate,
25931    ) -> ProjectLocationOperationListCall<'a, C> {
25932        self._delegate = Some(new_value);
25933        self
25934    }
25935
25936    /// Set any additional parameter of the query string used in the request.
25937    /// It should be used to set parameters which are not yet available through their own
25938    /// setters.
25939    ///
25940    /// Please note that this method must not be used to set any of the known parameters
25941    /// which have their own setter method. If done anyway, the request will fail.
25942    ///
25943    /// # Additional Parameters
25944    ///
25945    /// * *$.xgafv* (query-string) - V1 error format.
25946    /// * *access_token* (query-string) - OAuth access token.
25947    /// * *alt* (query-string) - Data format for response.
25948    /// * *callback* (query-string) - JSONP
25949    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25950    /// * *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.
25951    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25952    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25953    /// * *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.
25954    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25955    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25956    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationListCall<'a, C>
25957    where
25958        T: AsRef<str>,
25959    {
25960        self._additional_params
25961            .insert(name.as_ref().to_string(), value.as_ref().to_string());
25962        self
25963    }
25964
25965    /// Identifies the authorization scope for the method you are building.
25966    ///
25967    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25968    /// [`Scope::CloudPlatform`].
25969    ///
25970    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25971    /// tokens for more than one scope.
25972    ///
25973    /// Usually there is more than one suitable scope to authorize an operation, some of which may
25974    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25975    /// sufficient, a read-write scope will do as well.
25976    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationListCall<'a, C>
25977    where
25978        St: AsRef<str>,
25979    {
25980        self._scopes.insert(String::from(scope.as_ref()));
25981        self
25982    }
25983    /// Identifies the authorization scope(s) for the method you are building.
25984    ///
25985    /// See [`Self::add_scope()`] for details.
25986    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationListCall<'a, C>
25987    where
25988        I: IntoIterator<Item = St>,
25989        St: AsRef<str>,
25990    {
25991        self._scopes
25992            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25993        self
25994    }
25995
25996    /// Removes all scopes, and no default scope will be used either.
25997    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25998    /// for details).
25999    pub fn clear_scopes(mut self) -> ProjectLocationOperationListCall<'a, C> {
26000        self._scopes.clear();
26001        self
26002    }
26003}
26004
26005/// Gets details of a single event type.
26006///
26007/// A builder for the *locations.providers.connectors.versions.eventtypes.get* method supported by a *project* resource.
26008/// It is not used directly, but through a [`ProjectMethods`] instance.
26009///
26010/// # Example
26011///
26012/// Instantiate a resource method builder
26013///
26014/// ```test_harness,no_run
26015/// # extern crate hyper;
26016/// # extern crate hyper_rustls;
26017/// # extern crate google_connectors1 as connectors1;
26018/// # async fn dox() {
26019/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26020///
26021/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26022/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
26023/// #     .with_native_roots()
26024/// #     .unwrap()
26025/// #     .https_only()
26026/// #     .enable_http2()
26027/// #     .build();
26028///
26029/// # let executor = hyper_util::rt::TokioExecutor::new();
26030/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
26031/// #     secret,
26032/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26033/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
26034/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
26035/// #     ),
26036/// # ).build().await.unwrap();
26037///
26038/// # let client = hyper_util::client::legacy::Client::builder(
26039/// #     hyper_util::rt::TokioExecutor::new()
26040/// # )
26041/// # .build(
26042/// #     hyper_rustls::HttpsConnectorBuilder::new()
26043/// #         .with_native_roots()
26044/// #         .unwrap()
26045/// #         .https_or_http()
26046/// #         .enable_http2()
26047/// #         .build()
26048/// # );
26049/// # let mut hub = Connectors::new(client, auth);
26050/// // You can configure optional parameters by calling the respective setters at will, and
26051/// // execute the final call using `doit()`.
26052/// // Values shown here are possibly random and not representative !
26053/// let result = hub.projects().locations_providers_connectors_versions_eventtypes_get("name")
26054///              .doit().await;
26055/// # }
26056/// ```
26057pub struct ProjectLocationProviderConnectorVersionEventtypeGetCall<'a, C>
26058where
26059    C: 'a,
26060{
26061    hub: &'a Connectors<C>,
26062    _name: String,
26063    _delegate: Option<&'a mut dyn common::Delegate>,
26064    _additional_params: HashMap<String, String>,
26065    _scopes: BTreeSet<String>,
26066}
26067
26068impl<'a, C> common::CallBuilder for ProjectLocationProviderConnectorVersionEventtypeGetCall<'a, C> {}
26069
26070impl<'a, C> ProjectLocationProviderConnectorVersionEventtypeGetCall<'a, C>
26071where
26072    C: common::Connector,
26073{
26074    /// Perform the operation you have build so far.
26075    pub async fn doit(mut self) -> common::Result<(common::Response, EventType)> {
26076        use std::borrow::Cow;
26077        use std::io::{Read, Seek};
26078
26079        use common::{url::Params, ToParts};
26080        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26081
26082        let mut dd = common::DefaultDelegate;
26083        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26084        dlg.begin(common::MethodInfo {
26085            id: "connectors.projects.locations.providers.connectors.versions.eventtypes.get",
26086            http_method: hyper::Method::GET,
26087        });
26088
26089        for &field in ["alt", "name"].iter() {
26090            if self._additional_params.contains_key(field) {
26091                dlg.finished(false);
26092                return Err(common::Error::FieldClash(field));
26093            }
26094        }
26095
26096        let mut params = Params::with_capacity(3 + self._additional_params.len());
26097        params.push("name", self._name);
26098
26099        params.extend(self._additional_params.iter());
26100
26101        params.push("alt", "json");
26102        let mut url = self.hub._base_url.clone() + "v1/{+name}";
26103        if self._scopes.is_empty() {
26104            self._scopes
26105                .insert(Scope::CloudPlatform.as_ref().to_string());
26106        }
26107
26108        #[allow(clippy::single_element_loop)]
26109        for &(find_this, param_name) in [("{+name}", "name")].iter() {
26110            url = params.uri_replacement(url, param_name, find_this, true);
26111        }
26112        {
26113            let to_remove = ["name"];
26114            params.remove_params(&to_remove);
26115        }
26116
26117        let url = params.parse_with_url(&url);
26118
26119        loop {
26120            let token = match self
26121                .hub
26122                .auth
26123                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26124                .await
26125            {
26126                Ok(token) => token,
26127                Err(e) => match dlg.token(e) {
26128                    Ok(token) => token,
26129                    Err(e) => {
26130                        dlg.finished(false);
26131                        return Err(common::Error::MissingToken(e));
26132                    }
26133                },
26134            };
26135            let mut req_result = {
26136                let client = &self.hub.client;
26137                dlg.pre_request();
26138                let mut req_builder = hyper::Request::builder()
26139                    .method(hyper::Method::GET)
26140                    .uri(url.as_str())
26141                    .header(USER_AGENT, self.hub._user_agent.clone());
26142
26143                if let Some(token) = token.as_ref() {
26144                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26145                }
26146
26147                let request = req_builder
26148                    .header(CONTENT_LENGTH, 0_u64)
26149                    .body(common::to_body::<String>(None));
26150
26151                client.request(request.unwrap()).await
26152            };
26153
26154            match req_result {
26155                Err(err) => {
26156                    if let common::Retry::After(d) = dlg.http_error(&err) {
26157                        sleep(d).await;
26158                        continue;
26159                    }
26160                    dlg.finished(false);
26161                    return Err(common::Error::HttpError(err));
26162                }
26163                Ok(res) => {
26164                    let (mut parts, body) = res.into_parts();
26165                    let mut body = common::Body::new(body);
26166                    if !parts.status.is_success() {
26167                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26168                        let error = serde_json::from_str(&common::to_string(&bytes));
26169                        let response = common::to_response(parts, bytes.into());
26170
26171                        if let common::Retry::After(d) =
26172                            dlg.http_failure(&response, error.as_ref().ok())
26173                        {
26174                            sleep(d).await;
26175                            continue;
26176                        }
26177
26178                        dlg.finished(false);
26179
26180                        return Err(match error {
26181                            Ok(value) => common::Error::BadRequest(value),
26182                            _ => common::Error::Failure(response),
26183                        });
26184                    }
26185                    let response = {
26186                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26187                        let encoded = common::to_string(&bytes);
26188                        match serde_json::from_str(&encoded) {
26189                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26190                            Err(error) => {
26191                                dlg.response_json_decode_error(&encoded, &error);
26192                                return Err(common::Error::JsonDecodeError(
26193                                    encoded.to_string(),
26194                                    error,
26195                                ));
26196                            }
26197                        }
26198                    };
26199
26200                    dlg.finished(true);
26201                    return Ok(response);
26202                }
26203            }
26204        }
26205    }
26206
26207    /// Required. Resource name of the form: `projects/*/locations/*/providers/*/connectors/*/versions/*/eventtypes/*` Only global location is supported for EventType resource.
26208    ///
26209    /// Sets the *name* path property to the given value.
26210    ///
26211    /// Even though the property as already been set when instantiating this call,
26212    /// we provide this method for API completeness.
26213    pub fn name(
26214        mut self,
26215        new_value: &str,
26216    ) -> ProjectLocationProviderConnectorVersionEventtypeGetCall<'a, C> {
26217        self._name = new_value.to_string();
26218        self
26219    }
26220    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26221    /// while executing the actual API request.
26222    ///
26223    /// ````text
26224    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
26225    /// ````
26226    ///
26227    /// Sets the *delegate* property to the given value.
26228    pub fn delegate(
26229        mut self,
26230        new_value: &'a mut dyn common::Delegate,
26231    ) -> ProjectLocationProviderConnectorVersionEventtypeGetCall<'a, C> {
26232        self._delegate = Some(new_value);
26233        self
26234    }
26235
26236    /// Set any additional parameter of the query string used in the request.
26237    /// It should be used to set parameters which are not yet available through their own
26238    /// setters.
26239    ///
26240    /// Please note that this method must not be used to set any of the known parameters
26241    /// which have their own setter method. If done anyway, the request will fail.
26242    ///
26243    /// # Additional Parameters
26244    ///
26245    /// * *$.xgafv* (query-string) - V1 error format.
26246    /// * *access_token* (query-string) - OAuth access token.
26247    /// * *alt* (query-string) - Data format for response.
26248    /// * *callback* (query-string) - JSONP
26249    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26250    /// * *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.
26251    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26252    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26253    /// * *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.
26254    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26255    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26256    pub fn param<T>(
26257        mut self,
26258        name: T,
26259        value: T,
26260    ) -> ProjectLocationProviderConnectorVersionEventtypeGetCall<'a, C>
26261    where
26262        T: AsRef<str>,
26263    {
26264        self._additional_params
26265            .insert(name.as_ref().to_string(), value.as_ref().to_string());
26266        self
26267    }
26268
26269    /// Identifies the authorization scope for the method you are building.
26270    ///
26271    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26272    /// [`Scope::CloudPlatform`].
26273    ///
26274    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26275    /// tokens for more than one scope.
26276    ///
26277    /// Usually there is more than one suitable scope to authorize an operation, some of which may
26278    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26279    /// sufficient, a read-write scope will do as well.
26280    pub fn add_scope<St>(
26281        mut self,
26282        scope: St,
26283    ) -> ProjectLocationProviderConnectorVersionEventtypeGetCall<'a, C>
26284    where
26285        St: AsRef<str>,
26286    {
26287        self._scopes.insert(String::from(scope.as_ref()));
26288        self
26289    }
26290    /// Identifies the authorization scope(s) for the method you are building.
26291    ///
26292    /// See [`Self::add_scope()`] for details.
26293    pub fn add_scopes<I, St>(
26294        mut self,
26295        scopes: I,
26296    ) -> ProjectLocationProviderConnectorVersionEventtypeGetCall<'a, C>
26297    where
26298        I: IntoIterator<Item = St>,
26299        St: AsRef<str>,
26300    {
26301        self._scopes
26302            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26303        self
26304    }
26305
26306    /// Removes all scopes, and no default scope will be used either.
26307    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26308    /// for details).
26309    pub fn clear_scopes(
26310        mut self,
26311    ) -> ProjectLocationProviderConnectorVersionEventtypeGetCall<'a, C> {
26312        self._scopes.clear();
26313        self
26314    }
26315}
26316
26317/// Lists Event Types in a given Connector Version.
26318///
26319/// A builder for the *locations.providers.connectors.versions.eventtypes.list* method supported by a *project* resource.
26320/// It is not used directly, but through a [`ProjectMethods`] instance.
26321///
26322/// # Example
26323///
26324/// Instantiate a resource method builder
26325///
26326/// ```test_harness,no_run
26327/// # extern crate hyper;
26328/// # extern crate hyper_rustls;
26329/// # extern crate google_connectors1 as connectors1;
26330/// # async fn dox() {
26331/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26332///
26333/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26334/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
26335/// #     .with_native_roots()
26336/// #     .unwrap()
26337/// #     .https_only()
26338/// #     .enable_http2()
26339/// #     .build();
26340///
26341/// # let executor = hyper_util::rt::TokioExecutor::new();
26342/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
26343/// #     secret,
26344/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26345/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
26346/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
26347/// #     ),
26348/// # ).build().await.unwrap();
26349///
26350/// # let client = hyper_util::client::legacy::Client::builder(
26351/// #     hyper_util::rt::TokioExecutor::new()
26352/// # )
26353/// # .build(
26354/// #     hyper_rustls::HttpsConnectorBuilder::new()
26355/// #         .with_native_roots()
26356/// #         .unwrap()
26357/// #         .https_or_http()
26358/// #         .enable_http2()
26359/// #         .build()
26360/// # );
26361/// # let mut hub = Connectors::new(client, auth);
26362/// // You can configure optional parameters by calling the respective setters at will, and
26363/// // execute the final call using `doit()`.
26364/// // Values shown here are possibly random and not representative !
26365/// let result = hub.projects().locations_providers_connectors_versions_eventtypes_list("parent")
26366///              .page_token("et")
26367///              .page_size(-10)
26368///              .doit().await;
26369/// # }
26370/// ```
26371pub struct ProjectLocationProviderConnectorVersionEventtypeListCall<'a, C>
26372where
26373    C: 'a,
26374{
26375    hub: &'a Connectors<C>,
26376    _parent: String,
26377    _page_token: Option<String>,
26378    _page_size: Option<i32>,
26379    _delegate: Option<&'a mut dyn common::Delegate>,
26380    _additional_params: HashMap<String, String>,
26381    _scopes: BTreeSet<String>,
26382}
26383
26384impl<'a, C> common::CallBuilder
26385    for ProjectLocationProviderConnectorVersionEventtypeListCall<'a, C>
26386{
26387}
26388
26389impl<'a, C> ProjectLocationProviderConnectorVersionEventtypeListCall<'a, C>
26390where
26391    C: common::Connector,
26392{
26393    /// Perform the operation you have build so far.
26394    pub async fn doit(mut self) -> common::Result<(common::Response, ListEventTypesResponse)> {
26395        use std::borrow::Cow;
26396        use std::io::{Read, Seek};
26397
26398        use common::{url::Params, ToParts};
26399        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26400
26401        let mut dd = common::DefaultDelegate;
26402        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26403        dlg.begin(common::MethodInfo {
26404            id: "connectors.projects.locations.providers.connectors.versions.eventtypes.list",
26405            http_method: hyper::Method::GET,
26406        });
26407
26408        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
26409            if self._additional_params.contains_key(field) {
26410                dlg.finished(false);
26411                return Err(common::Error::FieldClash(field));
26412            }
26413        }
26414
26415        let mut params = Params::with_capacity(5 + self._additional_params.len());
26416        params.push("parent", self._parent);
26417        if let Some(value) = self._page_token.as_ref() {
26418            params.push("pageToken", value);
26419        }
26420        if let Some(value) = self._page_size.as_ref() {
26421            params.push("pageSize", value.to_string());
26422        }
26423
26424        params.extend(self._additional_params.iter());
26425
26426        params.push("alt", "json");
26427        let mut url = self.hub._base_url.clone() + "v1/{+parent}/eventtypes";
26428        if self._scopes.is_empty() {
26429            self._scopes
26430                .insert(Scope::CloudPlatform.as_ref().to_string());
26431        }
26432
26433        #[allow(clippy::single_element_loop)]
26434        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
26435            url = params.uri_replacement(url, param_name, find_this, true);
26436        }
26437        {
26438            let to_remove = ["parent"];
26439            params.remove_params(&to_remove);
26440        }
26441
26442        let url = params.parse_with_url(&url);
26443
26444        loop {
26445            let token = match self
26446                .hub
26447                .auth
26448                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26449                .await
26450            {
26451                Ok(token) => token,
26452                Err(e) => match dlg.token(e) {
26453                    Ok(token) => token,
26454                    Err(e) => {
26455                        dlg.finished(false);
26456                        return Err(common::Error::MissingToken(e));
26457                    }
26458                },
26459            };
26460            let mut req_result = {
26461                let client = &self.hub.client;
26462                dlg.pre_request();
26463                let mut req_builder = hyper::Request::builder()
26464                    .method(hyper::Method::GET)
26465                    .uri(url.as_str())
26466                    .header(USER_AGENT, self.hub._user_agent.clone());
26467
26468                if let Some(token) = token.as_ref() {
26469                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26470                }
26471
26472                let request = req_builder
26473                    .header(CONTENT_LENGTH, 0_u64)
26474                    .body(common::to_body::<String>(None));
26475
26476                client.request(request.unwrap()).await
26477            };
26478
26479            match req_result {
26480                Err(err) => {
26481                    if let common::Retry::After(d) = dlg.http_error(&err) {
26482                        sleep(d).await;
26483                        continue;
26484                    }
26485                    dlg.finished(false);
26486                    return Err(common::Error::HttpError(err));
26487                }
26488                Ok(res) => {
26489                    let (mut parts, body) = res.into_parts();
26490                    let mut body = common::Body::new(body);
26491                    if !parts.status.is_success() {
26492                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26493                        let error = serde_json::from_str(&common::to_string(&bytes));
26494                        let response = common::to_response(parts, bytes.into());
26495
26496                        if let common::Retry::After(d) =
26497                            dlg.http_failure(&response, error.as_ref().ok())
26498                        {
26499                            sleep(d).await;
26500                            continue;
26501                        }
26502
26503                        dlg.finished(false);
26504
26505                        return Err(match error {
26506                            Ok(value) => common::Error::BadRequest(value),
26507                            _ => common::Error::Failure(response),
26508                        });
26509                    }
26510                    let response = {
26511                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26512                        let encoded = common::to_string(&bytes);
26513                        match serde_json::from_str(&encoded) {
26514                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26515                            Err(error) => {
26516                                dlg.response_json_decode_error(&encoded, &error);
26517                                return Err(common::Error::JsonDecodeError(
26518                                    encoded.to_string(),
26519                                    error,
26520                                ));
26521                            }
26522                        }
26523                    };
26524
26525                    dlg.finished(true);
26526                    return Ok(response);
26527                }
26528            }
26529        }
26530    }
26531
26532    /// Required. Parent resource of the connectors, of the form: `projects/*/locations/*/providers/*/connectors/*/versions/*` Only global location is supported for EventType resource.
26533    ///
26534    /// Sets the *parent* path property to the given value.
26535    ///
26536    /// Even though the property as already been set when instantiating this call,
26537    /// we provide this method for API completeness.
26538    pub fn parent(
26539        mut self,
26540        new_value: &str,
26541    ) -> ProjectLocationProviderConnectorVersionEventtypeListCall<'a, C> {
26542        self._parent = new_value.to_string();
26543        self
26544    }
26545    /// Page token.
26546    ///
26547    /// Sets the *page token* query property to the given value.
26548    pub fn page_token(
26549        mut self,
26550        new_value: &str,
26551    ) -> ProjectLocationProviderConnectorVersionEventtypeListCall<'a, C> {
26552        self._page_token = Some(new_value.to_string());
26553        self
26554    }
26555    /// Page size.
26556    ///
26557    /// Sets the *page size* query property to the given value.
26558    pub fn page_size(
26559        mut self,
26560        new_value: i32,
26561    ) -> ProjectLocationProviderConnectorVersionEventtypeListCall<'a, C> {
26562        self._page_size = Some(new_value);
26563        self
26564    }
26565    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26566    /// while executing the actual API request.
26567    ///
26568    /// ````text
26569    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
26570    /// ````
26571    ///
26572    /// Sets the *delegate* property to the given value.
26573    pub fn delegate(
26574        mut self,
26575        new_value: &'a mut dyn common::Delegate,
26576    ) -> ProjectLocationProviderConnectorVersionEventtypeListCall<'a, C> {
26577        self._delegate = Some(new_value);
26578        self
26579    }
26580
26581    /// Set any additional parameter of the query string used in the request.
26582    /// It should be used to set parameters which are not yet available through their own
26583    /// setters.
26584    ///
26585    /// Please note that this method must not be used to set any of the known parameters
26586    /// which have their own setter method. If done anyway, the request will fail.
26587    ///
26588    /// # Additional Parameters
26589    ///
26590    /// * *$.xgafv* (query-string) - V1 error format.
26591    /// * *access_token* (query-string) - OAuth access token.
26592    /// * *alt* (query-string) - Data format for response.
26593    /// * *callback* (query-string) - JSONP
26594    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26595    /// * *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.
26596    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26597    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26598    /// * *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.
26599    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26600    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26601    pub fn param<T>(
26602        mut self,
26603        name: T,
26604        value: T,
26605    ) -> ProjectLocationProviderConnectorVersionEventtypeListCall<'a, C>
26606    where
26607        T: AsRef<str>,
26608    {
26609        self._additional_params
26610            .insert(name.as_ref().to_string(), value.as_ref().to_string());
26611        self
26612    }
26613
26614    /// Identifies the authorization scope for the method you are building.
26615    ///
26616    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26617    /// [`Scope::CloudPlatform`].
26618    ///
26619    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26620    /// tokens for more than one scope.
26621    ///
26622    /// Usually there is more than one suitable scope to authorize an operation, some of which may
26623    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26624    /// sufficient, a read-write scope will do as well.
26625    pub fn add_scope<St>(
26626        mut self,
26627        scope: St,
26628    ) -> ProjectLocationProviderConnectorVersionEventtypeListCall<'a, C>
26629    where
26630        St: AsRef<str>,
26631    {
26632        self._scopes.insert(String::from(scope.as_ref()));
26633        self
26634    }
26635    /// Identifies the authorization scope(s) for the method you are building.
26636    ///
26637    /// See [`Self::add_scope()`] for details.
26638    pub fn add_scopes<I, St>(
26639        mut self,
26640        scopes: I,
26641    ) -> ProjectLocationProviderConnectorVersionEventtypeListCall<'a, C>
26642    where
26643        I: IntoIterator<Item = St>,
26644        St: AsRef<str>,
26645    {
26646        self._scopes
26647            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26648        self
26649    }
26650
26651    /// Removes all scopes, and no default scope will be used either.
26652    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26653    /// for details).
26654    pub fn clear_scopes(
26655        mut self,
26656    ) -> ProjectLocationProviderConnectorVersionEventtypeListCall<'a, C> {
26657        self._scopes.clear();
26658        self
26659    }
26660}
26661
26662/// fetch and return the list of auth config variables required to override the connection backend auth.
26663///
26664/// A builder for the *locations.providers.connectors.versions.fetchAuthSchema* method supported by a *project* resource.
26665/// It is not used directly, but through a [`ProjectMethods`] instance.
26666///
26667/// # Example
26668///
26669/// Instantiate a resource method builder
26670///
26671/// ```test_harness,no_run
26672/// # extern crate hyper;
26673/// # extern crate hyper_rustls;
26674/// # extern crate google_connectors1 as connectors1;
26675/// # async fn dox() {
26676/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26677///
26678/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26679/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
26680/// #     .with_native_roots()
26681/// #     .unwrap()
26682/// #     .https_only()
26683/// #     .enable_http2()
26684/// #     .build();
26685///
26686/// # let executor = hyper_util::rt::TokioExecutor::new();
26687/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
26688/// #     secret,
26689/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26690/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
26691/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
26692/// #     ),
26693/// # ).build().await.unwrap();
26694///
26695/// # let client = hyper_util::client::legacy::Client::builder(
26696/// #     hyper_util::rt::TokioExecutor::new()
26697/// # )
26698/// # .build(
26699/// #     hyper_rustls::HttpsConnectorBuilder::new()
26700/// #         .with_native_roots()
26701/// #         .unwrap()
26702/// #         .https_or_http()
26703/// #         .enable_http2()
26704/// #         .build()
26705/// # );
26706/// # let mut hub = Connectors::new(client, auth);
26707/// // You can configure optional parameters by calling the respective setters at will, and
26708/// // execute the final call using `doit()`.
26709/// // Values shown here are possibly random and not representative !
26710/// let result = hub.projects().locations_providers_connectors_versions_fetch_auth_schema("name")
26711///              .view("consetetur")
26712///              .doit().await;
26713/// # }
26714/// ```
26715pub struct ProjectLocationProviderConnectorVersionFetchAuthSchemaCall<'a, C>
26716where
26717    C: 'a,
26718{
26719    hub: &'a Connectors<C>,
26720    _name: String,
26721    _view: Option<String>,
26722    _delegate: Option<&'a mut dyn common::Delegate>,
26723    _additional_params: HashMap<String, String>,
26724    _scopes: BTreeSet<String>,
26725}
26726
26727impl<'a, C> common::CallBuilder
26728    for ProjectLocationProviderConnectorVersionFetchAuthSchemaCall<'a, C>
26729{
26730}
26731
26732impl<'a, C> ProjectLocationProviderConnectorVersionFetchAuthSchemaCall<'a, C>
26733where
26734    C: common::Connector,
26735{
26736    /// Perform the operation you have build so far.
26737    pub async fn doit(mut self) -> common::Result<(common::Response, FetchAuthSchemaResponse)> {
26738        use std::borrow::Cow;
26739        use std::io::{Read, Seek};
26740
26741        use common::{url::Params, ToParts};
26742        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26743
26744        let mut dd = common::DefaultDelegate;
26745        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26746        dlg.begin(common::MethodInfo {
26747            id: "connectors.projects.locations.providers.connectors.versions.fetchAuthSchema",
26748            http_method: hyper::Method::GET,
26749        });
26750
26751        for &field in ["alt", "name", "view"].iter() {
26752            if self._additional_params.contains_key(field) {
26753                dlg.finished(false);
26754                return Err(common::Error::FieldClash(field));
26755            }
26756        }
26757
26758        let mut params = Params::with_capacity(4 + self._additional_params.len());
26759        params.push("name", self._name);
26760        if let Some(value) = self._view.as_ref() {
26761            params.push("view", value);
26762        }
26763
26764        params.extend(self._additional_params.iter());
26765
26766        params.push("alt", "json");
26767        let mut url = self.hub._base_url.clone() + "v1/{+name}:fetchAuthSchema";
26768        if self._scopes.is_empty() {
26769            self._scopes
26770                .insert(Scope::CloudPlatform.as_ref().to_string());
26771        }
26772
26773        #[allow(clippy::single_element_loop)]
26774        for &(find_this, param_name) in [("{+name}", "name")].iter() {
26775            url = params.uri_replacement(url, param_name, find_this, true);
26776        }
26777        {
26778            let to_remove = ["name"];
26779            params.remove_params(&to_remove);
26780        }
26781
26782        let url = params.parse_with_url(&url);
26783
26784        loop {
26785            let token = match self
26786                .hub
26787                .auth
26788                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26789                .await
26790            {
26791                Ok(token) => token,
26792                Err(e) => match dlg.token(e) {
26793                    Ok(token) => token,
26794                    Err(e) => {
26795                        dlg.finished(false);
26796                        return Err(common::Error::MissingToken(e));
26797                    }
26798                },
26799            };
26800            let mut req_result = {
26801                let client = &self.hub.client;
26802                dlg.pre_request();
26803                let mut req_builder = hyper::Request::builder()
26804                    .method(hyper::Method::GET)
26805                    .uri(url.as_str())
26806                    .header(USER_AGENT, self.hub._user_agent.clone());
26807
26808                if let Some(token) = token.as_ref() {
26809                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26810                }
26811
26812                let request = req_builder
26813                    .header(CONTENT_LENGTH, 0_u64)
26814                    .body(common::to_body::<String>(None));
26815
26816                client.request(request.unwrap()).await
26817            };
26818
26819            match req_result {
26820                Err(err) => {
26821                    if let common::Retry::After(d) = dlg.http_error(&err) {
26822                        sleep(d).await;
26823                        continue;
26824                    }
26825                    dlg.finished(false);
26826                    return Err(common::Error::HttpError(err));
26827                }
26828                Ok(res) => {
26829                    let (mut parts, body) = res.into_parts();
26830                    let mut body = common::Body::new(body);
26831                    if !parts.status.is_success() {
26832                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26833                        let error = serde_json::from_str(&common::to_string(&bytes));
26834                        let response = common::to_response(parts, bytes.into());
26835
26836                        if let common::Retry::After(d) =
26837                            dlg.http_failure(&response, error.as_ref().ok())
26838                        {
26839                            sleep(d).await;
26840                            continue;
26841                        }
26842
26843                        dlg.finished(false);
26844
26845                        return Err(match error {
26846                            Ok(value) => common::Error::BadRequest(value),
26847                            _ => common::Error::Failure(response),
26848                        });
26849                    }
26850                    let response = {
26851                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26852                        let encoded = common::to_string(&bytes);
26853                        match serde_json::from_str(&encoded) {
26854                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26855                            Err(error) => {
26856                                dlg.response_json_decode_error(&encoded, &error);
26857                                return Err(common::Error::JsonDecodeError(
26858                                    encoded.to_string(),
26859                                    error,
26860                                ));
26861                            }
26862                        }
26863                    };
26864
26865                    dlg.finished(true);
26866                    return Ok(response);
26867                }
26868            }
26869        }
26870    }
26871
26872    /// Required. Parent resource of the Connector Version, of the form: `projects/*/locations/*/providers/*/connectors/*/versions/*`
26873    ///
26874    /// Sets the *name* path property to the given value.
26875    ///
26876    /// Even though the property as already been set when instantiating this call,
26877    /// we provide this method for API completeness.
26878    pub fn name(
26879        mut self,
26880        new_value: &str,
26881    ) -> ProjectLocationProviderConnectorVersionFetchAuthSchemaCall<'a, C> {
26882        self._name = new_value.to_string();
26883        self
26884    }
26885    /// Optional. View of the AuthSchema. The default value is BASIC.
26886    ///
26887    /// Sets the *view* query property to the given value.
26888    pub fn view(
26889        mut self,
26890        new_value: &str,
26891    ) -> ProjectLocationProviderConnectorVersionFetchAuthSchemaCall<'a, C> {
26892        self._view = Some(new_value.to_string());
26893        self
26894    }
26895    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26896    /// while executing the actual API request.
26897    ///
26898    /// ````text
26899    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
26900    /// ````
26901    ///
26902    /// Sets the *delegate* property to the given value.
26903    pub fn delegate(
26904        mut self,
26905        new_value: &'a mut dyn common::Delegate,
26906    ) -> ProjectLocationProviderConnectorVersionFetchAuthSchemaCall<'a, C> {
26907        self._delegate = Some(new_value);
26908        self
26909    }
26910
26911    /// Set any additional parameter of the query string used in the request.
26912    /// It should be used to set parameters which are not yet available through their own
26913    /// setters.
26914    ///
26915    /// Please note that this method must not be used to set any of the known parameters
26916    /// which have their own setter method. If done anyway, the request will fail.
26917    ///
26918    /// # Additional Parameters
26919    ///
26920    /// * *$.xgafv* (query-string) - V1 error format.
26921    /// * *access_token* (query-string) - OAuth access token.
26922    /// * *alt* (query-string) - Data format for response.
26923    /// * *callback* (query-string) - JSONP
26924    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26925    /// * *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.
26926    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26927    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26928    /// * *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.
26929    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26930    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26931    pub fn param<T>(
26932        mut self,
26933        name: T,
26934        value: T,
26935    ) -> ProjectLocationProviderConnectorVersionFetchAuthSchemaCall<'a, C>
26936    where
26937        T: AsRef<str>,
26938    {
26939        self._additional_params
26940            .insert(name.as_ref().to_string(), value.as_ref().to_string());
26941        self
26942    }
26943
26944    /// Identifies the authorization scope for the method you are building.
26945    ///
26946    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26947    /// [`Scope::CloudPlatform`].
26948    ///
26949    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26950    /// tokens for more than one scope.
26951    ///
26952    /// Usually there is more than one suitable scope to authorize an operation, some of which may
26953    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26954    /// sufficient, a read-write scope will do as well.
26955    pub fn add_scope<St>(
26956        mut self,
26957        scope: St,
26958    ) -> ProjectLocationProviderConnectorVersionFetchAuthSchemaCall<'a, C>
26959    where
26960        St: AsRef<str>,
26961    {
26962        self._scopes.insert(String::from(scope.as_ref()));
26963        self
26964    }
26965    /// Identifies the authorization scope(s) for the method you are building.
26966    ///
26967    /// See [`Self::add_scope()`] for details.
26968    pub fn add_scopes<I, St>(
26969        mut self,
26970        scopes: I,
26971    ) -> ProjectLocationProviderConnectorVersionFetchAuthSchemaCall<'a, C>
26972    where
26973        I: IntoIterator<Item = St>,
26974        St: AsRef<str>,
26975    {
26976        self._scopes
26977            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26978        self
26979    }
26980
26981    /// Removes all scopes, and no default scope will be used either.
26982    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26983    /// for details).
26984    pub fn clear_scopes(
26985        mut self,
26986    ) -> ProjectLocationProviderConnectorVersionFetchAuthSchemaCall<'a, C> {
26987        self._scopes.clear();
26988        self
26989    }
26990}
26991
26992/// Gets details of a single connector version.
26993///
26994/// A builder for the *locations.providers.connectors.versions.get* method supported by a *project* resource.
26995/// It is not used directly, but through a [`ProjectMethods`] instance.
26996///
26997/// # Example
26998///
26999/// Instantiate a resource method builder
27000///
27001/// ```test_harness,no_run
27002/// # extern crate hyper;
27003/// # extern crate hyper_rustls;
27004/// # extern crate google_connectors1 as connectors1;
27005/// # async fn dox() {
27006/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27007///
27008/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27009/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
27010/// #     .with_native_roots()
27011/// #     .unwrap()
27012/// #     .https_only()
27013/// #     .enable_http2()
27014/// #     .build();
27015///
27016/// # let executor = hyper_util::rt::TokioExecutor::new();
27017/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
27018/// #     secret,
27019/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27020/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
27021/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
27022/// #     ),
27023/// # ).build().await.unwrap();
27024///
27025/// # let client = hyper_util::client::legacy::Client::builder(
27026/// #     hyper_util::rt::TokioExecutor::new()
27027/// # )
27028/// # .build(
27029/// #     hyper_rustls::HttpsConnectorBuilder::new()
27030/// #         .with_native_roots()
27031/// #         .unwrap()
27032/// #         .https_or_http()
27033/// #         .enable_http2()
27034/// #         .build()
27035/// # );
27036/// # let mut hub = Connectors::new(client, auth);
27037/// // You can configure optional parameters by calling the respective setters at will, and
27038/// // execute the final call using `doit()`.
27039/// // Values shown here are possibly random and not representative !
27040/// let result = hub.projects().locations_providers_connectors_versions_get("name")
27041///              .view("est")
27042///              .doit().await;
27043/// # }
27044/// ```
27045pub struct ProjectLocationProviderConnectorVersionGetCall<'a, C>
27046where
27047    C: 'a,
27048{
27049    hub: &'a Connectors<C>,
27050    _name: String,
27051    _view: Option<String>,
27052    _delegate: Option<&'a mut dyn common::Delegate>,
27053    _additional_params: HashMap<String, String>,
27054    _scopes: BTreeSet<String>,
27055}
27056
27057impl<'a, C> common::CallBuilder for ProjectLocationProviderConnectorVersionGetCall<'a, C> {}
27058
27059impl<'a, C> ProjectLocationProviderConnectorVersionGetCall<'a, C>
27060where
27061    C: common::Connector,
27062{
27063    /// Perform the operation you have build so far.
27064    pub async fn doit(mut self) -> common::Result<(common::Response, ConnectorVersion)> {
27065        use std::borrow::Cow;
27066        use std::io::{Read, Seek};
27067
27068        use common::{url::Params, ToParts};
27069        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27070
27071        let mut dd = common::DefaultDelegate;
27072        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27073        dlg.begin(common::MethodInfo {
27074            id: "connectors.projects.locations.providers.connectors.versions.get",
27075            http_method: hyper::Method::GET,
27076        });
27077
27078        for &field in ["alt", "name", "view"].iter() {
27079            if self._additional_params.contains_key(field) {
27080                dlg.finished(false);
27081                return Err(common::Error::FieldClash(field));
27082            }
27083        }
27084
27085        let mut params = Params::with_capacity(4 + self._additional_params.len());
27086        params.push("name", self._name);
27087        if let Some(value) = self._view.as_ref() {
27088            params.push("view", value);
27089        }
27090
27091        params.extend(self._additional_params.iter());
27092
27093        params.push("alt", "json");
27094        let mut url = self.hub._base_url.clone() + "v1/{+name}";
27095        if self._scopes.is_empty() {
27096            self._scopes
27097                .insert(Scope::CloudPlatform.as_ref().to_string());
27098        }
27099
27100        #[allow(clippy::single_element_loop)]
27101        for &(find_this, param_name) in [("{+name}", "name")].iter() {
27102            url = params.uri_replacement(url, param_name, find_this, true);
27103        }
27104        {
27105            let to_remove = ["name"];
27106            params.remove_params(&to_remove);
27107        }
27108
27109        let url = params.parse_with_url(&url);
27110
27111        loop {
27112            let token = match self
27113                .hub
27114                .auth
27115                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27116                .await
27117            {
27118                Ok(token) => token,
27119                Err(e) => match dlg.token(e) {
27120                    Ok(token) => token,
27121                    Err(e) => {
27122                        dlg.finished(false);
27123                        return Err(common::Error::MissingToken(e));
27124                    }
27125                },
27126            };
27127            let mut req_result = {
27128                let client = &self.hub.client;
27129                dlg.pre_request();
27130                let mut req_builder = hyper::Request::builder()
27131                    .method(hyper::Method::GET)
27132                    .uri(url.as_str())
27133                    .header(USER_AGENT, self.hub._user_agent.clone());
27134
27135                if let Some(token) = token.as_ref() {
27136                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27137                }
27138
27139                let request = req_builder
27140                    .header(CONTENT_LENGTH, 0_u64)
27141                    .body(common::to_body::<String>(None));
27142
27143                client.request(request.unwrap()).await
27144            };
27145
27146            match req_result {
27147                Err(err) => {
27148                    if let common::Retry::After(d) = dlg.http_error(&err) {
27149                        sleep(d).await;
27150                        continue;
27151                    }
27152                    dlg.finished(false);
27153                    return Err(common::Error::HttpError(err));
27154                }
27155                Ok(res) => {
27156                    let (mut parts, body) = res.into_parts();
27157                    let mut body = common::Body::new(body);
27158                    if !parts.status.is_success() {
27159                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27160                        let error = serde_json::from_str(&common::to_string(&bytes));
27161                        let response = common::to_response(parts, bytes.into());
27162
27163                        if let common::Retry::After(d) =
27164                            dlg.http_failure(&response, error.as_ref().ok())
27165                        {
27166                            sleep(d).await;
27167                            continue;
27168                        }
27169
27170                        dlg.finished(false);
27171
27172                        return Err(match error {
27173                            Ok(value) => common::Error::BadRequest(value),
27174                            _ => common::Error::Failure(response),
27175                        });
27176                    }
27177                    let response = {
27178                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27179                        let encoded = common::to_string(&bytes);
27180                        match serde_json::from_str(&encoded) {
27181                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27182                            Err(error) => {
27183                                dlg.response_json_decode_error(&encoded, &error);
27184                                return Err(common::Error::JsonDecodeError(
27185                                    encoded.to_string(),
27186                                    error,
27187                                ));
27188                            }
27189                        }
27190                    };
27191
27192                    dlg.finished(true);
27193                    return Ok(response);
27194                }
27195            }
27196        }
27197    }
27198
27199    /// Required. Resource name of the form: `projects/*/locations/*/providers/*/connectors/*/versions/*` Only global location is supported for ConnectorVersion resource.
27200    ///
27201    /// Sets the *name* path property to the given value.
27202    ///
27203    /// Even though the property as already been set when instantiating this call,
27204    /// we provide this method for API completeness.
27205    pub fn name(
27206        mut self,
27207        new_value: &str,
27208    ) -> ProjectLocationProviderConnectorVersionGetCall<'a, C> {
27209        self._name = new_value.to_string();
27210        self
27211    }
27212    /// Specifies which fields of the ConnectorVersion are returned in the response. Defaults to `CUSTOMER` view.
27213    ///
27214    /// Sets the *view* query property to the given value.
27215    pub fn view(
27216        mut self,
27217        new_value: &str,
27218    ) -> ProjectLocationProviderConnectorVersionGetCall<'a, C> {
27219        self._view = Some(new_value.to_string());
27220        self
27221    }
27222    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27223    /// while executing the actual API request.
27224    ///
27225    /// ````text
27226    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
27227    /// ````
27228    ///
27229    /// Sets the *delegate* property to the given value.
27230    pub fn delegate(
27231        mut self,
27232        new_value: &'a mut dyn common::Delegate,
27233    ) -> ProjectLocationProviderConnectorVersionGetCall<'a, C> {
27234        self._delegate = Some(new_value);
27235        self
27236    }
27237
27238    /// Set any additional parameter of the query string used in the request.
27239    /// It should be used to set parameters which are not yet available through their own
27240    /// setters.
27241    ///
27242    /// Please note that this method must not be used to set any of the known parameters
27243    /// which have their own setter method. If done anyway, the request will fail.
27244    ///
27245    /// # Additional Parameters
27246    ///
27247    /// * *$.xgafv* (query-string) - V1 error format.
27248    /// * *access_token* (query-string) - OAuth access token.
27249    /// * *alt* (query-string) - Data format for response.
27250    /// * *callback* (query-string) - JSONP
27251    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27252    /// * *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.
27253    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27254    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27255    /// * *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.
27256    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27257    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27258    pub fn param<T>(
27259        mut self,
27260        name: T,
27261        value: T,
27262    ) -> ProjectLocationProviderConnectorVersionGetCall<'a, C>
27263    where
27264        T: AsRef<str>,
27265    {
27266        self._additional_params
27267            .insert(name.as_ref().to_string(), value.as_ref().to_string());
27268        self
27269    }
27270
27271    /// Identifies the authorization scope for the method you are building.
27272    ///
27273    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27274    /// [`Scope::CloudPlatform`].
27275    ///
27276    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27277    /// tokens for more than one scope.
27278    ///
27279    /// Usually there is more than one suitable scope to authorize an operation, some of which may
27280    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27281    /// sufficient, a read-write scope will do as well.
27282    pub fn add_scope<St>(
27283        mut self,
27284        scope: St,
27285    ) -> ProjectLocationProviderConnectorVersionGetCall<'a, C>
27286    where
27287        St: AsRef<str>,
27288    {
27289        self._scopes.insert(String::from(scope.as_ref()));
27290        self
27291    }
27292    /// Identifies the authorization scope(s) for the method you are building.
27293    ///
27294    /// See [`Self::add_scope()`] for details.
27295    pub fn add_scopes<I, St>(
27296        mut self,
27297        scopes: I,
27298    ) -> ProjectLocationProviderConnectorVersionGetCall<'a, C>
27299    where
27300        I: IntoIterator<Item = St>,
27301        St: AsRef<str>,
27302    {
27303        self._scopes
27304            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27305        self
27306    }
27307
27308    /// Removes all scopes, and no default scope will be used either.
27309    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27310    /// for details).
27311    pub fn clear_scopes(mut self) -> ProjectLocationProviderConnectorVersionGetCall<'a, C> {
27312        self._scopes.clear();
27313        self
27314    }
27315}
27316
27317/// Lists Connector Versions in a given project and location.
27318///
27319/// A builder for the *locations.providers.connectors.versions.list* method supported by a *project* resource.
27320/// It is not used directly, but through a [`ProjectMethods`] instance.
27321///
27322/// # Example
27323///
27324/// Instantiate a resource method builder
27325///
27326/// ```test_harness,no_run
27327/// # extern crate hyper;
27328/// # extern crate hyper_rustls;
27329/// # extern crate google_connectors1 as connectors1;
27330/// # async fn dox() {
27331/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27332///
27333/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27334/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
27335/// #     .with_native_roots()
27336/// #     .unwrap()
27337/// #     .https_only()
27338/// #     .enable_http2()
27339/// #     .build();
27340///
27341/// # let executor = hyper_util::rt::TokioExecutor::new();
27342/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
27343/// #     secret,
27344/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27345/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
27346/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
27347/// #     ),
27348/// # ).build().await.unwrap();
27349///
27350/// # let client = hyper_util::client::legacy::Client::builder(
27351/// #     hyper_util::rt::TokioExecutor::new()
27352/// # )
27353/// # .build(
27354/// #     hyper_rustls::HttpsConnectorBuilder::new()
27355/// #         .with_native_roots()
27356/// #         .unwrap()
27357/// #         .https_or_http()
27358/// #         .enable_http2()
27359/// #         .build()
27360/// # );
27361/// # let mut hub = Connectors::new(client, auth);
27362/// // You can configure optional parameters by calling the respective setters at will, and
27363/// // execute the final call using `doit()`.
27364/// // Values shown here are possibly random and not representative !
27365/// let result = hub.projects().locations_providers_connectors_versions_list("parent")
27366///              .view("elitr")
27367///              .page_token("duo")
27368///              .page_size(-42)
27369///              .doit().await;
27370/// # }
27371/// ```
27372pub struct ProjectLocationProviderConnectorVersionListCall<'a, C>
27373where
27374    C: 'a,
27375{
27376    hub: &'a Connectors<C>,
27377    _parent: String,
27378    _view: Option<String>,
27379    _page_token: Option<String>,
27380    _page_size: Option<i32>,
27381    _delegate: Option<&'a mut dyn common::Delegate>,
27382    _additional_params: HashMap<String, String>,
27383    _scopes: BTreeSet<String>,
27384}
27385
27386impl<'a, C> common::CallBuilder for ProjectLocationProviderConnectorVersionListCall<'a, C> {}
27387
27388impl<'a, C> ProjectLocationProviderConnectorVersionListCall<'a, C>
27389where
27390    C: common::Connector,
27391{
27392    /// Perform the operation you have build so far.
27393    pub async fn doit(
27394        mut self,
27395    ) -> common::Result<(common::Response, ListConnectorVersionsResponse)> {
27396        use std::borrow::Cow;
27397        use std::io::{Read, Seek};
27398
27399        use common::{url::Params, ToParts};
27400        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27401
27402        let mut dd = common::DefaultDelegate;
27403        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27404        dlg.begin(common::MethodInfo {
27405            id: "connectors.projects.locations.providers.connectors.versions.list",
27406            http_method: hyper::Method::GET,
27407        });
27408
27409        for &field in ["alt", "parent", "view", "pageToken", "pageSize"].iter() {
27410            if self._additional_params.contains_key(field) {
27411                dlg.finished(false);
27412                return Err(common::Error::FieldClash(field));
27413            }
27414        }
27415
27416        let mut params = Params::with_capacity(6 + self._additional_params.len());
27417        params.push("parent", self._parent);
27418        if let Some(value) = self._view.as_ref() {
27419            params.push("view", value);
27420        }
27421        if let Some(value) = self._page_token.as_ref() {
27422            params.push("pageToken", value);
27423        }
27424        if let Some(value) = self._page_size.as_ref() {
27425            params.push("pageSize", value.to_string());
27426        }
27427
27428        params.extend(self._additional_params.iter());
27429
27430        params.push("alt", "json");
27431        let mut url = self.hub._base_url.clone() + "v1/{+parent}/versions";
27432        if self._scopes.is_empty() {
27433            self._scopes
27434                .insert(Scope::CloudPlatform.as_ref().to_string());
27435        }
27436
27437        #[allow(clippy::single_element_loop)]
27438        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
27439            url = params.uri_replacement(url, param_name, find_this, true);
27440        }
27441        {
27442            let to_remove = ["parent"];
27443            params.remove_params(&to_remove);
27444        }
27445
27446        let url = params.parse_with_url(&url);
27447
27448        loop {
27449            let token = match self
27450                .hub
27451                .auth
27452                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27453                .await
27454            {
27455                Ok(token) => token,
27456                Err(e) => match dlg.token(e) {
27457                    Ok(token) => token,
27458                    Err(e) => {
27459                        dlg.finished(false);
27460                        return Err(common::Error::MissingToken(e));
27461                    }
27462                },
27463            };
27464            let mut req_result = {
27465                let client = &self.hub.client;
27466                dlg.pre_request();
27467                let mut req_builder = hyper::Request::builder()
27468                    .method(hyper::Method::GET)
27469                    .uri(url.as_str())
27470                    .header(USER_AGENT, self.hub._user_agent.clone());
27471
27472                if let Some(token) = token.as_ref() {
27473                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27474                }
27475
27476                let request = req_builder
27477                    .header(CONTENT_LENGTH, 0_u64)
27478                    .body(common::to_body::<String>(None));
27479
27480                client.request(request.unwrap()).await
27481            };
27482
27483            match req_result {
27484                Err(err) => {
27485                    if let common::Retry::After(d) = dlg.http_error(&err) {
27486                        sleep(d).await;
27487                        continue;
27488                    }
27489                    dlg.finished(false);
27490                    return Err(common::Error::HttpError(err));
27491                }
27492                Ok(res) => {
27493                    let (mut parts, body) = res.into_parts();
27494                    let mut body = common::Body::new(body);
27495                    if !parts.status.is_success() {
27496                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27497                        let error = serde_json::from_str(&common::to_string(&bytes));
27498                        let response = common::to_response(parts, bytes.into());
27499
27500                        if let common::Retry::After(d) =
27501                            dlg.http_failure(&response, error.as_ref().ok())
27502                        {
27503                            sleep(d).await;
27504                            continue;
27505                        }
27506
27507                        dlg.finished(false);
27508
27509                        return Err(match error {
27510                            Ok(value) => common::Error::BadRequest(value),
27511                            _ => common::Error::Failure(response),
27512                        });
27513                    }
27514                    let response = {
27515                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27516                        let encoded = common::to_string(&bytes);
27517                        match serde_json::from_str(&encoded) {
27518                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27519                            Err(error) => {
27520                                dlg.response_json_decode_error(&encoded, &error);
27521                                return Err(common::Error::JsonDecodeError(
27522                                    encoded.to_string(),
27523                                    error,
27524                                ));
27525                            }
27526                        }
27527                    };
27528
27529                    dlg.finished(true);
27530                    return Ok(response);
27531                }
27532            }
27533        }
27534    }
27535
27536    ///
27537    /// Sets the *parent* path property to the given value.
27538    ///
27539    /// Even though the property as already been set when instantiating this call,
27540    /// we provide this method for API completeness.
27541    pub fn parent(
27542        mut self,
27543        new_value: &str,
27544    ) -> ProjectLocationProviderConnectorVersionListCall<'a, C> {
27545        self._parent = new_value.to_string();
27546        self
27547    }
27548    /// Specifies which fields of the ConnectorVersion are returned in the response. Defaults to `BASIC` view.
27549    ///
27550    /// Sets the *view* query property to the given value.
27551    pub fn view(
27552        mut self,
27553        new_value: &str,
27554    ) -> ProjectLocationProviderConnectorVersionListCall<'a, C> {
27555        self._view = Some(new_value.to_string());
27556        self
27557    }
27558    /// Page token.
27559    ///
27560    /// Sets the *page token* query property to the given value.
27561    pub fn page_token(
27562        mut self,
27563        new_value: &str,
27564    ) -> ProjectLocationProviderConnectorVersionListCall<'a, C> {
27565        self._page_token = Some(new_value.to_string());
27566        self
27567    }
27568    /// Page size.
27569    ///
27570    /// Sets the *page size* query property to the given value.
27571    pub fn page_size(
27572        mut self,
27573        new_value: i32,
27574    ) -> ProjectLocationProviderConnectorVersionListCall<'a, C> {
27575        self._page_size = Some(new_value);
27576        self
27577    }
27578    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27579    /// while executing the actual API request.
27580    ///
27581    /// ````text
27582    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
27583    /// ````
27584    ///
27585    /// Sets the *delegate* property to the given value.
27586    pub fn delegate(
27587        mut self,
27588        new_value: &'a mut dyn common::Delegate,
27589    ) -> ProjectLocationProviderConnectorVersionListCall<'a, C> {
27590        self._delegate = Some(new_value);
27591        self
27592    }
27593
27594    /// Set any additional parameter of the query string used in the request.
27595    /// It should be used to set parameters which are not yet available through their own
27596    /// setters.
27597    ///
27598    /// Please note that this method must not be used to set any of the known parameters
27599    /// which have their own setter method. If done anyway, the request will fail.
27600    ///
27601    /// # Additional Parameters
27602    ///
27603    /// * *$.xgafv* (query-string) - V1 error format.
27604    /// * *access_token* (query-string) - OAuth access token.
27605    /// * *alt* (query-string) - Data format for response.
27606    /// * *callback* (query-string) - JSONP
27607    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27608    /// * *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.
27609    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27610    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27611    /// * *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.
27612    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27613    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27614    pub fn param<T>(
27615        mut self,
27616        name: T,
27617        value: T,
27618    ) -> ProjectLocationProviderConnectorVersionListCall<'a, C>
27619    where
27620        T: AsRef<str>,
27621    {
27622        self._additional_params
27623            .insert(name.as_ref().to_string(), value.as_ref().to_string());
27624        self
27625    }
27626
27627    /// Identifies the authorization scope for the method you are building.
27628    ///
27629    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27630    /// [`Scope::CloudPlatform`].
27631    ///
27632    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27633    /// tokens for more than one scope.
27634    ///
27635    /// Usually there is more than one suitable scope to authorize an operation, some of which may
27636    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27637    /// sufficient, a read-write scope will do as well.
27638    pub fn add_scope<St>(
27639        mut self,
27640        scope: St,
27641    ) -> ProjectLocationProviderConnectorVersionListCall<'a, C>
27642    where
27643        St: AsRef<str>,
27644    {
27645        self._scopes.insert(String::from(scope.as_ref()));
27646        self
27647    }
27648    /// Identifies the authorization scope(s) for the method you are building.
27649    ///
27650    /// See [`Self::add_scope()`] for details.
27651    pub fn add_scopes<I, St>(
27652        mut self,
27653        scopes: I,
27654    ) -> ProjectLocationProviderConnectorVersionListCall<'a, C>
27655    where
27656        I: IntoIterator<Item = St>,
27657        St: AsRef<str>,
27658    {
27659        self._scopes
27660            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27661        self
27662    }
27663
27664    /// Removes all scopes, and no default scope will be used either.
27665    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27666    /// for details).
27667    pub fn clear_scopes(mut self) -> ProjectLocationProviderConnectorVersionListCall<'a, C> {
27668        self._scopes.clear();
27669        self
27670    }
27671}
27672
27673/// Gets details of a single Connector.
27674///
27675/// A builder for the *locations.providers.connectors.get* method supported by a *project* resource.
27676/// It is not used directly, but through a [`ProjectMethods`] instance.
27677///
27678/// # Example
27679///
27680/// Instantiate a resource method builder
27681///
27682/// ```test_harness,no_run
27683/// # extern crate hyper;
27684/// # extern crate hyper_rustls;
27685/// # extern crate google_connectors1 as connectors1;
27686/// # async fn dox() {
27687/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27688///
27689/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27690/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
27691/// #     .with_native_roots()
27692/// #     .unwrap()
27693/// #     .https_only()
27694/// #     .enable_http2()
27695/// #     .build();
27696///
27697/// # let executor = hyper_util::rt::TokioExecutor::new();
27698/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
27699/// #     secret,
27700/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27701/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
27702/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
27703/// #     ),
27704/// # ).build().await.unwrap();
27705///
27706/// # let client = hyper_util::client::legacy::Client::builder(
27707/// #     hyper_util::rt::TokioExecutor::new()
27708/// # )
27709/// # .build(
27710/// #     hyper_rustls::HttpsConnectorBuilder::new()
27711/// #         .with_native_roots()
27712/// #         .unwrap()
27713/// #         .https_or_http()
27714/// #         .enable_http2()
27715/// #         .build()
27716/// # );
27717/// # let mut hub = Connectors::new(client, auth);
27718/// // You can configure optional parameters by calling the respective setters at will, and
27719/// // execute the final call using `doit()`.
27720/// // Values shown here are possibly random and not representative !
27721/// let result = hub.projects().locations_providers_connectors_get("name")
27722///              .doit().await;
27723/// # }
27724/// ```
27725pub struct ProjectLocationProviderConnectorGetCall<'a, C>
27726where
27727    C: 'a,
27728{
27729    hub: &'a Connectors<C>,
27730    _name: String,
27731    _delegate: Option<&'a mut dyn common::Delegate>,
27732    _additional_params: HashMap<String, String>,
27733    _scopes: BTreeSet<String>,
27734}
27735
27736impl<'a, C> common::CallBuilder for ProjectLocationProviderConnectorGetCall<'a, C> {}
27737
27738impl<'a, C> ProjectLocationProviderConnectorGetCall<'a, C>
27739where
27740    C: common::Connector,
27741{
27742    /// Perform the operation you have build so far.
27743    pub async fn doit(mut self) -> common::Result<(common::Response, Connector)> {
27744        use std::borrow::Cow;
27745        use std::io::{Read, Seek};
27746
27747        use common::{url::Params, ToParts};
27748        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27749
27750        let mut dd = common::DefaultDelegate;
27751        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27752        dlg.begin(common::MethodInfo {
27753            id: "connectors.projects.locations.providers.connectors.get",
27754            http_method: hyper::Method::GET,
27755        });
27756
27757        for &field in ["alt", "name"].iter() {
27758            if self._additional_params.contains_key(field) {
27759                dlg.finished(false);
27760                return Err(common::Error::FieldClash(field));
27761            }
27762        }
27763
27764        let mut params = Params::with_capacity(3 + self._additional_params.len());
27765        params.push("name", self._name);
27766
27767        params.extend(self._additional_params.iter());
27768
27769        params.push("alt", "json");
27770        let mut url = self.hub._base_url.clone() + "v1/{+name}";
27771        if self._scopes.is_empty() {
27772            self._scopes
27773                .insert(Scope::CloudPlatform.as_ref().to_string());
27774        }
27775
27776        #[allow(clippy::single_element_loop)]
27777        for &(find_this, param_name) in [("{+name}", "name")].iter() {
27778            url = params.uri_replacement(url, param_name, find_this, true);
27779        }
27780        {
27781            let to_remove = ["name"];
27782            params.remove_params(&to_remove);
27783        }
27784
27785        let url = params.parse_with_url(&url);
27786
27787        loop {
27788            let token = match self
27789                .hub
27790                .auth
27791                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27792                .await
27793            {
27794                Ok(token) => token,
27795                Err(e) => match dlg.token(e) {
27796                    Ok(token) => token,
27797                    Err(e) => {
27798                        dlg.finished(false);
27799                        return Err(common::Error::MissingToken(e));
27800                    }
27801                },
27802            };
27803            let mut req_result = {
27804                let client = &self.hub.client;
27805                dlg.pre_request();
27806                let mut req_builder = hyper::Request::builder()
27807                    .method(hyper::Method::GET)
27808                    .uri(url.as_str())
27809                    .header(USER_AGENT, self.hub._user_agent.clone());
27810
27811                if let Some(token) = token.as_ref() {
27812                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27813                }
27814
27815                let request = req_builder
27816                    .header(CONTENT_LENGTH, 0_u64)
27817                    .body(common::to_body::<String>(None));
27818
27819                client.request(request.unwrap()).await
27820            };
27821
27822            match req_result {
27823                Err(err) => {
27824                    if let common::Retry::After(d) = dlg.http_error(&err) {
27825                        sleep(d).await;
27826                        continue;
27827                    }
27828                    dlg.finished(false);
27829                    return Err(common::Error::HttpError(err));
27830                }
27831                Ok(res) => {
27832                    let (mut parts, body) = res.into_parts();
27833                    let mut body = common::Body::new(body);
27834                    if !parts.status.is_success() {
27835                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27836                        let error = serde_json::from_str(&common::to_string(&bytes));
27837                        let response = common::to_response(parts, bytes.into());
27838
27839                        if let common::Retry::After(d) =
27840                            dlg.http_failure(&response, error.as_ref().ok())
27841                        {
27842                            sleep(d).await;
27843                            continue;
27844                        }
27845
27846                        dlg.finished(false);
27847
27848                        return Err(match error {
27849                            Ok(value) => common::Error::BadRequest(value),
27850                            _ => common::Error::Failure(response),
27851                        });
27852                    }
27853                    let response = {
27854                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27855                        let encoded = common::to_string(&bytes);
27856                        match serde_json::from_str(&encoded) {
27857                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27858                            Err(error) => {
27859                                dlg.response_json_decode_error(&encoded, &error);
27860                                return Err(common::Error::JsonDecodeError(
27861                                    encoded.to_string(),
27862                                    error,
27863                                ));
27864                            }
27865                        }
27866                    };
27867
27868                    dlg.finished(true);
27869                    return Ok(response);
27870                }
27871            }
27872        }
27873    }
27874
27875    /// Required. Resource name of the form: `projects/*/locations/*/providers/*/connectors/*` Only global location is supported for Connector resource.
27876    ///
27877    /// Sets the *name* path property to the given value.
27878    ///
27879    /// Even though the property as already been set when instantiating this call,
27880    /// we provide this method for API completeness.
27881    pub fn name(mut self, new_value: &str) -> ProjectLocationProviderConnectorGetCall<'a, C> {
27882        self._name = new_value.to_string();
27883        self
27884    }
27885    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27886    /// while executing the actual API request.
27887    ///
27888    /// ````text
27889    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
27890    /// ````
27891    ///
27892    /// Sets the *delegate* property to the given value.
27893    pub fn delegate(
27894        mut self,
27895        new_value: &'a mut dyn common::Delegate,
27896    ) -> ProjectLocationProviderConnectorGetCall<'a, C> {
27897        self._delegate = Some(new_value);
27898        self
27899    }
27900
27901    /// Set any additional parameter of the query string used in the request.
27902    /// It should be used to set parameters which are not yet available through their own
27903    /// setters.
27904    ///
27905    /// Please note that this method must not be used to set any of the known parameters
27906    /// which have their own setter method. If done anyway, the request will fail.
27907    ///
27908    /// # Additional Parameters
27909    ///
27910    /// * *$.xgafv* (query-string) - V1 error format.
27911    /// * *access_token* (query-string) - OAuth access token.
27912    /// * *alt* (query-string) - Data format for response.
27913    /// * *callback* (query-string) - JSONP
27914    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27915    /// * *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.
27916    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27917    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27918    /// * *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.
27919    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27920    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27921    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationProviderConnectorGetCall<'a, C>
27922    where
27923        T: AsRef<str>,
27924    {
27925        self._additional_params
27926            .insert(name.as_ref().to_string(), value.as_ref().to_string());
27927        self
27928    }
27929
27930    /// Identifies the authorization scope for the method you are building.
27931    ///
27932    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27933    /// [`Scope::CloudPlatform`].
27934    ///
27935    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27936    /// tokens for more than one scope.
27937    ///
27938    /// Usually there is more than one suitable scope to authorize an operation, some of which may
27939    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27940    /// sufficient, a read-write scope will do as well.
27941    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationProviderConnectorGetCall<'a, C>
27942    where
27943        St: AsRef<str>,
27944    {
27945        self._scopes.insert(String::from(scope.as_ref()));
27946        self
27947    }
27948    /// Identifies the authorization scope(s) for the method you are building.
27949    ///
27950    /// See [`Self::add_scope()`] for details.
27951    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationProviderConnectorGetCall<'a, C>
27952    where
27953        I: IntoIterator<Item = St>,
27954        St: AsRef<str>,
27955    {
27956        self._scopes
27957            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27958        self
27959    }
27960
27961    /// Removes all scopes, and no default scope will be used either.
27962    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27963    /// for details).
27964    pub fn clear_scopes(mut self) -> ProjectLocationProviderConnectorGetCall<'a, C> {
27965        self._scopes.clear();
27966        self
27967    }
27968}
27969
27970/// Lists Connectors in a given project and location.
27971///
27972/// A builder for the *locations.providers.connectors.list* method supported by a *project* resource.
27973/// It is not used directly, but through a [`ProjectMethods`] instance.
27974///
27975/// # Example
27976///
27977/// Instantiate a resource method builder
27978///
27979/// ```test_harness,no_run
27980/// # extern crate hyper;
27981/// # extern crate hyper_rustls;
27982/// # extern crate google_connectors1 as connectors1;
27983/// # async fn dox() {
27984/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27985///
27986/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27987/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
27988/// #     .with_native_roots()
27989/// #     .unwrap()
27990/// #     .https_only()
27991/// #     .enable_http2()
27992/// #     .build();
27993///
27994/// # let executor = hyper_util::rt::TokioExecutor::new();
27995/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
27996/// #     secret,
27997/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27998/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
27999/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
28000/// #     ),
28001/// # ).build().await.unwrap();
28002///
28003/// # let client = hyper_util::client::legacy::Client::builder(
28004/// #     hyper_util::rt::TokioExecutor::new()
28005/// # )
28006/// # .build(
28007/// #     hyper_rustls::HttpsConnectorBuilder::new()
28008/// #         .with_native_roots()
28009/// #         .unwrap()
28010/// #         .https_or_http()
28011/// #         .enable_http2()
28012/// #         .build()
28013/// # );
28014/// # let mut hub = Connectors::new(client, auth);
28015/// // You can configure optional parameters by calling the respective setters at will, and
28016/// // execute the final call using `doit()`.
28017/// // Values shown here are possibly random and not representative !
28018/// let result = hub.projects().locations_providers_connectors_list("parent")
28019///              .page_token("sed")
28020///              .page_size(-75)
28021///              .filter("Lorem")
28022///              .doit().await;
28023/// # }
28024/// ```
28025pub struct ProjectLocationProviderConnectorListCall<'a, C>
28026where
28027    C: 'a,
28028{
28029    hub: &'a Connectors<C>,
28030    _parent: String,
28031    _page_token: Option<String>,
28032    _page_size: Option<i32>,
28033    _filter: Option<String>,
28034    _delegate: Option<&'a mut dyn common::Delegate>,
28035    _additional_params: HashMap<String, String>,
28036    _scopes: BTreeSet<String>,
28037}
28038
28039impl<'a, C> common::CallBuilder for ProjectLocationProviderConnectorListCall<'a, C> {}
28040
28041impl<'a, C> ProjectLocationProviderConnectorListCall<'a, C>
28042where
28043    C: common::Connector,
28044{
28045    /// Perform the operation you have build so far.
28046    pub async fn doit(mut self) -> common::Result<(common::Response, ListConnectorsResponse)> {
28047        use std::borrow::Cow;
28048        use std::io::{Read, Seek};
28049
28050        use common::{url::Params, ToParts};
28051        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28052
28053        let mut dd = common::DefaultDelegate;
28054        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28055        dlg.begin(common::MethodInfo {
28056            id: "connectors.projects.locations.providers.connectors.list",
28057            http_method: hyper::Method::GET,
28058        });
28059
28060        for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
28061            if self._additional_params.contains_key(field) {
28062                dlg.finished(false);
28063                return Err(common::Error::FieldClash(field));
28064            }
28065        }
28066
28067        let mut params = Params::with_capacity(6 + self._additional_params.len());
28068        params.push("parent", self._parent);
28069        if let Some(value) = self._page_token.as_ref() {
28070            params.push("pageToken", value);
28071        }
28072        if let Some(value) = self._page_size.as_ref() {
28073            params.push("pageSize", value.to_string());
28074        }
28075        if let Some(value) = self._filter.as_ref() {
28076            params.push("filter", value);
28077        }
28078
28079        params.extend(self._additional_params.iter());
28080
28081        params.push("alt", "json");
28082        let mut url = self.hub._base_url.clone() + "v1/{+parent}/connectors";
28083        if self._scopes.is_empty() {
28084            self._scopes
28085                .insert(Scope::CloudPlatform.as_ref().to_string());
28086        }
28087
28088        #[allow(clippy::single_element_loop)]
28089        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
28090            url = params.uri_replacement(url, param_name, find_this, true);
28091        }
28092        {
28093            let to_remove = ["parent"];
28094            params.remove_params(&to_remove);
28095        }
28096
28097        let url = params.parse_with_url(&url);
28098
28099        loop {
28100            let token = match self
28101                .hub
28102                .auth
28103                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28104                .await
28105            {
28106                Ok(token) => token,
28107                Err(e) => match dlg.token(e) {
28108                    Ok(token) => token,
28109                    Err(e) => {
28110                        dlg.finished(false);
28111                        return Err(common::Error::MissingToken(e));
28112                    }
28113                },
28114            };
28115            let mut req_result = {
28116                let client = &self.hub.client;
28117                dlg.pre_request();
28118                let mut req_builder = hyper::Request::builder()
28119                    .method(hyper::Method::GET)
28120                    .uri(url.as_str())
28121                    .header(USER_AGENT, self.hub._user_agent.clone());
28122
28123                if let Some(token) = token.as_ref() {
28124                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28125                }
28126
28127                let request = req_builder
28128                    .header(CONTENT_LENGTH, 0_u64)
28129                    .body(common::to_body::<String>(None));
28130
28131                client.request(request.unwrap()).await
28132            };
28133
28134            match req_result {
28135                Err(err) => {
28136                    if let common::Retry::After(d) = dlg.http_error(&err) {
28137                        sleep(d).await;
28138                        continue;
28139                    }
28140                    dlg.finished(false);
28141                    return Err(common::Error::HttpError(err));
28142                }
28143                Ok(res) => {
28144                    let (mut parts, body) = res.into_parts();
28145                    let mut body = common::Body::new(body);
28146                    if !parts.status.is_success() {
28147                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28148                        let error = serde_json::from_str(&common::to_string(&bytes));
28149                        let response = common::to_response(parts, bytes.into());
28150
28151                        if let common::Retry::After(d) =
28152                            dlg.http_failure(&response, error.as_ref().ok())
28153                        {
28154                            sleep(d).await;
28155                            continue;
28156                        }
28157
28158                        dlg.finished(false);
28159
28160                        return Err(match error {
28161                            Ok(value) => common::Error::BadRequest(value),
28162                            _ => common::Error::Failure(response),
28163                        });
28164                    }
28165                    let response = {
28166                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28167                        let encoded = common::to_string(&bytes);
28168                        match serde_json::from_str(&encoded) {
28169                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28170                            Err(error) => {
28171                                dlg.response_json_decode_error(&encoded, &error);
28172                                return Err(common::Error::JsonDecodeError(
28173                                    encoded.to_string(),
28174                                    error,
28175                                ));
28176                            }
28177                        }
28178                    };
28179
28180                    dlg.finished(true);
28181                    return Ok(response);
28182                }
28183            }
28184        }
28185    }
28186
28187    /// Required. Parent resource of the connectors, of the form: `projects/*/locations/*/providers/*` Only global location is supported for Connector resource.
28188    ///
28189    /// Sets the *parent* path property to the given value.
28190    ///
28191    /// Even though the property as already been set when instantiating this call,
28192    /// we provide this method for API completeness.
28193    pub fn parent(mut self, new_value: &str) -> ProjectLocationProviderConnectorListCall<'a, C> {
28194        self._parent = new_value.to_string();
28195        self
28196    }
28197    /// Page token.
28198    ///
28199    /// Sets the *page token* query property to the given value.
28200    pub fn page_token(
28201        mut self,
28202        new_value: &str,
28203    ) -> ProjectLocationProviderConnectorListCall<'a, C> {
28204        self._page_token = Some(new_value.to_string());
28205        self
28206    }
28207    /// Page size.
28208    ///
28209    /// Sets the *page size* query property to the given value.
28210    pub fn page_size(mut self, new_value: i32) -> ProjectLocationProviderConnectorListCall<'a, C> {
28211        self._page_size = Some(new_value);
28212        self
28213    }
28214    /// Filter string.
28215    ///
28216    /// Sets the *filter* query property to the given value.
28217    pub fn filter(mut self, new_value: &str) -> ProjectLocationProviderConnectorListCall<'a, C> {
28218        self._filter = Some(new_value.to_string());
28219        self
28220    }
28221    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28222    /// while executing the actual API request.
28223    ///
28224    /// ````text
28225    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
28226    /// ````
28227    ///
28228    /// Sets the *delegate* property to the given value.
28229    pub fn delegate(
28230        mut self,
28231        new_value: &'a mut dyn common::Delegate,
28232    ) -> ProjectLocationProviderConnectorListCall<'a, C> {
28233        self._delegate = Some(new_value);
28234        self
28235    }
28236
28237    /// Set any additional parameter of the query string used in the request.
28238    /// It should be used to set parameters which are not yet available through their own
28239    /// setters.
28240    ///
28241    /// Please note that this method must not be used to set any of the known parameters
28242    /// which have their own setter method. If done anyway, the request will fail.
28243    ///
28244    /// # Additional Parameters
28245    ///
28246    /// * *$.xgafv* (query-string) - V1 error format.
28247    /// * *access_token* (query-string) - OAuth access token.
28248    /// * *alt* (query-string) - Data format for response.
28249    /// * *callback* (query-string) - JSONP
28250    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28251    /// * *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.
28252    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28253    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28254    /// * *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.
28255    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28256    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28257    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationProviderConnectorListCall<'a, C>
28258    where
28259        T: AsRef<str>,
28260    {
28261        self._additional_params
28262            .insert(name.as_ref().to_string(), value.as_ref().to_string());
28263        self
28264    }
28265
28266    /// Identifies the authorization scope for the method you are building.
28267    ///
28268    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28269    /// [`Scope::CloudPlatform`].
28270    ///
28271    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28272    /// tokens for more than one scope.
28273    ///
28274    /// Usually there is more than one suitable scope to authorize an operation, some of which may
28275    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28276    /// sufficient, a read-write scope will do as well.
28277    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationProviderConnectorListCall<'a, C>
28278    where
28279        St: AsRef<str>,
28280    {
28281        self._scopes.insert(String::from(scope.as_ref()));
28282        self
28283    }
28284    /// Identifies the authorization scope(s) for the method you are building.
28285    ///
28286    /// See [`Self::add_scope()`] for details.
28287    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationProviderConnectorListCall<'a, C>
28288    where
28289        I: IntoIterator<Item = St>,
28290        St: AsRef<str>,
28291    {
28292        self._scopes
28293            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28294        self
28295    }
28296
28297    /// Removes all scopes, and no default scope will be used either.
28298    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28299    /// for details).
28300    pub fn clear_scopes(mut self) -> ProjectLocationProviderConnectorListCall<'a, C> {
28301        self._scopes.clear();
28302        self
28303    }
28304}
28305
28306/// Gets details of a provider.
28307///
28308/// A builder for the *locations.providers.get* method supported by a *project* resource.
28309/// It is not used directly, but through a [`ProjectMethods`] instance.
28310///
28311/// # Example
28312///
28313/// Instantiate a resource method builder
28314///
28315/// ```test_harness,no_run
28316/// # extern crate hyper;
28317/// # extern crate hyper_rustls;
28318/// # extern crate google_connectors1 as connectors1;
28319/// # async fn dox() {
28320/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28321///
28322/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28323/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
28324/// #     .with_native_roots()
28325/// #     .unwrap()
28326/// #     .https_only()
28327/// #     .enable_http2()
28328/// #     .build();
28329///
28330/// # let executor = hyper_util::rt::TokioExecutor::new();
28331/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
28332/// #     secret,
28333/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28334/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
28335/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
28336/// #     ),
28337/// # ).build().await.unwrap();
28338///
28339/// # let client = hyper_util::client::legacy::Client::builder(
28340/// #     hyper_util::rt::TokioExecutor::new()
28341/// # )
28342/// # .build(
28343/// #     hyper_rustls::HttpsConnectorBuilder::new()
28344/// #         .with_native_roots()
28345/// #         .unwrap()
28346/// #         .https_or_http()
28347/// #         .enable_http2()
28348/// #         .build()
28349/// # );
28350/// # let mut hub = Connectors::new(client, auth);
28351/// // You can configure optional parameters by calling the respective setters at will, and
28352/// // execute the final call using `doit()`.
28353/// // Values shown here are possibly random and not representative !
28354/// let result = hub.projects().locations_providers_get("name")
28355///              .doit().await;
28356/// # }
28357/// ```
28358pub struct ProjectLocationProviderGetCall<'a, C>
28359where
28360    C: 'a,
28361{
28362    hub: &'a Connectors<C>,
28363    _name: String,
28364    _delegate: Option<&'a mut dyn common::Delegate>,
28365    _additional_params: HashMap<String, String>,
28366    _scopes: BTreeSet<String>,
28367}
28368
28369impl<'a, C> common::CallBuilder for ProjectLocationProviderGetCall<'a, C> {}
28370
28371impl<'a, C> ProjectLocationProviderGetCall<'a, C>
28372where
28373    C: common::Connector,
28374{
28375    /// Perform the operation you have build so far.
28376    pub async fn doit(mut self) -> common::Result<(common::Response, Provider)> {
28377        use std::borrow::Cow;
28378        use std::io::{Read, Seek};
28379
28380        use common::{url::Params, ToParts};
28381        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28382
28383        let mut dd = common::DefaultDelegate;
28384        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28385        dlg.begin(common::MethodInfo {
28386            id: "connectors.projects.locations.providers.get",
28387            http_method: hyper::Method::GET,
28388        });
28389
28390        for &field in ["alt", "name"].iter() {
28391            if self._additional_params.contains_key(field) {
28392                dlg.finished(false);
28393                return Err(common::Error::FieldClash(field));
28394            }
28395        }
28396
28397        let mut params = Params::with_capacity(3 + self._additional_params.len());
28398        params.push("name", self._name);
28399
28400        params.extend(self._additional_params.iter());
28401
28402        params.push("alt", "json");
28403        let mut url = self.hub._base_url.clone() + "v1/{+name}";
28404        if self._scopes.is_empty() {
28405            self._scopes
28406                .insert(Scope::CloudPlatform.as_ref().to_string());
28407        }
28408
28409        #[allow(clippy::single_element_loop)]
28410        for &(find_this, param_name) in [("{+name}", "name")].iter() {
28411            url = params.uri_replacement(url, param_name, find_this, true);
28412        }
28413        {
28414            let to_remove = ["name"];
28415            params.remove_params(&to_remove);
28416        }
28417
28418        let url = params.parse_with_url(&url);
28419
28420        loop {
28421            let token = match self
28422                .hub
28423                .auth
28424                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28425                .await
28426            {
28427                Ok(token) => token,
28428                Err(e) => match dlg.token(e) {
28429                    Ok(token) => token,
28430                    Err(e) => {
28431                        dlg.finished(false);
28432                        return Err(common::Error::MissingToken(e));
28433                    }
28434                },
28435            };
28436            let mut req_result = {
28437                let client = &self.hub.client;
28438                dlg.pre_request();
28439                let mut req_builder = hyper::Request::builder()
28440                    .method(hyper::Method::GET)
28441                    .uri(url.as_str())
28442                    .header(USER_AGENT, self.hub._user_agent.clone());
28443
28444                if let Some(token) = token.as_ref() {
28445                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28446                }
28447
28448                let request = req_builder
28449                    .header(CONTENT_LENGTH, 0_u64)
28450                    .body(common::to_body::<String>(None));
28451
28452                client.request(request.unwrap()).await
28453            };
28454
28455            match req_result {
28456                Err(err) => {
28457                    if let common::Retry::After(d) = dlg.http_error(&err) {
28458                        sleep(d).await;
28459                        continue;
28460                    }
28461                    dlg.finished(false);
28462                    return Err(common::Error::HttpError(err));
28463                }
28464                Ok(res) => {
28465                    let (mut parts, body) = res.into_parts();
28466                    let mut body = common::Body::new(body);
28467                    if !parts.status.is_success() {
28468                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28469                        let error = serde_json::from_str(&common::to_string(&bytes));
28470                        let response = common::to_response(parts, bytes.into());
28471
28472                        if let common::Retry::After(d) =
28473                            dlg.http_failure(&response, error.as_ref().ok())
28474                        {
28475                            sleep(d).await;
28476                            continue;
28477                        }
28478
28479                        dlg.finished(false);
28480
28481                        return Err(match error {
28482                            Ok(value) => common::Error::BadRequest(value),
28483                            _ => common::Error::Failure(response),
28484                        });
28485                    }
28486                    let response = {
28487                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28488                        let encoded = common::to_string(&bytes);
28489                        match serde_json::from_str(&encoded) {
28490                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28491                            Err(error) => {
28492                                dlg.response_json_decode_error(&encoded, &error);
28493                                return Err(common::Error::JsonDecodeError(
28494                                    encoded.to_string(),
28495                                    error,
28496                                ));
28497                            }
28498                        }
28499                    };
28500
28501                    dlg.finished(true);
28502                    return Ok(response);
28503                }
28504            }
28505        }
28506    }
28507
28508    /// Required. Resource name of the form: `projects/*/locations/*/providers/*` Only global location is supported for Provider resource.
28509    ///
28510    /// Sets the *name* path property to the given value.
28511    ///
28512    /// Even though the property as already been set when instantiating this call,
28513    /// we provide this method for API completeness.
28514    pub fn name(mut self, new_value: &str) -> ProjectLocationProviderGetCall<'a, C> {
28515        self._name = new_value.to_string();
28516        self
28517    }
28518    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28519    /// while executing the actual API request.
28520    ///
28521    /// ````text
28522    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
28523    /// ````
28524    ///
28525    /// Sets the *delegate* property to the given value.
28526    pub fn delegate(
28527        mut self,
28528        new_value: &'a mut dyn common::Delegate,
28529    ) -> ProjectLocationProviderGetCall<'a, C> {
28530        self._delegate = Some(new_value);
28531        self
28532    }
28533
28534    /// Set any additional parameter of the query string used in the request.
28535    /// It should be used to set parameters which are not yet available through their own
28536    /// setters.
28537    ///
28538    /// Please note that this method must not be used to set any of the known parameters
28539    /// which have their own setter method. If done anyway, the request will fail.
28540    ///
28541    /// # Additional Parameters
28542    ///
28543    /// * *$.xgafv* (query-string) - V1 error format.
28544    /// * *access_token* (query-string) - OAuth access token.
28545    /// * *alt* (query-string) - Data format for response.
28546    /// * *callback* (query-string) - JSONP
28547    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28548    /// * *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.
28549    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28550    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28551    /// * *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.
28552    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28553    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28554    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationProviderGetCall<'a, C>
28555    where
28556        T: AsRef<str>,
28557    {
28558        self._additional_params
28559            .insert(name.as_ref().to_string(), value.as_ref().to_string());
28560        self
28561    }
28562
28563    /// Identifies the authorization scope for the method you are building.
28564    ///
28565    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28566    /// [`Scope::CloudPlatform`].
28567    ///
28568    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28569    /// tokens for more than one scope.
28570    ///
28571    /// Usually there is more than one suitable scope to authorize an operation, some of which may
28572    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28573    /// sufficient, a read-write scope will do as well.
28574    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationProviderGetCall<'a, C>
28575    where
28576        St: AsRef<str>,
28577    {
28578        self._scopes.insert(String::from(scope.as_ref()));
28579        self
28580    }
28581    /// Identifies the authorization scope(s) for the method you are building.
28582    ///
28583    /// See [`Self::add_scope()`] for details.
28584    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationProviderGetCall<'a, C>
28585    where
28586        I: IntoIterator<Item = St>,
28587        St: AsRef<str>,
28588    {
28589        self._scopes
28590            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28591        self
28592    }
28593
28594    /// Removes all scopes, and no default scope will be used either.
28595    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28596    /// for details).
28597    pub fn clear_scopes(mut self) -> ProjectLocationProviderGetCall<'a, C> {
28598        self._scopes.clear();
28599        self
28600    }
28601}
28602
28603/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
28604///
28605/// A builder for the *locations.providers.getIamPolicy* method supported by a *project* resource.
28606/// It is not used directly, but through a [`ProjectMethods`] instance.
28607///
28608/// # Example
28609///
28610/// Instantiate a resource method builder
28611///
28612/// ```test_harness,no_run
28613/// # extern crate hyper;
28614/// # extern crate hyper_rustls;
28615/// # extern crate google_connectors1 as connectors1;
28616/// # async fn dox() {
28617/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28618///
28619/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28620/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
28621/// #     .with_native_roots()
28622/// #     .unwrap()
28623/// #     .https_only()
28624/// #     .enable_http2()
28625/// #     .build();
28626///
28627/// # let executor = hyper_util::rt::TokioExecutor::new();
28628/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
28629/// #     secret,
28630/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28631/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
28632/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
28633/// #     ),
28634/// # ).build().await.unwrap();
28635///
28636/// # let client = hyper_util::client::legacy::Client::builder(
28637/// #     hyper_util::rt::TokioExecutor::new()
28638/// # )
28639/// # .build(
28640/// #     hyper_rustls::HttpsConnectorBuilder::new()
28641/// #         .with_native_roots()
28642/// #         .unwrap()
28643/// #         .https_or_http()
28644/// #         .enable_http2()
28645/// #         .build()
28646/// # );
28647/// # let mut hub = Connectors::new(client, auth);
28648/// // You can configure optional parameters by calling the respective setters at will, and
28649/// // execute the final call using `doit()`.
28650/// // Values shown here are possibly random and not representative !
28651/// let result = hub.projects().locations_providers_get_iam_policy("resource")
28652///              .options_requested_policy_version(-19)
28653///              .doit().await;
28654/// # }
28655/// ```
28656pub struct ProjectLocationProviderGetIamPolicyCall<'a, C>
28657where
28658    C: 'a,
28659{
28660    hub: &'a Connectors<C>,
28661    _resource: String,
28662    _options_requested_policy_version: Option<i32>,
28663    _delegate: Option<&'a mut dyn common::Delegate>,
28664    _additional_params: HashMap<String, String>,
28665    _scopes: BTreeSet<String>,
28666}
28667
28668impl<'a, C> common::CallBuilder for ProjectLocationProviderGetIamPolicyCall<'a, C> {}
28669
28670impl<'a, C> ProjectLocationProviderGetIamPolicyCall<'a, C>
28671where
28672    C: common::Connector,
28673{
28674    /// Perform the operation you have build so far.
28675    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
28676        use std::borrow::Cow;
28677        use std::io::{Read, Seek};
28678
28679        use common::{url::Params, ToParts};
28680        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28681
28682        let mut dd = common::DefaultDelegate;
28683        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28684        dlg.begin(common::MethodInfo {
28685            id: "connectors.projects.locations.providers.getIamPolicy",
28686            http_method: hyper::Method::GET,
28687        });
28688
28689        for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
28690            if self._additional_params.contains_key(field) {
28691                dlg.finished(false);
28692                return Err(common::Error::FieldClash(field));
28693            }
28694        }
28695
28696        let mut params = Params::with_capacity(4 + self._additional_params.len());
28697        params.push("resource", self._resource);
28698        if let Some(value) = self._options_requested_policy_version.as_ref() {
28699            params.push("options.requestedPolicyVersion", value.to_string());
28700        }
28701
28702        params.extend(self._additional_params.iter());
28703
28704        params.push("alt", "json");
28705        let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
28706        if self._scopes.is_empty() {
28707            self._scopes
28708                .insert(Scope::CloudPlatform.as_ref().to_string());
28709        }
28710
28711        #[allow(clippy::single_element_loop)]
28712        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
28713            url = params.uri_replacement(url, param_name, find_this, true);
28714        }
28715        {
28716            let to_remove = ["resource"];
28717            params.remove_params(&to_remove);
28718        }
28719
28720        let url = params.parse_with_url(&url);
28721
28722        loop {
28723            let token = match self
28724                .hub
28725                .auth
28726                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28727                .await
28728            {
28729                Ok(token) => token,
28730                Err(e) => match dlg.token(e) {
28731                    Ok(token) => token,
28732                    Err(e) => {
28733                        dlg.finished(false);
28734                        return Err(common::Error::MissingToken(e));
28735                    }
28736                },
28737            };
28738            let mut req_result = {
28739                let client = &self.hub.client;
28740                dlg.pre_request();
28741                let mut req_builder = hyper::Request::builder()
28742                    .method(hyper::Method::GET)
28743                    .uri(url.as_str())
28744                    .header(USER_AGENT, self.hub._user_agent.clone());
28745
28746                if let Some(token) = token.as_ref() {
28747                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28748                }
28749
28750                let request = req_builder
28751                    .header(CONTENT_LENGTH, 0_u64)
28752                    .body(common::to_body::<String>(None));
28753
28754                client.request(request.unwrap()).await
28755            };
28756
28757            match req_result {
28758                Err(err) => {
28759                    if let common::Retry::After(d) = dlg.http_error(&err) {
28760                        sleep(d).await;
28761                        continue;
28762                    }
28763                    dlg.finished(false);
28764                    return Err(common::Error::HttpError(err));
28765                }
28766                Ok(res) => {
28767                    let (mut parts, body) = res.into_parts();
28768                    let mut body = common::Body::new(body);
28769                    if !parts.status.is_success() {
28770                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28771                        let error = serde_json::from_str(&common::to_string(&bytes));
28772                        let response = common::to_response(parts, bytes.into());
28773
28774                        if let common::Retry::After(d) =
28775                            dlg.http_failure(&response, error.as_ref().ok())
28776                        {
28777                            sleep(d).await;
28778                            continue;
28779                        }
28780
28781                        dlg.finished(false);
28782
28783                        return Err(match error {
28784                            Ok(value) => common::Error::BadRequest(value),
28785                            _ => common::Error::Failure(response),
28786                        });
28787                    }
28788                    let response = {
28789                        let bytes = common::to_bytes(body).await.unwrap_or_default();
28790                        let encoded = common::to_string(&bytes);
28791                        match serde_json::from_str(&encoded) {
28792                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28793                            Err(error) => {
28794                                dlg.response_json_decode_error(&encoded, &error);
28795                                return Err(common::Error::JsonDecodeError(
28796                                    encoded.to_string(),
28797                                    error,
28798                                ));
28799                            }
28800                        }
28801                    };
28802
28803                    dlg.finished(true);
28804                    return Ok(response);
28805                }
28806            }
28807        }
28808    }
28809
28810    /// 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.
28811    ///
28812    /// Sets the *resource* path property to the given value.
28813    ///
28814    /// Even though the property as already been set when instantiating this call,
28815    /// we provide this method for API completeness.
28816    pub fn resource(mut self, new_value: &str) -> ProjectLocationProviderGetIamPolicyCall<'a, C> {
28817        self._resource = new_value.to_string();
28818        self
28819    }
28820    /// 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).
28821    ///
28822    /// Sets the *options.requested policy version* query property to the given value.
28823    pub fn options_requested_policy_version(
28824        mut self,
28825        new_value: i32,
28826    ) -> ProjectLocationProviderGetIamPolicyCall<'a, C> {
28827        self._options_requested_policy_version = Some(new_value);
28828        self
28829    }
28830    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28831    /// while executing the actual API request.
28832    ///
28833    /// ````text
28834    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
28835    /// ````
28836    ///
28837    /// Sets the *delegate* property to the given value.
28838    pub fn delegate(
28839        mut self,
28840        new_value: &'a mut dyn common::Delegate,
28841    ) -> ProjectLocationProviderGetIamPolicyCall<'a, C> {
28842        self._delegate = Some(new_value);
28843        self
28844    }
28845
28846    /// Set any additional parameter of the query string used in the request.
28847    /// It should be used to set parameters which are not yet available through their own
28848    /// setters.
28849    ///
28850    /// Please note that this method must not be used to set any of the known parameters
28851    /// which have their own setter method. If done anyway, the request will fail.
28852    ///
28853    /// # Additional Parameters
28854    ///
28855    /// * *$.xgafv* (query-string) - V1 error format.
28856    /// * *access_token* (query-string) - OAuth access token.
28857    /// * *alt* (query-string) - Data format for response.
28858    /// * *callback* (query-string) - JSONP
28859    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28860    /// * *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.
28861    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28862    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28863    /// * *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.
28864    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28865    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28866    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationProviderGetIamPolicyCall<'a, C>
28867    where
28868        T: AsRef<str>,
28869    {
28870        self._additional_params
28871            .insert(name.as_ref().to_string(), value.as_ref().to_string());
28872        self
28873    }
28874
28875    /// Identifies the authorization scope for the method you are building.
28876    ///
28877    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28878    /// [`Scope::CloudPlatform`].
28879    ///
28880    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28881    /// tokens for more than one scope.
28882    ///
28883    /// Usually there is more than one suitable scope to authorize an operation, some of which may
28884    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28885    /// sufficient, a read-write scope will do as well.
28886    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationProviderGetIamPolicyCall<'a, C>
28887    where
28888        St: AsRef<str>,
28889    {
28890        self._scopes.insert(String::from(scope.as_ref()));
28891        self
28892    }
28893    /// Identifies the authorization scope(s) for the method you are building.
28894    ///
28895    /// See [`Self::add_scope()`] for details.
28896    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationProviderGetIamPolicyCall<'a, C>
28897    where
28898        I: IntoIterator<Item = St>,
28899        St: AsRef<str>,
28900    {
28901        self._scopes
28902            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28903        self
28904    }
28905
28906    /// Removes all scopes, and no default scope will be used either.
28907    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28908    /// for details).
28909    pub fn clear_scopes(mut self) -> ProjectLocationProviderGetIamPolicyCall<'a, C> {
28910        self._scopes.clear();
28911        self
28912    }
28913}
28914
28915/// Lists Providers in a given project and location.
28916///
28917/// A builder for the *locations.providers.list* method supported by a *project* resource.
28918/// It is not used directly, but through a [`ProjectMethods`] instance.
28919///
28920/// # Example
28921///
28922/// Instantiate a resource method builder
28923///
28924/// ```test_harness,no_run
28925/// # extern crate hyper;
28926/// # extern crate hyper_rustls;
28927/// # extern crate google_connectors1 as connectors1;
28928/// # async fn dox() {
28929/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28930///
28931/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28932/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
28933/// #     .with_native_roots()
28934/// #     .unwrap()
28935/// #     .https_only()
28936/// #     .enable_http2()
28937/// #     .build();
28938///
28939/// # let executor = hyper_util::rt::TokioExecutor::new();
28940/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
28941/// #     secret,
28942/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28943/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
28944/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
28945/// #     ),
28946/// # ).build().await.unwrap();
28947///
28948/// # let client = hyper_util::client::legacy::Client::builder(
28949/// #     hyper_util::rt::TokioExecutor::new()
28950/// # )
28951/// # .build(
28952/// #     hyper_rustls::HttpsConnectorBuilder::new()
28953/// #         .with_native_roots()
28954/// #         .unwrap()
28955/// #         .https_or_http()
28956/// #         .enable_http2()
28957/// #         .build()
28958/// # );
28959/// # let mut hub = Connectors::new(client, auth);
28960/// // You can configure optional parameters by calling the respective setters at will, and
28961/// // execute the final call using `doit()`.
28962/// // Values shown here are possibly random and not representative !
28963/// let result = hub.projects().locations_providers_list("parent")
28964///              .page_token("et")
28965///              .page_size(-10)
28966///              .doit().await;
28967/// # }
28968/// ```
28969pub struct ProjectLocationProviderListCall<'a, C>
28970where
28971    C: 'a,
28972{
28973    hub: &'a Connectors<C>,
28974    _parent: String,
28975    _page_token: Option<String>,
28976    _page_size: Option<i32>,
28977    _delegate: Option<&'a mut dyn common::Delegate>,
28978    _additional_params: HashMap<String, String>,
28979    _scopes: BTreeSet<String>,
28980}
28981
28982impl<'a, C> common::CallBuilder for ProjectLocationProviderListCall<'a, C> {}
28983
28984impl<'a, C> ProjectLocationProviderListCall<'a, C>
28985where
28986    C: common::Connector,
28987{
28988    /// Perform the operation you have build so far.
28989    pub async fn doit(mut self) -> common::Result<(common::Response, ListProvidersResponse)> {
28990        use std::borrow::Cow;
28991        use std::io::{Read, Seek};
28992
28993        use common::{url::Params, ToParts};
28994        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28995
28996        let mut dd = common::DefaultDelegate;
28997        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28998        dlg.begin(common::MethodInfo {
28999            id: "connectors.projects.locations.providers.list",
29000            http_method: hyper::Method::GET,
29001        });
29002
29003        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
29004            if self._additional_params.contains_key(field) {
29005                dlg.finished(false);
29006                return Err(common::Error::FieldClash(field));
29007            }
29008        }
29009
29010        let mut params = Params::with_capacity(5 + self._additional_params.len());
29011        params.push("parent", self._parent);
29012        if let Some(value) = self._page_token.as_ref() {
29013            params.push("pageToken", value);
29014        }
29015        if let Some(value) = self._page_size.as_ref() {
29016            params.push("pageSize", value.to_string());
29017        }
29018
29019        params.extend(self._additional_params.iter());
29020
29021        params.push("alt", "json");
29022        let mut url = self.hub._base_url.clone() + "v1/{+parent}/providers";
29023        if self._scopes.is_empty() {
29024            self._scopes
29025                .insert(Scope::CloudPlatform.as_ref().to_string());
29026        }
29027
29028        #[allow(clippy::single_element_loop)]
29029        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
29030            url = params.uri_replacement(url, param_name, find_this, true);
29031        }
29032        {
29033            let to_remove = ["parent"];
29034            params.remove_params(&to_remove);
29035        }
29036
29037        let url = params.parse_with_url(&url);
29038
29039        loop {
29040            let token = match self
29041                .hub
29042                .auth
29043                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29044                .await
29045            {
29046                Ok(token) => token,
29047                Err(e) => match dlg.token(e) {
29048                    Ok(token) => token,
29049                    Err(e) => {
29050                        dlg.finished(false);
29051                        return Err(common::Error::MissingToken(e));
29052                    }
29053                },
29054            };
29055            let mut req_result = {
29056                let client = &self.hub.client;
29057                dlg.pre_request();
29058                let mut req_builder = hyper::Request::builder()
29059                    .method(hyper::Method::GET)
29060                    .uri(url.as_str())
29061                    .header(USER_AGENT, self.hub._user_agent.clone());
29062
29063                if let Some(token) = token.as_ref() {
29064                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29065                }
29066
29067                let request = req_builder
29068                    .header(CONTENT_LENGTH, 0_u64)
29069                    .body(common::to_body::<String>(None));
29070
29071                client.request(request.unwrap()).await
29072            };
29073
29074            match req_result {
29075                Err(err) => {
29076                    if let common::Retry::After(d) = dlg.http_error(&err) {
29077                        sleep(d).await;
29078                        continue;
29079                    }
29080                    dlg.finished(false);
29081                    return Err(common::Error::HttpError(err));
29082                }
29083                Ok(res) => {
29084                    let (mut parts, body) = res.into_parts();
29085                    let mut body = common::Body::new(body);
29086                    if !parts.status.is_success() {
29087                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29088                        let error = serde_json::from_str(&common::to_string(&bytes));
29089                        let response = common::to_response(parts, bytes.into());
29090
29091                        if let common::Retry::After(d) =
29092                            dlg.http_failure(&response, error.as_ref().ok())
29093                        {
29094                            sleep(d).await;
29095                            continue;
29096                        }
29097
29098                        dlg.finished(false);
29099
29100                        return Err(match error {
29101                            Ok(value) => common::Error::BadRequest(value),
29102                            _ => common::Error::Failure(response),
29103                        });
29104                    }
29105                    let response = {
29106                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29107                        let encoded = common::to_string(&bytes);
29108                        match serde_json::from_str(&encoded) {
29109                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29110                            Err(error) => {
29111                                dlg.response_json_decode_error(&encoded, &error);
29112                                return Err(common::Error::JsonDecodeError(
29113                                    encoded.to_string(),
29114                                    error,
29115                                ));
29116                            }
29117                        }
29118                    };
29119
29120                    dlg.finished(true);
29121                    return Ok(response);
29122                }
29123            }
29124        }
29125    }
29126
29127    /// Required. Parent resource of the API, of the form: `projects/*/locations/*` Only global location is supported for Provider resource.
29128    ///
29129    /// Sets the *parent* path property to the given value.
29130    ///
29131    /// Even though the property as already been set when instantiating this call,
29132    /// we provide this method for API completeness.
29133    pub fn parent(mut self, new_value: &str) -> ProjectLocationProviderListCall<'a, C> {
29134        self._parent = new_value.to_string();
29135        self
29136    }
29137    /// Page token.
29138    ///
29139    /// Sets the *page token* query property to the given value.
29140    pub fn page_token(mut self, new_value: &str) -> ProjectLocationProviderListCall<'a, C> {
29141        self._page_token = Some(new_value.to_string());
29142        self
29143    }
29144    /// Page size.
29145    ///
29146    /// Sets the *page size* query property to the given value.
29147    pub fn page_size(mut self, new_value: i32) -> ProjectLocationProviderListCall<'a, C> {
29148        self._page_size = Some(new_value);
29149        self
29150    }
29151    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29152    /// while executing the actual API request.
29153    ///
29154    /// ````text
29155    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
29156    /// ````
29157    ///
29158    /// Sets the *delegate* property to the given value.
29159    pub fn delegate(
29160        mut self,
29161        new_value: &'a mut dyn common::Delegate,
29162    ) -> ProjectLocationProviderListCall<'a, C> {
29163        self._delegate = Some(new_value);
29164        self
29165    }
29166
29167    /// Set any additional parameter of the query string used in the request.
29168    /// It should be used to set parameters which are not yet available through their own
29169    /// setters.
29170    ///
29171    /// Please note that this method must not be used to set any of the known parameters
29172    /// which have their own setter method. If done anyway, the request will fail.
29173    ///
29174    /// # Additional Parameters
29175    ///
29176    /// * *$.xgafv* (query-string) - V1 error format.
29177    /// * *access_token* (query-string) - OAuth access token.
29178    /// * *alt* (query-string) - Data format for response.
29179    /// * *callback* (query-string) - JSONP
29180    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29181    /// * *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.
29182    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29183    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29184    /// * *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.
29185    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29186    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29187    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationProviderListCall<'a, C>
29188    where
29189        T: AsRef<str>,
29190    {
29191        self._additional_params
29192            .insert(name.as_ref().to_string(), value.as_ref().to_string());
29193        self
29194    }
29195
29196    /// Identifies the authorization scope for the method you are building.
29197    ///
29198    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29199    /// [`Scope::CloudPlatform`].
29200    ///
29201    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29202    /// tokens for more than one scope.
29203    ///
29204    /// Usually there is more than one suitable scope to authorize an operation, some of which may
29205    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29206    /// sufficient, a read-write scope will do as well.
29207    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationProviderListCall<'a, C>
29208    where
29209        St: AsRef<str>,
29210    {
29211        self._scopes.insert(String::from(scope.as_ref()));
29212        self
29213    }
29214    /// Identifies the authorization scope(s) for the method you are building.
29215    ///
29216    /// See [`Self::add_scope()`] for details.
29217    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationProviderListCall<'a, C>
29218    where
29219        I: IntoIterator<Item = St>,
29220        St: AsRef<str>,
29221    {
29222        self._scopes
29223            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29224        self
29225    }
29226
29227    /// Removes all scopes, and no default scope will be used either.
29228    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29229    /// for details).
29230    pub fn clear_scopes(mut self) -> ProjectLocationProviderListCall<'a, C> {
29231        self._scopes.clear();
29232        self
29233    }
29234}
29235
29236/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
29237///
29238/// A builder for the *locations.providers.setIamPolicy* method supported by a *project* resource.
29239/// It is not used directly, but through a [`ProjectMethods`] instance.
29240///
29241/// # Example
29242///
29243/// Instantiate a resource method builder
29244///
29245/// ```test_harness,no_run
29246/// # extern crate hyper;
29247/// # extern crate hyper_rustls;
29248/// # extern crate google_connectors1 as connectors1;
29249/// use connectors1::api::SetIamPolicyRequest;
29250/// # async fn dox() {
29251/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29252///
29253/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29254/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
29255/// #     .with_native_roots()
29256/// #     .unwrap()
29257/// #     .https_only()
29258/// #     .enable_http2()
29259/// #     .build();
29260///
29261/// # let executor = hyper_util::rt::TokioExecutor::new();
29262/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
29263/// #     secret,
29264/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29265/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
29266/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
29267/// #     ),
29268/// # ).build().await.unwrap();
29269///
29270/// # let client = hyper_util::client::legacy::Client::builder(
29271/// #     hyper_util::rt::TokioExecutor::new()
29272/// # )
29273/// # .build(
29274/// #     hyper_rustls::HttpsConnectorBuilder::new()
29275/// #         .with_native_roots()
29276/// #         .unwrap()
29277/// #         .https_or_http()
29278/// #         .enable_http2()
29279/// #         .build()
29280/// # );
29281/// # let mut hub = Connectors::new(client, auth);
29282/// // As the method needs a request, you would usually fill it with the desired information
29283/// // into the respective structure. Some of the parts shown here might not be applicable !
29284/// // Values shown here are possibly random and not representative !
29285/// let mut req = SetIamPolicyRequest::default();
29286///
29287/// // You can configure optional parameters by calling the respective setters at will, and
29288/// // execute the final call using `doit()`.
29289/// // Values shown here are possibly random and not representative !
29290/// let result = hub.projects().locations_providers_set_iam_policy(req, "resource")
29291///              .doit().await;
29292/// # }
29293/// ```
29294pub struct ProjectLocationProviderSetIamPolicyCall<'a, C>
29295where
29296    C: 'a,
29297{
29298    hub: &'a Connectors<C>,
29299    _request: SetIamPolicyRequest,
29300    _resource: String,
29301    _delegate: Option<&'a mut dyn common::Delegate>,
29302    _additional_params: HashMap<String, String>,
29303    _scopes: BTreeSet<String>,
29304}
29305
29306impl<'a, C> common::CallBuilder for ProjectLocationProviderSetIamPolicyCall<'a, C> {}
29307
29308impl<'a, C> ProjectLocationProviderSetIamPolicyCall<'a, C>
29309where
29310    C: common::Connector,
29311{
29312    /// Perform the operation you have build so far.
29313    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
29314        use std::borrow::Cow;
29315        use std::io::{Read, Seek};
29316
29317        use common::{url::Params, ToParts};
29318        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29319
29320        let mut dd = common::DefaultDelegate;
29321        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29322        dlg.begin(common::MethodInfo {
29323            id: "connectors.projects.locations.providers.setIamPolicy",
29324            http_method: hyper::Method::POST,
29325        });
29326
29327        for &field in ["alt", "resource"].iter() {
29328            if self._additional_params.contains_key(field) {
29329                dlg.finished(false);
29330                return Err(common::Error::FieldClash(field));
29331            }
29332        }
29333
29334        let mut params = Params::with_capacity(4 + self._additional_params.len());
29335        params.push("resource", self._resource);
29336
29337        params.extend(self._additional_params.iter());
29338
29339        params.push("alt", "json");
29340        let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
29341        if self._scopes.is_empty() {
29342            self._scopes
29343                .insert(Scope::CloudPlatform.as_ref().to_string());
29344        }
29345
29346        #[allow(clippy::single_element_loop)]
29347        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
29348            url = params.uri_replacement(url, param_name, find_this, true);
29349        }
29350        {
29351            let to_remove = ["resource"];
29352            params.remove_params(&to_remove);
29353        }
29354
29355        let url = params.parse_with_url(&url);
29356
29357        let mut json_mime_type = mime::APPLICATION_JSON;
29358        let mut request_value_reader = {
29359            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
29360            common::remove_json_null_values(&mut value);
29361            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
29362            serde_json::to_writer(&mut dst, &value).unwrap();
29363            dst
29364        };
29365        let request_size = request_value_reader
29366            .seek(std::io::SeekFrom::End(0))
29367            .unwrap();
29368        request_value_reader
29369            .seek(std::io::SeekFrom::Start(0))
29370            .unwrap();
29371
29372        loop {
29373            let token = match self
29374                .hub
29375                .auth
29376                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29377                .await
29378            {
29379                Ok(token) => token,
29380                Err(e) => match dlg.token(e) {
29381                    Ok(token) => token,
29382                    Err(e) => {
29383                        dlg.finished(false);
29384                        return Err(common::Error::MissingToken(e));
29385                    }
29386                },
29387            };
29388            request_value_reader
29389                .seek(std::io::SeekFrom::Start(0))
29390                .unwrap();
29391            let mut req_result = {
29392                let client = &self.hub.client;
29393                dlg.pre_request();
29394                let mut req_builder = hyper::Request::builder()
29395                    .method(hyper::Method::POST)
29396                    .uri(url.as_str())
29397                    .header(USER_AGENT, self.hub._user_agent.clone());
29398
29399                if let Some(token) = token.as_ref() {
29400                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29401                }
29402
29403                let request = req_builder
29404                    .header(CONTENT_TYPE, json_mime_type.to_string())
29405                    .header(CONTENT_LENGTH, request_size as u64)
29406                    .body(common::to_body(
29407                        request_value_reader.get_ref().clone().into(),
29408                    ));
29409
29410                client.request(request.unwrap()).await
29411            };
29412
29413            match req_result {
29414                Err(err) => {
29415                    if let common::Retry::After(d) = dlg.http_error(&err) {
29416                        sleep(d).await;
29417                        continue;
29418                    }
29419                    dlg.finished(false);
29420                    return Err(common::Error::HttpError(err));
29421                }
29422                Ok(res) => {
29423                    let (mut parts, body) = res.into_parts();
29424                    let mut body = common::Body::new(body);
29425                    if !parts.status.is_success() {
29426                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29427                        let error = serde_json::from_str(&common::to_string(&bytes));
29428                        let response = common::to_response(parts, bytes.into());
29429
29430                        if let common::Retry::After(d) =
29431                            dlg.http_failure(&response, error.as_ref().ok())
29432                        {
29433                            sleep(d).await;
29434                            continue;
29435                        }
29436
29437                        dlg.finished(false);
29438
29439                        return Err(match error {
29440                            Ok(value) => common::Error::BadRequest(value),
29441                            _ => common::Error::Failure(response),
29442                        });
29443                    }
29444                    let response = {
29445                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29446                        let encoded = common::to_string(&bytes);
29447                        match serde_json::from_str(&encoded) {
29448                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29449                            Err(error) => {
29450                                dlg.response_json_decode_error(&encoded, &error);
29451                                return Err(common::Error::JsonDecodeError(
29452                                    encoded.to_string(),
29453                                    error,
29454                                ));
29455                            }
29456                        }
29457                    };
29458
29459                    dlg.finished(true);
29460                    return Ok(response);
29461                }
29462            }
29463        }
29464    }
29465
29466    ///
29467    /// Sets the *request* property to the given value.
29468    ///
29469    /// Even though the property as already been set when instantiating this call,
29470    /// we provide this method for API completeness.
29471    pub fn request(
29472        mut self,
29473        new_value: SetIamPolicyRequest,
29474    ) -> ProjectLocationProviderSetIamPolicyCall<'a, C> {
29475        self._request = new_value;
29476        self
29477    }
29478    /// 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.
29479    ///
29480    /// Sets the *resource* path property to the given value.
29481    ///
29482    /// Even though the property as already been set when instantiating this call,
29483    /// we provide this method for API completeness.
29484    pub fn resource(mut self, new_value: &str) -> ProjectLocationProviderSetIamPolicyCall<'a, C> {
29485        self._resource = new_value.to_string();
29486        self
29487    }
29488    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29489    /// while executing the actual API request.
29490    ///
29491    /// ````text
29492    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
29493    /// ````
29494    ///
29495    /// Sets the *delegate* property to the given value.
29496    pub fn delegate(
29497        mut self,
29498        new_value: &'a mut dyn common::Delegate,
29499    ) -> ProjectLocationProviderSetIamPolicyCall<'a, C> {
29500        self._delegate = Some(new_value);
29501        self
29502    }
29503
29504    /// Set any additional parameter of the query string used in the request.
29505    /// It should be used to set parameters which are not yet available through their own
29506    /// setters.
29507    ///
29508    /// Please note that this method must not be used to set any of the known parameters
29509    /// which have their own setter method. If done anyway, the request will fail.
29510    ///
29511    /// # Additional Parameters
29512    ///
29513    /// * *$.xgafv* (query-string) - V1 error format.
29514    /// * *access_token* (query-string) - OAuth access token.
29515    /// * *alt* (query-string) - Data format for response.
29516    /// * *callback* (query-string) - JSONP
29517    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29518    /// * *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.
29519    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29520    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29521    /// * *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.
29522    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29523    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29524    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationProviderSetIamPolicyCall<'a, C>
29525    where
29526        T: AsRef<str>,
29527    {
29528        self._additional_params
29529            .insert(name.as_ref().to_string(), value.as_ref().to_string());
29530        self
29531    }
29532
29533    /// Identifies the authorization scope for the method you are building.
29534    ///
29535    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29536    /// [`Scope::CloudPlatform`].
29537    ///
29538    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29539    /// tokens for more than one scope.
29540    ///
29541    /// Usually there is more than one suitable scope to authorize an operation, some of which may
29542    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29543    /// sufficient, a read-write scope will do as well.
29544    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationProviderSetIamPolicyCall<'a, C>
29545    where
29546        St: AsRef<str>,
29547    {
29548        self._scopes.insert(String::from(scope.as_ref()));
29549        self
29550    }
29551    /// Identifies the authorization scope(s) for the method you are building.
29552    ///
29553    /// See [`Self::add_scope()`] for details.
29554    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationProviderSetIamPolicyCall<'a, C>
29555    where
29556        I: IntoIterator<Item = St>,
29557        St: AsRef<str>,
29558    {
29559        self._scopes
29560            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29561        self
29562    }
29563
29564    /// Removes all scopes, and no default scope will be used either.
29565    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29566    /// for details).
29567    pub fn clear_scopes(mut self) -> ProjectLocationProviderSetIamPolicyCall<'a, C> {
29568        self._scopes.clear();
29569        self
29570    }
29571}
29572
29573/// 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.
29574///
29575/// A builder for the *locations.providers.testIamPermissions* method supported by a *project* resource.
29576/// It is not used directly, but through a [`ProjectMethods`] instance.
29577///
29578/// # Example
29579///
29580/// Instantiate a resource method builder
29581///
29582/// ```test_harness,no_run
29583/// # extern crate hyper;
29584/// # extern crate hyper_rustls;
29585/// # extern crate google_connectors1 as connectors1;
29586/// use connectors1::api::TestIamPermissionsRequest;
29587/// # async fn dox() {
29588/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29589///
29590/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29591/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
29592/// #     .with_native_roots()
29593/// #     .unwrap()
29594/// #     .https_only()
29595/// #     .enable_http2()
29596/// #     .build();
29597///
29598/// # let executor = hyper_util::rt::TokioExecutor::new();
29599/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
29600/// #     secret,
29601/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29602/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
29603/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
29604/// #     ),
29605/// # ).build().await.unwrap();
29606///
29607/// # let client = hyper_util::client::legacy::Client::builder(
29608/// #     hyper_util::rt::TokioExecutor::new()
29609/// # )
29610/// # .build(
29611/// #     hyper_rustls::HttpsConnectorBuilder::new()
29612/// #         .with_native_roots()
29613/// #         .unwrap()
29614/// #         .https_or_http()
29615/// #         .enable_http2()
29616/// #         .build()
29617/// # );
29618/// # let mut hub = Connectors::new(client, auth);
29619/// // As the method needs a request, you would usually fill it with the desired information
29620/// // into the respective structure. Some of the parts shown here might not be applicable !
29621/// // Values shown here are possibly random and not representative !
29622/// let mut req = TestIamPermissionsRequest::default();
29623///
29624/// // You can configure optional parameters by calling the respective setters at will, and
29625/// // execute the final call using `doit()`.
29626/// // Values shown here are possibly random and not representative !
29627/// let result = hub.projects().locations_providers_test_iam_permissions(req, "resource")
29628///              .doit().await;
29629/// # }
29630/// ```
29631pub struct ProjectLocationProviderTestIamPermissionCall<'a, C>
29632where
29633    C: 'a,
29634{
29635    hub: &'a Connectors<C>,
29636    _request: TestIamPermissionsRequest,
29637    _resource: String,
29638    _delegate: Option<&'a mut dyn common::Delegate>,
29639    _additional_params: HashMap<String, String>,
29640    _scopes: BTreeSet<String>,
29641}
29642
29643impl<'a, C> common::CallBuilder for ProjectLocationProviderTestIamPermissionCall<'a, C> {}
29644
29645impl<'a, C> ProjectLocationProviderTestIamPermissionCall<'a, C>
29646where
29647    C: common::Connector,
29648{
29649    /// Perform the operation you have build so far.
29650    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
29651        use std::borrow::Cow;
29652        use std::io::{Read, Seek};
29653
29654        use common::{url::Params, ToParts};
29655        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29656
29657        let mut dd = common::DefaultDelegate;
29658        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29659        dlg.begin(common::MethodInfo {
29660            id: "connectors.projects.locations.providers.testIamPermissions",
29661            http_method: hyper::Method::POST,
29662        });
29663
29664        for &field in ["alt", "resource"].iter() {
29665            if self._additional_params.contains_key(field) {
29666                dlg.finished(false);
29667                return Err(common::Error::FieldClash(field));
29668            }
29669        }
29670
29671        let mut params = Params::with_capacity(4 + self._additional_params.len());
29672        params.push("resource", self._resource);
29673
29674        params.extend(self._additional_params.iter());
29675
29676        params.push("alt", "json");
29677        let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
29678        if self._scopes.is_empty() {
29679            self._scopes
29680                .insert(Scope::CloudPlatform.as_ref().to_string());
29681        }
29682
29683        #[allow(clippy::single_element_loop)]
29684        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
29685            url = params.uri_replacement(url, param_name, find_this, true);
29686        }
29687        {
29688            let to_remove = ["resource"];
29689            params.remove_params(&to_remove);
29690        }
29691
29692        let url = params.parse_with_url(&url);
29693
29694        let mut json_mime_type = mime::APPLICATION_JSON;
29695        let mut request_value_reader = {
29696            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
29697            common::remove_json_null_values(&mut value);
29698            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
29699            serde_json::to_writer(&mut dst, &value).unwrap();
29700            dst
29701        };
29702        let request_size = request_value_reader
29703            .seek(std::io::SeekFrom::End(0))
29704            .unwrap();
29705        request_value_reader
29706            .seek(std::io::SeekFrom::Start(0))
29707            .unwrap();
29708
29709        loop {
29710            let token = match self
29711                .hub
29712                .auth
29713                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29714                .await
29715            {
29716                Ok(token) => token,
29717                Err(e) => match dlg.token(e) {
29718                    Ok(token) => token,
29719                    Err(e) => {
29720                        dlg.finished(false);
29721                        return Err(common::Error::MissingToken(e));
29722                    }
29723                },
29724            };
29725            request_value_reader
29726                .seek(std::io::SeekFrom::Start(0))
29727                .unwrap();
29728            let mut req_result = {
29729                let client = &self.hub.client;
29730                dlg.pre_request();
29731                let mut req_builder = hyper::Request::builder()
29732                    .method(hyper::Method::POST)
29733                    .uri(url.as_str())
29734                    .header(USER_AGENT, self.hub._user_agent.clone());
29735
29736                if let Some(token) = token.as_ref() {
29737                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29738                }
29739
29740                let request = req_builder
29741                    .header(CONTENT_TYPE, json_mime_type.to_string())
29742                    .header(CONTENT_LENGTH, request_size as u64)
29743                    .body(common::to_body(
29744                        request_value_reader.get_ref().clone().into(),
29745                    ));
29746
29747                client.request(request.unwrap()).await
29748            };
29749
29750            match req_result {
29751                Err(err) => {
29752                    if let common::Retry::After(d) = dlg.http_error(&err) {
29753                        sleep(d).await;
29754                        continue;
29755                    }
29756                    dlg.finished(false);
29757                    return Err(common::Error::HttpError(err));
29758                }
29759                Ok(res) => {
29760                    let (mut parts, body) = res.into_parts();
29761                    let mut body = common::Body::new(body);
29762                    if !parts.status.is_success() {
29763                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29764                        let error = serde_json::from_str(&common::to_string(&bytes));
29765                        let response = common::to_response(parts, bytes.into());
29766
29767                        if let common::Retry::After(d) =
29768                            dlg.http_failure(&response, error.as_ref().ok())
29769                        {
29770                            sleep(d).await;
29771                            continue;
29772                        }
29773
29774                        dlg.finished(false);
29775
29776                        return Err(match error {
29777                            Ok(value) => common::Error::BadRequest(value),
29778                            _ => common::Error::Failure(response),
29779                        });
29780                    }
29781                    let response = {
29782                        let bytes = common::to_bytes(body).await.unwrap_or_default();
29783                        let encoded = common::to_string(&bytes);
29784                        match serde_json::from_str(&encoded) {
29785                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29786                            Err(error) => {
29787                                dlg.response_json_decode_error(&encoded, &error);
29788                                return Err(common::Error::JsonDecodeError(
29789                                    encoded.to_string(),
29790                                    error,
29791                                ));
29792                            }
29793                        }
29794                    };
29795
29796                    dlg.finished(true);
29797                    return Ok(response);
29798                }
29799            }
29800        }
29801    }
29802
29803    ///
29804    /// Sets the *request* property to the given value.
29805    ///
29806    /// Even though the property as already been set when instantiating this call,
29807    /// we provide this method for API completeness.
29808    pub fn request(
29809        mut self,
29810        new_value: TestIamPermissionsRequest,
29811    ) -> ProjectLocationProviderTestIamPermissionCall<'a, C> {
29812        self._request = new_value;
29813        self
29814    }
29815    /// 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.
29816    ///
29817    /// Sets the *resource* path property to the given value.
29818    ///
29819    /// Even though the property as already been set when instantiating this call,
29820    /// we provide this method for API completeness.
29821    pub fn resource(
29822        mut self,
29823        new_value: &str,
29824    ) -> ProjectLocationProviderTestIamPermissionCall<'a, C> {
29825        self._resource = new_value.to_string();
29826        self
29827    }
29828    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29829    /// while executing the actual API request.
29830    ///
29831    /// ````text
29832    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
29833    /// ````
29834    ///
29835    /// Sets the *delegate* property to the given value.
29836    pub fn delegate(
29837        mut self,
29838        new_value: &'a mut dyn common::Delegate,
29839    ) -> ProjectLocationProviderTestIamPermissionCall<'a, C> {
29840        self._delegate = Some(new_value);
29841        self
29842    }
29843
29844    /// Set any additional parameter of the query string used in the request.
29845    /// It should be used to set parameters which are not yet available through their own
29846    /// setters.
29847    ///
29848    /// Please note that this method must not be used to set any of the known parameters
29849    /// which have their own setter method. If done anyway, the request will fail.
29850    ///
29851    /// # Additional Parameters
29852    ///
29853    /// * *$.xgafv* (query-string) - V1 error format.
29854    /// * *access_token* (query-string) - OAuth access token.
29855    /// * *alt* (query-string) - Data format for response.
29856    /// * *callback* (query-string) - JSONP
29857    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29858    /// * *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.
29859    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29860    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29861    /// * *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.
29862    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29863    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29864    pub fn param<T>(
29865        mut self,
29866        name: T,
29867        value: T,
29868    ) -> ProjectLocationProviderTestIamPermissionCall<'a, C>
29869    where
29870        T: AsRef<str>,
29871    {
29872        self._additional_params
29873            .insert(name.as_ref().to_string(), value.as_ref().to_string());
29874        self
29875    }
29876
29877    /// Identifies the authorization scope for the method you are building.
29878    ///
29879    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29880    /// [`Scope::CloudPlatform`].
29881    ///
29882    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29883    /// tokens for more than one scope.
29884    ///
29885    /// Usually there is more than one suitable scope to authorize an operation, some of which may
29886    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29887    /// sufficient, a read-write scope will do as well.
29888    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationProviderTestIamPermissionCall<'a, C>
29889    where
29890        St: AsRef<str>,
29891    {
29892        self._scopes.insert(String::from(scope.as_ref()));
29893        self
29894    }
29895    /// Identifies the authorization scope(s) for the method you are building.
29896    ///
29897    /// See [`Self::add_scope()`] for details.
29898    pub fn add_scopes<I, St>(
29899        mut self,
29900        scopes: I,
29901    ) -> ProjectLocationProviderTestIamPermissionCall<'a, C>
29902    where
29903        I: IntoIterator<Item = St>,
29904        St: AsRef<str>,
29905    {
29906        self._scopes
29907            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29908        self
29909    }
29910
29911    /// Removes all scopes, and no default scope will be used either.
29912    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29913    /// for details).
29914    pub fn clear_scopes(mut self) -> ProjectLocationProviderTestIamPermissionCall<'a, C> {
29915        self._scopes.clear();
29916        self
29917    }
29918}
29919
29920/// Gets information about a location.
29921///
29922/// A builder for the *locations.get* method supported by a *project* resource.
29923/// It is not used directly, but through a [`ProjectMethods`] instance.
29924///
29925/// # Example
29926///
29927/// Instantiate a resource method builder
29928///
29929/// ```test_harness,no_run
29930/// # extern crate hyper;
29931/// # extern crate hyper_rustls;
29932/// # extern crate google_connectors1 as connectors1;
29933/// # async fn dox() {
29934/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29935///
29936/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29937/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
29938/// #     .with_native_roots()
29939/// #     .unwrap()
29940/// #     .https_only()
29941/// #     .enable_http2()
29942/// #     .build();
29943///
29944/// # let executor = hyper_util::rt::TokioExecutor::new();
29945/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
29946/// #     secret,
29947/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29948/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
29949/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
29950/// #     ),
29951/// # ).build().await.unwrap();
29952///
29953/// # let client = hyper_util::client::legacy::Client::builder(
29954/// #     hyper_util::rt::TokioExecutor::new()
29955/// # )
29956/// # .build(
29957/// #     hyper_rustls::HttpsConnectorBuilder::new()
29958/// #         .with_native_roots()
29959/// #         .unwrap()
29960/// #         .https_or_http()
29961/// #         .enable_http2()
29962/// #         .build()
29963/// # );
29964/// # let mut hub = Connectors::new(client, auth);
29965/// // You can configure optional parameters by calling the respective setters at will, and
29966/// // execute the final call using `doit()`.
29967/// // Values shown here are possibly random and not representative !
29968/// let result = hub.projects().locations_get("name")
29969///              .doit().await;
29970/// # }
29971/// ```
29972pub struct ProjectLocationGetCall<'a, C>
29973where
29974    C: 'a,
29975{
29976    hub: &'a Connectors<C>,
29977    _name: String,
29978    _delegate: Option<&'a mut dyn common::Delegate>,
29979    _additional_params: HashMap<String, String>,
29980    _scopes: BTreeSet<String>,
29981}
29982
29983impl<'a, C> common::CallBuilder for ProjectLocationGetCall<'a, C> {}
29984
29985impl<'a, C> ProjectLocationGetCall<'a, C>
29986where
29987    C: common::Connector,
29988{
29989    /// Perform the operation you have build so far.
29990    pub async fn doit(mut self) -> common::Result<(common::Response, Location)> {
29991        use std::borrow::Cow;
29992        use std::io::{Read, Seek};
29993
29994        use common::{url::Params, ToParts};
29995        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29996
29997        let mut dd = common::DefaultDelegate;
29998        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29999        dlg.begin(common::MethodInfo {
30000            id: "connectors.projects.locations.get",
30001            http_method: hyper::Method::GET,
30002        });
30003
30004        for &field in ["alt", "name"].iter() {
30005            if self._additional_params.contains_key(field) {
30006                dlg.finished(false);
30007                return Err(common::Error::FieldClash(field));
30008            }
30009        }
30010
30011        let mut params = Params::with_capacity(3 + self._additional_params.len());
30012        params.push("name", self._name);
30013
30014        params.extend(self._additional_params.iter());
30015
30016        params.push("alt", "json");
30017        let mut url = self.hub._base_url.clone() + "v1/{+name}";
30018        if self._scopes.is_empty() {
30019            self._scopes
30020                .insert(Scope::CloudPlatform.as_ref().to_string());
30021        }
30022
30023        #[allow(clippy::single_element_loop)]
30024        for &(find_this, param_name) in [("{+name}", "name")].iter() {
30025            url = params.uri_replacement(url, param_name, find_this, true);
30026        }
30027        {
30028            let to_remove = ["name"];
30029            params.remove_params(&to_remove);
30030        }
30031
30032        let url = params.parse_with_url(&url);
30033
30034        loop {
30035            let token = match self
30036                .hub
30037                .auth
30038                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30039                .await
30040            {
30041                Ok(token) => token,
30042                Err(e) => match dlg.token(e) {
30043                    Ok(token) => token,
30044                    Err(e) => {
30045                        dlg.finished(false);
30046                        return Err(common::Error::MissingToken(e));
30047                    }
30048                },
30049            };
30050            let mut req_result = {
30051                let client = &self.hub.client;
30052                dlg.pre_request();
30053                let mut req_builder = hyper::Request::builder()
30054                    .method(hyper::Method::GET)
30055                    .uri(url.as_str())
30056                    .header(USER_AGENT, self.hub._user_agent.clone());
30057
30058                if let Some(token) = token.as_ref() {
30059                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30060                }
30061
30062                let request = req_builder
30063                    .header(CONTENT_LENGTH, 0_u64)
30064                    .body(common::to_body::<String>(None));
30065
30066                client.request(request.unwrap()).await
30067            };
30068
30069            match req_result {
30070                Err(err) => {
30071                    if let common::Retry::After(d) = dlg.http_error(&err) {
30072                        sleep(d).await;
30073                        continue;
30074                    }
30075                    dlg.finished(false);
30076                    return Err(common::Error::HttpError(err));
30077                }
30078                Ok(res) => {
30079                    let (mut parts, body) = res.into_parts();
30080                    let mut body = common::Body::new(body);
30081                    if !parts.status.is_success() {
30082                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30083                        let error = serde_json::from_str(&common::to_string(&bytes));
30084                        let response = common::to_response(parts, bytes.into());
30085
30086                        if let common::Retry::After(d) =
30087                            dlg.http_failure(&response, error.as_ref().ok())
30088                        {
30089                            sleep(d).await;
30090                            continue;
30091                        }
30092
30093                        dlg.finished(false);
30094
30095                        return Err(match error {
30096                            Ok(value) => common::Error::BadRequest(value),
30097                            _ => common::Error::Failure(response),
30098                        });
30099                    }
30100                    let response = {
30101                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30102                        let encoded = common::to_string(&bytes);
30103                        match serde_json::from_str(&encoded) {
30104                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
30105                            Err(error) => {
30106                                dlg.response_json_decode_error(&encoded, &error);
30107                                return Err(common::Error::JsonDecodeError(
30108                                    encoded.to_string(),
30109                                    error,
30110                                ));
30111                            }
30112                        }
30113                    };
30114
30115                    dlg.finished(true);
30116                    return Ok(response);
30117                }
30118            }
30119        }
30120    }
30121
30122    /// Resource name for the location.
30123    ///
30124    /// Sets the *name* path property to the given value.
30125    ///
30126    /// Even though the property as already been set when instantiating this call,
30127    /// we provide this method for API completeness.
30128    pub fn name(mut self, new_value: &str) -> ProjectLocationGetCall<'a, C> {
30129        self._name = new_value.to_string();
30130        self
30131    }
30132    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30133    /// while executing the actual API request.
30134    ///
30135    /// ````text
30136    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
30137    /// ````
30138    ///
30139    /// Sets the *delegate* property to the given value.
30140    pub fn delegate(
30141        mut self,
30142        new_value: &'a mut dyn common::Delegate,
30143    ) -> ProjectLocationGetCall<'a, C> {
30144        self._delegate = Some(new_value);
30145        self
30146    }
30147
30148    /// Set any additional parameter of the query string used in the request.
30149    /// It should be used to set parameters which are not yet available through their own
30150    /// setters.
30151    ///
30152    /// Please note that this method must not be used to set any of the known parameters
30153    /// which have their own setter method. If done anyway, the request will fail.
30154    ///
30155    /// # Additional Parameters
30156    ///
30157    /// * *$.xgafv* (query-string) - V1 error format.
30158    /// * *access_token* (query-string) - OAuth access token.
30159    /// * *alt* (query-string) - Data format for response.
30160    /// * *callback* (query-string) - JSONP
30161    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30162    /// * *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.
30163    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30164    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30165    /// * *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.
30166    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30167    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30168    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C>
30169    where
30170        T: AsRef<str>,
30171    {
30172        self._additional_params
30173            .insert(name.as_ref().to_string(), value.as_ref().to_string());
30174        self
30175    }
30176
30177    /// Identifies the authorization scope for the method you are building.
30178    ///
30179    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30180    /// [`Scope::CloudPlatform`].
30181    ///
30182    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30183    /// tokens for more than one scope.
30184    ///
30185    /// Usually there is more than one suitable scope to authorize an operation, some of which may
30186    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30187    /// sufficient, a read-write scope will do as well.
30188    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetCall<'a, C>
30189    where
30190        St: AsRef<str>,
30191    {
30192        self._scopes.insert(String::from(scope.as_ref()));
30193        self
30194    }
30195    /// Identifies the authorization scope(s) for the method you are building.
30196    ///
30197    /// See [`Self::add_scope()`] for details.
30198    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetCall<'a, C>
30199    where
30200        I: IntoIterator<Item = St>,
30201        St: AsRef<str>,
30202    {
30203        self._scopes
30204            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30205        self
30206    }
30207
30208    /// Removes all scopes, and no default scope will be used either.
30209    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30210    /// for details).
30211    pub fn clear_scopes(mut self) -> ProjectLocationGetCall<'a, C> {
30212        self._scopes.clear();
30213        self
30214    }
30215}
30216
30217/// GetRegionalSettings gets settings of a region. RegionalSettings is a singleton resource.
30218///
30219/// A builder for the *locations.getRegionalSettings* method supported by a *project* resource.
30220/// It is not used directly, but through a [`ProjectMethods`] instance.
30221///
30222/// # Example
30223///
30224/// Instantiate a resource method builder
30225///
30226/// ```test_harness,no_run
30227/// # extern crate hyper;
30228/// # extern crate hyper_rustls;
30229/// # extern crate google_connectors1 as connectors1;
30230/// # async fn dox() {
30231/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30232///
30233/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30234/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
30235/// #     .with_native_roots()
30236/// #     .unwrap()
30237/// #     .https_only()
30238/// #     .enable_http2()
30239/// #     .build();
30240///
30241/// # let executor = hyper_util::rt::TokioExecutor::new();
30242/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
30243/// #     secret,
30244/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30245/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
30246/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
30247/// #     ),
30248/// # ).build().await.unwrap();
30249///
30250/// # let client = hyper_util::client::legacy::Client::builder(
30251/// #     hyper_util::rt::TokioExecutor::new()
30252/// # )
30253/// # .build(
30254/// #     hyper_rustls::HttpsConnectorBuilder::new()
30255/// #         .with_native_roots()
30256/// #         .unwrap()
30257/// #         .https_or_http()
30258/// #         .enable_http2()
30259/// #         .build()
30260/// # );
30261/// # let mut hub = Connectors::new(client, auth);
30262/// // You can configure optional parameters by calling the respective setters at will, and
30263/// // execute the final call using `doit()`.
30264/// // Values shown here are possibly random and not representative !
30265/// let result = hub.projects().locations_get_regional_settings("name")
30266///              .doit().await;
30267/// # }
30268/// ```
30269pub struct ProjectLocationGetRegionalSettingCall<'a, C>
30270where
30271    C: 'a,
30272{
30273    hub: &'a Connectors<C>,
30274    _name: String,
30275    _delegate: Option<&'a mut dyn common::Delegate>,
30276    _additional_params: HashMap<String, String>,
30277    _scopes: BTreeSet<String>,
30278}
30279
30280impl<'a, C> common::CallBuilder for ProjectLocationGetRegionalSettingCall<'a, C> {}
30281
30282impl<'a, C> ProjectLocationGetRegionalSettingCall<'a, C>
30283where
30284    C: common::Connector,
30285{
30286    /// Perform the operation you have build so far.
30287    pub async fn doit(mut self) -> common::Result<(common::Response, RegionalSettings)> {
30288        use std::borrow::Cow;
30289        use std::io::{Read, Seek};
30290
30291        use common::{url::Params, ToParts};
30292        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
30293
30294        let mut dd = common::DefaultDelegate;
30295        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
30296        dlg.begin(common::MethodInfo {
30297            id: "connectors.projects.locations.getRegionalSettings",
30298            http_method: hyper::Method::GET,
30299        });
30300
30301        for &field in ["alt", "name"].iter() {
30302            if self._additional_params.contains_key(field) {
30303                dlg.finished(false);
30304                return Err(common::Error::FieldClash(field));
30305            }
30306        }
30307
30308        let mut params = Params::with_capacity(3 + self._additional_params.len());
30309        params.push("name", self._name);
30310
30311        params.extend(self._additional_params.iter());
30312
30313        params.push("alt", "json");
30314        let mut url = self.hub._base_url.clone() + "v1/{+name}";
30315        if self._scopes.is_empty() {
30316            self._scopes
30317                .insert(Scope::CloudPlatform.as_ref().to_string());
30318        }
30319
30320        #[allow(clippy::single_element_loop)]
30321        for &(find_this, param_name) in [("{+name}", "name")].iter() {
30322            url = params.uri_replacement(url, param_name, find_this, true);
30323        }
30324        {
30325            let to_remove = ["name"];
30326            params.remove_params(&to_remove);
30327        }
30328
30329        let url = params.parse_with_url(&url);
30330
30331        loop {
30332            let token = match self
30333                .hub
30334                .auth
30335                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30336                .await
30337            {
30338                Ok(token) => token,
30339                Err(e) => match dlg.token(e) {
30340                    Ok(token) => token,
30341                    Err(e) => {
30342                        dlg.finished(false);
30343                        return Err(common::Error::MissingToken(e));
30344                    }
30345                },
30346            };
30347            let mut req_result = {
30348                let client = &self.hub.client;
30349                dlg.pre_request();
30350                let mut req_builder = hyper::Request::builder()
30351                    .method(hyper::Method::GET)
30352                    .uri(url.as_str())
30353                    .header(USER_AGENT, self.hub._user_agent.clone());
30354
30355                if let Some(token) = token.as_ref() {
30356                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30357                }
30358
30359                let request = req_builder
30360                    .header(CONTENT_LENGTH, 0_u64)
30361                    .body(common::to_body::<String>(None));
30362
30363                client.request(request.unwrap()).await
30364            };
30365
30366            match req_result {
30367                Err(err) => {
30368                    if let common::Retry::After(d) = dlg.http_error(&err) {
30369                        sleep(d).await;
30370                        continue;
30371                    }
30372                    dlg.finished(false);
30373                    return Err(common::Error::HttpError(err));
30374                }
30375                Ok(res) => {
30376                    let (mut parts, body) = res.into_parts();
30377                    let mut body = common::Body::new(body);
30378                    if !parts.status.is_success() {
30379                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30380                        let error = serde_json::from_str(&common::to_string(&bytes));
30381                        let response = common::to_response(parts, bytes.into());
30382
30383                        if let common::Retry::After(d) =
30384                            dlg.http_failure(&response, error.as_ref().ok())
30385                        {
30386                            sleep(d).await;
30387                            continue;
30388                        }
30389
30390                        dlg.finished(false);
30391
30392                        return Err(match error {
30393                            Ok(value) => common::Error::BadRequest(value),
30394                            _ => common::Error::Failure(response),
30395                        });
30396                    }
30397                    let response = {
30398                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30399                        let encoded = common::to_string(&bytes);
30400                        match serde_json::from_str(&encoded) {
30401                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
30402                            Err(error) => {
30403                                dlg.response_json_decode_error(&encoded, &error);
30404                                return Err(common::Error::JsonDecodeError(
30405                                    encoded.to_string(),
30406                                    error,
30407                                ));
30408                            }
30409                        }
30410                    };
30411
30412                    dlg.finished(true);
30413                    return Ok(response);
30414                }
30415            }
30416        }
30417    }
30418
30419    /// Required. The resource name of the Regional Settings.
30420    ///
30421    /// Sets the *name* path property to the given value.
30422    ///
30423    /// Even though the property as already been set when instantiating this call,
30424    /// we provide this method for API completeness.
30425    pub fn name(mut self, new_value: &str) -> ProjectLocationGetRegionalSettingCall<'a, C> {
30426        self._name = new_value.to_string();
30427        self
30428    }
30429    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30430    /// while executing the actual API request.
30431    ///
30432    /// ````text
30433    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
30434    /// ````
30435    ///
30436    /// Sets the *delegate* property to the given value.
30437    pub fn delegate(
30438        mut self,
30439        new_value: &'a mut dyn common::Delegate,
30440    ) -> ProjectLocationGetRegionalSettingCall<'a, C> {
30441        self._delegate = Some(new_value);
30442        self
30443    }
30444
30445    /// Set any additional parameter of the query string used in the request.
30446    /// It should be used to set parameters which are not yet available through their own
30447    /// setters.
30448    ///
30449    /// Please note that this method must not be used to set any of the known parameters
30450    /// which have their own setter method. If done anyway, the request will fail.
30451    ///
30452    /// # Additional Parameters
30453    ///
30454    /// * *$.xgafv* (query-string) - V1 error format.
30455    /// * *access_token* (query-string) - OAuth access token.
30456    /// * *alt* (query-string) - Data format for response.
30457    /// * *callback* (query-string) - JSONP
30458    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30459    /// * *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.
30460    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30461    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30462    /// * *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.
30463    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30464    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30465    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetRegionalSettingCall<'a, C>
30466    where
30467        T: AsRef<str>,
30468    {
30469        self._additional_params
30470            .insert(name.as_ref().to_string(), value.as_ref().to_string());
30471        self
30472    }
30473
30474    /// Identifies the authorization scope for the method you are building.
30475    ///
30476    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30477    /// [`Scope::CloudPlatform`].
30478    ///
30479    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30480    /// tokens for more than one scope.
30481    ///
30482    /// Usually there is more than one suitable scope to authorize an operation, some of which may
30483    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30484    /// sufficient, a read-write scope will do as well.
30485    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetRegionalSettingCall<'a, C>
30486    where
30487        St: AsRef<str>,
30488    {
30489        self._scopes.insert(String::from(scope.as_ref()));
30490        self
30491    }
30492    /// Identifies the authorization scope(s) for the method you are building.
30493    ///
30494    /// See [`Self::add_scope()`] for details.
30495    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetRegionalSettingCall<'a, C>
30496    where
30497        I: IntoIterator<Item = St>,
30498        St: AsRef<str>,
30499    {
30500        self._scopes
30501            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30502        self
30503    }
30504
30505    /// Removes all scopes, and no default scope will be used either.
30506    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30507    /// for details).
30508    pub fn clear_scopes(mut self) -> ProjectLocationGetRegionalSettingCall<'a, C> {
30509        self._scopes.clear();
30510        self
30511    }
30512}
30513
30514/// Gets the runtimeConfig of a location. RuntimeConfig is a singleton resource for each location.
30515///
30516/// A builder for the *locations.getRuntimeConfig* method supported by a *project* resource.
30517/// It is not used directly, but through a [`ProjectMethods`] instance.
30518///
30519/// # Example
30520///
30521/// Instantiate a resource method builder
30522///
30523/// ```test_harness,no_run
30524/// # extern crate hyper;
30525/// # extern crate hyper_rustls;
30526/// # extern crate google_connectors1 as connectors1;
30527/// # async fn dox() {
30528/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30529///
30530/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30531/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
30532/// #     .with_native_roots()
30533/// #     .unwrap()
30534/// #     .https_only()
30535/// #     .enable_http2()
30536/// #     .build();
30537///
30538/// # let executor = hyper_util::rt::TokioExecutor::new();
30539/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
30540/// #     secret,
30541/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30542/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
30543/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
30544/// #     ),
30545/// # ).build().await.unwrap();
30546///
30547/// # let client = hyper_util::client::legacy::Client::builder(
30548/// #     hyper_util::rt::TokioExecutor::new()
30549/// # )
30550/// # .build(
30551/// #     hyper_rustls::HttpsConnectorBuilder::new()
30552/// #         .with_native_roots()
30553/// #         .unwrap()
30554/// #         .https_or_http()
30555/// #         .enable_http2()
30556/// #         .build()
30557/// # );
30558/// # let mut hub = Connectors::new(client, auth);
30559/// // You can configure optional parameters by calling the respective setters at will, and
30560/// // execute the final call using `doit()`.
30561/// // Values shown here are possibly random and not representative !
30562/// let result = hub.projects().locations_get_runtime_config("name")
30563///              .doit().await;
30564/// # }
30565/// ```
30566pub struct ProjectLocationGetRuntimeConfigCall<'a, C>
30567where
30568    C: 'a,
30569{
30570    hub: &'a Connectors<C>,
30571    _name: String,
30572    _delegate: Option<&'a mut dyn common::Delegate>,
30573    _additional_params: HashMap<String, String>,
30574    _scopes: BTreeSet<String>,
30575}
30576
30577impl<'a, C> common::CallBuilder for ProjectLocationGetRuntimeConfigCall<'a, C> {}
30578
30579impl<'a, C> ProjectLocationGetRuntimeConfigCall<'a, C>
30580where
30581    C: common::Connector,
30582{
30583    /// Perform the operation you have build so far.
30584    pub async fn doit(mut self) -> common::Result<(common::Response, RuntimeConfig)> {
30585        use std::borrow::Cow;
30586        use std::io::{Read, Seek};
30587
30588        use common::{url::Params, ToParts};
30589        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
30590
30591        let mut dd = common::DefaultDelegate;
30592        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
30593        dlg.begin(common::MethodInfo {
30594            id: "connectors.projects.locations.getRuntimeConfig",
30595            http_method: hyper::Method::GET,
30596        });
30597
30598        for &field in ["alt", "name"].iter() {
30599            if self._additional_params.contains_key(field) {
30600                dlg.finished(false);
30601                return Err(common::Error::FieldClash(field));
30602            }
30603        }
30604
30605        let mut params = Params::with_capacity(3 + self._additional_params.len());
30606        params.push("name", self._name);
30607
30608        params.extend(self._additional_params.iter());
30609
30610        params.push("alt", "json");
30611        let mut url = self.hub._base_url.clone() + "v1/{+name}";
30612        if self._scopes.is_empty() {
30613            self._scopes
30614                .insert(Scope::CloudPlatform.as_ref().to_string());
30615        }
30616
30617        #[allow(clippy::single_element_loop)]
30618        for &(find_this, param_name) in [("{+name}", "name")].iter() {
30619            url = params.uri_replacement(url, param_name, find_this, true);
30620        }
30621        {
30622            let to_remove = ["name"];
30623            params.remove_params(&to_remove);
30624        }
30625
30626        let url = params.parse_with_url(&url);
30627
30628        loop {
30629            let token = match self
30630                .hub
30631                .auth
30632                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30633                .await
30634            {
30635                Ok(token) => token,
30636                Err(e) => match dlg.token(e) {
30637                    Ok(token) => token,
30638                    Err(e) => {
30639                        dlg.finished(false);
30640                        return Err(common::Error::MissingToken(e));
30641                    }
30642                },
30643            };
30644            let mut req_result = {
30645                let client = &self.hub.client;
30646                dlg.pre_request();
30647                let mut req_builder = hyper::Request::builder()
30648                    .method(hyper::Method::GET)
30649                    .uri(url.as_str())
30650                    .header(USER_AGENT, self.hub._user_agent.clone());
30651
30652                if let Some(token) = token.as_ref() {
30653                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30654                }
30655
30656                let request = req_builder
30657                    .header(CONTENT_LENGTH, 0_u64)
30658                    .body(common::to_body::<String>(None));
30659
30660                client.request(request.unwrap()).await
30661            };
30662
30663            match req_result {
30664                Err(err) => {
30665                    if let common::Retry::After(d) = dlg.http_error(&err) {
30666                        sleep(d).await;
30667                        continue;
30668                    }
30669                    dlg.finished(false);
30670                    return Err(common::Error::HttpError(err));
30671                }
30672                Ok(res) => {
30673                    let (mut parts, body) = res.into_parts();
30674                    let mut body = common::Body::new(body);
30675                    if !parts.status.is_success() {
30676                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30677                        let error = serde_json::from_str(&common::to_string(&bytes));
30678                        let response = common::to_response(parts, bytes.into());
30679
30680                        if let common::Retry::After(d) =
30681                            dlg.http_failure(&response, error.as_ref().ok())
30682                        {
30683                            sleep(d).await;
30684                            continue;
30685                        }
30686
30687                        dlg.finished(false);
30688
30689                        return Err(match error {
30690                            Ok(value) => common::Error::BadRequest(value),
30691                            _ => common::Error::Failure(response),
30692                        });
30693                    }
30694                    let response = {
30695                        let bytes = common::to_bytes(body).await.unwrap_or_default();
30696                        let encoded = common::to_string(&bytes);
30697                        match serde_json::from_str(&encoded) {
30698                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
30699                            Err(error) => {
30700                                dlg.response_json_decode_error(&encoded, &error);
30701                                return Err(common::Error::JsonDecodeError(
30702                                    encoded.to_string(),
30703                                    error,
30704                                ));
30705                            }
30706                        }
30707                    };
30708
30709                    dlg.finished(true);
30710                    return Ok(response);
30711                }
30712            }
30713        }
30714    }
30715
30716    /// Required. Resource name of the form: `projects/*/locations/*/runtimeConfig`
30717    ///
30718    /// Sets the *name* path property to the given value.
30719    ///
30720    /// Even though the property as already been set when instantiating this call,
30721    /// we provide this method for API completeness.
30722    pub fn name(mut self, new_value: &str) -> ProjectLocationGetRuntimeConfigCall<'a, C> {
30723        self._name = new_value.to_string();
30724        self
30725    }
30726    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30727    /// while executing the actual API request.
30728    ///
30729    /// ````text
30730    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
30731    /// ````
30732    ///
30733    /// Sets the *delegate* property to the given value.
30734    pub fn delegate(
30735        mut self,
30736        new_value: &'a mut dyn common::Delegate,
30737    ) -> ProjectLocationGetRuntimeConfigCall<'a, C> {
30738        self._delegate = Some(new_value);
30739        self
30740    }
30741
30742    /// Set any additional parameter of the query string used in the request.
30743    /// It should be used to set parameters which are not yet available through their own
30744    /// setters.
30745    ///
30746    /// Please note that this method must not be used to set any of the known parameters
30747    /// which have their own setter method. If done anyway, the request will fail.
30748    ///
30749    /// # Additional Parameters
30750    ///
30751    /// * *$.xgafv* (query-string) - V1 error format.
30752    /// * *access_token* (query-string) - OAuth access token.
30753    /// * *alt* (query-string) - Data format for response.
30754    /// * *callback* (query-string) - JSONP
30755    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30756    /// * *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.
30757    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30758    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30759    /// * *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.
30760    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30761    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30762    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetRuntimeConfigCall<'a, C>
30763    where
30764        T: AsRef<str>,
30765    {
30766        self._additional_params
30767            .insert(name.as_ref().to_string(), value.as_ref().to_string());
30768        self
30769    }
30770
30771    /// Identifies the authorization scope for the method you are building.
30772    ///
30773    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30774    /// [`Scope::CloudPlatform`].
30775    ///
30776    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30777    /// tokens for more than one scope.
30778    ///
30779    /// Usually there is more than one suitable scope to authorize an operation, some of which may
30780    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30781    /// sufficient, a read-write scope will do as well.
30782    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetRuntimeConfigCall<'a, C>
30783    where
30784        St: AsRef<str>,
30785    {
30786        self._scopes.insert(String::from(scope.as_ref()));
30787        self
30788    }
30789    /// Identifies the authorization scope(s) for the method you are building.
30790    ///
30791    /// See [`Self::add_scope()`] for details.
30792    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetRuntimeConfigCall<'a, C>
30793    where
30794        I: IntoIterator<Item = St>,
30795        St: AsRef<str>,
30796    {
30797        self._scopes
30798            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30799        self
30800    }
30801
30802    /// Removes all scopes, and no default scope will be used either.
30803    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30804    /// for details).
30805    pub fn clear_scopes(mut self) -> ProjectLocationGetRuntimeConfigCall<'a, C> {
30806        self._scopes.clear();
30807        self
30808    }
30809}
30810
30811/// Lists information about the supported locations for this service.
30812///
30813/// A builder for the *locations.list* method supported by a *project* resource.
30814/// It is not used directly, but through a [`ProjectMethods`] instance.
30815///
30816/// # Example
30817///
30818/// Instantiate a resource method builder
30819///
30820/// ```test_harness,no_run
30821/// # extern crate hyper;
30822/// # extern crate hyper_rustls;
30823/// # extern crate google_connectors1 as connectors1;
30824/// # async fn dox() {
30825/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30826///
30827/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30828/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
30829/// #     .with_native_roots()
30830/// #     .unwrap()
30831/// #     .https_only()
30832/// #     .enable_http2()
30833/// #     .build();
30834///
30835/// # let executor = hyper_util::rt::TokioExecutor::new();
30836/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
30837/// #     secret,
30838/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30839/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
30840/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
30841/// #     ),
30842/// # ).build().await.unwrap();
30843///
30844/// # let client = hyper_util::client::legacy::Client::builder(
30845/// #     hyper_util::rt::TokioExecutor::new()
30846/// # )
30847/// # .build(
30848/// #     hyper_rustls::HttpsConnectorBuilder::new()
30849/// #         .with_native_roots()
30850/// #         .unwrap()
30851/// #         .https_or_http()
30852/// #         .enable_http2()
30853/// #         .build()
30854/// # );
30855/// # let mut hub = Connectors::new(client, auth);
30856/// // You can configure optional parameters by calling the respective setters at will, and
30857/// // execute the final call using `doit()`.
30858/// // Values shown here are possibly random and not representative !
30859/// let result = hub.projects().locations_list("name")
30860///              .page_token("amet")
30861///              .page_size(-31)
30862///              .filter("dolores")
30863///              .add_extra_location_types("erat")
30864///              .doit().await;
30865/// # }
30866/// ```
30867pub struct ProjectLocationListCall<'a, C>
30868where
30869    C: 'a,
30870{
30871    hub: &'a Connectors<C>,
30872    _name: String,
30873    _page_token: Option<String>,
30874    _page_size: Option<i32>,
30875    _filter: Option<String>,
30876    _extra_location_types: Vec<String>,
30877    _delegate: Option<&'a mut dyn common::Delegate>,
30878    _additional_params: HashMap<String, String>,
30879    _scopes: BTreeSet<String>,
30880}
30881
30882impl<'a, C> common::CallBuilder for ProjectLocationListCall<'a, C> {}
30883
30884impl<'a, C> ProjectLocationListCall<'a, C>
30885where
30886    C: common::Connector,
30887{
30888    /// Perform the operation you have build so far.
30889    pub async fn doit(mut self) -> common::Result<(common::Response, ListLocationsResponse)> {
30890        use std::borrow::Cow;
30891        use std::io::{Read, Seek};
30892
30893        use common::{url::Params, ToParts};
30894        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
30895
30896        let mut dd = common::DefaultDelegate;
30897        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
30898        dlg.begin(common::MethodInfo {
30899            id: "connectors.projects.locations.list",
30900            http_method: hyper::Method::GET,
30901        });
30902
30903        for &field in [
30904            "alt",
30905            "name",
30906            "pageToken",
30907            "pageSize",
30908            "filter",
30909            "extraLocationTypes",
30910        ]
30911        .iter()
30912        {
30913            if self._additional_params.contains_key(field) {
30914                dlg.finished(false);
30915                return Err(common::Error::FieldClash(field));
30916            }
30917        }
30918
30919        let mut params = Params::with_capacity(7 + self._additional_params.len());
30920        params.push("name", self._name);
30921        if let Some(value) = self._page_token.as_ref() {
30922            params.push("pageToken", value);
30923        }
30924        if let Some(value) = self._page_size.as_ref() {
30925            params.push("pageSize", value.to_string());
30926        }
30927        if let Some(value) = self._filter.as_ref() {
30928            params.push("filter", value);
30929        }
30930        if !self._extra_location_types.is_empty() {
30931            for f in self._extra_location_types.iter() {
30932                params.push("extraLocationTypes", f);
30933            }
30934        }
30935
30936        params.extend(self._additional_params.iter());
30937
30938        params.push("alt", "json");
30939        let mut url = self.hub._base_url.clone() + "v1/{+name}/locations";
30940        if self._scopes.is_empty() {
30941            self._scopes
30942                .insert(Scope::CloudPlatform.as_ref().to_string());
30943        }
30944
30945        #[allow(clippy::single_element_loop)]
30946        for &(find_this, param_name) in [("{+name}", "name")].iter() {
30947            url = params.uri_replacement(url, param_name, find_this, true);
30948        }
30949        {
30950            let to_remove = ["name"];
30951            params.remove_params(&to_remove);
30952        }
30953
30954        let url = params.parse_with_url(&url);
30955
30956        loop {
30957            let token = match self
30958                .hub
30959                .auth
30960                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30961                .await
30962            {
30963                Ok(token) => token,
30964                Err(e) => match dlg.token(e) {
30965                    Ok(token) => token,
30966                    Err(e) => {
30967                        dlg.finished(false);
30968                        return Err(common::Error::MissingToken(e));
30969                    }
30970                },
30971            };
30972            let mut req_result = {
30973                let client = &self.hub.client;
30974                dlg.pre_request();
30975                let mut req_builder = hyper::Request::builder()
30976                    .method(hyper::Method::GET)
30977                    .uri(url.as_str())
30978                    .header(USER_AGENT, self.hub._user_agent.clone());
30979
30980                if let Some(token) = token.as_ref() {
30981                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30982                }
30983
30984                let request = req_builder
30985                    .header(CONTENT_LENGTH, 0_u64)
30986                    .body(common::to_body::<String>(None));
30987
30988                client.request(request.unwrap()).await
30989            };
30990
30991            match req_result {
30992                Err(err) => {
30993                    if let common::Retry::After(d) = dlg.http_error(&err) {
30994                        sleep(d).await;
30995                        continue;
30996                    }
30997                    dlg.finished(false);
30998                    return Err(common::Error::HttpError(err));
30999                }
31000                Ok(res) => {
31001                    let (mut parts, body) = res.into_parts();
31002                    let mut body = common::Body::new(body);
31003                    if !parts.status.is_success() {
31004                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31005                        let error = serde_json::from_str(&common::to_string(&bytes));
31006                        let response = common::to_response(parts, bytes.into());
31007
31008                        if let common::Retry::After(d) =
31009                            dlg.http_failure(&response, error.as_ref().ok())
31010                        {
31011                            sleep(d).await;
31012                            continue;
31013                        }
31014
31015                        dlg.finished(false);
31016
31017                        return Err(match error {
31018                            Ok(value) => common::Error::BadRequest(value),
31019                            _ => common::Error::Failure(response),
31020                        });
31021                    }
31022                    let response = {
31023                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31024                        let encoded = common::to_string(&bytes);
31025                        match serde_json::from_str(&encoded) {
31026                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
31027                            Err(error) => {
31028                                dlg.response_json_decode_error(&encoded, &error);
31029                                return Err(common::Error::JsonDecodeError(
31030                                    encoded.to_string(),
31031                                    error,
31032                                ));
31033                            }
31034                        }
31035                    };
31036
31037                    dlg.finished(true);
31038                    return Ok(response);
31039                }
31040            }
31041        }
31042    }
31043
31044    /// The resource that owns the locations collection, if applicable.
31045    ///
31046    /// Sets the *name* path property to the given value.
31047    ///
31048    /// Even though the property as already been set when instantiating this call,
31049    /// we provide this method for API completeness.
31050    pub fn name(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
31051        self._name = new_value.to_string();
31052        self
31053    }
31054    /// A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.
31055    ///
31056    /// Sets the *page token* query property to the given value.
31057    pub fn page_token(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
31058        self._page_token = Some(new_value.to_string());
31059        self
31060    }
31061    /// The maximum number of results to return. If not set, the service selects a default.
31062    ///
31063    /// Sets the *page size* query property to the given value.
31064    pub fn page_size(mut self, new_value: i32) -> ProjectLocationListCall<'a, C> {
31065        self._page_size = Some(new_value);
31066        self
31067    }
31068    /// 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).
31069    ///
31070    /// Sets the *filter* query property to the given value.
31071    pub fn filter(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
31072        self._filter = Some(new_value.to_string());
31073        self
31074    }
31075    /// Optional. Unless explicitly documented otherwise, don't use this unsupported field which is primarily intended for internal usage.
31076    ///
31077    /// Append the given value to the *extra location types* query property.
31078    /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
31079    pub fn add_extra_location_types(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
31080        self._extra_location_types.push(new_value.to_string());
31081        self
31082    }
31083    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
31084    /// while executing the actual API request.
31085    ///
31086    /// ````text
31087    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
31088    /// ````
31089    ///
31090    /// Sets the *delegate* property to the given value.
31091    pub fn delegate(
31092        mut self,
31093        new_value: &'a mut dyn common::Delegate,
31094    ) -> ProjectLocationListCall<'a, C> {
31095        self._delegate = Some(new_value);
31096        self
31097    }
31098
31099    /// Set any additional parameter of the query string used in the request.
31100    /// It should be used to set parameters which are not yet available through their own
31101    /// setters.
31102    ///
31103    /// Please note that this method must not be used to set any of the known parameters
31104    /// which have their own setter method. If done anyway, the request will fail.
31105    ///
31106    /// # Additional Parameters
31107    ///
31108    /// * *$.xgafv* (query-string) - V1 error format.
31109    /// * *access_token* (query-string) - OAuth access token.
31110    /// * *alt* (query-string) - Data format for response.
31111    /// * *callback* (query-string) - JSONP
31112    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
31113    /// * *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.
31114    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
31115    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
31116    /// * *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.
31117    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
31118    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
31119    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C>
31120    where
31121        T: AsRef<str>,
31122    {
31123        self._additional_params
31124            .insert(name.as_ref().to_string(), value.as_ref().to_string());
31125        self
31126    }
31127
31128    /// Identifies the authorization scope for the method you are building.
31129    ///
31130    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
31131    /// [`Scope::CloudPlatform`].
31132    ///
31133    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
31134    /// tokens for more than one scope.
31135    ///
31136    /// Usually there is more than one suitable scope to authorize an operation, some of which may
31137    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
31138    /// sufficient, a read-write scope will do as well.
31139    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationListCall<'a, C>
31140    where
31141        St: AsRef<str>,
31142    {
31143        self._scopes.insert(String::from(scope.as_ref()));
31144        self
31145    }
31146    /// Identifies the authorization scope(s) for the method you are building.
31147    ///
31148    /// See [`Self::add_scope()`] for details.
31149    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationListCall<'a, C>
31150    where
31151        I: IntoIterator<Item = St>,
31152        St: AsRef<str>,
31153    {
31154        self._scopes
31155            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
31156        self
31157    }
31158
31159    /// Removes all scopes, and no default scope will be used either.
31160    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
31161    /// for details).
31162    pub fn clear_scopes(mut self) -> ProjectLocationListCall<'a, C> {
31163        self._scopes.clear();
31164        self
31165    }
31166}
31167
31168/// Update the settings of a region.
31169///
31170/// A builder for the *locations.updateRegionalSettings* method supported by a *project* resource.
31171/// It is not used directly, but through a [`ProjectMethods`] instance.
31172///
31173/// # Example
31174///
31175/// Instantiate a resource method builder
31176///
31177/// ```test_harness,no_run
31178/// # extern crate hyper;
31179/// # extern crate hyper_rustls;
31180/// # extern crate google_connectors1 as connectors1;
31181/// use connectors1::api::RegionalSettings;
31182/// # async fn dox() {
31183/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
31184///
31185/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
31186/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
31187/// #     .with_native_roots()
31188/// #     .unwrap()
31189/// #     .https_only()
31190/// #     .enable_http2()
31191/// #     .build();
31192///
31193/// # let executor = hyper_util::rt::TokioExecutor::new();
31194/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
31195/// #     secret,
31196/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
31197/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
31198/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
31199/// #     ),
31200/// # ).build().await.unwrap();
31201///
31202/// # let client = hyper_util::client::legacy::Client::builder(
31203/// #     hyper_util::rt::TokioExecutor::new()
31204/// # )
31205/// # .build(
31206/// #     hyper_rustls::HttpsConnectorBuilder::new()
31207/// #         .with_native_roots()
31208/// #         .unwrap()
31209/// #         .https_or_http()
31210/// #         .enable_http2()
31211/// #         .build()
31212/// # );
31213/// # let mut hub = Connectors::new(client, auth);
31214/// // As the method needs a request, you would usually fill it with the desired information
31215/// // into the respective structure. Some of the parts shown here might not be applicable !
31216/// // Values shown here are possibly random and not representative !
31217/// let mut req = RegionalSettings::default();
31218///
31219/// // You can configure optional parameters by calling the respective setters at will, and
31220/// // execute the final call using `doit()`.
31221/// // Values shown here are possibly random and not representative !
31222/// let result = hub.projects().locations_update_regional_settings(req, "name")
31223///              .update_mask(FieldMask::new::<&str>(&[]))
31224///              .doit().await;
31225/// # }
31226/// ```
31227pub struct ProjectLocationUpdateRegionalSettingCall<'a, C>
31228where
31229    C: 'a,
31230{
31231    hub: &'a Connectors<C>,
31232    _request: RegionalSettings,
31233    _name: String,
31234    _update_mask: Option<common::FieldMask>,
31235    _delegate: Option<&'a mut dyn common::Delegate>,
31236    _additional_params: HashMap<String, String>,
31237    _scopes: BTreeSet<String>,
31238}
31239
31240impl<'a, C> common::CallBuilder for ProjectLocationUpdateRegionalSettingCall<'a, C> {}
31241
31242impl<'a, C> ProjectLocationUpdateRegionalSettingCall<'a, C>
31243where
31244    C: common::Connector,
31245{
31246    /// Perform the operation you have build so far.
31247    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
31248        use std::borrow::Cow;
31249        use std::io::{Read, Seek};
31250
31251        use common::{url::Params, ToParts};
31252        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
31253
31254        let mut dd = common::DefaultDelegate;
31255        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
31256        dlg.begin(common::MethodInfo {
31257            id: "connectors.projects.locations.updateRegionalSettings",
31258            http_method: hyper::Method::PATCH,
31259        });
31260
31261        for &field in ["alt", "name", "updateMask"].iter() {
31262            if self._additional_params.contains_key(field) {
31263                dlg.finished(false);
31264                return Err(common::Error::FieldClash(field));
31265            }
31266        }
31267
31268        let mut params = Params::with_capacity(5 + self._additional_params.len());
31269        params.push("name", self._name);
31270        if let Some(value) = self._update_mask.as_ref() {
31271            params.push("updateMask", value.to_string());
31272        }
31273
31274        params.extend(self._additional_params.iter());
31275
31276        params.push("alt", "json");
31277        let mut url = self.hub._base_url.clone() + "v1/{+name}";
31278        if self._scopes.is_empty() {
31279            self._scopes
31280                .insert(Scope::CloudPlatform.as_ref().to_string());
31281        }
31282
31283        #[allow(clippy::single_element_loop)]
31284        for &(find_this, param_name) in [("{+name}", "name")].iter() {
31285            url = params.uri_replacement(url, param_name, find_this, true);
31286        }
31287        {
31288            let to_remove = ["name"];
31289            params.remove_params(&to_remove);
31290        }
31291
31292        let url = params.parse_with_url(&url);
31293
31294        let mut json_mime_type = mime::APPLICATION_JSON;
31295        let mut request_value_reader = {
31296            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
31297            common::remove_json_null_values(&mut value);
31298            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
31299            serde_json::to_writer(&mut dst, &value).unwrap();
31300            dst
31301        };
31302        let request_size = request_value_reader
31303            .seek(std::io::SeekFrom::End(0))
31304            .unwrap();
31305        request_value_reader
31306            .seek(std::io::SeekFrom::Start(0))
31307            .unwrap();
31308
31309        loop {
31310            let token = match self
31311                .hub
31312                .auth
31313                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
31314                .await
31315            {
31316                Ok(token) => token,
31317                Err(e) => match dlg.token(e) {
31318                    Ok(token) => token,
31319                    Err(e) => {
31320                        dlg.finished(false);
31321                        return Err(common::Error::MissingToken(e));
31322                    }
31323                },
31324            };
31325            request_value_reader
31326                .seek(std::io::SeekFrom::Start(0))
31327                .unwrap();
31328            let mut req_result = {
31329                let client = &self.hub.client;
31330                dlg.pre_request();
31331                let mut req_builder = hyper::Request::builder()
31332                    .method(hyper::Method::PATCH)
31333                    .uri(url.as_str())
31334                    .header(USER_AGENT, self.hub._user_agent.clone());
31335
31336                if let Some(token) = token.as_ref() {
31337                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
31338                }
31339
31340                let request = req_builder
31341                    .header(CONTENT_TYPE, json_mime_type.to_string())
31342                    .header(CONTENT_LENGTH, request_size as u64)
31343                    .body(common::to_body(
31344                        request_value_reader.get_ref().clone().into(),
31345                    ));
31346
31347                client.request(request.unwrap()).await
31348            };
31349
31350            match req_result {
31351                Err(err) => {
31352                    if let common::Retry::After(d) = dlg.http_error(&err) {
31353                        sleep(d).await;
31354                        continue;
31355                    }
31356                    dlg.finished(false);
31357                    return Err(common::Error::HttpError(err));
31358                }
31359                Ok(res) => {
31360                    let (mut parts, body) = res.into_parts();
31361                    let mut body = common::Body::new(body);
31362                    if !parts.status.is_success() {
31363                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31364                        let error = serde_json::from_str(&common::to_string(&bytes));
31365                        let response = common::to_response(parts, bytes.into());
31366
31367                        if let common::Retry::After(d) =
31368                            dlg.http_failure(&response, error.as_ref().ok())
31369                        {
31370                            sleep(d).await;
31371                            continue;
31372                        }
31373
31374                        dlg.finished(false);
31375
31376                        return Err(match error {
31377                            Ok(value) => common::Error::BadRequest(value),
31378                            _ => common::Error::Failure(response),
31379                        });
31380                    }
31381                    let response = {
31382                        let bytes = common::to_bytes(body).await.unwrap_or_default();
31383                        let encoded = common::to_string(&bytes);
31384                        match serde_json::from_str(&encoded) {
31385                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
31386                            Err(error) => {
31387                                dlg.response_json_decode_error(&encoded, &error);
31388                                return Err(common::Error::JsonDecodeError(
31389                                    encoded.to_string(),
31390                                    error,
31391                                ));
31392                            }
31393                        }
31394                    };
31395
31396                    dlg.finished(true);
31397                    return Ok(response);
31398                }
31399            }
31400        }
31401    }
31402
31403    ///
31404    /// Sets the *request* property to the given value.
31405    ///
31406    /// Even though the property as already been set when instantiating this call,
31407    /// we provide this method for API completeness.
31408    pub fn request(
31409        mut self,
31410        new_value: RegionalSettings,
31411    ) -> ProjectLocationUpdateRegionalSettingCall<'a, C> {
31412        self._request = new_value;
31413        self
31414    }
31415    /// Output only. Resource name of the Connection. Format: projects/{project}/locations/{location}/regionalSettings
31416    ///
31417    /// Sets the *name* path property to the given value.
31418    ///
31419    /// Even though the property as already been set when instantiating this call,
31420    /// we provide this method for API completeness.
31421    pub fn name(mut self, new_value: &str) -> ProjectLocationUpdateRegionalSettingCall<'a, C> {
31422        self._name = new_value.to_string();
31423        self
31424    }
31425    /// Required. The list of fields to update.
31426    ///
31427    /// Sets the *update mask* query property to the given value.
31428    pub fn update_mask(
31429        mut self,
31430        new_value: common::FieldMask,
31431    ) -> ProjectLocationUpdateRegionalSettingCall<'a, C> {
31432        self._update_mask = Some(new_value);
31433        self
31434    }
31435    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
31436    /// while executing the actual API request.
31437    ///
31438    /// ````text
31439    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
31440    /// ````
31441    ///
31442    /// Sets the *delegate* property to the given value.
31443    pub fn delegate(
31444        mut self,
31445        new_value: &'a mut dyn common::Delegate,
31446    ) -> ProjectLocationUpdateRegionalSettingCall<'a, C> {
31447        self._delegate = Some(new_value);
31448        self
31449    }
31450
31451    /// Set any additional parameter of the query string used in the request.
31452    /// It should be used to set parameters which are not yet available through their own
31453    /// setters.
31454    ///
31455    /// Please note that this method must not be used to set any of the known parameters
31456    /// which have their own setter method. If done anyway, the request will fail.
31457    ///
31458    /// # Additional Parameters
31459    ///
31460    /// * *$.xgafv* (query-string) - V1 error format.
31461    /// * *access_token* (query-string) - OAuth access token.
31462    /// * *alt* (query-string) - Data format for response.
31463    /// * *callback* (query-string) - JSONP
31464    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
31465    /// * *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.
31466    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
31467    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
31468    /// * *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.
31469    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
31470    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
31471    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationUpdateRegionalSettingCall<'a, C>
31472    where
31473        T: AsRef<str>,
31474    {
31475        self._additional_params
31476            .insert(name.as_ref().to_string(), value.as_ref().to_string());
31477        self
31478    }
31479
31480    /// Identifies the authorization scope for the method you are building.
31481    ///
31482    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
31483    /// [`Scope::CloudPlatform`].
31484    ///
31485    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
31486    /// tokens for more than one scope.
31487    ///
31488    /// Usually there is more than one suitable scope to authorize an operation, some of which may
31489    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
31490    /// sufficient, a read-write scope will do as well.
31491    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationUpdateRegionalSettingCall<'a, C>
31492    where
31493        St: AsRef<str>,
31494    {
31495        self._scopes.insert(String::from(scope.as_ref()));
31496        self
31497    }
31498    /// Identifies the authorization scope(s) for the method you are building.
31499    ///
31500    /// See [`Self::add_scope()`] for details.
31501    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationUpdateRegionalSettingCall<'a, C>
31502    where
31503        I: IntoIterator<Item = St>,
31504        St: AsRef<str>,
31505    {
31506        self._scopes
31507            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
31508        self
31509    }
31510
31511    /// Removes all scopes, and no default scope will be used either.
31512    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
31513    /// for details).
31514    pub fn clear_scopes(mut self) -> ProjectLocationUpdateRegionalSettingCall<'a, C> {
31515        self._scopes.clear();
31516        self
31517    }
31518}