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::EventSubscription;
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 auth = yup_oauth2::InstalledFlowAuthenticator::builder(
63/// secret,
64/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
65/// ).build().await.unwrap();
66///
67/// let client = hyper_util::client::legacy::Client::builder(
68/// hyper_util::rt::TokioExecutor::new()
69/// )
70/// .build(
71/// hyper_rustls::HttpsConnectorBuilder::new()
72/// .with_native_roots()
73/// .unwrap()
74/// .https_or_http()
75/// .enable_http1()
76/// .build()
77/// );
78/// let mut hub = Connectors::new(client, auth);
79/// // As the method needs a request, you would usually fill it with the desired information
80/// // into the respective structure. Some of the parts shown here might not be applicable !
81/// // Values shown here are possibly random and not representative !
82/// let mut req = EventSubscription::default();
83///
84/// // You can configure optional parameters by calling the respective setters at will, and
85/// // execute the final call using `doit()`.
86/// // Values shown here are possibly random and not representative !
87/// let result = hub.projects().locations_connections_event_subscriptions_create(req, "parent")
88/// .event_subscription_id("At")
89/// .doit().await;
90///
91/// match result {
92/// Err(e) => match e {
93/// // The Error enum provides details about what exactly happened.
94/// // You can also just use its `Debug`, `Display` or `Error` traits
95/// Error::HttpError(_)
96/// |Error::Io(_)
97/// |Error::MissingAPIKey
98/// |Error::MissingToken(_)
99/// |Error::Cancelled
100/// |Error::UploadSizeLimitExceeded(_, _)
101/// |Error::Failure(_)
102/// |Error::BadRequest(_)
103/// |Error::FieldClash(_)
104/// |Error::JsonDecodeError(_, _) => println!("{}", e),
105/// },
106/// Ok(res) => println!("Success: {:?}", res),
107/// }
108/// # }
109/// ```
110#[derive(Clone)]
111pub struct Connectors<C> {
112 pub client: common::Client<C>,
113 pub auth: Box<dyn common::GetToken>,
114 _user_agent: String,
115 _base_url: String,
116 _root_url: String,
117}
118
119impl<C> common::Hub for Connectors<C> {}
120
121impl<'a, C> Connectors<C> {
122 pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> Connectors<C> {
123 Connectors {
124 client,
125 auth: Box::new(auth),
126 _user_agent: "google-api-rust-client/6.0.0".to_string(),
127 _base_url: "https://connectors.googleapis.com/".to_string(),
128 _root_url: "https://connectors.googleapis.com/".to_string(),
129 }
130 }
131
132 pub fn projects(&'a self) -> ProjectMethods<'a, C> {
133 ProjectMethods { hub: self }
134 }
135
136 /// Set the user-agent header field to use in all requests to the server.
137 /// It defaults to `google-api-rust-client/6.0.0`.
138 ///
139 /// Returns the previously set user-agent.
140 pub fn user_agent(&mut self, agent_name: String) -> String {
141 std::mem::replace(&mut self._user_agent, agent_name)
142 }
143
144 /// Set the base url to use in all requests to the server.
145 /// It defaults to `https://connectors.googleapis.com/`.
146 ///
147 /// Returns the previously set base url.
148 pub fn base_url(&mut self, new_base_url: String) -> String {
149 std::mem::replace(&mut self._base_url, new_base_url)
150 }
151
152 /// Set the root url to use in all requests to the server.
153 /// It defaults to `https://connectors.googleapis.com/`.
154 ///
155 /// Returns the previously set root url.
156 pub fn root_url(&mut self, new_root_url: String) -> String {
157 std::mem::replace(&mut self._root_url, new_root_url)
158 }
159}
160
161// ############
162// SCHEMAS ###
163// ##########
164/// 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.
165///
166/// This type is not used in any activity, and only used as *part* of another schema.
167///
168#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
169#[serde_with::serde_as]
170#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
171pub struct AuditConfig {
172 /// The configuration for logging of each type of permission.
173 #[serde(rename = "auditLogConfigs")]
174 pub audit_log_configs: Option<Vec<AuditLogConfig>>,
175 /// 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.
176 pub service: Option<String>,
177}
178
179impl common::Part for AuditConfig {}
180
181/// 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.
182///
183/// This type is not used in any activity, and only used as *part* of another schema.
184///
185#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
186#[serde_with::serde_as]
187#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
188pub struct AuditLogConfig {
189 /// Specifies the identities that do not cause logging for this type of permission. Follows the same format of Binding.members.
190 #[serde(rename = "exemptedMembers")]
191 pub exempted_members: Option<Vec<String>>,
192 /// The log type that this config enables.
193 #[serde(rename = "logType")]
194 pub log_type: Option<String>,
195}
196
197impl common::Part for AuditLogConfig {}
198
199/// AuthConfig defines details of a authentication type.
200///
201/// This type is not used in any activity, and only used as *part* of another schema.
202///
203#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
204#[serde_with::serde_as]
205#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
206pub struct AuthConfig {
207 /// List containing additional auth configs.
208 #[serde(rename = "additionalVariables")]
209 pub additional_variables: Option<Vec<ConfigVariable>>,
210 /// Identifier key for auth config
211 #[serde(rename = "authKey")]
212 pub auth_key: Option<String>,
213 /// The type of authentication configured.
214 #[serde(rename = "authType")]
215 pub auth_type: Option<String>,
216 /// Oauth2AuthCodeFlow.
217 #[serde(rename = "oauth2AuthCodeFlow")]
218 pub oauth2_auth_code_flow: Option<Oauth2AuthCodeFlow>,
219 /// Oauth2ClientCredentials.
220 #[serde(rename = "oauth2ClientCredentials")]
221 pub oauth2_client_credentials: Option<Oauth2ClientCredentials>,
222 /// Oauth2JwtBearer.
223 #[serde(rename = "oauth2JwtBearer")]
224 pub oauth2_jwt_bearer: Option<Oauth2JwtBearer>,
225 /// SSH Public Key.
226 #[serde(rename = "sshPublicKey")]
227 pub ssh_public_key: Option<SshPublicKey>,
228 /// UserPassword.
229 #[serde(rename = "userPassword")]
230 pub user_password: Option<UserPassword>,
231}
232
233impl common::Part for AuthConfig {}
234
235/// AuthConfigTemplate defines required field over an authentication type.
236///
237/// This type is not used in any activity, and only used as *part* of another schema.
238///
239#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
240#[serde_with::serde_as]
241#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
242pub struct AuthConfigTemplate {
243 /// Identifier key for auth config
244 #[serde(rename = "authKey")]
245 pub auth_key: Option<String>,
246 /// The type of authentication configured.
247 #[serde(rename = "authType")]
248 pub auth_type: Option<String>,
249 /// Config variables to describe an `AuthConfig` for a `Connection`.
250 #[serde(rename = "configVariableTemplates")]
251 pub config_variable_templates: Option<Vec<ConfigVariableTemplate>>,
252 /// Connector specific description for an authentication template.
253 pub description: Option<String>,
254 /// Display name for authentication template.
255 #[serde(rename = "displayName")]
256 pub display_name: Option<String>,
257}
258
259impl common::Part for AuthConfigTemplate {}
260
261/// This configuration captures the details required to render an authorization link for the OAuth Authorization Code Flow.
262///
263/// This type is not used in any activity, and only used as *part* of another schema.
264///
265#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
266#[serde_with::serde_as]
267#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
268pub struct AuthorizationCodeLink {
269 /// The client ID assigned to the Google Cloud Connectors OAuth app for the connector data source.
270 #[serde(rename = "clientId")]
271 pub client_id: Option<String>,
272 /// Whether to enable PKCE for the auth code flow.
273 #[serde(rename = "enablePkce")]
274 pub enable_pkce: Option<bool>,
275 /// The scopes for which the user will authorize Google Cloud Connectors on the connector data source.
276 pub scopes: Option<Vec<String>>,
277 /// The base URI the user must click to trigger the authorization code login flow.
278 pub uri: Option<String>,
279}
280
281impl common::Part for AuthorizationCodeLink {}
282
283/// Billing config for the connection.
284///
285/// This type is not used in any activity, and only used as *part* of another schema.
286///
287#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
288#[serde_with::serde_as]
289#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
290pub struct BillingConfig {
291 /// Output only. Billing category for the connector.
292 #[serde(rename = "billingCategory")]
293 pub billing_category: Option<String>,
294}
295
296impl common::Part for BillingConfig {}
297
298/// Associates `members`, or principals, with a `role`.
299///
300/// This type is not used in any activity, and only used as *part* of another schema.
301///
302#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
303#[serde_with::serde_as]
304#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
305pub struct Binding {
306 /// 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).
307 pub condition: Option<Expr>,
308 /// 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`.
309 pub members: Option<Vec<String>>,
310 /// 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).
311 pub role: Option<String>,
312}
313
314impl common::Part for Binding {}
315
316/// The request message for Operations.CancelOperation.
317///
318/// # Activities
319///
320/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
321/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
322///
323/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (request)
324#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
325#[serde_with::serde_as]
326#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
327pub struct CancelOperationRequest {
328 _never_set: Option<bool>,
329}
330
331impl common::RequestValue for CancelOperationRequest {}
332
333/// ConfigVariable represents a configuration variable present in a Connection. or AuthConfig.
334///
335/// This type is not used in any activity, and only used as *part* of another schema.
336///
337#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
338#[serde_with::serde_as]
339#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
340pub struct ConfigVariable {
341 /// Value is a bool.
342 #[serde(rename = "boolValue")]
343 pub bool_value: Option<bool>,
344 /// Value is a Encryption Key.
345 #[serde(rename = "encryptionKeyValue")]
346 pub encryption_key_value: Option<EncryptionKey>,
347 /// Value is an integer
348 #[serde(rename = "intValue")]
349 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
350 pub int_value: Option<i64>,
351 /// Key of the config variable.
352 pub key: Option<String>,
353 /// Value is a secret.
354 #[serde(rename = "secretValue")]
355 pub secret_value: Option<Secret>,
356 /// Value is a string.
357 #[serde(rename = "stringValue")]
358 pub string_value: Option<String>,
359}
360
361impl common::Part for ConfigVariable {}
362
363/// ConfigVariableTemplate provides metadata about a `ConfigVariable` that is used in a Connection.
364///
365/// This type is not used in any activity, and only used as *part* of another schema.
366///
367#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
368#[serde_with::serde_as]
369#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
370pub struct ConfigVariableTemplate {
371 /// Authorization code link options. To be populated if `ValueType` is `AUTHORIZATION_CODE`
372 #[serde(rename = "authorizationCodeLink")]
373 pub authorization_code_link: Option<AuthorizationCodeLink>,
374 /// Description.
375 pub description: Option<String>,
376 /// Display name of the parameter.
377 #[serde(rename = "displayName")]
378 pub display_name: Option<String>,
379 /// Enum options. To be populated if `ValueType` is `ENUM`
380 #[serde(rename = "enumOptions")]
381 pub enum_options: Option<Vec<EnumOption>>,
382 /// Optional. enum source denotes the source of api to fill the enum options
383 #[serde(rename = "enumSource")]
384 pub enum_source: Option<String>,
385 /// Indicates if current template is part of advanced settings
386 #[serde(rename = "isAdvanced")]
387 pub is_advanced: Option<bool>,
388 /// Key of the config variable.
389 pub key: Option<String>,
390 /// Optional. Location Tyep denotes where this value should be sent in BYOC connections.
391 #[serde(rename = "locationType")]
392 pub location_type: Option<String>,
393 /// Optional. MultipleSelectConfig represents the multiple options for a config variable.
394 #[serde(rename = "multipleSelectConfig")]
395 pub multiple_select_config: Option<MultipleSelectConfig>,
396 /// Flag represents that this `ConfigVariable` must be provided for a connection.
397 pub required: Option<bool>,
398 /// Condition under which a field would be required. The condition can be represented in the form of a logical expression.
399 #[serde(rename = "requiredCondition")]
400 pub required_condition: Option<LogicalExpression>,
401 /// Role grant configuration for the config variable.
402 #[serde(rename = "roleGrant")]
403 pub role_grant: Option<RoleGrant>,
404 /// State of the config variable.
405 pub state: Option<String>,
406 /// Regular expression in RE2 syntax used for validating the `value` of a `ConfigVariable`.
407 #[serde(rename = "validationRegex")]
408 pub validation_regex: Option<String>,
409 /// Type of the parameter: string, int, bool etc. consider custom type for the benefit for the validation.
410 #[serde(rename = "valueType")]
411 pub value_type: Option<String>,
412}
413
414impl common::Part for ConfigVariableTemplate {}
415
416/// Connection represents an instance of connector.
417///
418/// # Activities
419///
420/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
421/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
422///
423/// * [locations connections create projects](ProjectLocationConnectionCreateCall) (request)
424/// * [locations connections get projects](ProjectLocationConnectionGetCall) (response)
425/// * [locations connections patch projects](ProjectLocationConnectionPatchCall) (request)
426#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
427#[serde_with::serde_as]
428#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
429pub struct Connection {
430 /// Optional. Configuration for establishing the connection's authentication with an external system.
431 #[serde(rename = "authConfig")]
432 pub auth_config: Option<AuthConfig>,
433 /// Output only. Billing config for the connection.
434 #[serde(rename = "billingConfig")]
435 pub billing_config: Option<BillingConfig>,
436 /// Optional. Configuration for configuring the connection with an external system.
437 #[serde(rename = "configVariables")]
438 pub config_variables: Option<Vec<ConfigVariable>>,
439 /// Output only. Connection revision. This field is only updated when the connection is created or updated by User.
440 #[serde(rename = "connectionRevision")]
441 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
442 pub connection_revision: Option<i64>,
443 /// 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.
444 #[serde(rename = "connectorVersion")]
445 pub connector_version: Option<String>,
446 /// Output only. Infra configs supported by Connector Version.
447 #[serde(rename = "connectorVersionInfraConfig")]
448 pub connector_version_infra_config: Option<ConnectorVersionInfraConfig>,
449 /// Output only. Flag to mark the version indicating the launch stage.
450 #[serde(rename = "connectorVersionLaunchStage")]
451 pub connector_version_launch_stage: Option<String>,
452 /// Output only. Created time.
453 #[serde(rename = "createTime")]
454 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
455 /// Optional. Description of the resource.
456 pub description: Option<String>,
457 /// Optional. Configuration of the Connector's destination. Only accepted for Connectors that accepts user defined destination(s).
458 #[serde(rename = "destinationConfigs")]
459 pub destination_configs: Option<Vec<DestinationConfig>>,
460 /// Output only. GCR location where the envoy image is stored. formatted like: gcr.io/{bucketName}/{imageName}
461 #[serde(rename = "envoyImageLocation")]
462 pub envoy_image_location: Option<String>,
463 /// Optional. Eventing config of a connection
464 #[serde(rename = "eventingConfig")]
465 pub eventing_config: Option<EventingConfig>,
466 /// Optional. Eventing enablement type. Will be nil if eventing is not enabled.
467 #[serde(rename = "eventingEnablementType")]
468 pub eventing_enablement_type: Option<String>,
469 /// Output only. Eventing Runtime Data.
470 #[serde(rename = "eventingRuntimeData")]
471 pub eventing_runtime_data: Option<EventingRuntimeData>,
472 /// Output only. GCR location where the runtime image is stored. formatted like: gcr.io/{bucketName}/{imageName}
473 #[serde(rename = "imageLocation")]
474 pub image_location: Option<String>,
475 /// Output only. Is trusted tester program enabled for the project.
476 #[serde(rename = "isTrustedTester")]
477 pub is_trusted_tester: Option<bool>,
478 /// 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
479 pub labels: Option<HashMap<String, String>>,
480 /// Optional. Configuration that indicates whether or not the Connection can be edited.
481 #[serde(rename = "lockConfig")]
482 pub lock_config: Option<LockConfig>,
483 /// Optional. Log configuration for the connection.
484 #[serde(rename = "logConfig")]
485 pub log_config: Option<ConnectorsLogConfig>,
486 /// Output only. Resource name of the Connection. Format: projects/{project}/locations/{location}/connections/{connection}
487 pub name: Option<String>,
488 /// Optional. Node configuration for the connection.
489 #[serde(rename = "nodeConfig")]
490 pub node_config: Option<NodeConfig>,
491 /// Optional. Service account needed for runtime plane to access Google Cloud resources.
492 #[serde(rename = "serviceAccount")]
493 pub service_account: Option<String>,
494 /// 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"
495 #[serde(rename = "serviceDirectory")]
496 pub service_directory: Option<String>,
497 /// Optional. Ssl config of a connection
498 #[serde(rename = "sslConfig")]
499 pub ssl_config: Option<SslConfig>,
500 /// Output only. Current status of the connection.
501 pub status: Option<ConnectionStatus>,
502 /// Output only. This subscription type enum states the subscription type of the project.
503 #[serde(rename = "subscriptionType")]
504 pub subscription_type: Option<String>,
505 /// Optional. Suspended indicates if a user has suspended a connection or not.
506 pub suspended: Option<bool>,
507 /// Output only. Updated time.
508 #[serde(rename = "updateTime")]
509 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
510}
511
512impl common::RequestValue for Connection {}
513impl common::ResponseResult for Connection {}
514
515/// ConnectionSchemaMetadata is the singleton resource of each connection. It includes the entity and action names of runtime resources exposed by a connection backend.
516///
517/// # Activities
518///
519/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
520/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
521///
522/// * [locations connections get connection schema metadata projects](ProjectLocationConnectionGetConnectionSchemaMetadataCall) (response)
523#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
524#[serde_with::serde_as]
525#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
526pub struct ConnectionSchemaMetadata {
527 /// Output only. List of actions.
528 pub actions: Option<Vec<String>>,
529 /// Output only. List of entity names.
530 pub entities: Option<Vec<String>>,
531 /// Error message for users.
532 #[serde(rename = "errorMessage")]
533 pub error_message: Option<String>,
534 /// Output only. Resource name. Format: projects/{project}/locations/{location}/connections/{connection}/connectionSchemaMetadata
535 pub name: Option<String>,
536 /// Output only. Timestamp when the connection runtime schema refresh was triggered.
537 #[serde(rename = "refreshTime")]
538 pub refresh_time: Option<chrono::DateTime<chrono::offset::Utc>>,
539 /// Output only. The current state of runtime schema.
540 pub state: Option<String>,
541 /// Output only. Timestamp when the connection runtime schema was updated.
542 #[serde(rename = "updateTime")]
543 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
544}
545
546impl common::ResponseResult for ConnectionSchemaMetadata {}
547
548/// ConnectionStatus indicates the state of the connection.
549///
550/// This type is not used in any activity, and only used as *part* of another schema.
551///
552#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
553#[serde_with::serde_as]
554#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
555pub struct ConnectionStatus {
556 /// Description.
557 pub description: Option<String>,
558 /// State.
559 pub state: Option<String>,
560 /// Status provides detailed information for the state.
561 pub status: Option<String>,
562}
563
564impl common::Part for ConnectionStatus {}
565
566/// Connectors indicates a specific connector type, e.x. Salesforce, SAP etc.
567///
568/// # Activities
569///
570/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
571/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
572///
573/// * [locations providers connectors get projects](ProjectLocationProviderConnectorGetCall) (response)
574#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
575#[serde_with::serde_as]
576#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
577pub struct Connector {
578 /// Output only. Category of the connector.
579 pub category: Option<String>,
580 /// Output only. The type of the connector.
581 #[serde(rename = "connectorType")]
582 pub connector_type: Option<String>,
583 /// Output only. Created time.
584 #[serde(rename = "createTime")]
585 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
586 /// Output only. Description of the resource.
587 pub description: Option<String>,
588 /// Output only. Display name.
589 #[serde(rename = "displayName")]
590 pub display_name: Option<String>,
591 /// Output only. Link to documentation page.
592 #[serde(rename = "documentationUri")]
593 pub documentation_uri: Option<String>,
594 /// Output only. Eventing details. Will be null if eventing is not supported.
595 #[serde(rename = "eventingDetails")]
596 pub eventing_details: Option<EventingDetails>,
597 /// Output only. Link to external page.
598 #[serde(rename = "externalUri")]
599 pub external_uri: Option<String>,
600 /// 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
601 pub labels: Option<HashMap<String, String>>,
602 /// Output only. Flag to mark the version indicating the launch stage.
603 #[serde(rename = "launchStage")]
604 pub launch_stage: Option<String>,
605 /// Output only. Resource name of the Connector. Format: projects/{project}/locations/{location}/providers/{provider}/connectors/{connector} Only global location is supported for Connector resource.
606 pub name: Option<String>,
607 /// Output only. Tags of the connector.
608 pub tags: Option<Vec<String>>,
609 /// Output only. Updated time.
610 #[serde(rename = "updateTime")]
611 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
612 /// Output only. Cloud storage location of icons etc consumed by UI.
613 #[serde(rename = "webAssetsLocation")]
614 pub web_assets_location: Option<String>,
615}
616
617impl common::ResponseResult for Connector {}
618
619/// This cofiguration provides infra configs like rate limit threshold which need to be configurable for every connector version
620///
621/// This type is not used in any activity, and only used as *part* of another schema.
622///
623#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
624#[serde_with::serde_as]
625#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
626pub struct ConnectorInfraConfig {
627 /// The window used for ratelimiting runtime requests to connections.
628 #[serde(rename = "connectionRatelimitWindowSeconds")]
629 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
630 pub connection_ratelimit_window_seconds: Option<i64>,
631 /// Indicate whether connector is deployed on GKE/CloudRun
632 #[serde(rename = "deploymentModel")]
633 pub deployment_model: Option<String>,
634 /// HPA autoscaling config.
635 #[serde(rename = "hpaConfig")]
636 pub hpa_config: Option<HPAConfig>,
637 /// Max QPS supported for internal requests originating from Connd.
638 #[serde(rename = "internalclientRatelimitThreshold")]
639 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
640 pub internalclient_ratelimit_threshold: Option<i64>,
641 /// Max QPS supported by the connector version before throttling of requests.
642 #[serde(rename = "ratelimitThreshold")]
643 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
644 pub ratelimit_threshold: Option<i64>,
645 /// System resource limits.
646 #[serde(rename = "resourceLimits")]
647 pub resource_limits: Option<ResourceLimits>,
648 /// System resource requests.
649 #[serde(rename = "resourceRequests")]
650 pub resource_requests: Option<ResourceRequests>,
651 /// The name of shared connector deployment.
652 #[serde(rename = "sharedDeployment")]
653 pub shared_deployment: Option<String>,
654}
655
656impl common::Part for ConnectorInfraConfig {}
657
658/// ConnectorVersion indicates a specific version of a connector.
659///
660/// # Activities
661///
662/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
663/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
664///
665/// * [locations providers connectors versions get projects](ProjectLocationProviderConnectorVersionGetCall) (response)
666#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
667#[serde_with::serde_as]
668#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
669pub struct ConnectorVersion {
670 /// Output only. List of auth configs supported by the Connector Version.
671 #[serde(rename = "authConfigTemplates")]
672 pub auth_config_templates: Option<Vec<AuthConfigTemplate>>,
673 /// Output only. Flag to mark the dynamic auth override.
674 #[serde(rename = "authOverrideEnabled")]
675 pub auth_override_enabled: Option<bool>,
676 /// Output only. List of config variables needed to create a connection.
677 #[serde(rename = "configVariableTemplates")]
678 pub config_variable_templates: Option<Vec<ConfigVariableTemplate>>,
679 /// Output only. Infra configs supported by Connector.
680 #[serde(rename = "connectorInfraConfig")]
681 pub connector_infra_config: Option<ConnectorInfraConfig>,
682 /// Output only. Created time.
683 #[serde(rename = "createTime")]
684 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
685 /// Output only. List of destination configs needed to create a connection.
686 #[serde(rename = "destinationConfigTemplates")]
687 pub destination_config_templates: Option<Vec<DestinationConfigTemplate>>,
688 /// Output only. Display name.
689 #[serde(rename = "displayName")]
690 pub display_name: Option<String>,
691 /// Output only. Configuration for Egress Control.
692 #[serde(rename = "egressControlConfig")]
693 pub egress_control_config: Option<EgressControlConfig>,
694 /// Output only. Eventing configuration supported by the Connector.
695 #[serde(rename = "eventingConfigTemplate")]
696 pub eventing_config_template: Option<EventingConfigTemplate>,
697 /// 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
698 pub labels: Option<HashMap<String, String>>,
699 /// Output only. Flag to mark the version indicating the launch stage.
700 #[serde(rename = "launchStage")]
701 pub launch_stage: Option<String>,
702 /// 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.
703 pub name: Option<String>,
704 /// Output only. ReleaseVersion of the connector, for example: "1.0.1-alpha".
705 #[serde(rename = "releaseVersion")]
706 pub release_version: Option<String>,
707 /// Output only. Role grant configuration for this config variable. It will be DEPRECATED soon.
708 #[serde(rename = "roleGrant")]
709 pub role_grant: Option<RoleGrant>,
710 /// Output only. Role grant configurations for this connector version.
711 #[serde(rename = "roleGrants")]
712 pub role_grants: Option<Vec<RoleGrant>>,
713 /// Connection Schema Refresh Config
714 #[serde(rename = "schemaRefreshConfig")]
715 pub schema_refresh_config: Option<SchemaRefreshConfig>,
716 /// Output only. Ssl configuration supported by the Connector.
717 #[serde(rename = "sslConfigTemplate")]
718 pub ssl_config_template: Option<SslConfigTemplate>,
719 /// Output only. Information about the runtime features supported by the Connector.
720 #[serde(rename = "supportedRuntimeFeatures")]
721 pub supported_runtime_features: Option<SupportedRuntimeFeatures>,
722 /// Output only. Unsupported connection types.
723 #[serde(rename = "unsupportedConnectionTypes")]
724 pub unsupported_connection_types: Option<Vec<String>>,
725 /// Output only. Updated time.
726 #[serde(rename = "updateTime")]
727 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
728}
729
730impl common::ResponseResult for ConnectorVersion {}
731
732/// This cofiguration provides infra configs like rate limit threshold which need to be configurable for every connector version
733///
734/// This type is not used in any activity, and only used as *part* of another schema.
735///
736#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
737#[serde_with::serde_as]
738#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
739pub struct ConnectorVersionInfraConfig {
740 /// Output only. The window used for ratelimiting runtime requests to connections.
741 #[serde(rename = "connectionRatelimitWindowSeconds")]
742 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
743 pub connection_ratelimit_window_seconds: Option<i64>,
744 /// Optional. Indicates whether connector is deployed on GKE/CloudRun
745 #[serde(rename = "deploymentModel")]
746 pub deployment_model: Option<String>,
747 /// Output only. HPA autoscaling config.
748 #[serde(rename = "hpaConfig")]
749 pub hpa_config: Option<HPAConfig>,
750 /// Output only. Max QPS supported for internal requests originating from Connd.
751 #[serde(rename = "internalclientRatelimitThreshold")]
752 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
753 pub internalclient_ratelimit_threshold: Option<i64>,
754 /// Output only. Max QPS supported by the connector version before throttling of requests.
755 #[serde(rename = "ratelimitThreshold")]
756 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
757 pub ratelimit_threshold: Option<i64>,
758 /// Output only. System resource limits.
759 #[serde(rename = "resourceLimits")]
760 pub resource_limits: Option<ResourceLimits>,
761 /// Output only. System resource requests.
762 #[serde(rename = "resourceRequests")]
763 pub resource_requests: Option<ResourceRequests>,
764 /// Output only. The name of shared connector deployment.
765 #[serde(rename = "sharedDeployment")]
766 pub shared_deployment: Option<String>,
767}
768
769impl common::Part for ConnectorVersionInfraConfig {}
770
771/// Log configuration for the connection.
772///
773/// This type is not used in any activity, and only used as *part* of another schema.
774///
775#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
776#[serde_with::serde_as]
777#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
778pub struct ConnectorsLogConfig {
779 /// Enabled represents whether logging is enabled or not for a connection.
780 pub enabled: Option<bool>,
781 /// Optional. Log configuration level.
782 pub level: Option<String>,
783}
784
785impl common::Part for ConnectorsLogConfig {}
786
787/// CustomConnector represents the custom connector defined by the customer as part of byoc.
788///
789/// # Activities
790///
791/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
792/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
793///
794/// * [locations global custom connectors create projects](ProjectLocationGlobalCustomConnectorCreateCall) (request)
795/// * [locations global custom connectors get projects](ProjectLocationGlobalCustomConnectorGetCall) (response)
796/// * [locations global custom connectors patch projects](ProjectLocationGlobalCustomConnectorPatchCall) (request)
797#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
798#[serde_with::serde_as]
799#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
800pub struct CustomConnector {
801 /// Output only. Active connector versions.
802 #[serde(rename = "activeConnectorVersions")]
803 pub active_connector_versions: Option<Vec<String>>,
804 /// Output only. All connector versions.
805 #[serde(rename = "allConnectorVersions")]
806 pub all_connector_versions: Option<Vec<String>>,
807 /// Output only. Created time.
808 #[serde(rename = "createTime")]
809 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
810 /// Required. Type of the custom connector.
811 #[serde(rename = "customConnectorType")]
812 pub custom_connector_type: Option<String>,
813 /// Optional. Description of the resource.
814 pub description: Option<String>,
815 /// Optional. Display name.
816 #[serde(rename = "displayName")]
817 pub display_name: Option<String>,
818 /// 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
819 pub labels: Option<HashMap<String, String>>,
820 /// Optional. Logo of the resource.
821 pub logo: Option<String>,
822 /// Identifier. Resource name of the CustomConnector. Format: projects/{project}/locations/{location}/customConnectors/{connector}
823 pub name: Option<String>,
824 /// Output only. Updated time.
825 #[serde(rename = "updateTime")]
826 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
827}
828
829impl common::RequestValue for CustomConnector {}
830impl common::ResponseResult for CustomConnector {}
831
832/// CustomConnectorVersion indicates a specific version of a connector.
833///
834/// # Activities
835///
836/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
837/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
838///
839/// * [locations global custom connectors custom connector versions create projects](ProjectLocationGlobalCustomConnectorCustomConnectorVersionCreateCall) (request)
840/// * [locations global custom connectors custom connector versions get projects](ProjectLocationGlobalCustomConnectorCustomConnectorVersionGetCall) (response)
841#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
842#[serde_with::serde_as]
843#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
844pub struct CustomConnectorVersion {
845 /// Optional. Authentication config for accessing connector facade/ proxy. This is used only when enable_backend_destination_config is true.
846 #[serde(rename = "authConfig")]
847 pub auth_config: Option<AuthConfig>,
848 /// Optional. Backend variables config templates. This translates to additional variable templates in connection.
849 #[serde(rename = "backendVariableTemplates")]
850 pub backend_variable_templates: Option<Vec<ConfigVariableTemplate>>,
851 /// Output only. Created time.
852 #[serde(rename = "createTime")]
853 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
854 /// Optional. Destination config(s) for accessing connector facade/ proxy. This is used only when enable_backend_destination_config is true.
855 #[serde(rename = "destinationConfigs")]
856 pub destination_configs: Option<Vec<DestinationConfig>>,
857 /// Optional. When enabled, the connector will be a facade/ proxy, and connects to the destination provided during connection creation.
858 #[serde(rename = "enableBackendDestinationConfig")]
859 pub enable_backend_destination_config: Option<bool>,
860 /// 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
861 pub labels: Option<HashMap<String, String>>,
862 /// Output only. Identifier. Resource name of the Version. Format: projects/{project}/locations/{location}/customConnectors/{custom_connector}/customConnectorVersions/{custom_connector_version}
863 pub name: Option<String>,
864 /// Optional. Service account used by runtime plane to access auth config secrets.
865 #[serde(rename = "serviceAccount")]
866 pub service_account: Option<String>,
867 /// Optional. 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:///`
868 #[serde(rename = "specLocation")]
869 pub spec_location: Option<String>,
870 /// Output only. Server URLs parsed from the spec.
871 #[serde(rename = "specServerUrls")]
872 pub spec_server_urls: Option<Vec<String>>,
873 /// Output only. State of the custom connector version.
874 pub state: Option<String>,
875 /// Output only. Updated time.
876 #[serde(rename = "updateTime")]
877 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
878}
879
880impl common::RequestValue for CustomConnectorVersion {}
881impl common::ResponseResult for CustomConnectorVersion {}
882
883/// Dead Letter configuration details provided by the user.
884///
885/// This type is not used in any activity, and only used as *part* of another schema.
886///
887#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
888#[serde_with::serde_as]
889#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
890pub struct DeadLetterConfig {
891 /// Optional. Project which has the topic given.
892 #[serde(rename = "projectId")]
893 pub project_id: Option<String>,
894 /// Optional. Topic to push events which couldn't be processed.
895 pub topic: Option<String>,
896}
897
898impl common::Part for DeadLetterConfig {}
899
900/// Request message for ConnectorsService.DeprecateCustomConnectorVersion
901///
902/// # Activities
903///
904/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
905/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
906///
907/// * [locations custom connectors custom connector versions deprecate projects](ProjectLocationCustomConnectorCustomConnectorVersionDeprecateCall) (request)
908#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
909#[serde_with::serde_as]
910#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
911pub struct DeprecateCustomConnectorVersionRequest {
912 _never_set: Option<bool>,
913}
914
915impl common::RequestValue for DeprecateCustomConnectorVersionRequest {}
916
917/// There is no detailed description.
918///
919/// This type is not used in any activity, and only used as *part* of another schema.
920///
921#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
922#[serde_with::serde_as]
923#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
924pub struct Destination {
925 /// For publicly routable host.
926 pub host: Option<String>,
927 /// The port is the target port number that is accepted by the destination.
928 pub port: Option<i32>,
929 /// PSC service attachments. Format: projects/*/regions/*/serviceAttachments/*
930 #[serde(rename = "serviceAttachment")]
931 pub service_attachment: Option<String>,
932}
933
934impl common::Part for Destination {}
935
936/// Define the Connectors target endpoint.
937///
938/// This type is not used in any activity, and only used as *part* of another schema.
939///
940#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
941#[serde_with::serde_as]
942#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
943pub struct DestinationConfig {
944 /// The destinations for the key.
945 pub destinations: Option<Vec<Destination>>,
946 /// The key is the destination identifier that is supported by the Connector.
947 pub key: Option<String>,
948}
949
950impl common::Part for DestinationConfig {}
951
952/// DestinationConfigTemplate defines required destinations supported by the Connector.
953///
954/// This type is not used in any activity, and only used as *part* of another schema.
955///
956#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
957#[serde_with::serde_as]
958#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
959pub struct DestinationConfigTemplate {
960 /// Autocomplete suggestions for destination URL field.
961 #[serde(rename = "autocompleteSuggestions")]
962 pub autocomplete_suggestions: Option<Vec<String>>,
963 /// The default port.
964 #[serde(rename = "defaultPort")]
965 pub default_port: Option<i32>,
966 /// Description.
967 pub description: Option<String>,
968 /// Display name of the parameter.
969 #[serde(rename = "displayName")]
970 pub display_name: Option<String>,
971 /// Whether the current destination tempalate is part of Advanced settings
972 #[serde(rename = "isAdvanced")]
973 pub is_advanced: Option<bool>,
974 /// Key of the destination.
975 pub key: Option<String>,
976 /// The maximum number of destinations supported for this key.
977 pub max: Option<i32>,
978 /// The minimum number of destinations supported for this key.
979 pub min: Option<i32>,
980 /// Whether port number should be provided by customers.
981 #[serde(rename = "portFieldType")]
982 pub port_field_type: Option<String>,
983 /// Regex pattern for host.
984 #[serde(rename = "regexPattern")]
985 pub regex_pattern: Option<String>,
986}
987
988impl common::Part for DestinationConfigTemplate {}
989
990/// 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.
991///
992/// This type is not used in any activity, and only used as *part* of another schema.
993///
994#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
995#[serde_with::serde_as]
996#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
997pub struct EgressControlConfig {
998 /// 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).
999 pub backends: Option<String>,
1000 /// Extractions Rules to extract the backends from customer provided configuration.
1001 #[serde(rename = "extractionRules")]
1002 pub extraction_rules: Option<ExtractionRules>,
1003}
1004
1005impl common::Part for EgressControlConfig {}
1006
1007/// 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); }
1008///
1009/// # Activities
1010///
1011/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1012/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1013///
1014/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (response)
1015/// * [locations operations delete projects](ProjectLocationOperationDeleteCall) (response)
1016#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1017#[serde_with::serde_as]
1018#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1019pub struct Empty {
1020 _never_set: Option<bool>,
1021}
1022
1023impl common::ResponseResult for Empty {}
1024
1025/// Regional encryption config for CMEK details.
1026///
1027/// This type is not used in any activity, and only used as *part* of another schema.
1028///
1029#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1030#[serde_with::serde_as]
1031#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1032pub struct EncryptionConfig {
1033 /// Optional. Encryption type for the region.
1034 #[serde(rename = "encryptionType")]
1035 pub encryption_type: Option<String>,
1036 /// Optional. KMS crypto key. This field accepts identifiers of the form `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/ {crypto_key}`
1037 #[serde(rename = "kmsKeyName")]
1038 pub kms_key_name: Option<String>,
1039}
1040
1041impl common::Part for EncryptionConfig {}
1042
1043/// Encryption Key value.
1044///
1045/// This type is not used in any activity, and only used as *part* of another schema.
1046///
1047#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1048#[serde_with::serde_as]
1049#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1050pub struct EncryptionKey {
1051 /// 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.
1052 #[serde(rename = "kmsKeyName")]
1053 pub kms_key_name: Option<String>,
1054 /// Type.
1055 #[serde(rename = "type")]
1056 pub type_: Option<String>,
1057}
1058
1059impl common::Part for EncryptionKey {}
1060
1061/// Endpoint message includes details of the Destination endpoint.
1062///
1063/// This type is not used in any activity, and only used as *part* of another schema.
1064///
1065#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1066#[serde_with::serde_as]
1067#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1068pub struct EndPoint {
1069 /// The URI of the Endpoint.
1070 #[serde(rename = "endpointUri")]
1071 pub endpoint_uri: Option<String>,
1072 /// List of Header to be added to the Endpoint.
1073 pub headers: Option<Vec<Header>>,
1074}
1075
1076impl common::Part for EndPoint {}
1077
1078/// represents the Connector’s Endpoint Attachment resource
1079///
1080/// # Activities
1081///
1082/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1083/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1084///
1085/// * [locations endpoint attachments create projects](ProjectLocationEndpointAttachmentCreateCall) (request)
1086/// * [locations endpoint attachments get projects](ProjectLocationEndpointAttachmentGetCall) (response)
1087/// * [locations endpoint attachments patch projects](ProjectLocationEndpointAttachmentPatchCall) (request)
1088#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1089#[serde_with::serde_as]
1090#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1091pub struct EndpointAttachment {
1092 /// Output only. Created time.
1093 #[serde(rename = "createTime")]
1094 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1095 /// Optional. Description of the resource.
1096 pub description: Option<String>,
1097 /// Optional. The Private Service Connect Connection Endpoint Global Access. https://cloud.google.com/vpc/docs/about-accessing-vpc-hosted-services-endpoints#global-access
1098 #[serde(rename = "endpointGlobalAccess")]
1099 pub endpoint_global_access: Option<bool>,
1100 /// Output only. The Private Service Connect connection endpoint ip
1101 #[serde(rename = "endpointIp")]
1102 pub endpoint_ip: Option<String>,
1103 /// 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
1104 pub labels: Option<HashMap<String, String>>,
1105 /// Output only. Resource name of the Endpoint Attachment. Format: projects/{project}/locations/{location}/endpointAttachments/{endpoint_attachment}
1106 pub name: Option<String>,
1107 /// Required. The path of the service attachment
1108 #[serde(rename = "serviceAttachment")]
1109 pub service_attachment: Option<String>,
1110 /// Output only. Updated time.
1111 #[serde(rename = "updateTime")]
1112 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1113}
1114
1115impl common::RequestValue for EndpointAttachment {}
1116impl common::ResponseResult for EndpointAttachment {}
1117
1118/// EnumOption definition
1119///
1120/// This type is not used in any activity, and only used as *part* of another schema.
1121///
1122#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1123#[serde_with::serde_as]
1124#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1125pub struct EnumOption {
1126 /// Display name of the option.
1127 #[serde(rename = "displayName")]
1128 pub display_name: Option<String>,
1129 /// Id of the option.
1130 pub id: Option<String>,
1131}
1132
1133impl common::Part for EnumOption {}
1134
1135/// represents the Connector’s EventSubscription resource
1136///
1137/// # Activities
1138///
1139/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1140/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1141///
1142/// * [locations connections event subscriptions create projects](ProjectLocationConnectionEventSubscriptionCreateCall) (request)
1143/// * [locations connections event subscriptions get projects](ProjectLocationConnectionEventSubscriptionGetCall) (response)
1144/// * [locations connections event subscriptions patch projects](ProjectLocationConnectionEventSubscriptionPatchCall) (request)
1145#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1146#[serde_with::serde_as]
1147#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1148pub struct EventSubscription {
1149 /// Output only. Created time.
1150 #[serde(rename = "createTime")]
1151 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1152 /// Optional. The destination to hit when we receive an event
1153 pub destinations: Option<EventSubscriptionDestination>,
1154 /// Optional. Event type id of the event of current EventSubscription.
1155 #[serde(rename = "eventTypeId")]
1156 pub event_type_id: Option<String>,
1157 /// Optional. JMS is the source for the event listener.
1158 pub jms: Option<JMS>,
1159 /// Required. Resource name of the EventSubscription. Format: projects/{project}/locations/{location}/connections/{connection}/eventSubscriptions/{event_subscription}
1160 pub name: Option<String>,
1161 /// Optional. Status indicates the status of the event subscription resource
1162 pub status: Option<EventSubscriptionStatus>,
1163 /// Optional. name of the Subscriber for the current EventSubscription.
1164 pub subscriber: Option<String>,
1165 /// Optional. Link for Subscriber of the current EventSubscription.
1166 #[serde(rename = "subscriberLink")]
1167 pub subscriber_link: Option<String>,
1168 /// Optional. Configuration for configuring the trigger
1169 #[serde(rename = "triggerConfigVariables")]
1170 pub trigger_config_variables: Option<Vec<ConfigVariable>>,
1171 /// Output only. Updated time.
1172 #[serde(rename = "updateTime")]
1173 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1174}
1175
1176impl common::RequestValue for EventSubscription {}
1177impl common::ResponseResult for EventSubscription {}
1178
1179/// Message for EventSubscription Destination to act on receiving an event
1180///
1181/// This type is not used in any activity, and only used as *part* of another schema.
1182///
1183#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1184#[serde_with::serde_as]
1185#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1186pub struct EventSubscriptionDestination {
1187 /// OPTION 1: Hit an endpoint when we receive an event.
1188 pub endpoint: Option<EndPoint>,
1189 /// Service account needed for runtime plane to trigger IP workflow.
1190 #[serde(rename = "serviceAccount")]
1191 pub service_account: Option<String>,
1192 /// type of the destination
1193 #[serde(rename = "type")]
1194 pub type_: Option<String>,
1195}
1196
1197impl common::Part for EventSubscriptionDestination {}
1198
1199/// EventSubscription Status denotes the status of the EventSubscription resource.
1200///
1201/// This type is not used in any activity, and only used as *part* of another schema.
1202///
1203#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1204#[serde_with::serde_as]
1205#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1206pub struct EventSubscriptionStatus {
1207 /// Output only. Description of the state.
1208 pub description: Option<String>,
1209 /// Output only. State of Event Subscription resource.
1210 pub state: Option<String>,
1211}
1212
1213impl common::Part for EventSubscriptionStatus {}
1214
1215/// EventType includes fields.
1216///
1217/// # Activities
1218///
1219/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1220/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1221///
1222/// * [locations providers connectors versions eventtypes get projects](ProjectLocationProviderConnectorVersionEventtypeGetCall) (response)
1223#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1224#[serde_with::serde_as]
1225#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1226pub struct EventType {
1227 /// Output only. Created time.
1228 #[serde(rename = "createTime")]
1229 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1230 /// Output only. Schema of the event payload after enriched. Will be null if read before send is not supported.
1231 #[serde(rename = "enrichedEventPayloadSchema")]
1232 pub enriched_event_payload_schema: Option<String>,
1233 /// Output only. Runtime entity type name. Will be null if entity type map is not available. Used for read before send feature.
1234 #[serde(rename = "entityType")]
1235 pub entity_type: Option<String>,
1236 /// Output only. Schema of webhook event payload.
1237 #[serde(rename = "eventPayloadSchema")]
1238 pub event_payload_schema: Option<String>,
1239 /// Output only. Event type id. Example: `ticket.created`.
1240 #[serde(rename = "eventTypeId")]
1241 pub event_type_id: Option<String>,
1242 /// Output only. Id path denotes the path of id in webhook payload.
1243 #[serde(rename = "idPath")]
1244 pub id_path: Option<String>,
1245 /// 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.
1246 pub name: Option<String>,
1247 /// Output only. Updated time.
1248 #[serde(rename = "updateTime")]
1249 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1250}
1251
1252impl common::ResponseResult for EventType {}
1253
1254/// Eventing Configuration of a connection
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 EventingConfig {
1262 /// Additional eventing related field values
1263 #[serde(rename = "additionalVariables")]
1264 pub additional_variables: Option<Vec<ConfigVariable>>,
1265 /// Auth details for the webhook adapter.
1266 #[serde(rename = "authConfig")]
1267 pub auth_config: Option<AuthConfig>,
1268 /// Optional. Dead letter configuration for eventing of a connection.
1269 #[serde(rename = "deadLetterConfig")]
1270 pub dead_letter_config: Option<DeadLetterConfig>,
1271 /// Enrichment Enabled.
1272 #[serde(rename = "enrichmentEnabled")]
1273 pub enrichment_enabled: Option<bool>,
1274 /// Optional. Ingress endpoint of the event listener. This is used only when private connectivity is enabled.
1275 #[serde(rename = "eventsListenerIngressEndpoint")]
1276 pub events_listener_ingress_endpoint: Option<String>,
1277 /// Optional. Auth details for the event listener.
1278 #[serde(rename = "listenerAuthConfig")]
1279 pub listener_auth_config: Option<AuthConfig>,
1280 /// Optional. Private Connectivity Enabled.
1281 #[serde(rename = "privateConnectivityEnabled")]
1282 pub private_connectivity_enabled: Option<bool>,
1283 /// Optional. Proxy for Eventing auto-registration.
1284 #[serde(rename = "proxyDestinationConfig")]
1285 pub proxy_destination_config: Option<DestinationConfig>,
1286 /// Registration endpoint for auto registration.
1287 #[serde(rename = "registrationDestinationConfig")]
1288 pub registration_destination_config: Option<DestinationConfig>,
1289}
1290
1291impl common::Part for EventingConfig {}
1292
1293/// Eventing Config details of a connector version.
1294///
1295/// This type is not used in any activity, and only used as *part* of another schema.
1296///
1297#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1298#[serde_with::serde_as]
1299#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1300pub struct EventingConfigTemplate {
1301 /// Additional fields that need to be rendered.
1302 #[serde(rename = "additionalVariables")]
1303 pub additional_variables: Option<Vec<ConfigVariableTemplate>>,
1304 /// AuthConfigTemplates represents the auth values for the webhook adapter.
1305 #[serde(rename = "authConfigTemplates")]
1306 pub auth_config_templates: Option<Vec<AuthConfigTemplate>>,
1307 /// Auto refresh to extend webhook life.
1308 #[serde(rename = "autoRefresh")]
1309 pub auto_refresh: Option<bool>,
1310 /// Auto Registration supported.
1311 #[serde(rename = "autoRegistrationSupported")]
1312 pub auto_registration_supported: Option<bool>,
1313 /// Encryption key (can be either Google managed or CMEK).
1314 #[serde(rename = "encryptionKeyTemplate")]
1315 pub encryption_key_template: Option<ConfigVariableTemplate>,
1316 /// Enrichment Supported.
1317 #[serde(rename = "enrichmentSupported")]
1318 pub enrichment_supported: Option<bool>,
1319 /// The type of the event listener for a specific connector.
1320 #[serde(rename = "eventListenerType")]
1321 pub event_listener_type: Option<String>,
1322 /// Is Eventing Supported.
1323 #[serde(rename = "isEventingSupported")]
1324 pub is_eventing_supported: Option<bool>,
1325 /// ListenerAuthConfigTemplates represents the auth values for the event listener.
1326 #[serde(rename = "listenerAuthConfigTemplates")]
1327 pub listener_auth_config_templates: Option<Vec<AuthConfigTemplate>>,
1328 /// Proxy destination config template.
1329 #[serde(rename = "proxyDestinationConfig")]
1330 pub proxy_destination_config: Option<DestinationConfigTemplate>,
1331 /// Registration host destination config template.
1332 #[serde(rename = "registrationDestinationConfig")]
1333 pub registration_destination_config: Option<DestinationConfigTemplate>,
1334 /// Trigger Config fields that needs to be rendered
1335 #[serde(rename = "triggerConfigVariables")]
1336 pub trigger_config_variables: Option<Vec<ConfigVariableTemplate>>,
1337}
1338
1339impl common::Part for EventingConfigTemplate {}
1340
1341/// Eventing Details message.
1342///
1343/// This type is not used in any activity, and only used as *part* of another schema.
1344///
1345#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1346#[serde_with::serde_as]
1347#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1348pub struct EventingDetails {
1349 /// Output only. Custom Event Types.
1350 #[serde(rename = "customEventTypes")]
1351 pub custom_event_types: Option<bool>,
1352 /// Output only. Description.
1353 pub description: Option<String>,
1354 /// Output only. Link to public documentation.
1355 #[serde(rename = "documentationLink")]
1356 pub documentation_link: Option<String>,
1357 /// Output only. Cloud storage location of the icon.
1358 #[serde(rename = "iconLocation")]
1359 pub icon_location: Option<String>,
1360 /// Output only. Eventing Launch Stage.
1361 #[serde(rename = "launchStage")]
1362 pub launch_stage: Option<String>,
1363 /// Output only. Name of the Eventing trigger.
1364 pub name: Option<String>,
1365 /// Output only. Array of search keywords.
1366 #[serde(rename = "searchTags")]
1367 pub search_tags: Option<Vec<String>>,
1368 /// Output only. The type of the event listener for a specific connector.
1369 #[serde(rename = "type")]
1370 pub type_: Option<String>,
1371}
1372
1373impl common::Part for EventingDetails {}
1374
1375/// Eventing runtime data has the details related to eventing managed by the system.
1376///
1377/// This type is not used in any activity, and only used as *part* of another schema.
1378///
1379#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1380#[serde_with::serde_as]
1381#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1382pub struct EventingRuntimeData {
1383 /// Output only. Events listener endpoint. The value will populated after provisioning the events listener.
1384 #[serde(rename = "eventsListenerEndpoint")]
1385 pub events_listener_endpoint: Option<String>,
1386 /// Output only. Events listener PSC Service attachment. The value will be populated after provisioning the events listener with private connectivity enabled.
1387 #[serde(rename = "eventsListenerPscSa")]
1388 pub events_listener_psc_sa: Option<String>,
1389 /// Output only. Current status of eventing.
1390 pub status: Option<EventingStatus>,
1391 /// Output only. Webhook data.
1392 #[serde(rename = "webhookData")]
1393 pub webhook_data: Option<WebhookData>,
1394}
1395
1396impl common::Part for EventingRuntimeData {}
1397
1398/// EventingStatus indicates the state of eventing.
1399///
1400/// This type is not used in any activity, and only used as *part* of another schema.
1401///
1402#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1403#[serde_with::serde_as]
1404#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1405pub struct EventingStatus {
1406 /// Output only. Description of error if State is set to "ERROR".
1407 pub description: Option<String>,
1408 /// Output only. State.
1409 pub state: Option<String>,
1410}
1411
1412impl common::Part for EventingStatus {}
1413
1414/// 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.
1415///
1416/// This type is not used in any activity, and only used as *part* of another schema.
1417///
1418#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1419#[serde_with::serde_as]
1420#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1421pub struct Expr {
1422 /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
1423 pub description: Option<String>,
1424 /// Textual representation of an expression in Common Expression Language syntax.
1425 pub expression: Option<String>,
1426 /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
1427 pub location: Option<String>,
1428 /// 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.
1429 pub title: Option<String>,
1430}
1431
1432impl common::Part for Expr {}
1433
1434/// Extraction Rule.
1435///
1436/// This type is not used in any activity, and only used as *part* of another schema.
1437///
1438#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1439#[serde_with::serde_as]
1440#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1441pub struct ExtractionRule {
1442 /// Regex used to extract backend details from source. If empty, whole source value will be used.
1443 #[serde(rename = "extractionRegex")]
1444 pub extraction_regex: Option<String>,
1445 /// Source on which the rule is applied.
1446 pub source: Option<Source>,
1447}
1448
1449impl common::Part for ExtractionRule {}
1450
1451/// Extraction Rules to identity the backends from customer provided configuration in Connection resource.
1452///
1453/// This type is not used in any activity, and only used as *part* of another schema.
1454///
1455#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1456#[serde_with::serde_as]
1457#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1458pub struct ExtractionRules {
1459 /// Collection of Extraction Rule.
1460 #[serde(rename = "extractionRule")]
1461 pub extraction_rule: Option<Vec<ExtractionRule>>,
1462}
1463
1464impl common::Part for ExtractionRules {}
1465
1466/// Metadata of an entity field.
1467///
1468/// This type is not used in any activity, and only used as *part* of another schema.
1469///
1470#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1471#[serde_with::serde_as]
1472#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1473pub struct Field {
1474 /// The following map contains fields that are not explicitly mentioned above,this give connectors the flexibility to add new metadata fields.
1475 #[serde(rename = "additionalDetails")]
1476 pub additional_details: Option<HashMap<String, serde_json::Value>>,
1477 /// The data type of the Field.
1478 #[serde(rename = "dataType")]
1479 pub data_type: Option<String>,
1480 /// The following field specifies the default value of the Field provided by the external system if a value is not provided.
1481 #[serde(rename = "defaultValue")]
1482 pub default_value: Option<serde_json::Value>,
1483 /// A brief description of the Field.
1484 pub description: Option<String>,
1485 /// Name of the Field.
1486 pub field: Option<String>,
1487 /// JsonSchema representation of this entity's schema
1488 #[serde(rename = "jsonSchema")]
1489 pub json_schema: Option<JsonSchema>,
1490 /// The following boolean field specifies if the current Field acts as a primary key or id if the parent is of type entity.
1491 pub key: Option<bool>,
1492 /// Specifies whether a null value is allowed.
1493 pub nullable: Option<bool>,
1494 /// Specifies if the Field is readonly.
1495 pub readonly: Option<bool>,
1496}
1497
1498impl common::Part for Field {}
1499
1500/// Field that needs to be compared.
1501///
1502/// This type is not used in any activity, and only used as *part* of another schema.
1503///
1504#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1505#[serde_with::serde_as]
1506#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1507pub struct FieldComparison {
1508 /// Boolean value
1509 #[serde(rename = "boolValue")]
1510 pub bool_value: Option<bool>,
1511 /// Comparator to use for comparing the field value.
1512 pub comparator: Option<String>,
1513 /// Integer value
1514 #[serde(rename = "intValue")]
1515 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1516 pub int_value: Option<i64>,
1517 /// Key of the field.
1518 pub key: Option<String>,
1519 /// String value
1520 #[serde(rename = "stringValue")]
1521 pub string_value: Option<String>,
1522}
1523
1524impl common::Part for FieldComparison {}
1525
1526/// Autoscaling config for connector deployment system metrics.
1527///
1528/// This type is not used in any activity, and only used as *part* of another schema.
1529///
1530#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1531#[serde_with::serde_as]
1532#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1533pub struct HPAConfig {
1534 /// Output only. Percent CPU utilization where HPA triggers autoscaling.
1535 #[serde(rename = "cpuUtilizationThreshold")]
1536 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1537 pub cpu_utilization_threshold: Option<i64>,
1538 /// Output only. Percent Memory utilization where HPA triggers autoscaling.
1539 #[serde(rename = "memoryUtilizationThreshold")]
1540 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1541 pub memory_utilization_threshold: Option<i64>,
1542}
1543
1544impl common::Part for HPAConfig {}
1545
1546/// Header details for a given header to be added to Endpoint.
1547///
1548/// This type is not used in any activity, and only used as *part* of another schema.
1549///
1550#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1551#[serde_with::serde_as]
1552#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1553pub struct Header {
1554 /// Key of Header.
1555 pub key: Option<String>,
1556 /// Value of Header.
1557 pub value: Option<String>,
1558}
1559
1560impl common::Part for Header {}
1561
1562/// Metadata of an input parameter.
1563///
1564/// This type is not used in any activity, and only used as *part* of another schema.
1565///
1566#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1567#[serde_with::serde_as]
1568#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1569pub struct InputParameter {
1570 /// The data type of the Parameter.
1571 #[serde(rename = "dataType")]
1572 pub data_type: Option<String>,
1573 /// The following field specifies the default value of the Parameter provided by the external system if a value is not provided.
1574 #[serde(rename = "defaultValue")]
1575 pub default_value: Option<serde_json::Value>,
1576 /// A brief description of the Parameter.
1577 pub description: Option<String>,
1578 /// JsonSchema representation of this action's parameter
1579 #[serde(rename = "jsonSchema")]
1580 pub json_schema: Option<JsonSchema>,
1581 /// Specifies whether a null value is allowed.
1582 pub nullable: Option<bool>,
1583 /// Name of the Parameter.
1584 pub parameter: Option<String>,
1585}
1586
1587impl common::Part for InputParameter {}
1588
1589/// JMS message denotes the source of the event
1590///
1591/// This type is not used in any activity, and only used as *part* of another schema.
1592///
1593#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1594#[serde_with::serde_as]
1595#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1596pub struct JMS {
1597 /// Optional. Name of the JMS source. i.e. queueName or topicName
1598 pub name: Option<String>,
1599 /// Optional. Type of the JMS Source. i.e. Queue or Topic
1600 #[serde(rename = "type")]
1601 pub type_: Option<String>,
1602}
1603
1604impl common::Part for JMS {}
1605
1606/// JsonSchema representation of schema metadata
1607///
1608/// This type is not used in any activity, and only used as *part* of another schema.
1609///
1610#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1611#[serde_with::serde_as]
1612#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1613pub struct JsonSchema {
1614 /// The default value of the field or object described by this schema.
1615 pub default: Option<serde_json::Value>,
1616 /// A description of this schema.
1617 pub description: Option<String>,
1618 /// Possible values for an enumeration. This works in conjunction with `type` to represent types with a fixed set of legal values
1619 #[serde(rename = "enum")]
1620 pub enum_: Option<Vec<serde_json::Value>>,
1621 /// Format of the value as per https://json-schema.org/understanding-json-schema/reference/string.html#format
1622 pub format: Option<String>,
1623 /// Schema that applies to array values, applicable only if this is of type `array`.
1624 pub items: Option<Option<Box<JsonSchema>>>,
1625 /// JDBC datatype of the field.
1626 #[serde(rename = "jdbcType")]
1627 pub jdbc_type: Option<String>,
1628 /// 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
1629 pub properties: Option<HashMap<String, JsonSchema>>,
1630 /// Whether this property is required.
1631 pub required: Option<Vec<String>>,
1632 /// JSON Schema Validation: A Vocabulary for Structural Validation of JSON
1633 #[serde(rename = "type")]
1634 pub type_: Option<Vec<String>>,
1635}
1636
1637impl common::Part for JsonSchema {}
1638
1639/// JWT claims used for the jwt-bearer authorization grant.
1640///
1641/// This type is not used in any activity, and only used as *part* of another schema.
1642///
1643#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1644#[serde_with::serde_as]
1645#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1646pub struct JwtClaims {
1647 /// Value for the "aud" claim.
1648 pub audience: Option<String>,
1649 /// Value for the "iss" claim.
1650 pub issuer: Option<String>,
1651 /// Value for the "sub" claim.
1652 pub subject: Option<String>,
1653}
1654
1655impl common::Part for JwtClaims {}
1656
1657/// Response message for ListActions API
1658///
1659/// # Activities
1660///
1661/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1662/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1663///
1664/// * [locations connections connection schema metadata list actions projects](ProjectLocationConnectionConnectionSchemaMetadataListActionCall) (response)
1665#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1666#[serde_with::serde_as]
1667#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1668pub struct ListActionsResponse {
1669 /// list of actions
1670 pub actions: Option<Vec<RuntimeActionSchema>>,
1671 /// token for next page
1672 #[serde(rename = "nextPageToken")]
1673 pub next_page_token: Option<String>,
1674}
1675
1676impl common::ResponseResult for ListActionsResponse {}
1677
1678/// Response message for ConnectorsService.ListConnections
1679///
1680/// # Activities
1681///
1682/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1683/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1684///
1685/// * [locations connections list projects](ProjectLocationConnectionListCall) (response)
1686#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1687#[serde_with::serde_as]
1688#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1689pub struct ListConnectionsResponse {
1690 /// Connections.
1691 pub connections: Option<Vec<Connection>>,
1692 /// Next page token.
1693 #[serde(rename = "nextPageToken")]
1694 pub next_page_token: Option<String>,
1695 /// Locations that could not be reached.
1696 pub unreachable: Option<Vec<String>>,
1697}
1698
1699impl common::ResponseResult for ListConnectionsResponse {}
1700
1701/// Response message for Connectors.ListConnectorVersions.
1702///
1703/// # Activities
1704///
1705/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1706/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1707///
1708/// * [locations providers connectors versions list projects](ProjectLocationProviderConnectorVersionListCall) (response)
1709#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1710#[serde_with::serde_as]
1711#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1712pub struct ListConnectorVersionsResponse {
1713 /// A list of connector versions.
1714 #[serde(rename = "connectorVersions")]
1715 pub connector_versions: Option<Vec<ConnectorVersion>>,
1716 /// Next page token.
1717 #[serde(rename = "nextPageToken")]
1718 pub next_page_token: Option<String>,
1719 /// Locations that could not be reached.
1720 pub unreachable: Option<Vec<String>>,
1721}
1722
1723impl common::ResponseResult for ListConnectorVersionsResponse {}
1724
1725/// Response message for Connectors.ListConnectors.
1726///
1727/// # Activities
1728///
1729/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1730/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1731///
1732/// * [locations providers connectors list projects](ProjectLocationProviderConnectorListCall) (response)
1733#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1734#[serde_with::serde_as]
1735#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1736pub struct ListConnectorsResponse {
1737 /// A list of connectors.
1738 pub connectors: Option<Vec<Connector>>,
1739 /// Next page token.
1740 #[serde(rename = "nextPageToken")]
1741 pub next_page_token: Option<String>,
1742 /// Locations that could not be reached.
1743 pub unreachable: Option<Vec<String>>,
1744}
1745
1746impl common::ResponseResult for ListConnectorsResponse {}
1747
1748/// Response message for Connectors.ListCustomConnectorVersions.
1749///
1750/// # Activities
1751///
1752/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1753/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1754///
1755/// * [locations global custom connectors custom connector versions list projects](ProjectLocationGlobalCustomConnectorCustomConnectorVersionListCall) (response)
1756#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1757#[serde_with::serde_as]
1758#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1759pub struct ListCustomConnectorVersionsResponse {
1760 /// A list of connector versions.
1761 #[serde(rename = "customConnectorVersions")]
1762 pub custom_connector_versions: Option<Vec<CustomConnectorVersion>>,
1763 /// Next page token.
1764 #[serde(rename = "nextPageToken")]
1765 pub next_page_token: Option<String>,
1766 /// Locations that could not be reached.
1767 pub unreachable: Option<Vec<String>>,
1768}
1769
1770impl common::ResponseResult for ListCustomConnectorVersionsResponse {}
1771
1772/// Response message for Connectors.ListCustomConnectors.
1773///
1774/// # Activities
1775///
1776/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1777/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1778///
1779/// * [locations global custom connectors list projects](ProjectLocationGlobalCustomConnectorListCall) (response)
1780#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1781#[serde_with::serde_as]
1782#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1783pub struct ListCustomConnectorsResponse {
1784 /// A list of customConnectors.
1785 #[serde(rename = "customConnectors")]
1786 pub custom_connectors: Option<Vec<CustomConnector>>,
1787 /// Next page token.
1788 #[serde(rename = "nextPageToken")]
1789 pub next_page_token: Option<String>,
1790 /// Locations that could not be reached.
1791 pub unreachable: Option<Vec<String>>,
1792}
1793
1794impl common::ResponseResult for ListCustomConnectorsResponse {}
1795
1796/// Response message for ConnectorsService.ListEndpointAttachments
1797///
1798/// # Activities
1799///
1800/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1801/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1802///
1803/// * [locations endpoint attachments list projects](ProjectLocationEndpointAttachmentListCall) (response)
1804#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1805#[serde_with::serde_as]
1806#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1807pub struct ListEndpointAttachmentsResponse {
1808 /// EndpointAttachments.
1809 #[serde(rename = "endpointAttachments")]
1810 pub endpoint_attachments: Option<Vec<EndpointAttachment>>,
1811 /// Next page token.
1812 #[serde(rename = "nextPageToken")]
1813 pub next_page_token: Option<String>,
1814 /// Locations that could not be reached.
1815 pub unreachable: Option<Vec<String>>,
1816}
1817
1818impl common::ResponseResult for ListEndpointAttachmentsResponse {}
1819
1820/// Response message for ListEntityTypes API
1821///
1822/// # Activities
1823///
1824/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1825/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1826///
1827/// * [locations connections connection schema metadata list entity types projects](ProjectLocationConnectionConnectionSchemaMetadataListEntityTypeCall) (response)
1828#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1829#[serde_with::serde_as]
1830#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1831pub struct ListEntityTypesResponse {
1832 /// list of entity types
1833 #[serde(rename = "entityTypes")]
1834 pub entity_types: Option<Vec<RuntimeEntitySchema>>,
1835 /// token for next page
1836 #[serde(rename = "nextPageToken")]
1837 pub next_page_token: Option<String>,
1838}
1839
1840impl common::ResponseResult for ListEntityTypesResponse {}
1841
1842/// Response message for ConnectorsService.ListEventSubscriptions
1843///
1844/// # Activities
1845///
1846/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1847/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1848///
1849/// * [locations connections event subscriptions list projects](ProjectLocationConnectionEventSubscriptionListCall) (response)
1850#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1851#[serde_with::serde_as]
1852#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1853pub struct ListEventSubscriptionsResponse {
1854 /// Subscriptions.
1855 #[serde(rename = "eventSubscriptions")]
1856 pub event_subscriptions: Option<Vec<EventSubscription>>,
1857 /// Next page token.
1858 #[serde(rename = "nextPageToken")]
1859 pub next_page_token: Option<String>,
1860 /// Locations that could not be reached.
1861 pub unreachable: Option<Vec<String>>,
1862}
1863
1864impl common::ResponseResult for ListEventSubscriptionsResponse {}
1865
1866/// Response message for Connectors.ListEventTypes.
1867///
1868/// # Activities
1869///
1870/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1871/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1872///
1873/// * [locations providers connectors versions eventtypes list projects](ProjectLocationProviderConnectorVersionEventtypeListCall) (response)
1874#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1875#[serde_with::serde_as]
1876#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1877pub struct ListEventTypesResponse {
1878 /// A list of connector versions.
1879 #[serde(rename = "eventTypes")]
1880 pub event_types: Option<Vec<EventType>>,
1881 /// Next page token.
1882 #[serde(rename = "nextPageToken")]
1883 pub next_page_token: Option<String>,
1884}
1885
1886impl common::ResponseResult for ListEventTypesResponse {}
1887
1888/// The response message for Locations.ListLocations.
1889///
1890/// # Activities
1891///
1892/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1893/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1894///
1895/// * [locations list projects](ProjectLocationListCall) (response)
1896#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1897#[serde_with::serde_as]
1898#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1899pub struct ListLocationsResponse {
1900 /// A list of locations that matches the specified filter in the request.
1901 pub locations: Option<Vec<Location>>,
1902 /// The standard List next-page token.
1903 #[serde(rename = "nextPageToken")]
1904 pub next_page_token: Option<String>,
1905}
1906
1907impl common::ResponseResult for ListLocationsResponse {}
1908
1909/// Response message for ConnectorsService.ListManagedZones
1910///
1911/// # Activities
1912///
1913/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1914/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1915///
1916/// * [locations global managed zones list projects](ProjectLocationGlobalManagedZoneListCall) (response)
1917#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1918#[serde_with::serde_as]
1919#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1920pub struct ListManagedZonesResponse {
1921 /// ManagedZones.
1922 #[serde(rename = "managedZones")]
1923 pub managed_zones: Option<Vec<ManagedZone>>,
1924 /// Next page token.
1925 #[serde(rename = "nextPageToken")]
1926 pub next_page_token: Option<String>,
1927}
1928
1929impl common::ResponseResult for ListManagedZonesResponse {}
1930
1931/// The response message for Operations.ListOperations.
1932///
1933/// # Activities
1934///
1935/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1936/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1937///
1938/// * [locations operations list projects](ProjectLocationOperationListCall) (response)
1939#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1940#[serde_with::serde_as]
1941#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1942pub struct ListOperationsResponse {
1943 /// The standard List next-page token.
1944 #[serde(rename = "nextPageToken")]
1945 pub next_page_token: Option<String>,
1946 /// A list of operations that matches the specified filter in the request.
1947 pub operations: Option<Vec<Operation>>,
1948}
1949
1950impl common::ResponseResult for ListOperationsResponse {}
1951
1952/// Response message for Connectors.ListProviders.
1953///
1954/// # Activities
1955///
1956/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1957/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1958///
1959/// * [locations providers list projects](ProjectLocationProviderListCall) (response)
1960#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1961#[serde_with::serde_as]
1962#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1963pub struct ListProvidersResponse {
1964 /// Next page token.
1965 #[serde(rename = "nextPageToken")]
1966 pub next_page_token: Option<String>,
1967 /// A list of providers.
1968 pub providers: Option<Vec<Provider>>,
1969 /// Locations that could not be reached.
1970 pub unreachable: Option<Vec<String>>,
1971}
1972
1973impl common::ResponseResult for ListProvidersResponse {}
1974
1975/// Response message for ConnectorsService.ListRuntimeActionSchemas.
1976///
1977/// # Activities
1978///
1979/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1980/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1981///
1982/// * [locations connections runtime action schemas list projects](ProjectLocationConnectionRuntimeActionSchemaListCall) (response)
1983#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1984#[serde_with::serde_as]
1985#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1986pub struct ListRuntimeActionSchemasResponse {
1987 /// Next page token.
1988 #[serde(rename = "nextPageToken")]
1989 pub next_page_token: Option<String>,
1990 /// Runtime action schemas.
1991 #[serde(rename = "runtimeActionSchemas")]
1992 pub runtime_action_schemas: Option<Vec<RuntimeActionSchema>>,
1993}
1994
1995impl common::ResponseResult for ListRuntimeActionSchemasResponse {}
1996
1997/// Response message for ConnectorsService.ListRuntimeEntitySchemas.
1998///
1999/// # Activities
2000///
2001/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2002/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2003///
2004/// * [locations connections runtime entity schemas list projects](ProjectLocationConnectionRuntimeEntitySchemaListCall) (response)
2005#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2006#[serde_with::serde_as]
2007#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2008pub struct ListRuntimeEntitySchemasResponse {
2009 /// Next page token.
2010 #[serde(rename = "nextPageToken")]
2011 pub next_page_token: Option<String>,
2012 /// Runtime entity schemas.
2013 #[serde(rename = "runtimeEntitySchemas")]
2014 pub runtime_entity_schemas: Option<Vec<RuntimeEntitySchema>>,
2015}
2016
2017impl common::ResponseResult for ListRuntimeEntitySchemasResponse {}
2018
2019/// Expected request for ListenEvent API.
2020///
2021/// # Activities
2022///
2023/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2024/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2025///
2026/// * [locations connections listen event projects](ProjectLocationConnectionListenEventCall) (request)
2027#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2028#[serde_with::serde_as]
2029#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2030pub struct ListenEventRequest {
2031 /// Optional. Request payload.
2032 pub payload: Option<HashMap<String, serde_json::Value>>,
2033}
2034
2035impl common::RequestValue for ListenEventRequest {}
2036
2037/// Expected response for ListenEvent API.
2038///
2039/// # Activities
2040///
2041/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2042/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2043///
2044/// * [locations connections listen event projects](ProjectLocationConnectionListenEventCall) (response)
2045#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2046#[serde_with::serde_as]
2047#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2048pub struct ListenEventResponse {
2049 _never_set: Option<bool>,
2050}
2051
2052impl common::ResponseResult for ListenEventResponse {}
2053
2054/// A resource that represents a Google Cloud location.
2055///
2056/// # Activities
2057///
2058/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2059/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2060///
2061/// * [locations get projects](ProjectLocationGetCall) (response)
2062#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2063#[serde_with::serde_as]
2064#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2065pub struct Location {
2066 /// The friendly name for this location, typically a nearby city name. For example, "Tokyo".
2067 #[serde(rename = "displayName")]
2068 pub display_name: Option<String>,
2069 /// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"}
2070 pub labels: Option<HashMap<String, String>>,
2071 /// The canonical id for this location. For example: `"us-east1"`.
2072 #[serde(rename = "locationId")]
2073 pub location_id: Option<String>,
2074 /// Service-specific metadata. For example the available capacity at the given location.
2075 pub metadata: Option<HashMap<String, serde_json::Value>>,
2076 /// Resource name for the location, which may vary between implementations. For example: `"projects/example-project/locations/us-east1"`
2077 pub name: Option<String>,
2078}
2079
2080impl common::ResponseResult for Location {}
2081
2082/// Determines whether or no a connection is locked. If locked, a reason must be specified.
2083///
2084/// This type is not used in any activity, and only used as *part* of another schema.
2085///
2086#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2087#[serde_with::serde_as]
2088#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2089pub struct LockConfig {
2090 /// Indicates whether or not the connection is locked.
2091 pub locked: Option<bool>,
2092 /// Describes why a connection is locked.
2093 pub reason: Option<String>,
2094}
2095
2096impl common::Part for LockConfig {}
2097
2098/// Struct for representing boolean expressions.
2099///
2100/// This type is not used in any activity, and only used as *part* of another schema.
2101///
2102#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2103#[serde_with::serde_as]
2104#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2105pub struct LogicalExpression {
2106 /// A list of fields to be compared.
2107 #[serde(rename = "fieldComparisons")]
2108 pub field_comparisons: Option<Vec<FieldComparison>>,
2109 /// A list of nested conditions to be compared.
2110 #[serde(rename = "logicalExpressions")]
2111 pub logical_expressions: Option<Vec<LogicalExpression>>,
2112 /// The logical operator to use between the fields and conditions.
2113 #[serde(rename = "logicalOperator")]
2114 pub logical_operator: Option<String>,
2115}
2116
2117impl common::Part for LogicalExpression {}
2118
2119/// represents the Connector’s Managed Zone resource
2120///
2121/// # Activities
2122///
2123/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2124/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2125///
2126/// * [locations global managed zones create projects](ProjectLocationGlobalManagedZoneCreateCall) (request)
2127/// * [locations global managed zones get projects](ProjectLocationGlobalManagedZoneGetCall) (response)
2128/// * [locations global managed zones patch projects](ProjectLocationGlobalManagedZonePatchCall) (request)
2129#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2130#[serde_with::serde_as]
2131#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2132pub struct ManagedZone {
2133 /// Output only. Created time.
2134 #[serde(rename = "createTime")]
2135 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2136 /// Optional. Description of the resource.
2137 pub description: Option<String>,
2138 /// Required. DNS Name of the resource
2139 pub dns: Option<String>,
2140 /// 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
2141 pub labels: Option<HashMap<String, String>>,
2142 /// Output only. Resource name of the Managed Zone. Format: projects/{project}/locations/global/managedZones/{managed_zone}
2143 pub name: Option<String>,
2144 /// Required. The name of the Target Project
2145 #[serde(rename = "targetProject")]
2146 pub target_project: Option<String>,
2147 /// Required. The name of the Target Project VPC Network
2148 #[serde(rename = "targetVpc")]
2149 pub target_vpc: Option<String>,
2150 /// Output only. Updated time.
2151 #[serde(rename = "updateTime")]
2152 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2153}
2154
2155impl common::RequestValue for ManagedZone {}
2156impl common::ResponseResult for ManagedZone {}
2157
2158/// MultipleSelectConfig represents the multiple options for a config variable.
2159///
2160/// This type is not used in any activity, and only used as *part* of another schema.
2161///
2162#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2163#[serde_with::serde_as]
2164#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2165pub struct MultipleSelectConfig {
2166 /// Optional. Allow custom values.
2167 #[serde(rename = "allowCustomValues")]
2168 pub allow_custom_values: Option<bool>,
2169 /// Required. Multiple select options.
2170 #[serde(rename = "multipleSelectOptions")]
2171 pub multiple_select_options: Option<Vec<MultipleSelectOption>>,
2172 /// Required. Value separator.
2173 #[serde(rename = "valueSeparator")]
2174 pub value_separator: Option<String>,
2175}
2176
2177impl common::Part for MultipleSelectConfig {}
2178
2179/// MultiplSelecteOption represents the single option for a config variable.
2180///
2181/// This type is not used in any activity, and only used as *part* of another schema.
2182///
2183#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2184#[serde_with::serde_as]
2185#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2186pub struct MultipleSelectOption {
2187 /// Optional. Value of the option.
2188 pub description: Option<String>,
2189 /// Required. Display name of the option.
2190 #[serde(rename = "displayName")]
2191 pub display_name: Option<String>,
2192 /// Required. Key of the option.
2193 pub key: Option<String>,
2194 /// Optional. Indicates if the option is preselected.
2195 pub preselected: Option<bool>,
2196}
2197
2198impl common::Part for MultipleSelectOption {}
2199
2200/// Regional Network Config.
2201///
2202/// This type is not used in any activity, and only used as *part* of another schema.
2203///
2204#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2205#[serde_with::serde_as]
2206#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2207pub struct NetworkConfig {
2208 /// Output only. Egress IPs
2209 #[serde(rename = "egressIps")]
2210 pub egress_ips: Option<Vec<String>>,
2211 /// Optional. Egress mode for the network.
2212 #[serde(rename = "egressMode")]
2213 pub egress_mode: Option<String>,
2214}
2215
2216impl common::Part for NetworkConfig {}
2217
2218/// Node configuration for the connection.
2219///
2220/// This type is not used in any activity, and only used as *part* of another schema.
2221///
2222#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2223#[serde_with::serde_as]
2224#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2225pub struct NodeConfig {
2226 /// Maximum number of nodes in the runtime nodes.
2227 #[serde(rename = "maxNodeCount")]
2228 pub max_node_count: Option<i32>,
2229 /// Minimum number of nodes in the runtime nodes.
2230 #[serde(rename = "minNodeCount")]
2231 pub min_node_count: Option<i32>,
2232}
2233
2234impl common::Part for NodeConfig {}
2235
2236/// 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.
2237///
2238/// This type is not used in any activity, and only used as *part* of another schema.
2239///
2240#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2241#[serde_with::serde_as]
2242#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2243pub struct Oauth2AuthCodeFlow {
2244 /// Authorization code to be exchanged for access and refresh tokens.
2245 #[serde(rename = "authCode")]
2246 pub auth_code: Option<String>,
2247 /// Auth URL for Authorization Code Flow
2248 #[serde(rename = "authUri")]
2249 pub auth_uri: Option<String>,
2250 /// Client ID for user-provided OAuth app.
2251 #[serde(rename = "clientId")]
2252 pub client_id: Option<String>,
2253 /// Client secret for user-provided OAuth app.
2254 #[serde(rename = "clientSecret")]
2255 pub client_secret: Option<Secret>,
2256 /// Whether to enable PKCE when the user performs the auth code flow.
2257 #[serde(rename = "enablePkce")]
2258 pub enable_pkce: Option<bool>,
2259 /// PKCE verifier to be used during the auth code exchange.
2260 #[serde(rename = "pkceVerifier")]
2261 pub pkce_verifier: Option<String>,
2262 /// Redirect URI to be provided during the auth code exchange.
2263 #[serde(rename = "redirectUri")]
2264 pub redirect_uri: Option<String>,
2265 /// Scopes the connection will request when the user performs the auth code flow.
2266 pub scopes: Option<Vec<String>>,
2267}
2268
2269impl common::Part for Oauth2AuthCodeFlow {}
2270
2271/// Parameters to support Oauth 2.0 Client Credentials Grant Authentication. See https://tools.ietf.org/html/rfc6749#section-1.3.4 for more details.
2272///
2273/// This type is not used in any activity, and only used as *part* of another schema.
2274///
2275#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2276#[serde_with::serde_as]
2277#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2278pub struct Oauth2ClientCredentials {
2279 /// The client identifier.
2280 #[serde(rename = "clientId")]
2281 pub client_id: Option<String>,
2282 /// Secret version reference containing the client secret.
2283 #[serde(rename = "clientSecret")]
2284 pub client_secret: Option<Secret>,
2285}
2286
2287impl common::Part for Oauth2ClientCredentials {}
2288
2289/// 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.
2290///
2291/// This type is not used in any activity, and only used as *part* of another schema.
2292///
2293#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2294#[serde_with::serde_as]
2295#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2296pub struct Oauth2JwtBearer {
2297 /// 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/*`.
2298 #[serde(rename = "clientKey")]
2299 pub client_key: Option<Secret>,
2300 /// JwtClaims providers fields to generate the token.
2301 #[serde(rename = "jwtClaims")]
2302 pub jwt_claims: Option<JwtClaims>,
2303}
2304
2305impl common::Part for Oauth2JwtBearer {}
2306
2307/// This resource represents a long-running operation that is the result of a network API call.
2308///
2309/// # Activities
2310///
2311/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2312/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2313///
2314/// * [locations connections connection schema metadata get action projects](ProjectLocationConnectionConnectionSchemaMetadataGetActionCall) (response)
2315/// * [locations connections connection schema metadata get entity type projects](ProjectLocationConnectionConnectionSchemaMetadataGetEntityTypeCall) (response)
2316/// * [locations connections connection schema metadata refresh projects](ProjectLocationConnectionConnectionSchemaMetadataRefreshCall) (response)
2317/// * [locations connections event subscriptions create projects](ProjectLocationConnectionEventSubscriptionCreateCall) (response)
2318/// * [locations connections event subscriptions delete projects](ProjectLocationConnectionEventSubscriptionDeleteCall) (response)
2319/// * [locations connections event subscriptions patch projects](ProjectLocationConnectionEventSubscriptionPatchCall) (response)
2320/// * [locations connections event subscriptions retry projects](ProjectLocationConnectionEventSubscriptionRetryCall) (response)
2321/// * [locations connections create projects](ProjectLocationConnectionCreateCall) (response)
2322/// * [locations connections delete projects](ProjectLocationConnectionDeleteCall) (response)
2323/// * [locations connections patch projects](ProjectLocationConnectionPatchCall) (response)
2324/// * [locations connections repair eventing projects](ProjectLocationConnectionRepairEventingCall) (response)
2325/// * [locations custom connectors custom connector versions delete projects](ProjectLocationCustomConnectorCustomConnectorVersionDeleteCall) (response)
2326/// * [locations custom connectors custom connector versions deprecate projects](ProjectLocationCustomConnectorCustomConnectorVersionDeprecateCall) (response)
2327/// * [locations endpoint attachments create projects](ProjectLocationEndpointAttachmentCreateCall) (response)
2328/// * [locations endpoint attachments delete projects](ProjectLocationEndpointAttachmentDeleteCall) (response)
2329/// * [locations endpoint attachments patch projects](ProjectLocationEndpointAttachmentPatchCall) (response)
2330/// * [locations global custom connectors custom connector versions create projects](ProjectLocationGlobalCustomConnectorCustomConnectorVersionCreateCall) (response)
2331/// * [locations global custom connectors create projects](ProjectLocationGlobalCustomConnectorCreateCall) (response)
2332/// * [locations global custom connectors delete projects](ProjectLocationGlobalCustomConnectorDeleteCall) (response)
2333/// * [locations global custom connectors patch projects](ProjectLocationGlobalCustomConnectorPatchCall) (response)
2334/// * [locations global managed zones create projects](ProjectLocationGlobalManagedZoneCreateCall) (response)
2335/// * [locations global managed zones delete projects](ProjectLocationGlobalManagedZoneDeleteCall) (response)
2336/// * [locations global managed zones patch projects](ProjectLocationGlobalManagedZonePatchCall) (response)
2337/// * [locations global update settings projects](ProjectLocationGlobalUpdateSettingCall) (response)
2338/// * [locations operations get projects](ProjectLocationOperationGetCall) (response)
2339/// * [locations update regional settings projects](ProjectLocationUpdateRegionalSettingCall) (response)
2340#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2341#[serde_with::serde_as]
2342#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2343pub struct Operation {
2344 /// 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.
2345 pub done: Option<bool>,
2346 /// The error result of the operation in case of failure or cancellation.
2347 pub error: Option<Status>,
2348 /// 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.
2349 pub metadata: Option<HashMap<String, serde_json::Value>>,
2350 /// 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}`.
2351 pub name: Option<String>,
2352 /// 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`.
2353 pub response: Option<HashMap<String, serde_json::Value>>,
2354}
2355
2356impl common::ResponseResult for Operation {}
2357
2358/// 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/).
2359///
2360/// # Activities
2361///
2362/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2363/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2364///
2365/// * [locations connections get iam policy projects](ProjectLocationConnectionGetIamPolicyCall) (response)
2366/// * [locations connections set iam policy projects](ProjectLocationConnectionSetIamPolicyCall) (response)
2367/// * [locations providers get iam policy projects](ProjectLocationProviderGetIamPolicyCall) (response)
2368/// * [locations providers set iam policy projects](ProjectLocationProviderSetIamPolicyCall) (response)
2369#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2370#[serde_with::serde_as]
2371#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2372pub struct Policy {
2373 /// Specifies cloud audit logging configuration for this policy.
2374 #[serde(rename = "auditConfigs")]
2375 pub audit_configs: Option<Vec<AuditConfig>>,
2376 /// 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`.
2377 pub bindings: Option<Vec<Binding>>,
2378 /// `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.
2379 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
2380 pub etag: Option<Vec<u8>>,
2381 /// 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).
2382 pub version: Option<i32>,
2383}
2384
2385impl common::ResponseResult for Policy {}
2386
2387/// Provider indicates the owner who provides the connectors.
2388///
2389/// # Activities
2390///
2391/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2392/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2393///
2394/// * [locations providers get projects](ProjectLocationProviderGetCall) (response)
2395#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2396#[serde_with::serde_as]
2397#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2398pub struct Provider {
2399 /// Output only. Created time.
2400 #[serde(rename = "createTime")]
2401 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2402 /// Output only. Description of the resource.
2403 pub description: Option<String>,
2404 /// Output only. Display name.
2405 #[serde(rename = "displayName")]
2406 pub display_name: Option<String>,
2407 /// Output only. Link to documentation page.
2408 #[serde(rename = "documentationUri")]
2409 pub documentation_uri: Option<String>,
2410 /// Output only. Link to external page.
2411 #[serde(rename = "externalUri")]
2412 pub external_uri: Option<String>,
2413 /// 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
2414 pub labels: Option<HashMap<String, String>>,
2415 /// Output only. Flag to mark the version indicating the launch stage.
2416 #[serde(rename = "launchStage")]
2417 pub launch_stage: Option<String>,
2418 /// Output only. Resource name of the Provider. Format: projects/{project}/locations/{location}/providers/{provider} Only global location is supported for Provider resource.
2419 pub name: Option<String>,
2420 /// Output only. Updated time.
2421 #[serde(rename = "updateTime")]
2422 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2423 /// Output only. Cloud storage location of icons etc consumed by UI.
2424 #[serde(rename = "webAssetsLocation")]
2425 pub web_assets_location: Option<String>,
2426}
2427
2428impl common::ResponseResult for Provider {}
2429
2430/// Request message for ConnectorsService.RefreshConnectionSchemaMetadata.
2431///
2432/// # Activities
2433///
2434/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2435/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2436///
2437/// * [locations connections connection schema metadata refresh projects](ProjectLocationConnectionConnectionSchemaMetadataRefreshCall) (request)
2438#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2439#[serde_with::serde_as]
2440#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2441pub struct RefreshConnectionSchemaMetadataRequest {
2442 _never_set: Option<bool>,
2443}
2444
2445impl common::RequestValue for RefreshConnectionSchemaMetadataRequest {}
2446
2447/// Regional Settings details.
2448///
2449/// # Activities
2450///
2451/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2452/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2453///
2454/// * [locations get regional settings projects](ProjectLocationGetRegionalSettingCall) (response)
2455/// * [locations update regional settings projects](ProjectLocationUpdateRegionalSettingCall) (request)
2456#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2457#[serde_with::serde_as]
2458#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2459pub struct RegionalSettings {
2460 /// Optional. Regional encryption config to hold CMEK details.
2461 #[serde(rename = "encryptionConfig")]
2462 pub encryption_config: Option<EncryptionConfig>,
2463 /// Output only. Resource name of the Connection. Format: projects/{project}/locations/{location}/regionalSettings
2464 pub name: Option<String>,
2465 /// Optional. Regional network config.
2466 #[serde(rename = "networkConfig")]
2467 pub network_config: Option<NetworkConfig>,
2468 /// Output only. Specifies whether the region is provisioned.
2469 pub provisioned: Option<bool>,
2470}
2471
2472impl common::RequestValue for RegionalSettings {}
2473impl common::ResponseResult for RegionalSettings {}
2474
2475/// Request message for ConnectorsService.RepairEventing
2476///
2477/// # Activities
2478///
2479/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2480/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2481///
2482/// * [locations connections repair eventing projects](ProjectLocationConnectionRepairEventingCall) (request)
2483#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2484#[serde_with::serde_as]
2485#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2486pub struct RepairEventingRequest {
2487 _never_set: Option<bool>,
2488}
2489
2490impl common::RequestValue for RepairEventingRequest {}
2491
2492/// Resource definition
2493///
2494/// This type is not used in any activity, and only used as *part* of another schema.
2495///
2496#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2497#[serde_with::serde_as]
2498#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2499pub struct Resource {
2500 /// 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.
2501 #[serde(rename = "pathTemplate")]
2502 pub path_template: Option<String>,
2503 /// Different types of resource supported.
2504 #[serde(rename = "type")]
2505 pub type_: Option<String>,
2506}
2507
2508impl common::Part for Resource {}
2509
2510/// Resource limits defined for connection pods of a given connector type.
2511///
2512/// This type is not used in any activity, and only used as *part* of another schema.
2513///
2514#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2515#[serde_with::serde_as]
2516#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2517pub struct ResourceLimits {
2518 /// Output only. CPU limit.
2519 pub cpu: Option<String>,
2520 /// Output only. Memory limit.
2521 pub memory: Option<String>,
2522}
2523
2524impl common::Part for ResourceLimits {}
2525
2526/// Resource requests defined for connection pods of a given connector type.
2527///
2528/// This type is not used in any activity, and only used as *part* of another schema.
2529///
2530#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2531#[serde_with::serde_as]
2532#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2533pub struct ResourceRequests {
2534 /// Output only. CPU request.
2535 pub cpu: Option<String>,
2536 /// Output only. Memory request.
2537 pub memory: Option<String>,
2538}
2539
2540impl common::Part for ResourceRequests {}
2541
2542/// Metadata of result field.
2543///
2544/// This type is not used in any activity, and only used as *part* of another schema.
2545///
2546#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2547#[serde_with::serde_as]
2548#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2549pub struct ResultMetadata {
2550 /// The data type of the field.
2551 #[serde(rename = "dataType")]
2552 pub data_type: Option<String>,
2553 /// A brief description of the field.
2554 pub description: Option<String>,
2555 /// Name of the result field.
2556 pub field: Option<String>,
2557 /// JsonSchema representation of this action's result
2558 #[serde(rename = "jsonSchema")]
2559 pub json_schema: Option<JsonSchema>,
2560}
2561
2562impl common::Part for ResultMetadata {}
2563
2564/// Request message for ConnectorsService.RefreshEventSubscription
2565///
2566/// # Activities
2567///
2568/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2569/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2570///
2571/// * [locations connections event subscriptions retry projects](ProjectLocationConnectionEventSubscriptionRetryCall) (request)
2572#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2573#[serde_with::serde_as]
2574#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2575pub struct RetryEventSubscriptionRequest {
2576 _never_set: Option<bool>,
2577}
2578
2579impl common::RequestValue for RetryEventSubscriptionRequest {}
2580
2581/// 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.
2582///
2583/// This type is not used in any activity, and only used as *part* of another schema.
2584///
2585#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2586#[serde_with::serde_as]
2587#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2588pub struct RoleGrant {
2589 /// Template that UI can use to provide helper text to customers.
2590 #[serde(rename = "helperTextTemplate")]
2591 pub helper_text_template: Option<String>,
2592 /// Prinicipal/Identity for whom the role need to assigned.
2593 pub principal: Option<String>,
2594 /// Resource on which the roles needs to be granted for the principal.
2595 pub resource: Option<Resource>,
2596 /// List of roles that need to be granted.
2597 pub roles: Option<Vec<String>>,
2598}
2599
2600impl common::Part for RoleGrant {}
2601
2602/// Schema of a runtime action.
2603///
2604/// This type is not used in any activity, and only used as *part* of another schema.
2605///
2606#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2607#[serde_with::serde_as]
2608#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2609pub struct RuntimeActionSchema {
2610 /// Output only. Name of the action.
2611 pub action: Option<String>,
2612 /// Output only. Brief Description of action
2613 pub description: Option<String>,
2614 /// Output only. Display Name of action to be shown on client side
2615 #[serde(rename = "displayName")]
2616 pub display_name: Option<String>,
2617 /// Output only. JsonSchema representation of this action's input metadata
2618 #[serde(rename = "inputJsonSchema")]
2619 pub input_json_schema: Option<JsonSchema>,
2620 /// Output only. List of input parameter metadata for the action.
2621 #[serde(rename = "inputParameters")]
2622 pub input_parameters: Option<Vec<InputParameter>>,
2623 /// Output only. JsonSchema representation of this action's result metadata
2624 #[serde(rename = "resultJsonSchema")]
2625 pub result_json_schema: Option<JsonSchema>,
2626 /// Output only. List of result field metadata.
2627 #[serde(rename = "resultMetadata")]
2628 pub result_metadata: Option<Vec<ResultMetadata>>,
2629}
2630
2631impl common::Part for RuntimeActionSchema {}
2632
2633/// 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.
2634///
2635/// # Activities
2636///
2637/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2638/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2639///
2640/// * [locations get runtime config projects](ProjectLocationGetRuntimeConfigCall) (response)
2641#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2642#[serde_with::serde_as]
2643#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2644pub struct RuntimeConfig {
2645 /// Output only. Pub/Sub subscription for connd to receive message. E.g. projects/{project-id}/subscriptions/{topic-id}
2646 #[serde(rename = "conndSubscription")]
2647 pub connd_subscription: Option<String>,
2648 /// Output only. Pub/Sub topic for connd to send message. E.g. projects/{project-id}/topics/{topic-id}
2649 #[serde(rename = "conndTopic")]
2650 pub connd_topic: Option<String>,
2651 /// Output only. Pub/Sub subscription for control plane to receive message. E.g. projects/{project-id}/subscriptions/{topic-id}
2652 #[serde(rename = "controlPlaneSubscription")]
2653 pub control_plane_subscription: Option<String>,
2654 /// Output only. Pub/Sub topic for control plne to send message. communication. E.g. projects/{project-id}/topics/{topic-id}
2655 #[serde(rename = "controlPlaneTopic")]
2656 pub control_plane_topic: Option<String>,
2657 /// Output only. location_id of the runtime location. E.g. "us-west1".
2658 #[serde(rename = "locationId")]
2659 pub location_id: Option<String>,
2660 /// Output only. Name of the runtimeConfig resource. Format: projects/{project}/locations/{location}/runtimeConfig
2661 pub name: Option<String>,
2662 /// Output only. The endpoint of the connectors runtime ingress.
2663 #[serde(rename = "runtimeEndpoint")]
2664 pub runtime_endpoint: Option<String>,
2665 /// Output only. The Cloud Storage bucket that stores connector's schema reports.
2666 #[serde(rename = "schemaGcsBucket")]
2667 pub schema_gcs_bucket: Option<String>,
2668 /// Output only. The name of the Service Directory service name.
2669 #[serde(rename = "serviceDirectory")]
2670 pub service_directory: Option<String>,
2671 /// Output only. The state of the location.
2672 pub state: Option<String>,
2673}
2674
2675impl common::ResponseResult for RuntimeConfig {}
2676
2677/// Schema of a runtime entity.
2678///
2679/// This type is not used in any activity, and only used as *part* of another schema.
2680///
2681#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2682#[serde_with::serde_as]
2683#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2684pub struct RuntimeEntitySchema {
2685 /// Output only. Name of the entity.
2686 pub entity: Option<String>,
2687 /// Output only. List of fields in the entity.
2688 pub fields: Option<Vec<Field>>,
2689 /// Output only. JsonSchema representation of this entity's metadata
2690 #[serde(rename = "jsonSchema")]
2691 pub json_schema: Option<JsonSchema>,
2692 /// List of operations supported by this entity
2693 pub operations: Option<Vec<String>>,
2694}
2695
2696impl common::Part for RuntimeEntitySchema {}
2697
2698/// Config for connection schema refresh
2699///
2700/// This type is not used in any activity, and only used as *part* of another schema.
2701///
2702#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2703#[serde_with::serde_as]
2704#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2705pub struct SchemaRefreshConfig {
2706 /// Whether to use displayName for actions in UI.
2707 #[serde(rename = "useActionDisplayNames")]
2708 pub use_action_display_names: Option<bool>,
2709 /// Whether to use synchronous schema refresh.
2710 #[serde(rename = "useSynchronousSchemaRefresh")]
2711 pub use_synchronous_schema_refresh: Option<bool>,
2712}
2713
2714impl common::Part for SchemaRefreshConfig {}
2715
2716/// SearchConnectionInstance represents an instance of connector with specific fields
2717///
2718/// This type is not used in any activity, and only used as *part* of another schema.
2719///
2720#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2721#[serde_with::serde_as]
2722#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2723pub struct SearchConnectionInstance {
2724 /// Output only. Schema of a runtime action.
2725 #[serde(rename = "actionSchema")]
2726 pub action_schema: Option<RuntimeActionSchema>,
2727 /// Output only. Connection details
2728 pub connection: Option<Connection>,
2729 /// Output only. Schema of a runtime entity.
2730 #[serde(rename = "entitySchema")]
2731 pub entity_schema: Option<RuntimeEntitySchema>,
2732}
2733
2734impl common::Part for SearchConnectionInstance {}
2735
2736/// Response message for Connectors.SearchConnections.
2737///
2738/// # Activities
2739///
2740/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2741/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2742///
2743/// * [locations connections search projects](ProjectLocationConnectionSearchCall) (response)
2744#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2745#[serde_with::serde_as]
2746#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2747pub struct SearchConnectionsResponse {
2748 /// A list of connectors.
2749 pub connections: Option<Vec<SearchConnectionInstance>>,
2750 /// Optional. page_token
2751 #[serde(rename = "nextPageToken")]
2752 pub next_page_token: Option<String>,
2753 /// Locations that could not be reached.
2754 pub unreachable: Option<Vec<String>>,
2755}
2756
2757impl common::ResponseResult for SearchConnectionsResponse {}
2758
2759/// Secret provides a reference to entries in Secret Manager.
2760///
2761/// This type is not used in any activity, and only used as *part* of another schema.
2762///
2763#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2764#[serde_with::serde_as]
2765#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2766pub struct Secret {
2767 /// The resource name of the secret version in the format, format as: `projects/*/secrets/*/versions/*`.
2768 #[serde(rename = "secretVersion")]
2769 pub secret_version: Option<String>,
2770}
2771
2772impl common::Part for Secret {}
2773
2774/// Request message for `SetIamPolicy` method.
2775///
2776/// # Activities
2777///
2778/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2779/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2780///
2781/// * [locations connections set iam policy projects](ProjectLocationConnectionSetIamPolicyCall) (request)
2782/// * [locations providers set iam policy projects](ProjectLocationProviderSetIamPolicyCall) (request)
2783#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2784#[serde_with::serde_as]
2785#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2786pub struct SetIamPolicyRequest {
2787 /// 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.
2788 pub policy: Option<Policy>,
2789 /// 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"`
2790 #[serde(rename = "updateMask")]
2791 pub update_mask: Option<common::FieldMask>,
2792}
2793
2794impl common::RequestValue for SetIamPolicyRequest {}
2795
2796/// Global Settings details.
2797///
2798/// # Activities
2799///
2800/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2801/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2802///
2803/// * [locations global get settings projects](ProjectLocationGlobalGetSettingCall) (response)
2804/// * [locations global update settings projects](ProjectLocationGlobalUpdateSettingCall) (request)
2805#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2806#[serde_with::serde_as]
2807#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2808pub struct Settings {
2809 /// Output only. Resource name of the Connection. Format: projects/{project}/locations/global/settings}
2810 pub name: Option<String>,
2811 /// Output only. Flag indicates if user is in PayG model
2812 pub payg: Option<bool>,
2813 /// Output only. Tenant project id of the consumer project.
2814 #[serde(rename = "tenantProjectId")]
2815 pub tenant_project_id: Option<String>,
2816 /// Optional. Flag indicates whether vpc-sc is enabled.
2817 pub vpcsc: Option<bool>,
2818}
2819
2820impl common::RequestValue for Settings {}
2821impl common::ResponseResult for Settings {}
2822
2823/// Source to extract the backend from.
2824///
2825/// This type is not used in any activity, and only used as *part* of another schema.
2826///
2827#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2828#[serde_with::serde_as]
2829#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2830pub struct Source {
2831 /// Field identifier. For example config vaiable name.
2832 #[serde(rename = "fieldId")]
2833 pub field_id: Option<String>,
2834 /// Type of the source.
2835 #[serde(rename = "sourceType")]
2836 pub source_type: Option<String>,
2837}
2838
2839impl common::Part for Source {}
2840
2841/// Parameters to support Ssh public key Authentication.
2842///
2843/// This type is not used in any activity, and only used as *part* of another schema.
2844///
2845#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2846#[serde_with::serde_as]
2847#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2848pub struct SshPublicKey {
2849 /// Format of SSH Client cert.
2850 #[serde(rename = "certType")]
2851 pub cert_type: Option<String>,
2852 /// SSH Client Cert. It should contain both public and private key.
2853 #[serde(rename = "sshClientCert")]
2854 pub ssh_client_cert: Option<Secret>,
2855 /// Password (passphrase) for ssh client certificate if it has one.
2856 #[serde(rename = "sshClientCertPass")]
2857 pub ssh_client_cert_pass: Option<Secret>,
2858 /// The user account used to authenticate.
2859 pub username: Option<String>,
2860}
2861
2862impl common::Part for SshPublicKey {}
2863
2864/// SSL Configuration of a connection
2865///
2866/// This type is not used in any activity, and only used as *part* of another schema.
2867///
2868#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2869#[serde_with::serde_as]
2870#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2871pub struct SslConfig {
2872 /// Additional SSL related field values
2873 #[serde(rename = "additionalVariables")]
2874 pub additional_variables: Option<Vec<ConfigVariable>>,
2875 /// Type of Client Cert (PEM/JKS/.. etc.)
2876 #[serde(rename = "clientCertType")]
2877 pub client_cert_type: Option<String>,
2878 /// Client Certificate
2879 #[serde(rename = "clientCertificate")]
2880 pub client_certificate: Option<Secret>,
2881 /// Client Private Key
2882 #[serde(rename = "clientPrivateKey")]
2883 pub client_private_key: Option<Secret>,
2884 /// Secret containing the passphrase protecting the Client Private Key
2885 #[serde(rename = "clientPrivateKeyPass")]
2886 pub client_private_key_pass: Option<Secret>,
2887 /// Private Server Certificate. Needs to be specified if trust model is `PRIVATE`.
2888 #[serde(rename = "privateServerCertificate")]
2889 pub private_server_certificate: Option<Secret>,
2890 /// Type of Server Cert (PEM/JKS/.. etc.)
2891 #[serde(rename = "serverCertType")]
2892 pub server_cert_type: Option<String>,
2893 /// Trust Model of the SSL connection
2894 #[serde(rename = "trustModel")]
2895 pub trust_model: Option<String>,
2896 /// Controls the ssl type for the given connector version.
2897 #[serde(rename = "type")]
2898 pub type_: Option<String>,
2899 /// Bool for enabling SSL
2900 #[serde(rename = "useSsl")]
2901 pub use_ssl: Option<bool>,
2902}
2903
2904impl common::Part for SslConfig {}
2905
2906/// Ssl config details of a connector version
2907///
2908/// This type is not used in any activity, and only used as *part* of another schema.
2909///
2910#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2911#[serde_with::serde_as]
2912#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2913pub struct SslConfigTemplate {
2914 /// Any additional fields that need to be rendered
2915 #[serde(rename = "additionalVariables")]
2916 pub additional_variables: Option<Vec<ConfigVariableTemplate>>,
2917 /// List of supported Client Cert Types
2918 #[serde(rename = "clientCertType")]
2919 pub client_cert_type: Option<Vec<String>>,
2920 /// Boolean for determining if the connector version mandates TLS.
2921 #[serde(rename = "isTlsMandatory")]
2922 pub is_tls_mandatory: Option<bool>,
2923 /// List of supported Server Cert Types
2924 #[serde(rename = "serverCertType")]
2925 pub server_cert_type: Option<Vec<String>>,
2926 /// Controls the ssl type for the given connector version
2927 #[serde(rename = "sslType")]
2928 pub ssl_type: Option<String>,
2929}
2930
2931impl common::Part for SslConfigTemplate {}
2932
2933/// 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).
2934///
2935/// This type is not used in any activity, and only used as *part* of another schema.
2936///
2937#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2938#[serde_with::serde_as]
2939#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2940pub struct Status {
2941 /// The status code, which should be an enum value of google.rpc.Code.
2942 pub code: Option<i32>,
2943 /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
2944 pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
2945 /// 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.
2946 pub message: Option<String>,
2947}
2948
2949impl common::Part for Status {}
2950
2951/// Supported runtime features of a connector version.
2952///
2953/// This type is not used in any activity, and only used as *part* of another schema.
2954///
2955#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2956#[serde_with::serde_as]
2957#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2958pub struct SupportedRuntimeFeatures {
2959 /// Specifies if the connector supports action apis like 'executeAction'.
2960 #[serde(rename = "actionApis")]
2961 pub action_apis: Option<bool>,
2962 /// Specifies if the connector supports entity apis like 'createEntity'.
2963 #[serde(rename = "entityApis")]
2964 pub entity_apis: Option<bool>,
2965 /// Specifies if the connector supports 'ExecuteSqlQuery' operation.
2966 #[serde(rename = "sqlQuery")]
2967 pub sql_query: Option<bool>,
2968}
2969
2970impl common::Part for SupportedRuntimeFeatures {}
2971
2972/// Request message for `TestIamPermissions` method.
2973///
2974/// # Activities
2975///
2976/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2977/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2978///
2979/// * [locations connections test iam permissions projects](ProjectLocationConnectionTestIamPermissionCall) (request)
2980/// * [locations providers test iam permissions projects](ProjectLocationProviderTestIamPermissionCall) (request)
2981#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2982#[serde_with::serde_as]
2983#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2984pub struct TestIamPermissionsRequest {
2985 /// 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).
2986 pub permissions: Option<Vec<String>>,
2987}
2988
2989impl common::RequestValue for TestIamPermissionsRequest {}
2990
2991/// Response message for `TestIamPermissions` method.
2992///
2993/// # Activities
2994///
2995/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2996/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2997///
2998/// * [locations connections test iam permissions projects](ProjectLocationConnectionTestIamPermissionCall) (response)
2999/// * [locations providers test iam permissions projects](ProjectLocationProviderTestIamPermissionCall) (response)
3000#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3001#[serde_with::serde_as]
3002#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3003pub struct TestIamPermissionsResponse {
3004 /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed.
3005 pub permissions: Option<Vec<String>>,
3006}
3007
3008impl common::ResponseResult for TestIamPermissionsResponse {}
3009
3010/// Parameters to support Username and Password Authentication.
3011///
3012/// This type is not used in any activity, and only used as *part* of another schema.
3013///
3014#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3015#[serde_with::serde_as]
3016#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3017pub struct UserPassword {
3018 /// Secret version reference containing the password.
3019 pub password: Option<Secret>,
3020 /// Username.
3021 pub username: Option<String>,
3022}
3023
3024impl common::Part for UserPassword {}
3025
3026/// Request message for ConnectorsService.ValidateCustomConnectorSpec
3027///
3028/// # Activities
3029///
3030/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3031/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3032///
3033/// * [locations custom connectors validate custom connector spec projects](ProjectLocationCustomConnectorValidateCustomConnectorSpecCall) (request)
3034#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3035#[serde_with::serde_as]
3036#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3037pub struct ValidateCustomConnectorSpecRequest {
3038 /// Required. Service account to access the spec from Google Cloud Storage.
3039 #[serde(rename = "serviceAccount")]
3040 pub service_account: Option<String>,
3041 /// 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:///`
3042 #[serde(rename = "specLocation")]
3043 pub spec_location: Option<String>,
3044 /// Required. Spec type of the custom connector spec.
3045 #[serde(rename = "specType")]
3046 pub spec_type: Option<String>,
3047}
3048
3049impl common::RequestValue for ValidateCustomConnectorSpecRequest {}
3050
3051/// Response message for ConnectorsService.ValidateCustomConnectorSpec
3052///
3053/// # Activities
3054///
3055/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3056/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3057///
3058/// * [locations custom connectors validate custom connector spec projects](ProjectLocationCustomConnectorValidateCustomConnectorSpecCall) (response)
3059#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3060#[serde_with::serde_as]
3061#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3062pub struct ValidateCustomConnectorSpecResponse {
3063 /// Error message. The spec is valid if the error message is empty.
3064 #[serde(rename = "errorMessage")]
3065 pub error_message: Option<String>,
3066}
3067
3068impl common::ResponseResult for ValidateCustomConnectorSpecResponse {}
3069
3070/// WebhookData has details of webhook configuration.
3071///
3072/// This type is not used in any activity, and only used as *part* of another schema.
3073///
3074#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3075#[serde_with::serde_as]
3076#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3077pub struct WebhookData {
3078 /// Output only. Additional webhook related field values.
3079 #[serde(rename = "additionalVariables")]
3080 pub additional_variables: Option<Vec<ConfigVariable>>,
3081 /// Output only. Timestamp when the webhook was created.
3082 #[serde(rename = "createTime")]
3083 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
3084 /// Output only. ID to uniquely identify webhook.
3085 pub id: Option<String>,
3086 /// Output only. Name of the Webhook
3087 pub name: Option<String>,
3088 /// Output only. Next webhook refresh time. Will be null if refresh is not supported.
3089 #[serde(rename = "nextRefreshTime")]
3090 pub next_refresh_time: Option<chrono::DateTime<chrono::offset::Utc>>,
3091 /// Output only. Timestamp when the webhook was last updated.
3092 #[serde(rename = "updateTime")]
3093 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
3094}
3095
3096impl common::Part for WebhookData {}
3097
3098// ###################
3099// MethodBuilders ###
3100// #################
3101
3102/// A builder providing access to all methods supported on *project* resources.
3103/// It is not used directly, but through the [`Connectors`] hub.
3104///
3105/// # Example
3106///
3107/// Instantiate a resource builder
3108///
3109/// ```test_harness,no_run
3110/// extern crate hyper;
3111/// extern crate hyper_rustls;
3112/// extern crate google_connectors1 as connectors1;
3113///
3114/// # async fn dox() {
3115/// use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3116///
3117/// let secret: yup_oauth2::ApplicationSecret = Default::default();
3118/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3119/// secret,
3120/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3121/// ).build().await.unwrap();
3122///
3123/// let client = hyper_util::client::legacy::Client::builder(
3124/// hyper_util::rt::TokioExecutor::new()
3125/// )
3126/// .build(
3127/// hyper_rustls::HttpsConnectorBuilder::new()
3128/// .with_native_roots()
3129/// .unwrap()
3130/// .https_or_http()
3131/// .enable_http1()
3132/// .build()
3133/// );
3134/// let mut hub = Connectors::new(client, auth);
3135/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
3136/// // 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_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_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_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(...)`
3137/// // to build up your call.
3138/// let rb = hub.projects();
3139/// # }
3140/// ```
3141pub struct ProjectMethods<'a, C>
3142where
3143 C: 'a,
3144{
3145 hub: &'a Connectors<C>,
3146}
3147
3148impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
3149
3150impl<'a, C> ProjectMethods<'a, C> {
3151 /// Create a builder to help you perform the following task:
3152 ///
3153 /// Get action.
3154 ///
3155 /// # Arguments
3156 ///
3157 /// * `name` - Required. Resource name format: projects/{project}/locations/{location}/connections/{connection}/connectionSchemaMetadata
3158 pub fn locations_connections_connection_schema_metadata_get_action(
3159 &self,
3160 name: &str,
3161 ) -> ProjectLocationConnectionConnectionSchemaMetadataGetActionCall<'a, C> {
3162 ProjectLocationConnectionConnectionSchemaMetadataGetActionCall {
3163 hub: self.hub,
3164 _name: name.to_string(),
3165 _action_id: Default::default(),
3166 _delegate: Default::default(),
3167 _additional_params: Default::default(),
3168 _scopes: Default::default(),
3169 }
3170 }
3171
3172 /// Create a builder to help you perform the following task:
3173 ///
3174 /// Get entity type.
3175 ///
3176 /// # Arguments
3177 ///
3178 /// * `name` - Required. Resource name format: projects/{project}/locations/{location}/connections/{connection}/connectionSchemaMetadata
3179 pub fn locations_connections_connection_schema_metadata_get_entity_type(
3180 &self,
3181 name: &str,
3182 ) -> ProjectLocationConnectionConnectionSchemaMetadataGetEntityTypeCall<'a, C> {
3183 ProjectLocationConnectionConnectionSchemaMetadataGetEntityTypeCall {
3184 hub: self.hub,
3185 _name: name.to_string(),
3186 _entity_id: Default::default(),
3187 _delegate: Default::default(),
3188 _additional_params: Default::default(),
3189 _scopes: Default::default(),
3190 }
3191 }
3192
3193 /// Create a builder to help you perform the following task:
3194 ///
3195 /// List actions.
3196 ///
3197 /// # Arguments
3198 ///
3199 /// * `name` - Required. Resource name format. projects/{project}/locations/{location}/connections/{connection}/connectionSchemaMetadata
3200 pub fn locations_connections_connection_schema_metadata_list_actions(
3201 &self,
3202 name: &str,
3203 ) -> ProjectLocationConnectionConnectionSchemaMetadataListActionCall<'a, C> {
3204 ProjectLocationConnectionConnectionSchemaMetadataListActionCall {
3205 hub: self.hub,
3206 _name: name.to_string(),
3207 _view: Default::default(),
3208 _page_token: Default::default(),
3209 _page_size: Default::default(),
3210 _filter: Default::default(),
3211 _delegate: Default::default(),
3212 _additional_params: Default::default(),
3213 _scopes: Default::default(),
3214 }
3215 }
3216
3217 /// Create a builder to help you perform the following task:
3218 ///
3219 /// List entity types.
3220 ///
3221 /// # Arguments
3222 ///
3223 /// * `name` - Required. Resource name format: projects/{project}/locations/{location}/connections/{connection}/connectionSchemaMetadata
3224 pub fn locations_connections_connection_schema_metadata_list_entity_types(
3225 &self,
3226 name: &str,
3227 ) -> ProjectLocationConnectionConnectionSchemaMetadataListEntityTypeCall<'a, C> {
3228 ProjectLocationConnectionConnectionSchemaMetadataListEntityTypeCall {
3229 hub: self.hub,
3230 _name: name.to_string(),
3231 _view: Default::default(),
3232 _page_token: Default::default(),
3233 _page_size: Default::default(),
3234 _filter: Default::default(),
3235 _delegate: Default::default(),
3236 _additional_params: Default::default(),
3237 _scopes: Default::default(),
3238 }
3239 }
3240
3241 /// Create a builder to help you perform the following task:
3242 ///
3243 /// Refresh runtime schema of a connection.
3244 ///
3245 /// # Arguments
3246 ///
3247 /// * `request` - No description provided.
3248 /// * `name` - Required. Resource name. Format: projects/{project}/locations/{location}/connections/{connection}/connectionSchemaMetadata
3249 pub fn locations_connections_connection_schema_metadata_refresh(
3250 &self,
3251 request: RefreshConnectionSchemaMetadataRequest,
3252 name: &str,
3253 ) -> ProjectLocationConnectionConnectionSchemaMetadataRefreshCall<'a, C> {
3254 ProjectLocationConnectionConnectionSchemaMetadataRefreshCall {
3255 hub: self.hub,
3256 _request: request,
3257 _name: name.to_string(),
3258 _delegate: Default::default(),
3259 _additional_params: Default::default(),
3260 _scopes: Default::default(),
3261 }
3262 }
3263
3264 /// Create a builder to help you perform the following task:
3265 ///
3266 /// Creates a new EventSubscription in a given project,location and connection.
3267 ///
3268 /// # Arguments
3269 ///
3270 /// * `request` - No description provided.
3271 /// * `parent` - Required. Parent resource of the EventSubscription, of the form: `projects/*/locations/*/connections/*`
3272 pub fn locations_connections_event_subscriptions_create(
3273 &self,
3274 request: EventSubscription,
3275 parent: &str,
3276 ) -> ProjectLocationConnectionEventSubscriptionCreateCall<'a, C> {
3277 ProjectLocationConnectionEventSubscriptionCreateCall {
3278 hub: self.hub,
3279 _request: request,
3280 _parent: parent.to_string(),
3281 _event_subscription_id: Default::default(),
3282 _delegate: Default::default(),
3283 _additional_params: Default::default(),
3284 _scopes: Default::default(),
3285 }
3286 }
3287
3288 /// Create a builder to help you perform the following task:
3289 ///
3290 /// Deletes a single EventSubscription.
3291 ///
3292 /// # Arguments
3293 ///
3294 /// * `name` - Required. Resource name of the form: `projects/*/locations/*/connections/*/eventsubscriptions/*`
3295 pub fn locations_connections_event_subscriptions_delete(
3296 &self,
3297 name: &str,
3298 ) -> ProjectLocationConnectionEventSubscriptionDeleteCall<'a, C> {
3299 ProjectLocationConnectionEventSubscriptionDeleteCall {
3300 hub: self.hub,
3301 _name: name.to_string(),
3302 _delegate: Default::default(),
3303 _additional_params: Default::default(),
3304 _scopes: Default::default(),
3305 }
3306 }
3307
3308 /// Create a builder to help you perform the following task:
3309 ///
3310 /// Gets details of a single EventSubscription.
3311 ///
3312 /// # Arguments
3313 ///
3314 /// * `name` - Required. Resource name of the form: `projects/*/locations/*/connections/*/eventSubscriptions/*`
3315 pub fn locations_connections_event_subscriptions_get(
3316 &self,
3317 name: &str,
3318 ) -> ProjectLocationConnectionEventSubscriptionGetCall<'a, C> {
3319 ProjectLocationConnectionEventSubscriptionGetCall {
3320 hub: self.hub,
3321 _name: name.to_string(),
3322 _delegate: Default::default(),
3323 _additional_params: Default::default(),
3324 _scopes: Default::default(),
3325 }
3326 }
3327
3328 /// Create a builder to help you perform the following task:
3329 ///
3330 /// List EventSubscriptions in a given project,location and connection.
3331 ///
3332 /// # Arguments
3333 ///
3334 /// * `parent` - Required. Parent resource of the EventSubscription, of the form: `projects/*/locations/*/connections/*`
3335 pub fn locations_connections_event_subscriptions_list(
3336 &self,
3337 parent: &str,
3338 ) -> ProjectLocationConnectionEventSubscriptionListCall<'a, C> {
3339 ProjectLocationConnectionEventSubscriptionListCall {
3340 hub: self.hub,
3341 _parent: parent.to_string(),
3342 _page_token: Default::default(),
3343 _page_size: Default::default(),
3344 _order_by: Default::default(),
3345 _filter: Default::default(),
3346 _delegate: Default::default(),
3347 _additional_params: Default::default(),
3348 _scopes: Default::default(),
3349 }
3350 }
3351
3352 /// Create a builder to help you perform the following task:
3353 ///
3354 /// Updates the parameters of a single EventSubscription.
3355 ///
3356 /// # Arguments
3357 ///
3358 /// * `request` - No description provided.
3359 /// * `name` - Required. Resource name of the EventSubscription. Format: projects/{project}/locations/{location}/connections/{connection}/eventSubscriptions/{event_subscription}
3360 pub fn locations_connections_event_subscriptions_patch(
3361 &self,
3362 request: EventSubscription,
3363 name: &str,
3364 ) -> ProjectLocationConnectionEventSubscriptionPatchCall<'a, C> {
3365 ProjectLocationConnectionEventSubscriptionPatchCall {
3366 hub: self.hub,
3367 _request: request,
3368 _name: name.to_string(),
3369 _update_mask: Default::default(),
3370 _delegate: Default::default(),
3371 _additional_params: Default::default(),
3372 _scopes: Default::default(),
3373 }
3374 }
3375
3376 /// Create a builder to help you perform the following task:
3377 ///
3378 /// RetryEventSubscription retries the registration of Subscription.
3379 ///
3380 /// # Arguments
3381 ///
3382 /// * `request` - No description provided.
3383 /// * `name` - Required. Resource name of the form: `projects/*/locations/*/connections/*/eventSubscriptions/*`
3384 pub fn locations_connections_event_subscriptions_retry(
3385 &self,
3386 request: RetryEventSubscriptionRequest,
3387 name: &str,
3388 ) -> ProjectLocationConnectionEventSubscriptionRetryCall<'a, C> {
3389 ProjectLocationConnectionEventSubscriptionRetryCall {
3390 hub: self.hub,
3391 _request: request,
3392 _name: name.to_string(),
3393 _delegate: Default::default(),
3394 _additional_params: Default::default(),
3395 _scopes: Default::default(),
3396 }
3397 }
3398
3399 /// Create a builder to help you perform the following task:
3400 ///
3401 /// List schema of a runtime actions filtered by action name.
3402 ///
3403 /// # Arguments
3404 ///
3405 /// * `parent` - Required. Parent resource of RuntimeActionSchema Format: projects/{project}/locations/{location}/connections/{connection}
3406 pub fn locations_connections_runtime_action_schemas_list(
3407 &self,
3408 parent: &str,
3409 ) -> ProjectLocationConnectionRuntimeActionSchemaListCall<'a, C> {
3410 ProjectLocationConnectionRuntimeActionSchemaListCall {
3411 hub: self.hub,
3412 _parent: parent.to_string(),
3413 _page_token: Default::default(),
3414 _page_size: Default::default(),
3415 _filter: Default::default(),
3416 _delegate: Default::default(),
3417 _additional_params: Default::default(),
3418 _scopes: Default::default(),
3419 }
3420 }
3421
3422 /// Create a builder to help you perform the following task:
3423 ///
3424 /// List schema of a runtime entities filtered by entity name.
3425 ///
3426 /// # Arguments
3427 ///
3428 /// * `parent` - Required. Parent resource of RuntimeEntitySchema Format: projects/{project}/locations/{location}/connections/{connection}
3429 pub fn locations_connections_runtime_entity_schemas_list(
3430 &self,
3431 parent: &str,
3432 ) -> ProjectLocationConnectionRuntimeEntitySchemaListCall<'a, C> {
3433 ProjectLocationConnectionRuntimeEntitySchemaListCall {
3434 hub: self.hub,
3435 _parent: parent.to_string(),
3436 _page_token: Default::default(),
3437 _page_size: Default::default(),
3438 _filter: Default::default(),
3439 _delegate: Default::default(),
3440 _additional_params: Default::default(),
3441 _scopes: Default::default(),
3442 }
3443 }
3444
3445 /// Create a builder to help you perform the following task:
3446 ///
3447 /// Creates a new Connection in a given project and location.
3448 ///
3449 /// # Arguments
3450 ///
3451 /// * `request` - No description provided.
3452 /// * `parent` - Required. Parent resource of the Connection, of the form: `projects/*/locations/*`
3453 pub fn locations_connections_create(
3454 &self,
3455 request: Connection,
3456 parent: &str,
3457 ) -> ProjectLocationConnectionCreateCall<'a, C> {
3458 ProjectLocationConnectionCreateCall {
3459 hub: self.hub,
3460 _request: request,
3461 _parent: parent.to_string(),
3462 _connection_id: Default::default(),
3463 _delegate: Default::default(),
3464 _additional_params: Default::default(),
3465 _scopes: Default::default(),
3466 }
3467 }
3468
3469 /// Create a builder to help you perform the following task:
3470 ///
3471 /// Deletes a single Connection.
3472 ///
3473 /// # Arguments
3474 ///
3475 /// * `name` - Required. Resource name of the form: `projects/*/locations/*/connections/*`
3476 pub fn locations_connections_delete(
3477 &self,
3478 name: &str,
3479 ) -> ProjectLocationConnectionDeleteCall<'a, C> {
3480 ProjectLocationConnectionDeleteCall {
3481 hub: self.hub,
3482 _name: name.to_string(),
3483 _delegate: Default::default(),
3484 _additional_params: Default::default(),
3485 _scopes: Default::default(),
3486 }
3487 }
3488
3489 /// Create a builder to help you perform the following task:
3490 ///
3491 /// Gets details of a single Connection.
3492 ///
3493 /// # Arguments
3494 ///
3495 /// * `name` - Required. Resource name of the form: `projects/*/locations/*/connections/*`
3496 pub fn locations_connections_get(&self, name: &str) -> ProjectLocationConnectionGetCall<'a, C> {
3497 ProjectLocationConnectionGetCall {
3498 hub: self.hub,
3499 _name: name.to_string(),
3500 _view: Default::default(),
3501 _delegate: Default::default(),
3502 _additional_params: Default::default(),
3503 _scopes: Default::default(),
3504 }
3505 }
3506
3507 /// Create a builder to help you perform the following task:
3508 ///
3509 /// Gets schema metadata of a connection. SchemaMetadata is a singleton resource for each connection.
3510 ///
3511 /// # Arguments
3512 ///
3513 /// * `name` - Required. Connection name Format: projects/{project}/locations/{location}/connections/{connection}/connectionSchemaMetadata
3514 pub fn locations_connections_get_connection_schema_metadata(
3515 &self,
3516 name: &str,
3517 ) -> ProjectLocationConnectionGetConnectionSchemaMetadataCall<'a, C> {
3518 ProjectLocationConnectionGetConnectionSchemaMetadataCall {
3519 hub: self.hub,
3520 _name: name.to_string(),
3521 _delegate: Default::default(),
3522 _additional_params: Default::default(),
3523 _scopes: Default::default(),
3524 }
3525 }
3526
3527 /// Create a builder to help you perform the following task:
3528 ///
3529 /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
3530 ///
3531 /// # Arguments
3532 ///
3533 /// * `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.
3534 pub fn locations_connections_get_iam_policy(
3535 &self,
3536 resource: &str,
3537 ) -> ProjectLocationConnectionGetIamPolicyCall<'a, C> {
3538 ProjectLocationConnectionGetIamPolicyCall {
3539 hub: self.hub,
3540 _resource: resource.to_string(),
3541 _options_requested_policy_version: Default::default(),
3542 _delegate: Default::default(),
3543 _additional_params: Default::default(),
3544 _scopes: Default::default(),
3545 }
3546 }
3547
3548 /// Create a builder to help you perform the following task:
3549 ///
3550 /// Lists Connections in a given project and location.
3551 ///
3552 /// # Arguments
3553 ///
3554 /// * `parent` - Required. Parent resource of the Connection, of the form: `projects/*/locations/*`
3555 pub fn locations_connections_list(
3556 &self,
3557 parent: &str,
3558 ) -> ProjectLocationConnectionListCall<'a, C> {
3559 ProjectLocationConnectionListCall {
3560 hub: self.hub,
3561 _parent: parent.to_string(),
3562 _view: Default::default(),
3563 _page_token: Default::default(),
3564 _page_size: Default::default(),
3565 _order_by: Default::default(),
3566 _filter: Default::default(),
3567 _delegate: Default::default(),
3568 _additional_params: Default::default(),
3569 _scopes: Default::default(),
3570 }
3571 }
3572
3573 /// Create a builder to help you perform the following task:
3574 ///
3575 /// ListenEvent listens to the event.
3576 ///
3577 /// # Arguments
3578 ///
3579 /// * `request` - No description provided.
3580 /// * `resourcePath` - Required. Resource path for request.
3581 pub fn locations_connections_listen_event(
3582 &self,
3583 request: ListenEventRequest,
3584 resource_path: &str,
3585 ) -> ProjectLocationConnectionListenEventCall<'a, C> {
3586 ProjectLocationConnectionListenEventCall {
3587 hub: self.hub,
3588 _request: request,
3589 _resource_path: resource_path.to_string(),
3590 _delegate: Default::default(),
3591 _additional_params: Default::default(),
3592 _scopes: Default::default(),
3593 }
3594 }
3595
3596 /// Create a builder to help you perform the following task:
3597 ///
3598 /// Updates the parameters of a single Connection.
3599 ///
3600 /// # Arguments
3601 ///
3602 /// * `request` - No description provided.
3603 /// * `name` - Output only. Resource name of the Connection. Format: projects/{project}/locations/{location}/connections/{connection}
3604 pub fn locations_connections_patch(
3605 &self,
3606 request: Connection,
3607 name: &str,
3608 ) -> ProjectLocationConnectionPatchCall<'a, C> {
3609 ProjectLocationConnectionPatchCall {
3610 hub: self.hub,
3611 _request: request,
3612 _name: name.to_string(),
3613 _update_mask: Default::default(),
3614 _delegate: Default::default(),
3615 _additional_params: Default::default(),
3616 _scopes: Default::default(),
3617 }
3618 }
3619
3620 /// Create a builder to help you perform the following task:
3621 ///
3622 /// RepaiEventing tries to repair eventing related event subscriptions.
3623 ///
3624 /// # Arguments
3625 ///
3626 /// * `request` - No description provided.
3627 /// * `name` - Required. Resource name of the form: `projects/*/locations/*/connections/*`
3628 pub fn locations_connections_repair_eventing(
3629 &self,
3630 request: RepairEventingRequest,
3631 name: &str,
3632 ) -> ProjectLocationConnectionRepairEventingCall<'a, C> {
3633 ProjectLocationConnectionRepairEventingCall {
3634 hub: self.hub,
3635 _request: request,
3636 _name: name.to_string(),
3637 _delegate: Default::default(),
3638 _additional_params: Default::default(),
3639 _scopes: Default::default(),
3640 }
3641 }
3642
3643 /// Create a builder to help you perform the following task:
3644 ///
3645 /// Returns Top matching Connections for a given query.
3646 ///
3647 /// # Arguments
3648 ///
3649 /// * `name` - Required. Parent resource of the Connection, of the form: `projects/*/locations/*/connections`
3650 pub fn locations_connections_search(
3651 &self,
3652 name: &str,
3653 ) -> ProjectLocationConnectionSearchCall<'a, C> {
3654 ProjectLocationConnectionSearchCall {
3655 hub: self.hub,
3656 _name: name.to_string(),
3657 _query: Default::default(),
3658 _page_token: Default::default(),
3659 _page_size: Default::default(),
3660 _delegate: Default::default(),
3661 _additional_params: Default::default(),
3662 _scopes: Default::default(),
3663 }
3664 }
3665
3666 /// Create a builder to help you perform the following task:
3667 ///
3668 /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
3669 ///
3670 /// # Arguments
3671 ///
3672 /// * `request` - No description provided.
3673 /// * `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.
3674 pub fn locations_connections_set_iam_policy(
3675 &self,
3676 request: SetIamPolicyRequest,
3677 resource: &str,
3678 ) -> ProjectLocationConnectionSetIamPolicyCall<'a, C> {
3679 ProjectLocationConnectionSetIamPolicyCall {
3680 hub: self.hub,
3681 _request: request,
3682 _resource: resource.to_string(),
3683 _delegate: Default::default(),
3684 _additional_params: Default::default(),
3685 _scopes: Default::default(),
3686 }
3687 }
3688
3689 /// Create a builder to help you perform the following task:
3690 ///
3691 /// 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.
3692 ///
3693 /// # Arguments
3694 ///
3695 /// * `request` - No description provided.
3696 /// * `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.
3697 pub fn locations_connections_test_iam_permissions(
3698 &self,
3699 request: TestIamPermissionsRequest,
3700 resource: &str,
3701 ) -> ProjectLocationConnectionTestIamPermissionCall<'a, C> {
3702 ProjectLocationConnectionTestIamPermissionCall {
3703 hub: self.hub,
3704 _request: request,
3705 _resource: resource.to_string(),
3706 _delegate: Default::default(),
3707 _additional_params: Default::default(),
3708 _scopes: Default::default(),
3709 }
3710 }
3711
3712 /// Create a builder to help you perform the following task:
3713 ///
3714 /// Deletes a single CustomConnectorVersion.
3715 ///
3716 /// # Arguments
3717 ///
3718 /// * `name` - Required. Resource name of the form: `projects/{project}/locations/{location}/customConnectors/{custom_connector}/customConnectorVersions/{custom_connector_version}`
3719 pub fn locations_custom_connectors_custom_connector_versions_delete(
3720 &self,
3721 name: &str,
3722 ) -> ProjectLocationCustomConnectorCustomConnectorVersionDeleteCall<'a, C> {
3723 ProjectLocationCustomConnectorCustomConnectorVersionDeleteCall {
3724 hub: self.hub,
3725 _name: name.to_string(),
3726 _delegate: Default::default(),
3727 _additional_params: Default::default(),
3728 _scopes: Default::default(),
3729 }
3730 }
3731
3732 /// Create a builder to help you perform the following task:
3733 ///
3734 /// Deprecates a single CustomConnectorVersion.
3735 ///
3736 /// # Arguments
3737 ///
3738 /// * `request` - No description provided.
3739 /// * `name` - Required. Resource name of the form: `projects/{project}/locations/{location}/customConnectors/{custom_connector}/customConnectorVersions/{custom_connector_version}`
3740 pub fn locations_custom_connectors_custom_connector_versions_deprecate(
3741 &self,
3742 request: DeprecateCustomConnectorVersionRequest,
3743 name: &str,
3744 ) -> ProjectLocationCustomConnectorCustomConnectorVersionDeprecateCall<'a, C> {
3745 ProjectLocationCustomConnectorCustomConnectorVersionDeprecateCall {
3746 hub: self.hub,
3747 _request: request,
3748 _name: name.to_string(),
3749 _delegate: Default::default(),
3750 _additional_params: Default::default(),
3751 _scopes: Default::default(),
3752 }
3753 }
3754
3755 /// Create a builder to help you perform the following task:
3756 ///
3757 /// Validates a Custom Connector Spec.
3758 ///
3759 /// # Arguments
3760 ///
3761 /// * `request` - No description provided.
3762 /// * `parent` - Required. Location at which the custom connector is being created.
3763 pub fn locations_custom_connectors_validate_custom_connector_spec(
3764 &self,
3765 request: ValidateCustomConnectorSpecRequest,
3766 parent: &str,
3767 ) -> ProjectLocationCustomConnectorValidateCustomConnectorSpecCall<'a, C> {
3768 ProjectLocationCustomConnectorValidateCustomConnectorSpecCall {
3769 hub: self.hub,
3770 _request: request,
3771 _parent: parent.to_string(),
3772 _delegate: Default::default(),
3773 _additional_params: Default::default(),
3774 _scopes: Default::default(),
3775 }
3776 }
3777
3778 /// Create a builder to help you perform the following task:
3779 ///
3780 /// Creates a new EndpointAttachment in a given project and location.
3781 ///
3782 /// # Arguments
3783 ///
3784 /// * `request` - No description provided.
3785 /// * `parent` - Required. Parent resource of the EndpointAttachment, of the form: `projects/*/locations/*`
3786 pub fn locations_endpoint_attachments_create(
3787 &self,
3788 request: EndpointAttachment,
3789 parent: &str,
3790 ) -> ProjectLocationEndpointAttachmentCreateCall<'a, C> {
3791 ProjectLocationEndpointAttachmentCreateCall {
3792 hub: self.hub,
3793 _request: request,
3794 _parent: parent.to_string(),
3795 _endpoint_attachment_id: Default::default(),
3796 _delegate: Default::default(),
3797 _additional_params: Default::default(),
3798 _scopes: Default::default(),
3799 }
3800 }
3801
3802 /// Create a builder to help you perform the following task:
3803 ///
3804 /// Deletes a single EndpointAttachment.
3805 ///
3806 /// # Arguments
3807 ///
3808 /// * `name` - Required. Resource name of the form: `projects/*/locations/*/endpointAttachments/*`
3809 pub fn locations_endpoint_attachments_delete(
3810 &self,
3811 name: &str,
3812 ) -> ProjectLocationEndpointAttachmentDeleteCall<'a, C> {
3813 ProjectLocationEndpointAttachmentDeleteCall {
3814 hub: self.hub,
3815 _name: name.to_string(),
3816 _delegate: Default::default(),
3817 _additional_params: Default::default(),
3818 _scopes: Default::default(),
3819 }
3820 }
3821
3822 /// Create a builder to help you perform the following task:
3823 ///
3824 /// Gets details of a single EndpointAttachment.
3825 ///
3826 /// # Arguments
3827 ///
3828 /// * `name` - Required. Resource name of the form: `projects/*/locations/*/endpointAttachments/*`
3829 pub fn locations_endpoint_attachments_get(
3830 &self,
3831 name: &str,
3832 ) -> ProjectLocationEndpointAttachmentGetCall<'a, C> {
3833 ProjectLocationEndpointAttachmentGetCall {
3834 hub: self.hub,
3835 _name: name.to_string(),
3836 _delegate: Default::default(),
3837 _additional_params: Default::default(),
3838 _scopes: Default::default(),
3839 }
3840 }
3841
3842 /// Create a builder to help you perform the following task:
3843 ///
3844 /// List EndpointAttachments in a given project
3845 ///
3846 /// # Arguments
3847 ///
3848 /// * `parent` - Required. Parent resource od the EndpointAttachment, of the form: `projects/*/locations/*`
3849 pub fn locations_endpoint_attachments_list(
3850 &self,
3851 parent: &str,
3852 ) -> ProjectLocationEndpointAttachmentListCall<'a, C> {
3853 ProjectLocationEndpointAttachmentListCall {
3854 hub: self.hub,
3855 _parent: parent.to_string(),
3856 _page_token: Default::default(),
3857 _page_size: Default::default(),
3858 _order_by: Default::default(),
3859 _filter: Default::default(),
3860 _delegate: Default::default(),
3861 _additional_params: Default::default(),
3862 _scopes: Default::default(),
3863 }
3864 }
3865
3866 /// Create a builder to help you perform the following task:
3867 ///
3868 /// Updates the parameters of a single EndpointAttachment.
3869 ///
3870 /// # Arguments
3871 ///
3872 /// * `request` - No description provided.
3873 /// * `name` - Output only. Resource name of the Endpoint Attachment. Format: projects/{project}/locations/{location}/endpointAttachments/{endpoint_attachment}
3874 pub fn locations_endpoint_attachments_patch(
3875 &self,
3876 request: EndpointAttachment,
3877 name: &str,
3878 ) -> ProjectLocationEndpointAttachmentPatchCall<'a, C> {
3879 ProjectLocationEndpointAttachmentPatchCall {
3880 hub: self.hub,
3881 _request: request,
3882 _name: name.to_string(),
3883 _update_mask: Default::default(),
3884 _delegate: Default::default(),
3885 _additional_params: Default::default(),
3886 _scopes: Default::default(),
3887 }
3888 }
3889
3890 /// Create a builder to help you perform the following task:
3891 ///
3892 /// Creates a new CustomConnectorVersion in a given project and location.
3893 ///
3894 /// # Arguments
3895 ///
3896 /// * `request` - No description provided.
3897 /// * `parent` - Required. Parent resource of the CreateCustomConnector, of the form: `projects/{project}/locations/{location}/customConnectors/{custom_connector}`
3898 pub fn locations_global_custom_connectors_custom_connector_versions_create(
3899 &self,
3900 request: CustomConnectorVersion,
3901 parent: &str,
3902 ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionCreateCall<'a, C> {
3903 ProjectLocationGlobalCustomConnectorCustomConnectorVersionCreateCall {
3904 hub: self.hub,
3905 _request: request,
3906 _parent: parent.to_string(),
3907 _custom_connector_version_id: Default::default(),
3908 _delegate: Default::default(),
3909 _additional_params: Default::default(),
3910 _scopes: Default::default(),
3911 }
3912 }
3913
3914 /// Create a builder to help you perform the following task:
3915 ///
3916 /// Gets details of a single CustomConnectorVersion.
3917 ///
3918 /// # Arguments
3919 ///
3920 /// * `name` - Required. Resource name of the form: `projects/*/locations/{location}/customConnectors/*/customConnectorVersions/*`
3921 pub fn locations_global_custom_connectors_custom_connector_versions_get(
3922 &self,
3923 name: &str,
3924 ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionGetCall<'a, C> {
3925 ProjectLocationGlobalCustomConnectorCustomConnectorVersionGetCall {
3926 hub: self.hub,
3927 _name: name.to_string(),
3928 _delegate: Default::default(),
3929 _additional_params: Default::default(),
3930 _scopes: Default::default(),
3931 }
3932 }
3933
3934 /// Create a builder to help you perform the following task:
3935 ///
3936 /// List CustomConnectorVersions in a given project
3937 ///
3938 /// # Arguments
3939 ///
3940 /// * `parent` - Required. Parent resource of the connectors, of the form: `projects/*/locations/{location}/customConnectors/*/customConnectorVersions/*`
3941 pub fn locations_global_custom_connectors_custom_connector_versions_list(
3942 &self,
3943 parent: &str,
3944 ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionListCall<'a, C> {
3945 ProjectLocationGlobalCustomConnectorCustomConnectorVersionListCall {
3946 hub: self.hub,
3947 _parent: parent.to_string(),
3948 _page_token: Default::default(),
3949 _page_size: Default::default(),
3950 _delegate: Default::default(),
3951 _additional_params: Default::default(),
3952 _scopes: Default::default(),
3953 }
3954 }
3955
3956 /// Create a builder to help you perform the following task:
3957 ///
3958 /// Creates a new CustomConnector in a given project and location.
3959 ///
3960 /// # Arguments
3961 ///
3962 /// * `request` - No description provided.
3963 /// * `parent` - Required. Parent resource of the CreateCustomConnector, of the form: `projects/{project}/locations/*`
3964 pub fn locations_global_custom_connectors_create(
3965 &self,
3966 request: CustomConnector,
3967 parent: &str,
3968 ) -> ProjectLocationGlobalCustomConnectorCreateCall<'a, C> {
3969 ProjectLocationGlobalCustomConnectorCreateCall {
3970 hub: self.hub,
3971 _request: request,
3972 _parent: parent.to_string(),
3973 _custom_connector_id: Default::default(),
3974 _delegate: Default::default(),
3975 _additional_params: Default::default(),
3976 _scopes: Default::default(),
3977 }
3978 }
3979
3980 /// Create a builder to help you perform the following task:
3981 ///
3982 /// Deletes a single CustomConnector.
3983 ///
3984 /// # Arguments
3985 ///
3986 /// * `name` - Required. Resource name of the form: `projects/{project}/locations/{location}/customConnectors/{connector}`
3987 pub fn locations_global_custom_connectors_delete(
3988 &self,
3989 name: &str,
3990 ) -> ProjectLocationGlobalCustomConnectorDeleteCall<'a, C> {
3991 ProjectLocationGlobalCustomConnectorDeleteCall {
3992 hub: self.hub,
3993 _name: name.to_string(),
3994 _force: Default::default(),
3995 _delegate: Default::default(),
3996 _additional_params: Default::default(),
3997 _scopes: Default::default(),
3998 }
3999 }
4000
4001 /// Create a builder to help you perform the following task:
4002 ///
4003 /// Gets details of a single CustomConnector.
4004 ///
4005 /// # Arguments
4006 ///
4007 /// * `name` - Required. Resource name of the form: `projects/*/locations/*/customConnectors/*`
4008 pub fn locations_global_custom_connectors_get(
4009 &self,
4010 name: &str,
4011 ) -> ProjectLocationGlobalCustomConnectorGetCall<'a, C> {
4012 ProjectLocationGlobalCustomConnectorGetCall {
4013 hub: self.hub,
4014 _name: name.to_string(),
4015 _delegate: Default::default(),
4016 _additional_params: Default::default(),
4017 _scopes: Default::default(),
4018 }
4019 }
4020
4021 /// Create a builder to help you perform the following task:
4022 ///
4023 /// List CustomConnectorVersions in a given project
4024 ///
4025 /// # Arguments
4026 ///
4027 /// * `parent` - Required. Parent resource of the custom connectors, of the form: `projects/*/locations/*` Only global location is supported for CustomConnector resource.
4028 pub fn locations_global_custom_connectors_list(
4029 &self,
4030 parent: &str,
4031 ) -> ProjectLocationGlobalCustomConnectorListCall<'a, C> {
4032 ProjectLocationGlobalCustomConnectorListCall {
4033 hub: self.hub,
4034 _parent: parent.to_string(),
4035 _page_token: Default::default(),
4036 _page_size: Default::default(),
4037 _filter: Default::default(),
4038 _delegate: Default::default(),
4039 _additional_params: Default::default(),
4040 _scopes: Default::default(),
4041 }
4042 }
4043
4044 /// Create a builder to help you perform the following task:
4045 ///
4046 /// Updates the parameters of a CustomConnector.
4047 ///
4048 /// # Arguments
4049 ///
4050 /// * `request` - No description provided.
4051 /// * `name` - Identifier. Resource name of the CustomConnector. Format: projects/{project}/locations/{location}/customConnectors/{connector}
4052 pub fn locations_global_custom_connectors_patch(
4053 &self,
4054 request: CustomConnector,
4055 name: &str,
4056 ) -> ProjectLocationGlobalCustomConnectorPatchCall<'a, C> {
4057 ProjectLocationGlobalCustomConnectorPatchCall {
4058 hub: self.hub,
4059 _request: request,
4060 _name: name.to_string(),
4061 _update_mask: Default::default(),
4062 _delegate: Default::default(),
4063 _additional_params: Default::default(),
4064 _scopes: Default::default(),
4065 }
4066 }
4067
4068 /// Create a builder to help you perform the following task:
4069 ///
4070 /// Creates a new ManagedZone in a given project and location.
4071 ///
4072 /// # Arguments
4073 ///
4074 /// * `request` - No description provided.
4075 /// * `parent` - Required. Parent resource of the ManagedZone, of the form: `projects/*/locations/global`
4076 pub fn locations_global_managed_zones_create(
4077 &self,
4078 request: ManagedZone,
4079 parent: &str,
4080 ) -> ProjectLocationGlobalManagedZoneCreateCall<'a, C> {
4081 ProjectLocationGlobalManagedZoneCreateCall {
4082 hub: self.hub,
4083 _request: request,
4084 _parent: parent.to_string(),
4085 _managed_zone_id: Default::default(),
4086 _delegate: Default::default(),
4087 _additional_params: Default::default(),
4088 _scopes: Default::default(),
4089 }
4090 }
4091
4092 /// Create a builder to help you perform the following task:
4093 ///
4094 /// Deletes a single ManagedZone.
4095 ///
4096 /// # Arguments
4097 ///
4098 /// * `name` - Required. Resource name of the form: `projects/*/locations/global/managedZones/*`
4099 pub fn locations_global_managed_zones_delete(
4100 &self,
4101 name: &str,
4102 ) -> ProjectLocationGlobalManagedZoneDeleteCall<'a, C> {
4103 ProjectLocationGlobalManagedZoneDeleteCall {
4104 hub: self.hub,
4105 _name: name.to_string(),
4106 _delegate: Default::default(),
4107 _additional_params: Default::default(),
4108 _scopes: Default::default(),
4109 }
4110 }
4111
4112 /// Create a builder to help you perform the following task:
4113 ///
4114 /// Gets details of a single ManagedZone.
4115 ///
4116 /// # Arguments
4117 ///
4118 /// * `name` - Required. Resource name of the form: `projects/*/locations/global/managedZones/*`
4119 pub fn locations_global_managed_zones_get(
4120 &self,
4121 name: &str,
4122 ) -> ProjectLocationGlobalManagedZoneGetCall<'a, C> {
4123 ProjectLocationGlobalManagedZoneGetCall {
4124 hub: self.hub,
4125 _name: name.to_string(),
4126 _delegate: Default::default(),
4127 _additional_params: Default::default(),
4128 _scopes: Default::default(),
4129 }
4130 }
4131
4132 /// Create a builder to help you perform the following task:
4133 ///
4134 /// List ManagedZones in a given project
4135 ///
4136 /// # Arguments
4137 ///
4138 /// * `parent` - Required. Parent resource of the Managed Zone, of the form: `projects/*/locations/global`
4139 pub fn locations_global_managed_zones_list(
4140 &self,
4141 parent: &str,
4142 ) -> ProjectLocationGlobalManagedZoneListCall<'a, C> {
4143 ProjectLocationGlobalManagedZoneListCall {
4144 hub: self.hub,
4145 _parent: parent.to_string(),
4146 _page_token: Default::default(),
4147 _page_size: Default::default(),
4148 _order_by: Default::default(),
4149 _filter: Default::default(),
4150 _delegate: Default::default(),
4151 _additional_params: Default::default(),
4152 _scopes: Default::default(),
4153 }
4154 }
4155
4156 /// Create a builder to help you perform the following task:
4157 ///
4158 /// Updates the parameters of a single ManagedZone.
4159 ///
4160 /// # Arguments
4161 ///
4162 /// * `request` - No description provided.
4163 /// * `name` - Output only. Resource name of the Managed Zone. Format: projects/{project}/locations/global/managedZones/{managed_zone}
4164 pub fn locations_global_managed_zones_patch(
4165 &self,
4166 request: ManagedZone,
4167 name: &str,
4168 ) -> ProjectLocationGlobalManagedZonePatchCall<'a, C> {
4169 ProjectLocationGlobalManagedZonePatchCall {
4170 hub: self.hub,
4171 _request: request,
4172 _name: name.to_string(),
4173 _update_mask: Default::default(),
4174 _delegate: Default::default(),
4175 _additional_params: Default::default(),
4176 _scopes: Default::default(),
4177 }
4178 }
4179
4180 /// Create a builder to help you perform the following task:
4181 ///
4182 /// GetGlobalSettings gets settings of a project. GlobalSettings is a singleton resource.
4183 ///
4184 /// # Arguments
4185 ///
4186 /// * `name` - Required. The resource name of the Settings.
4187 pub fn locations_global_get_settings(
4188 &self,
4189 name: &str,
4190 ) -> ProjectLocationGlobalGetSettingCall<'a, C> {
4191 ProjectLocationGlobalGetSettingCall {
4192 hub: self.hub,
4193 _name: name.to_string(),
4194 _delegate: Default::default(),
4195 _additional_params: Default::default(),
4196 _scopes: Default::default(),
4197 }
4198 }
4199
4200 /// Create a builder to help you perform the following task:
4201 ///
4202 /// Update the global settings of a project.
4203 ///
4204 /// # Arguments
4205 ///
4206 /// * `request` - No description provided.
4207 /// * `name` - Output only. Resource name of the Connection. Format: projects/{project}/locations/global/settings}
4208 pub fn locations_global_update_settings(
4209 &self,
4210 request: Settings,
4211 name: &str,
4212 ) -> ProjectLocationGlobalUpdateSettingCall<'a, C> {
4213 ProjectLocationGlobalUpdateSettingCall {
4214 hub: self.hub,
4215 _request: request,
4216 _name: name.to_string(),
4217 _update_mask: Default::default(),
4218 _delegate: Default::default(),
4219 _additional_params: Default::default(),
4220 _scopes: Default::default(),
4221 }
4222 }
4223
4224 /// Create a builder to help you perform the following task:
4225 ///
4226 /// 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`.
4227 ///
4228 /// # Arguments
4229 ///
4230 /// * `request` - No description provided.
4231 /// * `name` - The name of the operation resource to be cancelled.
4232 pub fn locations_operations_cancel(
4233 &self,
4234 request: CancelOperationRequest,
4235 name: &str,
4236 ) -> ProjectLocationOperationCancelCall<'a, C> {
4237 ProjectLocationOperationCancelCall {
4238 hub: self.hub,
4239 _request: request,
4240 _name: name.to_string(),
4241 _delegate: Default::default(),
4242 _additional_params: Default::default(),
4243 _scopes: Default::default(),
4244 }
4245 }
4246
4247 /// Create a builder to help you perform the following task:
4248 ///
4249 /// 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`.
4250 ///
4251 /// # Arguments
4252 ///
4253 /// * `name` - The name of the operation resource to be deleted.
4254 pub fn locations_operations_delete(
4255 &self,
4256 name: &str,
4257 ) -> ProjectLocationOperationDeleteCall<'a, C> {
4258 ProjectLocationOperationDeleteCall {
4259 hub: self.hub,
4260 _name: name.to_string(),
4261 _delegate: Default::default(),
4262 _additional_params: Default::default(),
4263 _scopes: Default::default(),
4264 }
4265 }
4266
4267 /// Create a builder to help you perform the following task:
4268 ///
4269 /// 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.
4270 ///
4271 /// # Arguments
4272 ///
4273 /// * `name` - The name of the operation resource.
4274 pub fn locations_operations_get(&self, name: &str) -> ProjectLocationOperationGetCall<'a, C> {
4275 ProjectLocationOperationGetCall {
4276 hub: self.hub,
4277 _name: name.to_string(),
4278 _delegate: Default::default(),
4279 _additional_params: Default::default(),
4280 _scopes: Default::default(),
4281 }
4282 }
4283
4284 /// Create a builder to help you perform the following task:
4285 ///
4286 /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
4287 ///
4288 /// # Arguments
4289 ///
4290 /// * `name` - The name of the operation's parent resource.
4291 pub fn locations_operations_list(&self, name: &str) -> ProjectLocationOperationListCall<'a, C> {
4292 ProjectLocationOperationListCall {
4293 hub: self.hub,
4294 _name: name.to_string(),
4295 _page_token: Default::default(),
4296 _page_size: Default::default(),
4297 _filter: Default::default(),
4298 _delegate: Default::default(),
4299 _additional_params: Default::default(),
4300 _scopes: Default::default(),
4301 }
4302 }
4303
4304 /// Create a builder to help you perform the following task:
4305 ///
4306 /// Gets details of a single event type.
4307 ///
4308 /// # Arguments
4309 ///
4310 /// * `name` - Required. Resource name of the form: `projects/*/locations/*/providers/*/connectors/*/versions/*/eventtypes/*` Only global location is supported for EventType resource.
4311 pub fn locations_providers_connectors_versions_eventtypes_get(
4312 &self,
4313 name: &str,
4314 ) -> ProjectLocationProviderConnectorVersionEventtypeGetCall<'a, C> {
4315 ProjectLocationProviderConnectorVersionEventtypeGetCall {
4316 hub: self.hub,
4317 _name: name.to_string(),
4318 _delegate: Default::default(),
4319 _additional_params: Default::default(),
4320 _scopes: Default::default(),
4321 }
4322 }
4323
4324 /// Create a builder to help you perform the following task:
4325 ///
4326 /// Lists Event Types in a given Connector Version.
4327 ///
4328 /// # Arguments
4329 ///
4330 /// * `parent` - Required. Parent resource of the connectors, of the form: `projects/*/locations/*/providers/*/connectors/*/versions/*` Only global location is supported for EventType resource.
4331 pub fn locations_providers_connectors_versions_eventtypes_list(
4332 &self,
4333 parent: &str,
4334 ) -> ProjectLocationProviderConnectorVersionEventtypeListCall<'a, C> {
4335 ProjectLocationProviderConnectorVersionEventtypeListCall {
4336 hub: self.hub,
4337 _parent: parent.to_string(),
4338 _page_token: Default::default(),
4339 _page_size: Default::default(),
4340 _delegate: Default::default(),
4341 _additional_params: Default::default(),
4342 _scopes: Default::default(),
4343 }
4344 }
4345
4346 /// Create a builder to help you perform the following task:
4347 ///
4348 /// Gets details of a single connector version.
4349 ///
4350 /// # Arguments
4351 ///
4352 /// * `name` - Required. Resource name of the form: `projects/*/locations/*/providers/*/connectors/*/versions/*` Only global location is supported for ConnectorVersion resource.
4353 pub fn locations_providers_connectors_versions_get(
4354 &self,
4355 name: &str,
4356 ) -> ProjectLocationProviderConnectorVersionGetCall<'a, C> {
4357 ProjectLocationProviderConnectorVersionGetCall {
4358 hub: self.hub,
4359 _name: name.to_string(),
4360 _view: Default::default(),
4361 _delegate: Default::default(),
4362 _additional_params: Default::default(),
4363 _scopes: Default::default(),
4364 }
4365 }
4366
4367 /// Create a builder to help you perform the following task:
4368 ///
4369 /// Lists Connector Versions in a given project and location.
4370 ///
4371 /// # Arguments
4372 ///
4373 /// * `parent` - Required. Parent resource of the connectors, of the form: `projects/*/locations/*/providers/*/connectors/*` Only global location is supported for ConnectorVersion resource.
4374 pub fn locations_providers_connectors_versions_list(
4375 &self,
4376 parent: &str,
4377 ) -> ProjectLocationProviderConnectorVersionListCall<'a, C> {
4378 ProjectLocationProviderConnectorVersionListCall {
4379 hub: self.hub,
4380 _parent: parent.to_string(),
4381 _view: Default::default(),
4382 _page_token: Default::default(),
4383 _page_size: Default::default(),
4384 _delegate: Default::default(),
4385 _additional_params: Default::default(),
4386 _scopes: Default::default(),
4387 }
4388 }
4389
4390 /// Create a builder to help you perform the following task:
4391 ///
4392 /// Gets details of a single Connector.
4393 ///
4394 /// # Arguments
4395 ///
4396 /// * `name` - Required. Resource name of the form: `projects/*/locations/*/providers/*/connectors/*` Only global location is supported for Connector resource.
4397 pub fn locations_providers_connectors_get(
4398 &self,
4399 name: &str,
4400 ) -> ProjectLocationProviderConnectorGetCall<'a, C> {
4401 ProjectLocationProviderConnectorGetCall {
4402 hub: self.hub,
4403 _name: name.to_string(),
4404 _delegate: Default::default(),
4405 _additional_params: Default::default(),
4406 _scopes: Default::default(),
4407 }
4408 }
4409
4410 /// Create a builder to help you perform the following task:
4411 ///
4412 /// Lists Connectors in a given project and location.
4413 ///
4414 /// # Arguments
4415 ///
4416 /// * `parent` - Required. Parent resource of the connectors, of the form: `projects/*/locations/*/providers/*` Only global location is supported for Connector resource.
4417 pub fn locations_providers_connectors_list(
4418 &self,
4419 parent: &str,
4420 ) -> ProjectLocationProviderConnectorListCall<'a, C> {
4421 ProjectLocationProviderConnectorListCall {
4422 hub: self.hub,
4423 _parent: parent.to_string(),
4424 _page_token: Default::default(),
4425 _page_size: Default::default(),
4426 _filter: Default::default(),
4427 _delegate: Default::default(),
4428 _additional_params: Default::default(),
4429 _scopes: Default::default(),
4430 }
4431 }
4432
4433 /// Create a builder to help you perform the following task:
4434 ///
4435 /// Gets details of a provider.
4436 ///
4437 /// # Arguments
4438 ///
4439 /// * `name` - Required. Resource name of the form: `projects/*/locations/*/providers/*` Only global location is supported for Provider resource.
4440 pub fn locations_providers_get(&self, name: &str) -> ProjectLocationProviderGetCall<'a, C> {
4441 ProjectLocationProviderGetCall {
4442 hub: self.hub,
4443 _name: name.to_string(),
4444 _delegate: Default::default(),
4445 _additional_params: Default::default(),
4446 _scopes: Default::default(),
4447 }
4448 }
4449
4450 /// Create a builder to help you perform the following task:
4451 ///
4452 /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
4453 ///
4454 /// # Arguments
4455 ///
4456 /// * `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.
4457 pub fn locations_providers_get_iam_policy(
4458 &self,
4459 resource: &str,
4460 ) -> ProjectLocationProviderGetIamPolicyCall<'a, C> {
4461 ProjectLocationProviderGetIamPolicyCall {
4462 hub: self.hub,
4463 _resource: resource.to_string(),
4464 _options_requested_policy_version: Default::default(),
4465 _delegate: Default::default(),
4466 _additional_params: Default::default(),
4467 _scopes: Default::default(),
4468 }
4469 }
4470
4471 /// Create a builder to help you perform the following task:
4472 ///
4473 /// Lists Providers in a given project and location.
4474 ///
4475 /// # Arguments
4476 ///
4477 /// * `parent` - Required. Parent resource of the API, of the form: `projects/*/locations/*` Only global location is supported for Provider resource.
4478 pub fn locations_providers_list(&self, parent: &str) -> ProjectLocationProviderListCall<'a, C> {
4479 ProjectLocationProviderListCall {
4480 hub: self.hub,
4481 _parent: parent.to_string(),
4482 _page_token: Default::default(),
4483 _page_size: Default::default(),
4484 _delegate: Default::default(),
4485 _additional_params: Default::default(),
4486 _scopes: Default::default(),
4487 }
4488 }
4489
4490 /// Create a builder to help you perform the following task:
4491 ///
4492 /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
4493 ///
4494 /// # Arguments
4495 ///
4496 /// * `request` - No description provided.
4497 /// * `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.
4498 pub fn locations_providers_set_iam_policy(
4499 &self,
4500 request: SetIamPolicyRequest,
4501 resource: &str,
4502 ) -> ProjectLocationProviderSetIamPolicyCall<'a, C> {
4503 ProjectLocationProviderSetIamPolicyCall {
4504 hub: self.hub,
4505 _request: request,
4506 _resource: resource.to_string(),
4507 _delegate: Default::default(),
4508 _additional_params: Default::default(),
4509 _scopes: Default::default(),
4510 }
4511 }
4512
4513 /// Create a builder to help you perform the following task:
4514 ///
4515 /// 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.
4516 ///
4517 /// # Arguments
4518 ///
4519 /// * `request` - No description provided.
4520 /// * `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.
4521 pub fn locations_providers_test_iam_permissions(
4522 &self,
4523 request: TestIamPermissionsRequest,
4524 resource: &str,
4525 ) -> ProjectLocationProviderTestIamPermissionCall<'a, C> {
4526 ProjectLocationProviderTestIamPermissionCall {
4527 hub: self.hub,
4528 _request: request,
4529 _resource: resource.to_string(),
4530 _delegate: Default::default(),
4531 _additional_params: Default::default(),
4532 _scopes: Default::default(),
4533 }
4534 }
4535
4536 /// Create a builder to help you perform the following task:
4537 ///
4538 /// Gets information about a location.
4539 ///
4540 /// # Arguments
4541 ///
4542 /// * `name` - Resource name for the location.
4543 pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, C> {
4544 ProjectLocationGetCall {
4545 hub: self.hub,
4546 _name: name.to_string(),
4547 _delegate: Default::default(),
4548 _additional_params: Default::default(),
4549 _scopes: Default::default(),
4550 }
4551 }
4552
4553 /// Create a builder to help you perform the following task:
4554 ///
4555 /// GetRegionalSettings gets settings of a region. RegionalSettings is a singleton resource.
4556 ///
4557 /// # Arguments
4558 ///
4559 /// * `name` - Required. The resource name of the Regional Settings.
4560 pub fn locations_get_regional_settings(
4561 &self,
4562 name: &str,
4563 ) -> ProjectLocationGetRegionalSettingCall<'a, C> {
4564 ProjectLocationGetRegionalSettingCall {
4565 hub: self.hub,
4566 _name: name.to_string(),
4567 _delegate: Default::default(),
4568 _additional_params: Default::default(),
4569 _scopes: Default::default(),
4570 }
4571 }
4572
4573 /// Create a builder to help you perform the following task:
4574 ///
4575 /// Gets the runtimeConfig of a location. RuntimeConfig is a singleton resource for each location.
4576 ///
4577 /// # Arguments
4578 ///
4579 /// * `name` - Required. Resource name of the form: `projects/*/locations/*/runtimeConfig`
4580 pub fn locations_get_runtime_config(
4581 &self,
4582 name: &str,
4583 ) -> ProjectLocationGetRuntimeConfigCall<'a, C> {
4584 ProjectLocationGetRuntimeConfigCall {
4585 hub: self.hub,
4586 _name: name.to_string(),
4587 _delegate: Default::default(),
4588 _additional_params: Default::default(),
4589 _scopes: Default::default(),
4590 }
4591 }
4592
4593 /// Create a builder to help you perform the following task:
4594 ///
4595 /// Lists information about the supported locations for this service.
4596 ///
4597 /// # Arguments
4598 ///
4599 /// * `name` - The resource that owns the locations collection, if applicable.
4600 pub fn locations_list(&self, name: &str) -> ProjectLocationListCall<'a, C> {
4601 ProjectLocationListCall {
4602 hub: self.hub,
4603 _name: name.to_string(),
4604 _page_token: Default::default(),
4605 _page_size: Default::default(),
4606 _filter: Default::default(),
4607 _delegate: Default::default(),
4608 _additional_params: Default::default(),
4609 _scopes: Default::default(),
4610 }
4611 }
4612
4613 /// Create a builder to help you perform the following task:
4614 ///
4615 /// Update the settings of a region.
4616 ///
4617 /// # Arguments
4618 ///
4619 /// * `request` - No description provided.
4620 /// * `name` - Output only. Resource name of the Connection. Format: projects/{project}/locations/{location}/regionalSettings
4621 pub fn locations_update_regional_settings(
4622 &self,
4623 request: RegionalSettings,
4624 name: &str,
4625 ) -> ProjectLocationUpdateRegionalSettingCall<'a, C> {
4626 ProjectLocationUpdateRegionalSettingCall {
4627 hub: self.hub,
4628 _request: request,
4629 _name: name.to_string(),
4630 _update_mask: Default::default(),
4631 _delegate: Default::default(),
4632 _additional_params: Default::default(),
4633 _scopes: Default::default(),
4634 }
4635 }
4636}
4637
4638// ###################
4639// CallBuilders ###
4640// #################
4641
4642/// Get action.
4643///
4644/// A builder for the *locations.connections.connectionSchemaMetadata.getAction* method supported by a *project* resource.
4645/// It is not used directly, but through a [`ProjectMethods`] instance.
4646///
4647/// # Example
4648///
4649/// Instantiate a resource method builder
4650///
4651/// ```test_harness,no_run
4652/// # extern crate hyper;
4653/// # extern crate hyper_rustls;
4654/// # extern crate google_connectors1 as connectors1;
4655/// # async fn dox() {
4656/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4657///
4658/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4659/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4660/// # secret,
4661/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4662/// # ).build().await.unwrap();
4663///
4664/// # let client = hyper_util::client::legacy::Client::builder(
4665/// # hyper_util::rt::TokioExecutor::new()
4666/// # )
4667/// # .build(
4668/// # hyper_rustls::HttpsConnectorBuilder::new()
4669/// # .with_native_roots()
4670/// # .unwrap()
4671/// # .https_or_http()
4672/// # .enable_http1()
4673/// # .build()
4674/// # );
4675/// # let mut hub = Connectors::new(client, auth);
4676/// // You can configure optional parameters by calling the respective setters at will, and
4677/// // execute the final call using `doit()`.
4678/// // Values shown here are possibly random and not representative !
4679/// let result = hub.projects().locations_connections_connection_schema_metadata_get_action("name")
4680/// .action_id("sed")
4681/// .doit().await;
4682/// # }
4683/// ```
4684pub struct ProjectLocationConnectionConnectionSchemaMetadataGetActionCall<'a, C>
4685where
4686 C: 'a,
4687{
4688 hub: &'a Connectors<C>,
4689 _name: String,
4690 _action_id: Option<String>,
4691 _delegate: Option<&'a mut dyn common::Delegate>,
4692 _additional_params: HashMap<String, String>,
4693 _scopes: BTreeSet<String>,
4694}
4695
4696impl<'a, C> common::CallBuilder
4697 for ProjectLocationConnectionConnectionSchemaMetadataGetActionCall<'a, C>
4698{
4699}
4700
4701impl<'a, C> ProjectLocationConnectionConnectionSchemaMetadataGetActionCall<'a, C>
4702where
4703 C: common::Connector,
4704{
4705 /// Perform the operation you have build so far.
4706 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
4707 use std::borrow::Cow;
4708 use std::io::{Read, Seek};
4709
4710 use common::{url::Params, ToParts};
4711 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4712
4713 let mut dd = common::DefaultDelegate;
4714 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4715 dlg.begin(common::MethodInfo {
4716 id: "connectors.projects.locations.connections.connectionSchemaMetadata.getAction",
4717 http_method: hyper::Method::GET,
4718 });
4719
4720 for &field in ["alt", "name", "actionId"].iter() {
4721 if self._additional_params.contains_key(field) {
4722 dlg.finished(false);
4723 return Err(common::Error::FieldClash(field));
4724 }
4725 }
4726
4727 let mut params = Params::with_capacity(4 + self._additional_params.len());
4728 params.push("name", self._name);
4729 if let Some(value) = self._action_id.as_ref() {
4730 params.push("actionId", value);
4731 }
4732
4733 params.extend(self._additional_params.iter());
4734
4735 params.push("alt", "json");
4736 let mut url = self.hub._base_url.clone() + "v1/{+name}:getAction";
4737 if self._scopes.is_empty() {
4738 self._scopes
4739 .insert(Scope::CloudPlatform.as_ref().to_string());
4740 }
4741
4742 #[allow(clippy::single_element_loop)]
4743 for &(find_this, param_name) in [("{+name}", "name")].iter() {
4744 url = params.uri_replacement(url, param_name, find_this, true);
4745 }
4746 {
4747 let to_remove = ["name"];
4748 params.remove_params(&to_remove);
4749 }
4750
4751 let url = params.parse_with_url(&url);
4752
4753 loop {
4754 let token = match self
4755 .hub
4756 .auth
4757 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4758 .await
4759 {
4760 Ok(token) => token,
4761 Err(e) => match dlg.token(e) {
4762 Ok(token) => token,
4763 Err(e) => {
4764 dlg.finished(false);
4765 return Err(common::Error::MissingToken(e));
4766 }
4767 },
4768 };
4769 let mut req_result = {
4770 let client = &self.hub.client;
4771 dlg.pre_request();
4772 let mut req_builder = hyper::Request::builder()
4773 .method(hyper::Method::GET)
4774 .uri(url.as_str())
4775 .header(USER_AGENT, self.hub._user_agent.clone());
4776
4777 if let Some(token) = token.as_ref() {
4778 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4779 }
4780
4781 let request = req_builder
4782 .header(CONTENT_LENGTH, 0_u64)
4783 .body(common::to_body::<String>(None));
4784
4785 client.request(request.unwrap()).await
4786 };
4787
4788 match req_result {
4789 Err(err) => {
4790 if let common::Retry::After(d) = dlg.http_error(&err) {
4791 sleep(d).await;
4792 continue;
4793 }
4794 dlg.finished(false);
4795 return Err(common::Error::HttpError(err));
4796 }
4797 Ok(res) => {
4798 let (mut parts, body) = res.into_parts();
4799 let mut body = common::Body::new(body);
4800 if !parts.status.is_success() {
4801 let bytes = common::to_bytes(body).await.unwrap_or_default();
4802 let error = serde_json::from_str(&common::to_string(&bytes));
4803 let response = common::to_response(parts, bytes.into());
4804
4805 if let common::Retry::After(d) =
4806 dlg.http_failure(&response, error.as_ref().ok())
4807 {
4808 sleep(d).await;
4809 continue;
4810 }
4811
4812 dlg.finished(false);
4813
4814 return Err(match error {
4815 Ok(value) => common::Error::BadRequest(value),
4816 _ => common::Error::Failure(response),
4817 });
4818 }
4819 let response = {
4820 let bytes = common::to_bytes(body).await.unwrap_or_default();
4821 let encoded = common::to_string(&bytes);
4822 match serde_json::from_str(&encoded) {
4823 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4824 Err(error) => {
4825 dlg.response_json_decode_error(&encoded, &error);
4826 return Err(common::Error::JsonDecodeError(
4827 encoded.to_string(),
4828 error,
4829 ));
4830 }
4831 }
4832 };
4833
4834 dlg.finished(true);
4835 return Ok(response);
4836 }
4837 }
4838 }
4839 }
4840
4841 /// Required. Resource name format: projects/{project}/locations/{location}/connections/{connection}/connectionSchemaMetadata
4842 ///
4843 /// Sets the *name* path property to the given value.
4844 ///
4845 /// Even though the property as already been set when instantiating this call,
4846 /// we provide this method for API completeness.
4847 pub fn name(
4848 mut self,
4849 new_value: &str,
4850 ) -> ProjectLocationConnectionConnectionSchemaMetadataGetActionCall<'a, C> {
4851 self._name = new_value.to_string();
4852 self
4853 }
4854 /// Required. Id of the action.
4855 ///
4856 /// Sets the *action id* query property to the given value.
4857 pub fn action_id(
4858 mut self,
4859 new_value: &str,
4860 ) -> ProjectLocationConnectionConnectionSchemaMetadataGetActionCall<'a, C> {
4861 self._action_id = Some(new_value.to_string());
4862 self
4863 }
4864 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4865 /// while executing the actual API request.
4866 ///
4867 /// ````text
4868 /// It should be used to handle progress information, and to implement a certain level of resilience.
4869 /// ````
4870 ///
4871 /// Sets the *delegate* property to the given value.
4872 pub fn delegate(
4873 mut self,
4874 new_value: &'a mut dyn common::Delegate,
4875 ) -> ProjectLocationConnectionConnectionSchemaMetadataGetActionCall<'a, C> {
4876 self._delegate = Some(new_value);
4877 self
4878 }
4879
4880 /// Set any additional parameter of the query string used in the request.
4881 /// It should be used to set parameters which are not yet available through their own
4882 /// setters.
4883 ///
4884 /// Please note that this method must not be used to set any of the known parameters
4885 /// which have their own setter method. If done anyway, the request will fail.
4886 ///
4887 /// # Additional Parameters
4888 ///
4889 /// * *$.xgafv* (query-string) - V1 error format.
4890 /// * *access_token* (query-string) - OAuth access token.
4891 /// * *alt* (query-string) - Data format for response.
4892 /// * *callback* (query-string) - JSONP
4893 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4894 /// * *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.
4895 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4896 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4897 /// * *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.
4898 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4899 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4900 pub fn param<T>(
4901 mut self,
4902 name: T,
4903 value: T,
4904 ) -> ProjectLocationConnectionConnectionSchemaMetadataGetActionCall<'a, C>
4905 where
4906 T: AsRef<str>,
4907 {
4908 self._additional_params
4909 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4910 self
4911 }
4912
4913 /// Identifies the authorization scope for the method you are building.
4914 ///
4915 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4916 /// [`Scope::CloudPlatform`].
4917 ///
4918 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4919 /// tokens for more than one scope.
4920 ///
4921 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4922 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4923 /// sufficient, a read-write scope will do as well.
4924 pub fn add_scope<St>(
4925 mut self,
4926 scope: St,
4927 ) -> ProjectLocationConnectionConnectionSchemaMetadataGetActionCall<'a, C>
4928 where
4929 St: AsRef<str>,
4930 {
4931 self._scopes.insert(String::from(scope.as_ref()));
4932 self
4933 }
4934 /// Identifies the authorization scope(s) for the method you are building.
4935 ///
4936 /// See [`Self::add_scope()`] for details.
4937 pub fn add_scopes<I, St>(
4938 mut self,
4939 scopes: I,
4940 ) -> ProjectLocationConnectionConnectionSchemaMetadataGetActionCall<'a, C>
4941 where
4942 I: IntoIterator<Item = St>,
4943 St: AsRef<str>,
4944 {
4945 self._scopes
4946 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4947 self
4948 }
4949
4950 /// Removes all scopes, and no default scope will be used either.
4951 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4952 /// for details).
4953 pub fn clear_scopes(
4954 mut self,
4955 ) -> ProjectLocationConnectionConnectionSchemaMetadataGetActionCall<'a, C> {
4956 self._scopes.clear();
4957 self
4958 }
4959}
4960
4961/// Get entity type.
4962///
4963/// A builder for the *locations.connections.connectionSchemaMetadata.getEntityType* method supported by a *project* resource.
4964/// It is not used directly, but through a [`ProjectMethods`] instance.
4965///
4966/// # Example
4967///
4968/// Instantiate a resource method builder
4969///
4970/// ```test_harness,no_run
4971/// # extern crate hyper;
4972/// # extern crate hyper_rustls;
4973/// # extern crate google_connectors1 as connectors1;
4974/// # async fn dox() {
4975/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4976///
4977/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4978/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4979/// # secret,
4980/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4981/// # ).build().await.unwrap();
4982///
4983/// # let client = hyper_util::client::legacy::Client::builder(
4984/// # hyper_util::rt::TokioExecutor::new()
4985/// # )
4986/// # .build(
4987/// # hyper_rustls::HttpsConnectorBuilder::new()
4988/// # .with_native_roots()
4989/// # .unwrap()
4990/// # .https_or_http()
4991/// # .enable_http1()
4992/// # .build()
4993/// # );
4994/// # let mut hub = Connectors::new(client, auth);
4995/// // You can configure optional parameters by calling the respective setters at will, and
4996/// // execute the final call using `doit()`.
4997/// // Values shown here are possibly random and not representative !
4998/// let result = hub.projects().locations_connections_connection_schema_metadata_get_entity_type("name")
4999/// .entity_id("takimata")
5000/// .doit().await;
5001/// # }
5002/// ```
5003pub struct ProjectLocationConnectionConnectionSchemaMetadataGetEntityTypeCall<'a, C>
5004where
5005 C: 'a,
5006{
5007 hub: &'a Connectors<C>,
5008 _name: String,
5009 _entity_id: Option<String>,
5010 _delegate: Option<&'a mut dyn common::Delegate>,
5011 _additional_params: HashMap<String, String>,
5012 _scopes: BTreeSet<String>,
5013}
5014
5015impl<'a, C> common::CallBuilder
5016 for ProjectLocationConnectionConnectionSchemaMetadataGetEntityTypeCall<'a, C>
5017{
5018}
5019
5020impl<'a, C> ProjectLocationConnectionConnectionSchemaMetadataGetEntityTypeCall<'a, C>
5021where
5022 C: common::Connector,
5023{
5024 /// Perform the operation you have build so far.
5025 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5026 use std::borrow::Cow;
5027 use std::io::{Read, Seek};
5028
5029 use common::{url::Params, ToParts};
5030 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5031
5032 let mut dd = common::DefaultDelegate;
5033 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5034 dlg.begin(common::MethodInfo {
5035 id: "connectors.projects.locations.connections.connectionSchemaMetadata.getEntityType",
5036 http_method: hyper::Method::GET,
5037 });
5038
5039 for &field in ["alt", "name", "entityId"].iter() {
5040 if self._additional_params.contains_key(field) {
5041 dlg.finished(false);
5042 return Err(common::Error::FieldClash(field));
5043 }
5044 }
5045
5046 let mut params = Params::with_capacity(4 + self._additional_params.len());
5047 params.push("name", self._name);
5048 if let Some(value) = self._entity_id.as_ref() {
5049 params.push("entityId", value);
5050 }
5051
5052 params.extend(self._additional_params.iter());
5053
5054 params.push("alt", "json");
5055 let mut url = self.hub._base_url.clone() + "v1/{+name}:getEntityType";
5056 if self._scopes.is_empty() {
5057 self._scopes
5058 .insert(Scope::CloudPlatform.as_ref().to_string());
5059 }
5060
5061 #[allow(clippy::single_element_loop)]
5062 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5063 url = params.uri_replacement(url, param_name, find_this, true);
5064 }
5065 {
5066 let to_remove = ["name"];
5067 params.remove_params(&to_remove);
5068 }
5069
5070 let url = params.parse_with_url(&url);
5071
5072 loop {
5073 let token = match self
5074 .hub
5075 .auth
5076 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5077 .await
5078 {
5079 Ok(token) => token,
5080 Err(e) => match dlg.token(e) {
5081 Ok(token) => token,
5082 Err(e) => {
5083 dlg.finished(false);
5084 return Err(common::Error::MissingToken(e));
5085 }
5086 },
5087 };
5088 let mut req_result = {
5089 let client = &self.hub.client;
5090 dlg.pre_request();
5091 let mut req_builder = hyper::Request::builder()
5092 .method(hyper::Method::GET)
5093 .uri(url.as_str())
5094 .header(USER_AGENT, self.hub._user_agent.clone());
5095
5096 if let Some(token) = token.as_ref() {
5097 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5098 }
5099
5100 let request = req_builder
5101 .header(CONTENT_LENGTH, 0_u64)
5102 .body(common::to_body::<String>(None));
5103
5104 client.request(request.unwrap()).await
5105 };
5106
5107 match req_result {
5108 Err(err) => {
5109 if let common::Retry::After(d) = dlg.http_error(&err) {
5110 sleep(d).await;
5111 continue;
5112 }
5113 dlg.finished(false);
5114 return Err(common::Error::HttpError(err));
5115 }
5116 Ok(res) => {
5117 let (mut parts, body) = res.into_parts();
5118 let mut body = common::Body::new(body);
5119 if !parts.status.is_success() {
5120 let bytes = common::to_bytes(body).await.unwrap_or_default();
5121 let error = serde_json::from_str(&common::to_string(&bytes));
5122 let response = common::to_response(parts, bytes.into());
5123
5124 if let common::Retry::After(d) =
5125 dlg.http_failure(&response, error.as_ref().ok())
5126 {
5127 sleep(d).await;
5128 continue;
5129 }
5130
5131 dlg.finished(false);
5132
5133 return Err(match error {
5134 Ok(value) => common::Error::BadRequest(value),
5135 _ => common::Error::Failure(response),
5136 });
5137 }
5138 let response = {
5139 let bytes = common::to_bytes(body).await.unwrap_or_default();
5140 let encoded = common::to_string(&bytes);
5141 match serde_json::from_str(&encoded) {
5142 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5143 Err(error) => {
5144 dlg.response_json_decode_error(&encoded, &error);
5145 return Err(common::Error::JsonDecodeError(
5146 encoded.to_string(),
5147 error,
5148 ));
5149 }
5150 }
5151 };
5152
5153 dlg.finished(true);
5154 return Ok(response);
5155 }
5156 }
5157 }
5158 }
5159
5160 /// Required. Resource name format: projects/{project}/locations/{location}/connections/{connection}/connectionSchemaMetadata
5161 ///
5162 /// Sets the *name* path property to the given value.
5163 ///
5164 /// Even though the property as already been set when instantiating this call,
5165 /// we provide this method for API completeness.
5166 pub fn name(
5167 mut self,
5168 new_value: &str,
5169 ) -> ProjectLocationConnectionConnectionSchemaMetadataGetEntityTypeCall<'a, C> {
5170 self._name = new_value.to_string();
5171 self
5172 }
5173 /// Required. Id of the entity type.
5174 ///
5175 /// Sets the *entity id* query property to the given value.
5176 pub fn entity_id(
5177 mut self,
5178 new_value: &str,
5179 ) -> ProjectLocationConnectionConnectionSchemaMetadataGetEntityTypeCall<'a, C> {
5180 self._entity_id = Some(new_value.to_string());
5181 self
5182 }
5183 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5184 /// while executing the actual API request.
5185 ///
5186 /// ````text
5187 /// It should be used to handle progress information, and to implement a certain level of resilience.
5188 /// ````
5189 ///
5190 /// Sets the *delegate* property to the given value.
5191 pub fn delegate(
5192 mut self,
5193 new_value: &'a mut dyn common::Delegate,
5194 ) -> ProjectLocationConnectionConnectionSchemaMetadataGetEntityTypeCall<'a, C> {
5195 self._delegate = Some(new_value);
5196 self
5197 }
5198
5199 /// Set any additional parameter of the query string used in the request.
5200 /// It should be used to set parameters which are not yet available through their own
5201 /// setters.
5202 ///
5203 /// Please note that this method must not be used to set any of the known parameters
5204 /// which have their own setter method. If done anyway, the request will fail.
5205 ///
5206 /// # Additional Parameters
5207 ///
5208 /// * *$.xgafv* (query-string) - V1 error format.
5209 /// * *access_token* (query-string) - OAuth access token.
5210 /// * *alt* (query-string) - Data format for response.
5211 /// * *callback* (query-string) - JSONP
5212 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5213 /// * *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.
5214 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5215 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5216 /// * *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.
5217 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5218 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5219 pub fn param<T>(
5220 mut self,
5221 name: T,
5222 value: T,
5223 ) -> ProjectLocationConnectionConnectionSchemaMetadataGetEntityTypeCall<'a, C>
5224 where
5225 T: AsRef<str>,
5226 {
5227 self._additional_params
5228 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5229 self
5230 }
5231
5232 /// Identifies the authorization scope for the method you are building.
5233 ///
5234 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5235 /// [`Scope::CloudPlatform`].
5236 ///
5237 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5238 /// tokens for more than one scope.
5239 ///
5240 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5241 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5242 /// sufficient, a read-write scope will do as well.
5243 pub fn add_scope<St>(
5244 mut self,
5245 scope: St,
5246 ) -> ProjectLocationConnectionConnectionSchemaMetadataGetEntityTypeCall<'a, C>
5247 where
5248 St: AsRef<str>,
5249 {
5250 self._scopes.insert(String::from(scope.as_ref()));
5251 self
5252 }
5253 /// Identifies the authorization scope(s) for the method you are building.
5254 ///
5255 /// See [`Self::add_scope()`] for details.
5256 pub fn add_scopes<I, St>(
5257 mut self,
5258 scopes: I,
5259 ) -> ProjectLocationConnectionConnectionSchemaMetadataGetEntityTypeCall<'a, C>
5260 where
5261 I: IntoIterator<Item = St>,
5262 St: AsRef<str>,
5263 {
5264 self._scopes
5265 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5266 self
5267 }
5268
5269 /// Removes all scopes, and no default scope will be used either.
5270 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5271 /// for details).
5272 pub fn clear_scopes(
5273 mut self,
5274 ) -> ProjectLocationConnectionConnectionSchemaMetadataGetEntityTypeCall<'a, C> {
5275 self._scopes.clear();
5276 self
5277 }
5278}
5279
5280/// List actions.
5281///
5282/// A builder for the *locations.connections.connectionSchemaMetadata.listActions* method supported by a *project* resource.
5283/// It is not used directly, but through a [`ProjectMethods`] instance.
5284///
5285/// # Example
5286///
5287/// Instantiate a resource method builder
5288///
5289/// ```test_harness,no_run
5290/// # extern crate hyper;
5291/// # extern crate hyper_rustls;
5292/// # extern crate google_connectors1 as connectors1;
5293/// # async fn dox() {
5294/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5295///
5296/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5297/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5298/// # secret,
5299/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5300/// # ).build().await.unwrap();
5301///
5302/// # let client = hyper_util::client::legacy::Client::builder(
5303/// # hyper_util::rt::TokioExecutor::new()
5304/// # )
5305/// # .build(
5306/// # hyper_rustls::HttpsConnectorBuilder::new()
5307/// # .with_native_roots()
5308/// # .unwrap()
5309/// # .https_or_http()
5310/// # .enable_http1()
5311/// # .build()
5312/// # );
5313/// # let mut hub = Connectors::new(client, auth);
5314/// // You can configure optional parameters by calling the respective setters at will, and
5315/// // execute the final call using `doit()`.
5316/// // Values shown here are possibly random and not representative !
5317/// let result = hub.projects().locations_connections_connection_schema_metadata_list_actions("name")
5318/// .view("duo")
5319/// .page_token("ipsum")
5320/// .page_size(-62)
5321/// .filter("Lorem")
5322/// .doit().await;
5323/// # }
5324/// ```
5325pub struct ProjectLocationConnectionConnectionSchemaMetadataListActionCall<'a, C>
5326where
5327 C: 'a,
5328{
5329 hub: &'a Connectors<C>,
5330 _name: String,
5331 _view: Option<String>,
5332 _page_token: Option<String>,
5333 _page_size: Option<i32>,
5334 _filter: Option<String>,
5335 _delegate: Option<&'a mut dyn common::Delegate>,
5336 _additional_params: HashMap<String, String>,
5337 _scopes: BTreeSet<String>,
5338}
5339
5340impl<'a, C> common::CallBuilder
5341 for ProjectLocationConnectionConnectionSchemaMetadataListActionCall<'a, C>
5342{
5343}
5344
5345impl<'a, C> ProjectLocationConnectionConnectionSchemaMetadataListActionCall<'a, C>
5346where
5347 C: common::Connector,
5348{
5349 /// Perform the operation you have build so far.
5350 pub async fn doit(mut self) -> common::Result<(common::Response, ListActionsResponse)> {
5351 use std::borrow::Cow;
5352 use std::io::{Read, Seek};
5353
5354 use common::{url::Params, ToParts};
5355 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5356
5357 let mut dd = common::DefaultDelegate;
5358 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5359 dlg.begin(common::MethodInfo {
5360 id: "connectors.projects.locations.connections.connectionSchemaMetadata.listActions",
5361 http_method: hyper::Method::GET,
5362 });
5363
5364 for &field in ["alt", "name", "view", "pageToken", "pageSize", "filter"].iter() {
5365 if self._additional_params.contains_key(field) {
5366 dlg.finished(false);
5367 return Err(common::Error::FieldClash(field));
5368 }
5369 }
5370
5371 let mut params = Params::with_capacity(7 + self._additional_params.len());
5372 params.push("name", self._name);
5373 if let Some(value) = self._view.as_ref() {
5374 params.push("view", value);
5375 }
5376 if let Some(value) = self._page_token.as_ref() {
5377 params.push("pageToken", value);
5378 }
5379 if let Some(value) = self._page_size.as_ref() {
5380 params.push("pageSize", value.to_string());
5381 }
5382 if let Some(value) = self._filter.as_ref() {
5383 params.push("filter", value);
5384 }
5385
5386 params.extend(self._additional_params.iter());
5387
5388 params.push("alt", "json");
5389 let mut url = self.hub._base_url.clone() + "v1/{+name}:listActions";
5390 if self._scopes.is_empty() {
5391 self._scopes
5392 .insert(Scope::CloudPlatform.as_ref().to_string());
5393 }
5394
5395 #[allow(clippy::single_element_loop)]
5396 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5397 url = params.uri_replacement(url, param_name, find_this, true);
5398 }
5399 {
5400 let to_remove = ["name"];
5401 params.remove_params(&to_remove);
5402 }
5403
5404 let url = params.parse_with_url(&url);
5405
5406 loop {
5407 let token = match self
5408 .hub
5409 .auth
5410 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5411 .await
5412 {
5413 Ok(token) => token,
5414 Err(e) => match dlg.token(e) {
5415 Ok(token) => token,
5416 Err(e) => {
5417 dlg.finished(false);
5418 return Err(common::Error::MissingToken(e));
5419 }
5420 },
5421 };
5422 let mut req_result = {
5423 let client = &self.hub.client;
5424 dlg.pre_request();
5425 let mut req_builder = hyper::Request::builder()
5426 .method(hyper::Method::GET)
5427 .uri(url.as_str())
5428 .header(USER_AGENT, self.hub._user_agent.clone());
5429
5430 if let Some(token) = token.as_ref() {
5431 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5432 }
5433
5434 let request = req_builder
5435 .header(CONTENT_LENGTH, 0_u64)
5436 .body(common::to_body::<String>(None));
5437
5438 client.request(request.unwrap()).await
5439 };
5440
5441 match req_result {
5442 Err(err) => {
5443 if let common::Retry::After(d) = dlg.http_error(&err) {
5444 sleep(d).await;
5445 continue;
5446 }
5447 dlg.finished(false);
5448 return Err(common::Error::HttpError(err));
5449 }
5450 Ok(res) => {
5451 let (mut parts, body) = res.into_parts();
5452 let mut body = common::Body::new(body);
5453 if !parts.status.is_success() {
5454 let bytes = common::to_bytes(body).await.unwrap_or_default();
5455 let error = serde_json::from_str(&common::to_string(&bytes));
5456 let response = common::to_response(parts, bytes.into());
5457
5458 if let common::Retry::After(d) =
5459 dlg.http_failure(&response, error.as_ref().ok())
5460 {
5461 sleep(d).await;
5462 continue;
5463 }
5464
5465 dlg.finished(false);
5466
5467 return Err(match error {
5468 Ok(value) => common::Error::BadRequest(value),
5469 _ => common::Error::Failure(response),
5470 });
5471 }
5472 let response = {
5473 let bytes = common::to_bytes(body).await.unwrap_or_default();
5474 let encoded = common::to_string(&bytes);
5475 match serde_json::from_str(&encoded) {
5476 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5477 Err(error) => {
5478 dlg.response_json_decode_error(&encoded, &error);
5479 return Err(common::Error::JsonDecodeError(
5480 encoded.to_string(),
5481 error,
5482 ));
5483 }
5484 }
5485 };
5486
5487 dlg.finished(true);
5488 return Ok(response);
5489 }
5490 }
5491 }
5492 }
5493
5494 /// Required. Resource name format. projects/{project}/locations/{location}/connections/{connection}/connectionSchemaMetadata
5495 ///
5496 /// Sets the *name* path property to the given value.
5497 ///
5498 /// Even though the property as already been set when instantiating this call,
5499 /// we provide this method for API completeness.
5500 pub fn name(
5501 mut self,
5502 new_value: &str,
5503 ) -> ProjectLocationConnectionConnectionSchemaMetadataListActionCall<'a, C> {
5504 self._name = new_value.to_string();
5505 self
5506 }
5507 /// Specifies which fields are returned in response. Defaults to BASIC view.
5508 ///
5509 /// Sets the *view* query property to the given value.
5510 pub fn view(
5511 mut self,
5512 new_value: &str,
5513 ) -> ProjectLocationConnectionConnectionSchemaMetadataListActionCall<'a, C> {
5514 self._view = Some(new_value.to_string());
5515 self
5516 }
5517 /// Page token.
5518 ///
5519 /// Sets the *page token* query property to the given value.
5520 pub fn page_token(
5521 mut self,
5522 new_value: &str,
5523 ) -> ProjectLocationConnectionConnectionSchemaMetadataListActionCall<'a, C> {
5524 self._page_token = Some(new_value.to_string());
5525 self
5526 }
5527 /// Page size. If unspecified, at most 50 actions will be returned.
5528 ///
5529 /// Sets the *page size* query property to the given value.
5530 pub fn page_size(
5531 mut self,
5532 new_value: i32,
5533 ) -> ProjectLocationConnectionConnectionSchemaMetadataListActionCall<'a, C> {
5534 self._page_size = Some(new_value);
5535 self
5536 }
5537 /// Required. Filter Wildcards are not supported in the filter currently.
5538 ///
5539 /// Sets the *filter* query property to the given value.
5540 pub fn filter(
5541 mut self,
5542 new_value: &str,
5543 ) -> ProjectLocationConnectionConnectionSchemaMetadataListActionCall<'a, C> {
5544 self._filter = Some(new_value.to_string());
5545 self
5546 }
5547 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5548 /// while executing the actual API request.
5549 ///
5550 /// ````text
5551 /// It should be used to handle progress information, and to implement a certain level of resilience.
5552 /// ````
5553 ///
5554 /// Sets the *delegate* property to the given value.
5555 pub fn delegate(
5556 mut self,
5557 new_value: &'a mut dyn common::Delegate,
5558 ) -> ProjectLocationConnectionConnectionSchemaMetadataListActionCall<'a, C> {
5559 self._delegate = Some(new_value);
5560 self
5561 }
5562
5563 /// Set any additional parameter of the query string used in the request.
5564 /// It should be used to set parameters which are not yet available through their own
5565 /// setters.
5566 ///
5567 /// Please note that this method must not be used to set any of the known parameters
5568 /// which have their own setter method. If done anyway, the request will fail.
5569 ///
5570 /// # Additional Parameters
5571 ///
5572 /// * *$.xgafv* (query-string) - V1 error format.
5573 /// * *access_token* (query-string) - OAuth access token.
5574 /// * *alt* (query-string) - Data format for response.
5575 /// * *callback* (query-string) - JSONP
5576 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5577 /// * *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.
5578 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5579 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5580 /// * *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.
5581 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5582 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5583 pub fn param<T>(
5584 mut self,
5585 name: T,
5586 value: T,
5587 ) -> ProjectLocationConnectionConnectionSchemaMetadataListActionCall<'a, C>
5588 where
5589 T: AsRef<str>,
5590 {
5591 self._additional_params
5592 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5593 self
5594 }
5595
5596 /// Identifies the authorization scope for the method you are building.
5597 ///
5598 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5599 /// [`Scope::CloudPlatform`].
5600 ///
5601 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5602 /// tokens for more than one scope.
5603 ///
5604 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5605 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5606 /// sufficient, a read-write scope will do as well.
5607 pub fn add_scope<St>(
5608 mut self,
5609 scope: St,
5610 ) -> ProjectLocationConnectionConnectionSchemaMetadataListActionCall<'a, C>
5611 where
5612 St: AsRef<str>,
5613 {
5614 self._scopes.insert(String::from(scope.as_ref()));
5615 self
5616 }
5617 /// Identifies the authorization scope(s) for the method you are building.
5618 ///
5619 /// See [`Self::add_scope()`] for details.
5620 pub fn add_scopes<I, St>(
5621 mut self,
5622 scopes: I,
5623 ) -> ProjectLocationConnectionConnectionSchemaMetadataListActionCall<'a, C>
5624 where
5625 I: IntoIterator<Item = St>,
5626 St: AsRef<str>,
5627 {
5628 self._scopes
5629 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5630 self
5631 }
5632
5633 /// Removes all scopes, and no default scope will be used either.
5634 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5635 /// for details).
5636 pub fn clear_scopes(
5637 mut self,
5638 ) -> ProjectLocationConnectionConnectionSchemaMetadataListActionCall<'a, C> {
5639 self._scopes.clear();
5640 self
5641 }
5642}
5643
5644/// List entity types.
5645///
5646/// A builder for the *locations.connections.connectionSchemaMetadata.listEntityTypes* method supported by a *project* resource.
5647/// It is not used directly, but through a [`ProjectMethods`] instance.
5648///
5649/// # Example
5650///
5651/// Instantiate a resource method builder
5652///
5653/// ```test_harness,no_run
5654/// # extern crate hyper;
5655/// # extern crate hyper_rustls;
5656/// # extern crate google_connectors1 as connectors1;
5657/// # async fn dox() {
5658/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5659///
5660/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5661/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5662/// # secret,
5663/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5664/// # ).build().await.unwrap();
5665///
5666/// # let client = hyper_util::client::legacy::Client::builder(
5667/// # hyper_util::rt::TokioExecutor::new()
5668/// # )
5669/// # .build(
5670/// # hyper_rustls::HttpsConnectorBuilder::new()
5671/// # .with_native_roots()
5672/// # .unwrap()
5673/// # .https_or_http()
5674/// # .enable_http1()
5675/// # .build()
5676/// # );
5677/// # let mut hub = Connectors::new(client, auth);
5678/// // You can configure optional parameters by calling the respective setters at will, and
5679/// // execute the final call using `doit()`.
5680/// // Values shown here are possibly random and not representative !
5681/// let result = hub.projects().locations_connections_connection_schema_metadata_list_entity_types("name")
5682/// .view("eos")
5683/// .page_token("dolor")
5684/// .page_size(-17)
5685/// .filter("ipsum")
5686/// .doit().await;
5687/// # }
5688/// ```
5689pub struct ProjectLocationConnectionConnectionSchemaMetadataListEntityTypeCall<'a, C>
5690where
5691 C: 'a,
5692{
5693 hub: &'a Connectors<C>,
5694 _name: String,
5695 _view: Option<String>,
5696 _page_token: Option<String>,
5697 _page_size: Option<i32>,
5698 _filter: Option<String>,
5699 _delegate: Option<&'a mut dyn common::Delegate>,
5700 _additional_params: HashMap<String, String>,
5701 _scopes: BTreeSet<String>,
5702}
5703
5704impl<'a, C> common::CallBuilder
5705 for ProjectLocationConnectionConnectionSchemaMetadataListEntityTypeCall<'a, C>
5706{
5707}
5708
5709impl<'a, C> ProjectLocationConnectionConnectionSchemaMetadataListEntityTypeCall<'a, C>
5710where
5711 C: common::Connector,
5712{
5713 /// Perform the operation you have build so far.
5714 pub async fn doit(mut self) -> common::Result<(common::Response, ListEntityTypesResponse)> {
5715 use std::borrow::Cow;
5716 use std::io::{Read, Seek};
5717
5718 use common::{url::Params, ToParts};
5719 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5720
5721 let mut dd = common::DefaultDelegate;
5722 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5723 dlg.begin(common::MethodInfo { id: "connectors.projects.locations.connections.connectionSchemaMetadata.listEntityTypes",
5724 http_method: hyper::Method::GET });
5725
5726 for &field in ["alt", "name", "view", "pageToken", "pageSize", "filter"].iter() {
5727 if self._additional_params.contains_key(field) {
5728 dlg.finished(false);
5729 return Err(common::Error::FieldClash(field));
5730 }
5731 }
5732
5733 let mut params = Params::with_capacity(7 + self._additional_params.len());
5734 params.push("name", self._name);
5735 if let Some(value) = self._view.as_ref() {
5736 params.push("view", value);
5737 }
5738 if let Some(value) = self._page_token.as_ref() {
5739 params.push("pageToken", value);
5740 }
5741 if let Some(value) = self._page_size.as_ref() {
5742 params.push("pageSize", value.to_string());
5743 }
5744 if let Some(value) = self._filter.as_ref() {
5745 params.push("filter", value);
5746 }
5747
5748 params.extend(self._additional_params.iter());
5749
5750 params.push("alt", "json");
5751 let mut url = self.hub._base_url.clone() + "v1/{+name}:listEntityTypes";
5752 if self._scopes.is_empty() {
5753 self._scopes
5754 .insert(Scope::CloudPlatform.as_ref().to_string());
5755 }
5756
5757 #[allow(clippy::single_element_loop)]
5758 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5759 url = params.uri_replacement(url, param_name, find_this, true);
5760 }
5761 {
5762 let to_remove = ["name"];
5763 params.remove_params(&to_remove);
5764 }
5765
5766 let url = params.parse_with_url(&url);
5767
5768 loop {
5769 let token = match self
5770 .hub
5771 .auth
5772 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5773 .await
5774 {
5775 Ok(token) => token,
5776 Err(e) => match dlg.token(e) {
5777 Ok(token) => token,
5778 Err(e) => {
5779 dlg.finished(false);
5780 return Err(common::Error::MissingToken(e));
5781 }
5782 },
5783 };
5784 let mut req_result = {
5785 let client = &self.hub.client;
5786 dlg.pre_request();
5787 let mut req_builder = hyper::Request::builder()
5788 .method(hyper::Method::GET)
5789 .uri(url.as_str())
5790 .header(USER_AGENT, self.hub._user_agent.clone());
5791
5792 if let Some(token) = token.as_ref() {
5793 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5794 }
5795
5796 let request = req_builder
5797 .header(CONTENT_LENGTH, 0_u64)
5798 .body(common::to_body::<String>(None));
5799
5800 client.request(request.unwrap()).await
5801 };
5802
5803 match req_result {
5804 Err(err) => {
5805 if let common::Retry::After(d) = dlg.http_error(&err) {
5806 sleep(d).await;
5807 continue;
5808 }
5809 dlg.finished(false);
5810 return Err(common::Error::HttpError(err));
5811 }
5812 Ok(res) => {
5813 let (mut parts, body) = res.into_parts();
5814 let mut body = common::Body::new(body);
5815 if !parts.status.is_success() {
5816 let bytes = common::to_bytes(body).await.unwrap_or_default();
5817 let error = serde_json::from_str(&common::to_string(&bytes));
5818 let response = common::to_response(parts, bytes.into());
5819
5820 if let common::Retry::After(d) =
5821 dlg.http_failure(&response, error.as_ref().ok())
5822 {
5823 sleep(d).await;
5824 continue;
5825 }
5826
5827 dlg.finished(false);
5828
5829 return Err(match error {
5830 Ok(value) => common::Error::BadRequest(value),
5831 _ => common::Error::Failure(response),
5832 });
5833 }
5834 let response = {
5835 let bytes = common::to_bytes(body).await.unwrap_or_default();
5836 let encoded = common::to_string(&bytes);
5837 match serde_json::from_str(&encoded) {
5838 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5839 Err(error) => {
5840 dlg.response_json_decode_error(&encoded, &error);
5841 return Err(common::Error::JsonDecodeError(
5842 encoded.to_string(),
5843 error,
5844 ));
5845 }
5846 }
5847 };
5848
5849 dlg.finished(true);
5850 return Ok(response);
5851 }
5852 }
5853 }
5854 }
5855
5856 /// Required. Resource name format: projects/{project}/locations/{location}/connections/{connection}/connectionSchemaMetadata
5857 ///
5858 /// Sets the *name* path property to the given value.
5859 ///
5860 /// Even though the property as already been set when instantiating this call,
5861 /// we provide this method for API completeness.
5862 pub fn name(
5863 mut self,
5864 new_value: &str,
5865 ) -> ProjectLocationConnectionConnectionSchemaMetadataListEntityTypeCall<'a, C> {
5866 self._name = new_value.to_string();
5867 self
5868 }
5869 /// Specifies which fields are returned in response. Defaults to BASIC view.
5870 ///
5871 /// Sets the *view* query property to the given value.
5872 pub fn view(
5873 mut self,
5874 new_value: &str,
5875 ) -> ProjectLocationConnectionConnectionSchemaMetadataListEntityTypeCall<'a, C> {
5876 self._view = Some(new_value.to_string());
5877 self
5878 }
5879 /// Page token.
5880 ///
5881 /// Sets the *page token* query property to the given value.
5882 pub fn page_token(
5883 mut self,
5884 new_value: &str,
5885 ) -> ProjectLocationConnectionConnectionSchemaMetadataListEntityTypeCall<'a, C> {
5886 self._page_token = Some(new_value.to_string());
5887 self
5888 }
5889 /// Page size. If unspecified, at most 50 entity types will be returned.
5890 ///
5891 /// Sets the *page size* query property to the given value.
5892 pub fn page_size(
5893 mut self,
5894 new_value: i32,
5895 ) -> ProjectLocationConnectionConnectionSchemaMetadataListEntityTypeCall<'a, C> {
5896 self._page_size = Some(new_value);
5897 self
5898 }
5899 /// Required. Filter Wildcards are not supported in the filter currently.
5900 ///
5901 /// Sets the *filter* query property to the given value.
5902 pub fn filter(
5903 mut self,
5904 new_value: &str,
5905 ) -> ProjectLocationConnectionConnectionSchemaMetadataListEntityTypeCall<'a, C> {
5906 self._filter = Some(new_value.to_string());
5907 self
5908 }
5909 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5910 /// while executing the actual API request.
5911 ///
5912 /// ````text
5913 /// It should be used to handle progress information, and to implement a certain level of resilience.
5914 /// ````
5915 ///
5916 /// Sets the *delegate* property to the given value.
5917 pub fn delegate(
5918 mut self,
5919 new_value: &'a mut dyn common::Delegate,
5920 ) -> ProjectLocationConnectionConnectionSchemaMetadataListEntityTypeCall<'a, C> {
5921 self._delegate = Some(new_value);
5922 self
5923 }
5924
5925 /// Set any additional parameter of the query string used in the request.
5926 /// It should be used to set parameters which are not yet available through their own
5927 /// setters.
5928 ///
5929 /// Please note that this method must not be used to set any of the known parameters
5930 /// which have their own setter method. If done anyway, the request will fail.
5931 ///
5932 /// # Additional Parameters
5933 ///
5934 /// * *$.xgafv* (query-string) - V1 error format.
5935 /// * *access_token* (query-string) - OAuth access token.
5936 /// * *alt* (query-string) - Data format for response.
5937 /// * *callback* (query-string) - JSONP
5938 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5939 /// * *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.
5940 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5941 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5942 /// * *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.
5943 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5944 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5945 pub fn param<T>(
5946 mut self,
5947 name: T,
5948 value: T,
5949 ) -> ProjectLocationConnectionConnectionSchemaMetadataListEntityTypeCall<'a, C>
5950 where
5951 T: AsRef<str>,
5952 {
5953 self._additional_params
5954 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5955 self
5956 }
5957
5958 /// Identifies the authorization scope for the method you are building.
5959 ///
5960 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5961 /// [`Scope::CloudPlatform`].
5962 ///
5963 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5964 /// tokens for more than one scope.
5965 ///
5966 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5967 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5968 /// sufficient, a read-write scope will do as well.
5969 pub fn add_scope<St>(
5970 mut self,
5971 scope: St,
5972 ) -> ProjectLocationConnectionConnectionSchemaMetadataListEntityTypeCall<'a, C>
5973 where
5974 St: AsRef<str>,
5975 {
5976 self._scopes.insert(String::from(scope.as_ref()));
5977 self
5978 }
5979 /// Identifies the authorization scope(s) for the method you are building.
5980 ///
5981 /// See [`Self::add_scope()`] for details.
5982 pub fn add_scopes<I, St>(
5983 mut self,
5984 scopes: I,
5985 ) -> ProjectLocationConnectionConnectionSchemaMetadataListEntityTypeCall<'a, C>
5986 where
5987 I: IntoIterator<Item = St>,
5988 St: AsRef<str>,
5989 {
5990 self._scopes
5991 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5992 self
5993 }
5994
5995 /// Removes all scopes, and no default scope will be used either.
5996 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5997 /// for details).
5998 pub fn clear_scopes(
5999 mut self,
6000 ) -> ProjectLocationConnectionConnectionSchemaMetadataListEntityTypeCall<'a, C> {
6001 self._scopes.clear();
6002 self
6003 }
6004}
6005
6006/// Refresh runtime schema of a connection.
6007///
6008/// A builder for the *locations.connections.connectionSchemaMetadata.refresh* method supported by a *project* resource.
6009/// It is not used directly, but through a [`ProjectMethods`] instance.
6010///
6011/// # Example
6012///
6013/// Instantiate a resource method builder
6014///
6015/// ```test_harness,no_run
6016/// # extern crate hyper;
6017/// # extern crate hyper_rustls;
6018/// # extern crate google_connectors1 as connectors1;
6019/// use connectors1::api::RefreshConnectionSchemaMetadataRequest;
6020/// # async fn dox() {
6021/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6022///
6023/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6024/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6025/// # secret,
6026/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6027/// # ).build().await.unwrap();
6028///
6029/// # let client = hyper_util::client::legacy::Client::builder(
6030/// # hyper_util::rt::TokioExecutor::new()
6031/// # )
6032/// # .build(
6033/// # hyper_rustls::HttpsConnectorBuilder::new()
6034/// # .with_native_roots()
6035/// # .unwrap()
6036/// # .https_or_http()
6037/// # .enable_http1()
6038/// # .build()
6039/// # );
6040/// # let mut hub = Connectors::new(client, auth);
6041/// // As the method needs a request, you would usually fill it with the desired information
6042/// // into the respective structure. Some of the parts shown here might not be applicable !
6043/// // Values shown here are possibly random and not representative !
6044/// let mut req = RefreshConnectionSchemaMetadataRequest::default();
6045///
6046/// // You can configure optional parameters by calling the respective setters at will, and
6047/// // execute the final call using `doit()`.
6048/// // Values shown here are possibly random and not representative !
6049/// let result = hub.projects().locations_connections_connection_schema_metadata_refresh(req, "name")
6050/// .doit().await;
6051/// # }
6052/// ```
6053pub struct ProjectLocationConnectionConnectionSchemaMetadataRefreshCall<'a, C>
6054where
6055 C: 'a,
6056{
6057 hub: &'a Connectors<C>,
6058 _request: RefreshConnectionSchemaMetadataRequest,
6059 _name: String,
6060 _delegate: Option<&'a mut dyn common::Delegate>,
6061 _additional_params: HashMap<String, String>,
6062 _scopes: BTreeSet<String>,
6063}
6064
6065impl<'a, C> common::CallBuilder
6066 for ProjectLocationConnectionConnectionSchemaMetadataRefreshCall<'a, C>
6067{
6068}
6069
6070impl<'a, C> ProjectLocationConnectionConnectionSchemaMetadataRefreshCall<'a, C>
6071where
6072 C: common::Connector,
6073{
6074 /// Perform the operation you have build so far.
6075 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6076 use std::borrow::Cow;
6077 use std::io::{Read, Seek};
6078
6079 use common::{url::Params, ToParts};
6080 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6081
6082 let mut dd = common::DefaultDelegate;
6083 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6084 dlg.begin(common::MethodInfo {
6085 id: "connectors.projects.locations.connections.connectionSchemaMetadata.refresh",
6086 http_method: hyper::Method::POST,
6087 });
6088
6089 for &field in ["alt", "name"].iter() {
6090 if self._additional_params.contains_key(field) {
6091 dlg.finished(false);
6092 return Err(common::Error::FieldClash(field));
6093 }
6094 }
6095
6096 let mut params = Params::with_capacity(4 + self._additional_params.len());
6097 params.push("name", self._name);
6098
6099 params.extend(self._additional_params.iter());
6100
6101 params.push("alt", "json");
6102 let mut url = self.hub._base_url.clone() + "v1/{+name}:refresh";
6103 if self._scopes.is_empty() {
6104 self._scopes
6105 .insert(Scope::CloudPlatform.as_ref().to_string());
6106 }
6107
6108 #[allow(clippy::single_element_loop)]
6109 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6110 url = params.uri_replacement(url, param_name, find_this, true);
6111 }
6112 {
6113 let to_remove = ["name"];
6114 params.remove_params(&to_remove);
6115 }
6116
6117 let url = params.parse_with_url(&url);
6118
6119 let mut json_mime_type = mime::APPLICATION_JSON;
6120 let mut request_value_reader = {
6121 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6122 common::remove_json_null_values(&mut value);
6123 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6124 serde_json::to_writer(&mut dst, &value).unwrap();
6125 dst
6126 };
6127 let request_size = request_value_reader
6128 .seek(std::io::SeekFrom::End(0))
6129 .unwrap();
6130 request_value_reader
6131 .seek(std::io::SeekFrom::Start(0))
6132 .unwrap();
6133
6134 loop {
6135 let token = match self
6136 .hub
6137 .auth
6138 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6139 .await
6140 {
6141 Ok(token) => token,
6142 Err(e) => match dlg.token(e) {
6143 Ok(token) => token,
6144 Err(e) => {
6145 dlg.finished(false);
6146 return Err(common::Error::MissingToken(e));
6147 }
6148 },
6149 };
6150 request_value_reader
6151 .seek(std::io::SeekFrom::Start(0))
6152 .unwrap();
6153 let mut req_result = {
6154 let client = &self.hub.client;
6155 dlg.pre_request();
6156 let mut req_builder = hyper::Request::builder()
6157 .method(hyper::Method::POST)
6158 .uri(url.as_str())
6159 .header(USER_AGENT, self.hub._user_agent.clone());
6160
6161 if let Some(token) = token.as_ref() {
6162 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6163 }
6164
6165 let request = req_builder
6166 .header(CONTENT_TYPE, json_mime_type.to_string())
6167 .header(CONTENT_LENGTH, request_size as u64)
6168 .body(common::to_body(
6169 request_value_reader.get_ref().clone().into(),
6170 ));
6171
6172 client.request(request.unwrap()).await
6173 };
6174
6175 match req_result {
6176 Err(err) => {
6177 if let common::Retry::After(d) = dlg.http_error(&err) {
6178 sleep(d).await;
6179 continue;
6180 }
6181 dlg.finished(false);
6182 return Err(common::Error::HttpError(err));
6183 }
6184 Ok(res) => {
6185 let (mut parts, body) = res.into_parts();
6186 let mut body = common::Body::new(body);
6187 if !parts.status.is_success() {
6188 let bytes = common::to_bytes(body).await.unwrap_or_default();
6189 let error = serde_json::from_str(&common::to_string(&bytes));
6190 let response = common::to_response(parts, bytes.into());
6191
6192 if let common::Retry::After(d) =
6193 dlg.http_failure(&response, error.as_ref().ok())
6194 {
6195 sleep(d).await;
6196 continue;
6197 }
6198
6199 dlg.finished(false);
6200
6201 return Err(match error {
6202 Ok(value) => common::Error::BadRequest(value),
6203 _ => common::Error::Failure(response),
6204 });
6205 }
6206 let response = {
6207 let bytes = common::to_bytes(body).await.unwrap_or_default();
6208 let encoded = common::to_string(&bytes);
6209 match serde_json::from_str(&encoded) {
6210 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6211 Err(error) => {
6212 dlg.response_json_decode_error(&encoded, &error);
6213 return Err(common::Error::JsonDecodeError(
6214 encoded.to_string(),
6215 error,
6216 ));
6217 }
6218 }
6219 };
6220
6221 dlg.finished(true);
6222 return Ok(response);
6223 }
6224 }
6225 }
6226 }
6227
6228 ///
6229 /// Sets the *request* property to the given value.
6230 ///
6231 /// Even though the property as already been set when instantiating this call,
6232 /// we provide this method for API completeness.
6233 pub fn request(
6234 mut self,
6235 new_value: RefreshConnectionSchemaMetadataRequest,
6236 ) -> ProjectLocationConnectionConnectionSchemaMetadataRefreshCall<'a, C> {
6237 self._request = new_value;
6238 self
6239 }
6240 /// Required. Resource name. Format: projects/{project}/locations/{location}/connections/{connection}/connectionSchemaMetadata
6241 ///
6242 /// Sets the *name* path property to the given value.
6243 ///
6244 /// Even though the property as already been set when instantiating this call,
6245 /// we provide this method for API completeness.
6246 pub fn name(
6247 mut self,
6248 new_value: &str,
6249 ) -> ProjectLocationConnectionConnectionSchemaMetadataRefreshCall<'a, C> {
6250 self._name = new_value.to_string();
6251 self
6252 }
6253 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6254 /// while executing the actual API request.
6255 ///
6256 /// ````text
6257 /// It should be used to handle progress information, and to implement a certain level of resilience.
6258 /// ````
6259 ///
6260 /// Sets the *delegate* property to the given value.
6261 pub fn delegate(
6262 mut self,
6263 new_value: &'a mut dyn common::Delegate,
6264 ) -> ProjectLocationConnectionConnectionSchemaMetadataRefreshCall<'a, C> {
6265 self._delegate = Some(new_value);
6266 self
6267 }
6268
6269 /// Set any additional parameter of the query string used in the request.
6270 /// It should be used to set parameters which are not yet available through their own
6271 /// setters.
6272 ///
6273 /// Please note that this method must not be used to set any of the known parameters
6274 /// which have their own setter method. If done anyway, the request will fail.
6275 ///
6276 /// # Additional Parameters
6277 ///
6278 /// * *$.xgafv* (query-string) - V1 error format.
6279 /// * *access_token* (query-string) - OAuth access token.
6280 /// * *alt* (query-string) - Data format for response.
6281 /// * *callback* (query-string) - JSONP
6282 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6283 /// * *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.
6284 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6285 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6286 /// * *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.
6287 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6288 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6289 pub fn param<T>(
6290 mut self,
6291 name: T,
6292 value: T,
6293 ) -> ProjectLocationConnectionConnectionSchemaMetadataRefreshCall<'a, C>
6294 where
6295 T: AsRef<str>,
6296 {
6297 self._additional_params
6298 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6299 self
6300 }
6301
6302 /// Identifies the authorization scope for the method you are building.
6303 ///
6304 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6305 /// [`Scope::CloudPlatform`].
6306 ///
6307 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6308 /// tokens for more than one scope.
6309 ///
6310 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6311 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6312 /// sufficient, a read-write scope will do as well.
6313 pub fn add_scope<St>(
6314 mut self,
6315 scope: St,
6316 ) -> ProjectLocationConnectionConnectionSchemaMetadataRefreshCall<'a, C>
6317 where
6318 St: AsRef<str>,
6319 {
6320 self._scopes.insert(String::from(scope.as_ref()));
6321 self
6322 }
6323 /// Identifies the authorization scope(s) for the method you are building.
6324 ///
6325 /// See [`Self::add_scope()`] for details.
6326 pub fn add_scopes<I, St>(
6327 mut self,
6328 scopes: I,
6329 ) -> ProjectLocationConnectionConnectionSchemaMetadataRefreshCall<'a, C>
6330 where
6331 I: IntoIterator<Item = St>,
6332 St: AsRef<str>,
6333 {
6334 self._scopes
6335 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6336 self
6337 }
6338
6339 /// Removes all scopes, and no default scope will be used either.
6340 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6341 /// for details).
6342 pub fn clear_scopes(
6343 mut self,
6344 ) -> ProjectLocationConnectionConnectionSchemaMetadataRefreshCall<'a, C> {
6345 self._scopes.clear();
6346 self
6347 }
6348}
6349
6350/// Creates a new EventSubscription in a given project,location and connection.
6351///
6352/// A builder for the *locations.connections.eventSubscriptions.create* method supported by a *project* resource.
6353/// It is not used directly, but through a [`ProjectMethods`] instance.
6354///
6355/// # Example
6356///
6357/// Instantiate a resource method builder
6358///
6359/// ```test_harness,no_run
6360/// # extern crate hyper;
6361/// # extern crate hyper_rustls;
6362/// # extern crate google_connectors1 as connectors1;
6363/// use connectors1::api::EventSubscription;
6364/// # async fn dox() {
6365/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6366///
6367/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6368/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6369/// # secret,
6370/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6371/// # ).build().await.unwrap();
6372///
6373/// # let client = hyper_util::client::legacy::Client::builder(
6374/// # hyper_util::rt::TokioExecutor::new()
6375/// # )
6376/// # .build(
6377/// # hyper_rustls::HttpsConnectorBuilder::new()
6378/// # .with_native_roots()
6379/// # .unwrap()
6380/// # .https_or_http()
6381/// # .enable_http1()
6382/// # .build()
6383/// # );
6384/// # let mut hub = Connectors::new(client, auth);
6385/// // As the method needs a request, you would usually fill it with the desired information
6386/// // into the respective structure. Some of the parts shown here might not be applicable !
6387/// // Values shown here are possibly random and not representative !
6388/// let mut req = EventSubscription::default();
6389///
6390/// // You can configure optional parameters by calling the respective setters at will, and
6391/// // execute the final call using `doit()`.
6392/// // Values shown here are possibly random and not representative !
6393/// let result = hub.projects().locations_connections_event_subscriptions_create(req, "parent")
6394/// .event_subscription_id("duo")
6395/// .doit().await;
6396/// # }
6397/// ```
6398pub struct ProjectLocationConnectionEventSubscriptionCreateCall<'a, C>
6399where
6400 C: 'a,
6401{
6402 hub: &'a Connectors<C>,
6403 _request: EventSubscription,
6404 _parent: String,
6405 _event_subscription_id: Option<String>,
6406 _delegate: Option<&'a mut dyn common::Delegate>,
6407 _additional_params: HashMap<String, String>,
6408 _scopes: BTreeSet<String>,
6409}
6410
6411impl<'a, C> common::CallBuilder for ProjectLocationConnectionEventSubscriptionCreateCall<'a, C> {}
6412
6413impl<'a, C> ProjectLocationConnectionEventSubscriptionCreateCall<'a, C>
6414where
6415 C: common::Connector,
6416{
6417 /// Perform the operation you have build so far.
6418 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6419 use std::borrow::Cow;
6420 use std::io::{Read, Seek};
6421
6422 use common::{url::Params, ToParts};
6423 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6424
6425 let mut dd = common::DefaultDelegate;
6426 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6427 dlg.begin(common::MethodInfo {
6428 id: "connectors.projects.locations.connections.eventSubscriptions.create",
6429 http_method: hyper::Method::POST,
6430 });
6431
6432 for &field in ["alt", "parent", "eventSubscriptionId"].iter() {
6433 if self._additional_params.contains_key(field) {
6434 dlg.finished(false);
6435 return Err(common::Error::FieldClash(field));
6436 }
6437 }
6438
6439 let mut params = Params::with_capacity(5 + self._additional_params.len());
6440 params.push("parent", self._parent);
6441 if let Some(value) = self._event_subscription_id.as_ref() {
6442 params.push("eventSubscriptionId", value);
6443 }
6444
6445 params.extend(self._additional_params.iter());
6446
6447 params.push("alt", "json");
6448 let mut url = self.hub._base_url.clone() + "v1/{+parent}/eventSubscriptions";
6449 if self._scopes.is_empty() {
6450 self._scopes
6451 .insert(Scope::CloudPlatform.as_ref().to_string());
6452 }
6453
6454 #[allow(clippy::single_element_loop)]
6455 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6456 url = params.uri_replacement(url, param_name, find_this, true);
6457 }
6458 {
6459 let to_remove = ["parent"];
6460 params.remove_params(&to_remove);
6461 }
6462
6463 let url = params.parse_with_url(&url);
6464
6465 let mut json_mime_type = mime::APPLICATION_JSON;
6466 let mut request_value_reader = {
6467 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6468 common::remove_json_null_values(&mut value);
6469 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6470 serde_json::to_writer(&mut dst, &value).unwrap();
6471 dst
6472 };
6473 let request_size = request_value_reader
6474 .seek(std::io::SeekFrom::End(0))
6475 .unwrap();
6476 request_value_reader
6477 .seek(std::io::SeekFrom::Start(0))
6478 .unwrap();
6479
6480 loop {
6481 let token = match self
6482 .hub
6483 .auth
6484 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6485 .await
6486 {
6487 Ok(token) => token,
6488 Err(e) => match dlg.token(e) {
6489 Ok(token) => token,
6490 Err(e) => {
6491 dlg.finished(false);
6492 return Err(common::Error::MissingToken(e));
6493 }
6494 },
6495 };
6496 request_value_reader
6497 .seek(std::io::SeekFrom::Start(0))
6498 .unwrap();
6499 let mut req_result = {
6500 let client = &self.hub.client;
6501 dlg.pre_request();
6502 let mut req_builder = hyper::Request::builder()
6503 .method(hyper::Method::POST)
6504 .uri(url.as_str())
6505 .header(USER_AGENT, self.hub._user_agent.clone());
6506
6507 if let Some(token) = token.as_ref() {
6508 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6509 }
6510
6511 let request = req_builder
6512 .header(CONTENT_TYPE, json_mime_type.to_string())
6513 .header(CONTENT_LENGTH, request_size as u64)
6514 .body(common::to_body(
6515 request_value_reader.get_ref().clone().into(),
6516 ));
6517
6518 client.request(request.unwrap()).await
6519 };
6520
6521 match req_result {
6522 Err(err) => {
6523 if let common::Retry::After(d) = dlg.http_error(&err) {
6524 sleep(d).await;
6525 continue;
6526 }
6527 dlg.finished(false);
6528 return Err(common::Error::HttpError(err));
6529 }
6530 Ok(res) => {
6531 let (mut parts, body) = res.into_parts();
6532 let mut body = common::Body::new(body);
6533 if !parts.status.is_success() {
6534 let bytes = common::to_bytes(body).await.unwrap_or_default();
6535 let error = serde_json::from_str(&common::to_string(&bytes));
6536 let response = common::to_response(parts, bytes.into());
6537
6538 if let common::Retry::After(d) =
6539 dlg.http_failure(&response, error.as_ref().ok())
6540 {
6541 sleep(d).await;
6542 continue;
6543 }
6544
6545 dlg.finished(false);
6546
6547 return Err(match error {
6548 Ok(value) => common::Error::BadRequest(value),
6549 _ => common::Error::Failure(response),
6550 });
6551 }
6552 let response = {
6553 let bytes = common::to_bytes(body).await.unwrap_or_default();
6554 let encoded = common::to_string(&bytes);
6555 match serde_json::from_str(&encoded) {
6556 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6557 Err(error) => {
6558 dlg.response_json_decode_error(&encoded, &error);
6559 return Err(common::Error::JsonDecodeError(
6560 encoded.to_string(),
6561 error,
6562 ));
6563 }
6564 }
6565 };
6566
6567 dlg.finished(true);
6568 return Ok(response);
6569 }
6570 }
6571 }
6572 }
6573
6574 ///
6575 /// Sets the *request* property to the given value.
6576 ///
6577 /// Even though the property as already been set when instantiating this call,
6578 /// we provide this method for API completeness.
6579 pub fn request(
6580 mut self,
6581 new_value: EventSubscription,
6582 ) -> ProjectLocationConnectionEventSubscriptionCreateCall<'a, C> {
6583 self._request = new_value;
6584 self
6585 }
6586 /// Required. Parent resource of the EventSubscription, of the form: `projects/*/locations/*/connections/*`
6587 ///
6588 /// Sets the *parent* path property to the given value.
6589 ///
6590 /// Even though the property as already been set when instantiating this call,
6591 /// we provide this method for API completeness.
6592 pub fn parent(
6593 mut self,
6594 new_value: &str,
6595 ) -> ProjectLocationConnectionEventSubscriptionCreateCall<'a, C> {
6596 self._parent = new_value.to_string();
6597 self
6598 }
6599 /// Required. Identifier to assign to the Event Subscription. Must be unique within scope of the parent resource.
6600 ///
6601 /// Sets the *event subscription id* query property to the given value.
6602 pub fn event_subscription_id(
6603 mut self,
6604 new_value: &str,
6605 ) -> ProjectLocationConnectionEventSubscriptionCreateCall<'a, C> {
6606 self._event_subscription_id = Some(new_value.to_string());
6607 self
6608 }
6609 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6610 /// while executing the actual API request.
6611 ///
6612 /// ````text
6613 /// It should be used to handle progress information, and to implement a certain level of resilience.
6614 /// ````
6615 ///
6616 /// Sets the *delegate* property to the given value.
6617 pub fn delegate(
6618 mut self,
6619 new_value: &'a mut dyn common::Delegate,
6620 ) -> ProjectLocationConnectionEventSubscriptionCreateCall<'a, C> {
6621 self._delegate = Some(new_value);
6622 self
6623 }
6624
6625 /// Set any additional parameter of the query string used in the request.
6626 /// It should be used to set parameters which are not yet available through their own
6627 /// setters.
6628 ///
6629 /// Please note that this method must not be used to set any of the known parameters
6630 /// which have their own setter method. If done anyway, the request will fail.
6631 ///
6632 /// # Additional Parameters
6633 ///
6634 /// * *$.xgafv* (query-string) - V1 error format.
6635 /// * *access_token* (query-string) - OAuth access token.
6636 /// * *alt* (query-string) - Data format for response.
6637 /// * *callback* (query-string) - JSONP
6638 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6639 /// * *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.
6640 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6641 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6642 /// * *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.
6643 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6644 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6645 pub fn param<T>(
6646 mut self,
6647 name: T,
6648 value: T,
6649 ) -> ProjectLocationConnectionEventSubscriptionCreateCall<'a, C>
6650 where
6651 T: AsRef<str>,
6652 {
6653 self._additional_params
6654 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6655 self
6656 }
6657
6658 /// Identifies the authorization scope for the method you are building.
6659 ///
6660 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6661 /// [`Scope::CloudPlatform`].
6662 ///
6663 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6664 /// tokens for more than one scope.
6665 ///
6666 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6667 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6668 /// sufficient, a read-write scope will do as well.
6669 pub fn add_scope<St>(
6670 mut self,
6671 scope: St,
6672 ) -> ProjectLocationConnectionEventSubscriptionCreateCall<'a, C>
6673 where
6674 St: AsRef<str>,
6675 {
6676 self._scopes.insert(String::from(scope.as_ref()));
6677 self
6678 }
6679 /// Identifies the authorization scope(s) for the method you are building.
6680 ///
6681 /// See [`Self::add_scope()`] for details.
6682 pub fn add_scopes<I, St>(
6683 mut self,
6684 scopes: I,
6685 ) -> ProjectLocationConnectionEventSubscriptionCreateCall<'a, C>
6686 where
6687 I: IntoIterator<Item = St>,
6688 St: AsRef<str>,
6689 {
6690 self._scopes
6691 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6692 self
6693 }
6694
6695 /// Removes all scopes, and no default scope will be used either.
6696 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6697 /// for details).
6698 pub fn clear_scopes(mut self) -> ProjectLocationConnectionEventSubscriptionCreateCall<'a, C> {
6699 self._scopes.clear();
6700 self
6701 }
6702}
6703
6704/// Deletes a single EventSubscription.
6705///
6706/// A builder for the *locations.connections.eventSubscriptions.delete* method supported by a *project* resource.
6707/// It is not used directly, but through a [`ProjectMethods`] instance.
6708///
6709/// # Example
6710///
6711/// Instantiate a resource method builder
6712///
6713/// ```test_harness,no_run
6714/// # extern crate hyper;
6715/// # extern crate hyper_rustls;
6716/// # extern crate google_connectors1 as connectors1;
6717/// # async fn dox() {
6718/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6719///
6720/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6721/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6722/// # secret,
6723/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6724/// # ).build().await.unwrap();
6725///
6726/// # let client = hyper_util::client::legacy::Client::builder(
6727/// # hyper_util::rt::TokioExecutor::new()
6728/// # )
6729/// # .build(
6730/// # hyper_rustls::HttpsConnectorBuilder::new()
6731/// # .with_native_roots()
6732/// # .unwrap()
6733/// # .https_or_http()
6734/// # .enable_http1()
6735/// # .build()
6736/// # );
6737/// # let mut hub = Connectors::new(client, auth);
6738/// // You can configure optional parameters by calling the respective setters at will, and
6739/// // execute the final call using `doit()`.
6740/// // Values shown here are possibly random and not representative !
6741/// let result = hub.projects().locations_connections_event_subscriptions_delete("name")
6742/// .doit().await;
6743/// # }
6744/// ```
6745pub struct ProjectLocationConnectionEventSubscriptionDeleteCall<'a, C>
6746where
6747 C: 'a,
6748{
6749 hub: &'a Connectors<C>,
6750 _name: String,
6751 _delegate: Option<&'a mut dyn common::Delegate>,
6752 _additional_params: HashMap<String, String>,
6753 _scopes: BTreeSet<String>,
6754}
6755
6756impl<'a, C> common::CallBuilder for ProjectLocationConnectionEventSubscriptionDeleteCall<'a, C> {}
6757
6758impl<'a, C> ProjectLocationConnectionEventSubscriptionDeleteCall<'a, C>
6759where
6760 C: common::Connector,
6761{
6762 /// Perform the operation you have build so far.
6763 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6764 use std::borrow::Cow;
6765 use std::io::{Read, Seek};
6766
6767 use common::{url::Params, ToParts};
6768 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6769
6770 let mut dd = common::DefaultDelegate;
6771 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6772 dlg.begin(common::MethodInfo {
6773 id: "connectors.projects.locations.connections.eventSubscriptions.delete",
6774 http_method: hyper::Method::DELETE,
6775 });
6776
6777 for &field in ["alt", "name"].iter() {
6778 if self._additional_params.contains_key(field) {
6779 dlg.finished(false);
6780 return Err(common::Error::FieldClash(field));
6781 }
6782 }
6783
6784 let mut params = Params::with_capacity(3 + self._additional_params.len());
6785 params.push("name", self._name);
6786
6787 params.extend(self._additional_params.iter());
6788
6789 params.push("alt", "json");
6790 let mut url = self.hub._base_url.clone() + "v1/{+name}";
6791 if self._scopes.is_empty() {
6792 self._scopes
6793 .insert(Scope::CloudPlatform.as_ref().to_string());
6794 }
6795
6796 #[allow(clippy::single_element_loop)]
6797 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6798 url = params.uri_replacement(url, param_name, find_this, true);
6799 }
6800 {
6801 let to_remove = ["name"];
6802 params.remove_params(&to_remove);
6803 }
6804
6805 let url = params.parse_with_url(&url);
6806
6807 loop {
6808 let token = match self
6809 .hub
6810 .auth
6811 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6812 .await
6813 {
6814 Ok(token) => token,
6815 Err(e) => match dlg.token(e) {
6816 Ok(token) => token,
6817 Err(e) => {
6818 dlg.finished(false);
6819 return Err(common::Error::MissingToken(e));
6820 }
6821 },
6822 };
6823 let mut req_result = {
6824 let client = &self.hub.client;
6825 dlg.pre_request();
6826 let mut req_builder = hyper::Request::builder()
6827 .method(hyper::Method::DELETE)
6828 .uri(url.as_str())
6829 .header(USER_AGENT, self.hub._user_agent.clone());
6830
6831 if let Some(token) = token.as_ref() {
6832 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6833 }
6834
6835 let request = req_builder
6836 .header(CONTENT_LENGTH, 0_u64)
6837 .body(common::to_body::<String>(None));
6838
6839 client.request(request.unwrap()).await
6840 };
6841
6842 match req_result {
6843 Err(err) => {
6844 if let common::Retry::After(d) = dlg.http_error(&err) {
6845 sleep(d).await;
6846 continue;
6847 }
6848 dlg.finished(false);
6849 return Err(common::Error::HttpError(err));
6850 }
6851 Ok(res) => {
6852 let (mut parts, body) = res.into_parts();
6853 let mut body = common::Body::new(body);
6854 if !parts.status.is_success() {
6855 let bytes = common::to_bytes(body).await.unwrap_or_default();
6856 let error = serde_json::from_str(&common::to_string(&bytes));
6857 let response = common::to_response(parts, bytes.into());
6858
6859 if let common::Retry::After(d) =
6860 dlg.http_failure(&response, error.as_ref().ok())
6861 {
6862 sleep(d).await;
6863 continue;
6864 }
6865
6866 dlg.finished(false);
6867
6868 return Err(match error {
6869 Ok(value) => common::Error::BadRequest(value),
6870 _ => common::Error::Failure(response),
6871 });
6872 }
6873 let response = {
6874 let bytes = common::to_bytes(body).await.unwrap_or_default();
6875 let encoded = common::to_string(&bytes);
6876 match serde_json::from_str(&encoded) {
6877 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6878 Err(error) => {
6879 dlg.response_json_decode_error(&encoded, &error);
6880 return Err(common::Error::JsonDecodeError(
6881 encoded.to_string(),
6882 error,
6883 ));
6884 }
6885 }
6886 };
6887
6888 dlg.finished(true);
6889 return Ok(response);
6890 }
6891 }
6892 }
6893 }
6894
6895 /// Required. Resource name of the form: `projects/*/locations/*/connections/*/eventsubscriptions/*`
6896 ///
6897 /// Sets the *name* path property to the given value.
6898 ///
6899 /// Even though the property as already been set when instantiating this call,
6900 /// we provide this method for API completeness.
6901 pub fn name(
6902 mut self,
6903 new_value: &str,
6904 ) -> ProjectLocationConnectionEventSubscriptionDeleteCall<'a, C> {
6905 self._name = new_value.to_string();
6906 self
6907 }
6908 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6909 /// while executing the actual API request.
6910 ///
6911 /// ````text
6912 /// It should be used to handle progress information, and to implement a certain level of resilience.
6913 /// ````
6914 ///
6915 /// Sets the *delegate* property to the given value.
6916 pub fn delegate(
6917 mut self,
6918 new_value: &'a mut dyn common::Delegate,
6919 ) -> ProjectLocationConnectionEventSubscriptionDeleteCall<'a, C> {
6920 self._delegate = Some(new_value);
6921 self
6922 }
6923
6924 /// Set any additional parameter of the query string used in the request.
6925 /// It should be used to set parameters which are not yet available through their own
6926 /// setters.
6927 ///
6928 /// Please note that this method must not be used to set any of the known parameters
6929 /// which have their own setter method. If done anyway, the request will fail.
6930 ///
6931 /// # Additional Parameters
6932 ///
6933 /// * *$.xgafv* (query-string) - V1 error format.
6934 /// * *access_token* (query-string) - OAuth access token.
6935 /// * *alt* (query-string) - Data format for response.
6936 /// * *callback* (query-string) - JSONP
6937 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6938 /// * *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.
6939 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6940 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6941 /// * *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.
6942 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6943 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6944 pub fn param<T>(
6945 mut self,
6946 name: T,
6947 value: T,
6948 ) -> ProjectLocationConnectionEventSubscriptionDeleteCall<'a, C>
6949 where
6950 T: AsRef<str>,
6951 {
6952 self._additional_params
6953 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6954 self
6955 }
6956
6957 /// Identifies the authorization scope for the method you are building.
6958 ///
6959 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6960 /// [`Scope::CloudPlatform`].
6961 ///
6962 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6963 /// tokens for more than one scope.
6964 ///
6965 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6966 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6967 /// sufficient, a read-write scope will do as well.
6968 pub fn add_scope<St>(
6969 mut self,
6970 scope: St,
6971 ) -> ProjectLocationConnectionEventSubscriptionDeleteCall<'a, C>
6972 where
6973 St: AsRef<str>,
6974 {
6975 self._scopes.insert(String::from(scope.as_ref()));
6976 self
6977 }
6978 /// Identifies the authorization scope(s) for the method you are building.
6979 ///
6980 /// See [`Self::add_scope()`] for details.
6981 pub fn add_scopes<I, St>(
6982 mut self,
6983 scopes: I,
6984 ) -> ProjectLocationConnectionEventSubscriptionDeleteCall<'a, C>
6985 where
6986 I: IntoIterator<Item = St>,
6987 St: AsRef<str>,
6988 {
6989 self._scopes
6990 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6991 self
6992 }
6993
6994 /// Removes all scopes, and no default scope will be used either.
6995 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6996 /// for details).
6997 pub fn clear_scopes(mut self) -> ProjectLocationConnectionEventSubscriptionDeleteCall<'a, C> {
6998 self._scopes.clear();
6999 self
7000 }
7001}
7002
7003/// Gets details of a single EventSubscription.
7004///
7005/// A builder for the *locations.connections.eventSubscriptions.get* method supported by a *project* resource.
7006/// It is not used directly, but through a [`ProjectMethods`] instance.
7007///
7008/// # Example
7009///
7010/// Instantiate a resource method builder
7011///
7012/// ```test_harness,no_run
7013/// # extern crate hyper;
7014/// # extern crate hyper_rustls;
7015/// # extern crate google_connectors1 as connectors1;
7016/// # async fn dox() {
7017/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7018///
7019/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7020/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7021/// # secret,
7022/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7023/// # ).build().await.unwrap();
7024///
7025/// # let client = hyper_util::client::legacy::Client::builder(
7026/// # hyper_util::rt::TokioExecutor::new()
7027/// # )
7028/// # .build(
7029/// # hyper_rustls::HttpsConnectorBuilder::new()
7030/// # .with_native_roots()
7031/// # .unwrap()
7032/// # .https_or_http()
7033/// # .enable_http1()
7034/// # .build()
7035/// # );
7036/// # let mut hub = Connectors::new(client, auth);
7037/// // You can configure optional parameters by calling the respective setters at will, and
7038/// // execute the final call using `doit()`.
7039/// // Values shown here are possibly random and not representative !
7040/// let result = hub.projects().locations_connections_event_subscriptions_get("name")
7041/// .doit().await;
7042/// # }
7043/// ```
7044pub struct ProjectLocationConnectionEventSubscriptionGetCall<'a, C>
7045where
7046 C: 'a,
7047{
7048 hub: &'a Connectors<C>,
7049 _name: String,
7050 _delegate: Option<&'a mut dyn common::Delegate>,
7051 _additional_params: HashMap<String, String>,
7052 _scopes: BTreeSet<String>,
7053}
7054
7055impl<'a, C> common::CallBuilder for ProjectLocationConnectionEventSubscriptionGetCall<'a, C> {}
7056
7057impl<'a, C> ProjectLocationConnectionEventSubscriptionGetCall<'a, C>
7058where
7059 C: common::Connector,
7060{
7061 /// Perform the operation you have build so far.
7062 pub async fn doit(mut self) -> common::Result<(common::Response, EventSubscription)> {
7063 use std::borrow::Cow;
7064 use std::io::{Read, Seek};
7065
7066 use common::{url::Params, ToParts};
7067 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7068
7069 let mut dd = common::DefaultDelegate;
7070 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7071 dlg.begin(common::MethodInfo {
7072 id: "connectors.projects.locations.connections.eventSubscriptions.get",
7073 http_method: hyper::Method::GET,
7074 });
7075
7076 for &field in ["alt", "name"].iter() {
7077 if self._additional_params.contains_key(field) {
7078 dlg.finished(false);
7079 return Err(common::Error::FieldClash(field));
7080 }
7081 }
7082
7083 let mut params = Params::with_capacity(3 + self._additional_params.len());
7084 params.push("name", self._name);
7085
7086 params.extend(self._additional_params.iter());
7087
7088 params.push("alt", "json");
7089 let mut url = self.hub._base_url.clone() + "v1/{+name}";
7090 if self._scopes.is_empty() {
7091 self._scopes
7092 .insert(Scope::CloudPlatform.as_ref().to_string());
7093 }
7094
7095 #[allow(clippy::single_element_loop)]
7096 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7097 url = params.uri_replacement(url, param_name, find_this, true);
7098 }
7099 {
7100 let to_remove = ["name"];
7101 params.remove_params(&to_remove);
7102 }
7103
7104 let url = params.parse_with_url(&url);
7105
7106 loop {
7107 let token = match self
7108 .hub
7109 .auth
7110 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7111 .await
7112 {
7113 Ok(token) => token,
7114 Err(e) => match dlg.token(e) {
7115 Ok(token) => token,
7116 Err(e) => {
7117 dlg.finished(false);
7118 return Err(common::Error::MissingToken(e));
7119 }
7120 },
7121 };
7122 let mut req_result = {
7123 let client = &self.hub.client;
7124 dlg.pre_request();
7125 let mut req_builder = hyper::Request::builder()
7126 .method(hyper::Method::GET)
7127 .uri(url.as_str())
7128 .header(USER_AGENT, self.hub._user_agent.clone());
7129
7130 if let Some(token) = token.as_ref() {
7131 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7132 }
7133
7134 let request = req_builder
7135 .header(CONTENT_LENGTH, 0_u64)
7136 .body(common::to_body::<String>(None));
7137
7138 client.request(request.unwrap()).await
7139 };
7140
7141 match req_result {
7142 Err(err) => {
7143 if let common::Retry::After(d) = dlg.http_error(&err) {
7144 sleep(d).await;
7145 continue;
7146 }
7147 dlg.finished(false);
7148 return Err(common::Error::HttpError(err));
7149 }
7150 Ok(res) => {
7151 let (mut parts, body) = res.into_parts();
7152 let mut body = common::Body::new(body);
7153 if !parts.status.is_success() {
7154 let bytes = common::to_bytes(body).await.unwrap_or_default();
7155 let error = serde_json::from_str(&common::to_string(&bytes));
7156 let response = common::to_response(parts, bytes.into());
7157
7158 if let common::Retry::After(d) =
7159 dlg.http_failure(&response, error.as_ref().ok())
7160 {
7161 sleep(d).await;
7162 continue;
7163 }
7164
7165 dlg.finished(false);
7166
7167 return Err(match error {
7168 Ok(value) => common::Error::BadRequest(value),
7169 _ => common::Error::Failure(response),
7170 });
7171 }
7172 let response = {
7173 let bytes = common::to_bytes(body).await.unwrap_or_default();
7174 let encoded = common::to_string(&bytes);
7175 match serde_json::from_str(&encoded) {
7176 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7177 Err(error) => {
7178 dlg.response_json_decode_error(&encoded, &error);
7179 return Err(common::Error::JsonDecodeError(
7180 encoded.to_string(),
7181 error,
7182 ));
7183 }
7184 }
7185 };
7186
7187 dlg.finished(true);
7188 return Ok(response);
7189 }
7190 }
7191 }
7192 }
7193
7194 /// Required. Resource name of the form: `projects/*/locations/*/connections/*/eventSubscriptions/*`
7195 ///
7196 /// Sets the *name* path property to the given value.
7197 ///
7198 /// Even though the property as already been set when instantiating this call,
7199 /// we provide this method for API completeness.
7200 pub fn name(
7201 mut self,
7202 new_value: &str,
7203 ) -> ProjectLocationConnectionEventSubscriptionGetCall<'a, C> {
7204 self._name = new_value.to_string();
7205 self
7206 }
7207 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7208 /// while executing the actual API request.
7209 ///
7210 /// ````text
7211 /// It should be used to handle progress information, and to implement a certain level of resilience.
7212 /// ````
7213 ///
7214 /// Sets the *delegate* property to the given value.
7215 pub fn delegate(
7216 mut self,
7217 new_value: &'a mut dyn common::Delegate,
7218 ) -> ProjectLocationConnectionEventSubscriptionGetCall<'a, C> {
7219 self._delegate = Some(new_value);
7220 self
7221 }
7222
7223 /// Set any additional parameter of the query string used in the request.
7224 /// It should be used to set parameters which are not yet available through their own
7225 /// setters.
7226 ///
7227 /// Please note that this method must not be used to set any of the known parameters
7228 /// which have their own setter method. If done anyway, the request will fail.
7229 ///
7230 /// # Additional Parameters
7231 ///
7232 /// * *$.xgafv* (query-string) - V1 error format.
7233 /// * *access_token* (query-string) - OAuth access token.
7234 /// * *alt* (query-string) - Data format for response.
7235 /// * *callback* (query-string) - JSONP
7236 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7237 /// * *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.
7238 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7239 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7240 /// * *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.
7241 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7242 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7243 pub fn param<T>(
7244 mut self,
7245 name: T,
7246 value: T,
7247 ) -> ProjectLocationConnectionEventSubscriptionGetCall<'a, C>
7248 where
7249 T: AsRef<str>,
7250 {
7251 self._additional_params
7252 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7253 self
7254 }
7255
7256 /// Identifies the authorization scope for the method you are building.
7257 ///
7258 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7259 /// [`Scope::CloudPlatform`].
7260 ///
7261 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7262 /// tokens for more than one scope.
7263 ///
7264 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7265 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7266 /// sufficient, a read-write scope will do as well.
7267 pub fn add_scope<St>(
7268 mut self,
7269 scope: St,
7270 ) -> ProjectLocationConnectionEventSubscriptionGetCall<'a, C>
7271 where
7272 St: AsRef<str>,
7273 {
7274 self._scopes.insert(String::from(scope.as_ref()));
7275 self
7276 }
7277 /// Identifies the authorization scope(s) for the method you are building.
7278 ///
7279 /// See [`Self::add_scope()`] for details.
7280 pub fn add_scopes<I, St>(
7281 mut self,
7282 scopes: I,
7283 ) -> ProjectLocationConnectionEventSubscriptionGetCall<'a, C>
7284 where
7285 I: IntoIterator<Item = St>,
7286 St: AsRef<str>,
7287 {
7288 self._scopes
7289 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7290 self
7291 }
7292
7293 /// Removes all scopes, and no default scope will be used either.
7294 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7295 /// for details).
7296 pub fn clear_scopes(mut self) -> ProjectLocationConnectionEventSubscriptionGetCall<'a, C> {
7297 self._scopes.clear();
7298 self
7299 }
7300}
7301
7302/// List EventSubscriptions in a given project,location and connection.
7303///
7304/// A builder for the *locations.connections.eventSubscriptions.list* method supported by a *project* resource.
7305/// It is not used directly, but through a [`ProjectMethods`] instance.
7306///
7307/// # Example
7308///
7309/// Instantiate a resource method builder
7310///
7311/// ```test_harness,no_run
7312/// # extern crate hyper;
7313/// # extern crate hyper_rustls;
7314/// # extern crate google_connectors1 as connectors1;
7315/// # async fn dox() {
7316/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7317///
7318/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7319/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7320/// # secret,
7321/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7322/// # ).build().await.unwrap();
7323///
7324/// # let client = hyper_util::client::legacy::Client::builder(
7325/// # hyper_util::rt::TokioExecutor::new()
7326/// # )
7327/// # .build(
7328/// # hyper_rustls::HttpsConnectorBuilder::new()
7329/// # .with_native_roots()
7330/// # .unwrap()
7331/// # .https_or_http()
7332/// # .enable_http1()
7333/// # .build()
7334/// # );
7335/// # let mut hub = Connectors::new(client, auth);
7336/// // You can configure optional parameters by calling the respective setters at will, and
7337/// // execute the final call using `doit()`.
7338/// // Values shown here are possibly random and not representative !
7339/// let result = hub.projects().locations_connections_event_subscriptions_list("parent")
7340/// .page_token("gubergren")
7341/// .page_size(-16)
7342/// .order_by("est")
7343/// .filter("ipsum")
7344/// .doit().await;
7345/// # }
7346/// ```
7347pub struct ProjectLocationConnectionEventSubscriptionListCall<'a, C>
7348where
7349 C: 'a,
7350{
7351 hub: &'a Connectors<C>,
7352 _parent: String,
7353 _page_token: Option<String>,
7354 _page_size: Option<i32>,
7355 _order_by: Option<String>,
7356 _filter: Option<String>,
7357 _delegate: Option<&'a mut dyn common::Delegate>,
7358 _additional_params: HashMap<String, String>,
7359 _scopes: BTreeSet<String>,
7360}
7361
7362impl<'a, C> common::CallBuilder for ProjectLocationConnectionEventSubscriptionListCall<'a, C> {}
7363
7364impl<'a, C> ProjectLocationConnectionEventSubscriptionListCall<'a, C>
7365where
7366 C: common::Connector,
7367{
7368 /// Perform the operation you have build so far.
7369 pub async fn doit(
7370 mut self,
7371 ) -> common::Result<(common::Response, ListEventSubscriptionsResponse)> {
7372 use std::borrow::Cow;
7373 use std::io::{Read, Seek};
7374
7375 use common::{url::Params, ToParts};
7376 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7377
7378 let mut dd = common::DefaultDelegate;
7379 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7380 dlg.begin(common::MethodInfo {
7381 id: "connectors.projects.locations.connections.eventSubscriptions.list",
7382 http_method: hyper::Method::GET,
7383 });
7384
7385 for &field in [
7386 "alt",
7387 "parent",
7388 "pageToken",
7389 "pageSize",
7390 "orderBy",
7391 "filter",
7392 ]
7393 .iter()
7394 {
7395 if self._additional_params.contains_key(field) {
7396 dlg.finished(false);
7397 return Err(common::Error::FieldClash(field));
7398 }
7399 }
7400
7401 let mut params = Params::with_capacity(7 + self._additional_params.len());
7402 params.push("parent", self._parent);
7403 if let Some(value) = self._page_token.as_ref() {
7404 params.push("pageToken", value);
7405 }
7406 if let Some(value) = self._page_size.as_ref() {
7407 params.push("pageSize", value.to_string());
7408 }
7409 if let Some(value) = self._order_by.as_ref() {
7410 params.push("orderBy", value);
7411 }
7412 if let Some(value) = self._filter.as_ref() {
7413 params.push("filter", value);
7414 }
7415
7416 params.extend(self._additional_params.iter());
7417
7418 params.push("alt", "json");
7419 let mut url = self.hub._base_url.clone() + "v1/{+parent}/eventSubscriptions";
7420 if self._scopes.is_empty() {
7421 self._scopes
7422 .insert(Scope::CloudPlatform.as_ref().to_string());
7423 }
7424
7425 #[allow(clippy::single_element_loop)]
7426 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7427 url = params.uri_replacement(url, param_name, find_this, true);
7428 }
7429 {
7430 let to_remove = ["parent"];
7431 params.remove_params(&to_remove);
7432 }
7433
7434 let url = params.parse_with_url(&url);
7435
7436 loop {
7437 let token = match self
7438 .hub
7439 .auth
7440 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7441 .await
7442 {
7443 Ok(token) => token,
7444 Err(e) => match dlg.token(e) {
7445 Ok(token) => token,
7446 Err(e) => {
7447 dlg.finished(false);
7448 return Err(common::Error::MissingToken(e));
7449 }
7450 },
7451 };
7452 let mut req_result = {
7453 let client = &self.hub.client;
7454 dlg.pre_request();
7455 let mut req_builder = hyper::Request::builder()
7456 .method(hyper::Method::GET)
7457 .uri(url.as_str())
7458 .header(USER_AGENT, self.hub._user_agent.clone());
7459
7460 if let Some(token) = token.as_ref() {
7461 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7462 }
7463
7464 let request = req_builder
7465 .header(CONTENT_LENGTH, 0_u64)
7466 .body(common::to_body::<String>(None));
7467
7468 client.request(request.unwrap()).await
7469 };
7470
7471 match req_result {
7472 Err(err) => {
7473 if let common::Retry::After(d) = dlg.http_error(&err) {
7474 sleep(d).await;
7475 continue;
7476 }
7477 dlg.finished(false);
7478 return Err(common::Error::HttpError(err));
7479 }
7480 Ok(res) => {
7481 let (mut parts, body) = res.into_parts();
7482 let mut body = common::Body::new(body);
7483 if !parts.status.is_success() {
7484 let bytes = common::to_bytes(body).await.unwrap_or_default();
7485 let error = serde_json::from_str(&common::to_string(&bytes));
7486 let response = common::to_response(parts, bytes.into());
7487
7488 if let common::Retry::After(d) =
7489 dlg.http_failure(&response, error.as_ref().ok())
7490 {
7491 sleep(d).await;
7492 continue;
7493 }
7494
7495 dlg.finished(false);
7496
7497 return Err(match error {
7498 Ok(value) => common::Error::BadRequest(value),
7499 _ => common::Error::Failure(response),
7500 });
7501 }
7502 let response = {
7503 let bytes = common::to_bytes(body).await.unwrap_or_default();
7504 let encoded = common::to_string(&bytes);
7505 match serde_json::from_str(&encoded) {
7506 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7507 Err(error) => {
7508 dlg.response_json_decode_error(&encoded, &error);
7509 return Err(common::Error::JsonDecodeError(
7510 encoded.to_string(),
7511 error,
7512 ));
7513 }
7514 }
7515 };
7516
7517 dlg.finished(true);
7518 return Ok(response);
7519 }
7520 }
7521 }
7522 }
7523
7524 /// Required. Parent resource of the EventSubscription, of the form: `projects/*/locations/*/connections/*`
7525 ///
7526 /// Sets the *parent* path property to the given value.
7527 ///
7528 /// Even though the property as already been set when instantiating this call,
7529 /// we provide this method for API completeness.
7530 pub fn parent(
7531 mut self,
7532 new_value: &str,
7533 ) -> ProjectLocationConnectionEventSubscriptionListCall<'a, C> {
7534 self._parent = new_value.to_string();
7535 self
7536 }
7537 /// Page token.
7538 ///
7539 /// Sets the *page token* query property to the given value.
7540 pub fn page_token(
7541 mut self,
7542 new_value: &str,
7543 ) -> ProjectLocationConnectionEventSubscriptionListCall<'a, C> {
7544 self._page_token = Some(new_value.to_string());
7545 self
7546 }
7547 /// Page size.
7548 ///
7549 /// Sets the *page size* query property to the given value.
7550 pub fn page_size(
7551 mut self,
7552 new_value: i32,
7553 ) -> ProjectLocationConnectionEventSubscriptionListCall<'a, C> {
7554 self._page_size = Some(new_value);
7555 self
7556 }
7557 /// Order by parameters.
7558 ///
7559 /// Sets the *order by* query property to the given value.
7560 pub fn order_by(
7561 mut self,
7562 new_value: &str,
7563 ) -> ProjectLocationConnectionEventSubscriptionListCall<'a, C> {
7564 self._order_by = Some(new_value.to_string());
7565 self
7566 }
7567 /// Filter.
7568 ///
7569 /// Sets the *filter* query property to the given value.
7570 pub fn filter(
7571 mut self,
7572 new_value: &str,
7573 ) -> ProjectLocationConnectionEventSubscriptionListCall<'a, C> {
7574 self._filter = Some(new_value.to_string());
7575 self
7576 }
7577 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7578 /// while executing the actual API request.
7579 ///
7580 /// ````text
7581 /// It should be used to handle progress information, and to implement a certain level of resilience.
7582 /// ````
7583 ///
7584 /// Sets the *delegate* property to the given value.
7585 pub fn delegate(
7586 mut self,
7587 new_value: &'a mut dyn common::Delegate,
7588 ) -> ProjectLocationConnectionEventSubscriptionListCall<'a, C> {
7589 self._delegate = Some(new_value);
7590 self
7591 }
7592
7593 /// Set any additional parameter of the query string used in the request.
7594 /// It should be used to set parameters which are not yet available through their own
7595 /// setters.
7596 ///
7597 /// Please note that this method must not be used to set any of the known parameters
7598 /// which have their own setter method. If done anyway, the request will fail.
7599 ///
7600 /// # Additional Parameters
7601 ///
7602 /// * *$.xgafv* (query-string) - V1 error format.
7603 /// * *access_token* (query-string) - OAuth access token.
7604 /// * *alt* (query-string) - Data format for response.
7605 /// * *callback* (query-string) - JSONP
7606 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7607 /// * *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.
7608 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7609 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7610 /// * *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.
7611 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7612 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7613 pub fn param<T>(
7614 mut self,
7615 name: T,
7616 value: T,
7617 ) -> ProjectLocationConnectionEventSubscriptionListCall<'a, C>
7618 where
7619 T: AsRef<str>,
7620 {
7621 self._additional_params
7622 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7623 self
7624 }
7625
7626 /// Identifies the authorization scope for the method you are building.
7627 ///
7628 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7629 /// [`Scope::CloudPlatform`].
7630 ///
7631 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7632 /// tokens for more than one scope.
7633 ///
7634 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7635 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7636 /// sufficient, a read-write scope will do as well.
7637 pub fn add_scope<St>(
7638 mut self,
7639 scope: St,
7640 ) -> ProjectLocationConnectionEventSubscriptionListCall<'a, C>
7641 where
7642 St: AsRef<str>,
7643 {
7644 self._scopes.insert(String::from(scope.as_ref()));
7645 self
7646 }
7647 /// Identifies the authorization scope(s) for the method you are building.
7648 ///
7649 /// See [`Self::add_scope()`] for details.
7650 pub fn add_scopes<I, St>(
7651 mut self,
7652 scopes: I,
7653 ) -> ProjectLocationConnectionEventSubscriptionListCall<'a, C>
7654 where
7655 I: IntoIterator<Item = St>,
7656 St: AsRef<str>,
7657 {
7658 self._scopes
7659 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7660 self
7661 }
7662
7663 /// Removes all scopes, and no default scope will be used either.
7664 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7665 /// for details).
7666 pub fn clear_scopes(mut self) -> ProjectLocationConnectionEventSubscriptionListCall<'a, C> {
7667 self._scopes.clear();
7668 self
7669 }
7670}
7671
7672/// Updates the parameters of a single EventSubscription.
7673///
7674/// A builder for the *locations.connections.eventSubscriptions.patch* method supported by a *project* resource.
7675/// It is not used directly, but through a [`ProjectMethods`] instance.
7676///
7677/// # Example
7678///
7679/// Instantiate a resource method builder
7680///
7681/// ```test_harness,no_run
7682/// # extern crate hyper;
7683/// # extern crate hyper_rustls;
7684/// # extern crate google_connectors1 as connectors1;
7685/// use connectors1::api::EventSubscription;
7686/// # async fn dox() {
7687/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7688///
7689/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7690/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7691/// # secret,
7692/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7693/// # ).build().await.unwrap();
7694///
7695/// # let client = hyper_util::client::legacy::Client::builder(
7696/// # hyper_util::rt::TokioExecutor::new()
7697/// # )
7698/// # .build(
7699/// # hyper_rustls::HttpsConnectorBuilder::new()
7700/// # .with_native_roots()
7701/// # .unwrap()
7702/// # .https_or_http()
7703/// # .enable_http1()
7704/// # .build()
7705/// # );
7706/// # let mut hub = Connectors::new(client, auth);
7707/// // As the method needs a request, you would usually fill it with the desired information
7708/// // into the respective structure. Some of the parts shown here might not be applicable !
7709/// // Values shown here are possibly random and not representative !
7710/// let mut req = EventSubscription::default();
7711///
7712/// // You can configure optional parameters by calling the respective setters at will, and
7713/// // execute the final call using `doit()`.
7714/// // Values shown here are possibly random and not representative !
7715/// let result = hub.projects().locations_connections_event_subscriptions_patch(req, "name")
7716/// .update_mask(FieldMask::new::<&str>(&[]))
7717/// .doit().await;
7718/// # }
7719/// ```
7720pub struct ProjectLocationConnectionEventSubscriptionPatchCall<'a, C>
7721where
7722 C: 'a,
7723{
7724 hub: &'a Connectors<C>,
7725 _request: EventSubscription,
7726 _name: String,
7727 _update_mask: Option<common::FieldMask>,
7728 _delegate: Option<&'a mut dyn common::Delegate>,
7729 _additional_params: HashMap<String, String>,
7730 _scopes: BTreeSet<String>,
7731}
7732
7733impl<'a, C> common::CallBuilder for ProjectLocationConnectionEventSubscriptionPatchCall<'a, C> {}
7734
7735impl<'a, C> ProjectLocationConnectionEventSubscriptionPatchCall<'a, C>
7736where
7737 C: common::Connector,
7738{
7739 /// Perform the operation you have build so far.
7740 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
7741 use std::borrow::Cow;
7742 use std::io::{Read, Seek};
7743
7744 use common::{url::Params, ToParts};
7745 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7746
7747 let mut dd = common::DefaultDelegate;
7748 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7749 dlg.begin(common::MethodInfo {
7750 id: "connectors.projects.locations.connections.eventSubscriptions.patch",
7751 http_method: hyper::Method::PATCH,
7752 });
7753
7754 for &field in ["alt", "name", "updateMask"].iter() {
7755 if self._additional_params.contains_key(field) {
7756 dlg.finished(false);
7757 return Err(common::Error::FieldClash(field));
7758 }
7759 }
7760
7761 let mut params = Params::with_capacity(5 + self._additional_params.len());
7762 params.push("name", self._name);
7763 if let Some(value) = self._update_mask.as_ref() {
7764 params.push("updateMask", value.to_string());
7765 }
7766
7767 params.extend(self._additional_params.iter());
7768
7769 params.push("alt", "json");
7770 let mut url = self.hub._base_url.clone() + "v1/{+name}";
7771 if self._scopes.is_empty() {
7772 self._scopes
7773 .insert(Scope::CloudPlatform.as_ref().to_string());
7774 }
7775
7776 #[allow(clippy::single_element_loop)]
7777 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7778 url = params.uri_replacement(url, param_name, find_this, true);
7779 }
7780 {
7781 let to_remove = ["name"];
7782 params.remove_params(&to_remove);
7783 }
7784
7785 let url = params.parse_with_url(&url);
7786
7787 let mut json_mime_type = mime::APPLICATION_JSON;
7788 let mut request_value_reader = {
7789 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7790 common::remove_json_null_values(&mut value);
7791 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7792 serde_json::to_writer(&mut dst, &value).unwrap();
7793 dst
7794 };
7795 let request_size = request_value_reader
7796 .seek(std::io::SeekFrom::End(0))
7797 .unwrap();
7798 request_value_reader
7799 .seek(std::io::SeekFrom::Start(0))
7800 .unwrap();
7801
7802 loop {
7803 let token = match self
7804 .hub
7805 .auth
7806 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7807 .await
7808 {
7809 Ok(token) => token,
7810 Err(e) => match dlg.token(e) {
7811 Ok(token) => token,
7812 Err(e) => {
7813 dlg.finished(false);
7814 return Err(common::Error::MissingToken(e));
7815 }
7816 },
7817 };
7818 request_value_reader
7819 .seek(std::io::SeekFrom::Start(0))
7820 .unwrap();
7821 let mut req_result = {
7822 let client = &self.hub.client;
7823 dlg.pre_request();
7824 let mut req_builder = hyper::Request::builder()
7825 .method(hyper::Method::PATCH)
7826 .uri(url.as_str())
7827 .header(USER_AGENT, self.hub._user_agent.clone());
7828
7829 if let Some(token) = token.as_ref() {
7830 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7831 }
7832
7833 let request = req_builder
7834 .header(CONTENT_TYPE, json_mime_type.to_string())
7835 .header(CONTENT_LENGTH, request_size as u64)
7836 .body(common::to_body(
7837 request_value_reader.get_ref().clone().into(),
7838 ));
7839
7840 client.request(request.unwrap()).await
7841 };
7842
7843 match req_result {
7844 Err(err) => {
7845 if let common::Retry::After(d) = dlg.http_error(&err) {
7846 sleep(d).await;
7847 continue;
7848 }
7849 dlg.finished(false);
7850 return Err(common::Error::HttpError(err));
7851 }
7852 Ok(res) => {
7853 let (mut parts, body) = res.into_parts();
7854 let mut body = common::Body::new(body);
7855 if !parts.status.is_success() {
7856 let bytes = common::to_bytes(body).await.unwrap_or_default();
7857 let error = serde_json::from_str(&common::to_string(&bytes));
7858 let response = common::to_response(parts, bytes.into());
7859
7860 if let common::Retry::After(d) =
7861 dlg.http_failure(&response, error.as_ref().ok())
7862 {
7863 sleep(d).await;
7864 continue;
7865 }
7866
7867 dlg.finished(false);
7868
7869 return Err(match error {
7870 Ok(value) => common::Error::BadRequest(value),
7871 _ => common::Error::Failure(response),
7872 });
7873 }
7874 let response = {
7875 let bytes = common::to_bytes(body).await.unwrap_or_default();
7876 let encoded = common::to_string(&bytes);
7877 match serde_json::from_str(&encoded) {
7878 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7879 Err(error) => {
7880 dlg.response_json_decode_error(&encoded, &error);
7881 return Err(common::Error::JsonDecodeError(
7882 encoded.to_string(),
7883 error,
7884 ));
7885 }
7886 }
7887 };
7888
7889 dlg.finished(true);
7890 return Ok(response);
7891 }
7892 }
7893 }
7894 }
7895
7896 ///
7897 /// Sets the *request* property to the given value.
7898 ///
7899 /// Even though the property as already been set when instantiating this call,
7900 /// we provide this method for API completeness.
7901 pub fn request(
7902 mut self,
7903 new_value: EventSubscription,
7904 ) -> ProjectLocationConnectionEventSubscriptionPatchCall<'a, C> {
7905 self._request = new_value;
7906 self
7907 }
7908 /// Required. Resource name of the EventSubscription. Format: projects/{project}/locations/{location}/connections/{connection}/eventSubscriptions/{event_subscription}
7909 ///
7910 /// Sets the *name* path property to the given value.
7911 ///
7912 /// Even though the property as already been set when instantiating this call,
7913 /// we provide this method for API completeness.
7914 pub fn name(
7915 mut self,
7916 new_value: &str,
7917 ) -> ProjectLocationConnectionEventSubscriptionPatchCall<'a, C> {
7918 self._name = new_value.to_string();
7919 self
7920 }
7921 /// 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`
7922 ///
7923 /// Sets the *update mask* query property to the given value.
7924 pub fn update_mask(
7925 mut self,
7926 new_value: common::FieldMask,
7927 ) -> ProjectLocationConnectionEventSubscriptionPatchCall<'a, C> {
7928 self._update_mask = Some(new_value);
7929 self
7930 }
7931 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7932 /// while executing the actual API request.
7933 ///
7934 /// ````text
7935 /// It should be used to handle progress information, and to implement a certain level of resilience.
7936 /// ````
7937 ///
7938 /// Sets the *delegate* property to the given value.
7939 pub fn delegate(
7940 mut self,
7941 new_value: &'a mut dyn common::Delegate,
7942 ) -> ProjectLocationConnectionEventSubscriptionPatchCall<'a, C> {
7943 self._delegate = Some(new_value);
7944 self
7945 }
7946
7947 /// Set any additional parameter of the query string used in the request.
7948 /// It should be used to set parameters which are not yet available through their own
7949 /// setters.
7950 ///
7951 /// Please note that this method must not be used to set any of the known parameters
7952 /// which have their own setter method. If done anyway, the request will fail.
7953 ///
7954 /// # Additional Parameters
7955 ///
7956 /// * *$.xgafv* (query-string) - V1 error format.
7957 /// * *access_token* (query-string) - OAuth access token.
7958 /// * *alt* (query-string) - Data format for response.
7959 /// * *callback* (query-string) - JSONP
7960 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7961 /// * *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.
7962 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7963 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7964 /// * *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.
7965 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7966 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7967 pub fn param<T>(
7968 mut self,
7969 name: T,
7970 value: T,
7971 ) -> ProjectLocationConnectionEventSubscriptionPatchCall<'a, C>
7972 where
7973 T: AsRef<str>,
7974 {
7975 self._additional_params
7976 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7977 self
7978 }
7979
7980 /// Identifies the authorization scope for the method you are building.
7981 ///
7982 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7983 /// [`Scope::CloudPlatform`].
7984 ///
7985 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7986 /// tokens for more than one scope.
7987 ///
7988 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7989 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7990 /// sufficient, a read-write scope will do as well.
7991 pub fn add_scope<St>(
7992 mut self,
7993 scope: St,
7994 ) -> ProjectLocationConnectionEventSubscriptionPatchCall<'a, C>
7995 where
7996 St: AsRef<str>,
7997 {
7998 self._scopes.insert(String::from(scope.as_ref()));
7999 self
8000 }
8001 /// Identifies the authorization scope(s) for the method you are building.
8002 ///
8003 /// See [`Self::add_scope()`] for details.
8004 pub fn add_scopes<I, St>(
8005 mut self,
8006 scopes: I,
8007 ) -> ProjectLocationConnectionEventSubscriptionPatchCall<'a, C>
8008 where
8009 I: IntoIterator<Item = St>,
8010 St: AsRef<str>,
8011 {
8012 self._scopes
8013 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8014 self
8015 }
8016
8017 /// Removes all scopes, and no default scope will be used either.
8018 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8019 /// for details).
8020 pub fn clear_scopes(mut self) -> ProjectLocationConnectionEventSubscriptionPatchCall<'a, C> {
8021 self._scopes.clear();
8022 self
8023 }
8024}
8025
8026/// RetryEventSubscription retries the registration of Subscription.
8027///
8028/// A builder for the *locations.connections.eventSubscriptions.retry* method supported by a *project* resource.
8029/// It is not used directly, but through a [`ProjectMethods`] instance.
8030///
8031/// # Example
8032///
8033/// Instantiate a resource method builder
8034///
8035/// ```test_harness,no_run
8036/// # extern crate hyper;
8037/// # extern crate hyper_rustls;
8038/// # extern crate google_connectors1 as connectors1;
8039/// use connectors1::api::RetryEventSubscriptionRequest;
8040/// # async fn dox() {
8041/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8042///
8043/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8044/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8045/// # secret,
8046/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8047/// # ).build().await.unwrap();
8048///
8049/// # let client = hyper_util::client::legacy::Client::builder(
8050/// # hyper_util::rt::TokioExecutor::new()
8051/// # )
8052/// # .build(
8053/// # hyper_rustls::HttpsConnectorBuilder::new()
8054/// # .with_native_roots()
8055/// # .unwrap()
8056/// # .https_or_http()
8057/// # .enable_http1()
8058/// # .build()
8059/// # );
8060/// # let mut hub = Connectors::new(client, auth);
8061/// // As the method needs a request, you would usually fill it with the desired information
8062/// // into the respective structure. Some of the parts shown here might not be applicable !
8063/// // Values shown here are possibly random and not representative !
8064/// let mut req = RetryEventSubscriptionRequest::default();
8065///
8066/// // You can configure optional parameters by calling the respective setters at will, and
8067/// // execute the final call using `doit()`.
8068/// // Values shown here are possibly random and not representative !
8069/// let result = hub.projects().locations_connections_event_subscriptions_retry(req, "name")
8070/// .doit().await;
8071/// # }
8072/// ```
8073pub struct ProjectLocationConnectionEventSubscriptionRetryCall<'a, C>
8074where
8075 C: 'a,
8076{
8077 hub: &'a Connectors<C>,
8078 _request: RetryEventSubscriptionRequest,
8079 _name: String,
8080 _delegate: Option<&'a mut dyn common::Delegate>,
8081 _additional_params: HashMap<String, String>,
8082 _scopes: BTreeSet<String>,
8083}
8084
8085impl<'a, C> common::CallBuilder for ProjectLocationConnectionEventSubscriptionRetryCall<'a, C> {}
8086
8087impl<'a, C> ProjectLocationConnectionEventSubscriptionRetryCall<'a, C>
8088where
8089 C: common::Connector,
8090{
8091 /// Perform the operation you have build so far.
8092 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8093 use std::borrow::Cow;
8094 use std::io::{Read, Seek};
8095
8096 use common::{url::Params, ToParts};
8097 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8098
8099 let mut dd = common::DefaultDelegate;
8100 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8101 dlg.begin(common::MethodInfo {
8102 id: "connectors.projects.locations.connections.eventSubscriptions.retry",
8103 http_method: hyper::Method::POST,
8104 });
8105
8106 for &field in ["alt", "name"].iter() {
8107 if self._additional_params.contains_key(field) {
8108 dlg.finished(false);
8109 return Err(common::Error::FieldClash(field));
8110 }
8111 }
8112
8113 let mut params = Params::with_capacity(4 + self._additional_params.len());
8114 params.push("name", self._name);
8115
8116 params.extend(self._additional_params.iter());
8117
8118 params.push("alt", "json");
8119 let mut url = self.hub._base_url.clone() + "v1/{+name}:retry";
8120 if self._scopes.is_empty() {
8121 self._scopes
8122 .insert(Scope::CloudPlatform.as_ref().to_string());
8123 }
8124
8125 #[allow(clippy::single_element_loop)]
8126 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8127 url = params.uri_replacement(url, param_name, find_this, true);
8128 }
8129 {
8130 let to_remove = ["name"];
8131 params.remove_params(&to_remove);
8132 }
8133
8134 let url = params.parse_with_url(&url);
8135
8136 let mut json_mime_type = mime::APPLICATION_JSON;
8137 let mut request_value_reader = {
8138 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8139 common::remove_json_null_values(&mut value);
8140 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8141 serde_json::to_writer(&mut dst, &value).unwrap();
8142 dst
8143 };
8144 let request_size = request_value_reader
8145 .seek(std::io::SeekFrom::End(0))
8146 .unwrap();
8147 request_value_reader
8148 .seek(std::io::SeekFrom::Start(0))
8149 .unwrap();
8150
8151 loop {
8152 let token = match self
8153 .hub
8154 .auth
8155 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8156 .await
8157 {
8158 Ok(token) => token,
8159 Err(e) => match dlg.token(e) {
8160 Ok(token) => token,
8161 Err(e) => {
8162 dlg.finished(false);
8163 return Err(common::Error::MissingToken(e));
8164 }
8165 },
8166 };
8167 request_value_reader
8168 .seek(std::io::SeekFrom::Start(0))
8169 .unwrap();
8170 let mut req_result = {
8171 let client = &self.hub.client;
8172 dlg.pre_request();
8173 let mut req_builder = hyper::Request::builder()
8174 .method(hyper::Method::POST)
8175 .uri(url.as_str())
8176 .header(USER_AGENT, self.hub._user_agent.clone());
8177
8178 if let Some(token) = token.as_ref() {
8179 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8180 }
8181
8182 let request = req_builder
8183 .header(CONTENT_TYPE, json_mime_type.to_string())
8184 .header(CONTENT_LENGTH, request_size as u64)
8185 .body(common::to_body(
8186 request_value_reader.get_ref().clone().into(),
8187 ));
8188
8189 client.request(request.unwrap()).await
8190 };
8191
8192 match req_result {
8193 Err(err) => {
8194 if let common::Retry::After(d) = dlg.http_error(&err) {
8195 sleep(d).await;
8196 continue;
8197 }
8198 dlg.finished(false);
8199 return Err(common::Error::HttpError(err));
8200 }
8201 Ok(res) => {
8202 let (mut parts, body) = res.into_parts();
8203 let mut body = common::Body::new(body);
8204 if !parts.status.is_success() {
8205 let bytes = common::to_bytes(body).await.unwrap_or_default();
8206 let error = serde_json::from_str(&common::to_string(&bytes));
8207 let response = common::to_response(parts, bytes.into());
8208
8209 if let common::Retry::After(d) =
8210 dlg.http_failure(&response, error.as_ref().ok())
8211 {
8212 sleep(d).await;
8213 continue;
8214 }
8215
8216 dlg.finished(false);
8217
8218 return Err(match error {
8219 Ok(value) => common::Error::BadRequest(value),
8220 _ => common::Error::Failure(response),
8221 });
8222 }
8223 let response = {
8224 let bytes = common::to_bytes(body).await.unwrap_or_default();
8225 let encoded = common::to_string(&bytes);
8226 match serde_json::from_str(&encoded) {
8227 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8228 Err(error) => {
8229 dlg.response_json_decode_error(&encoded, &error);
8230 return Err(common::Error::JsonDecodeError(
8231 encoded.to_string(),
8232 error,
8233 ));
8234 }
8235 }
8236 };
8237
8238 dlg.finished(true);
8239 return Ok(response);
8240 }
8241 }
8242 }
8243 }
8244
8245 ///
8246 /// Sets the *request* property to the given value.
8247 ///
8248 /// Even though the property as already been set when instantiating this call,
8249 /// we provide this method for API completeness.
8250 pub fn request(
8251 mut self,
8252 new_value: RetryEventSubscriptionRequest,
8253 ) -> ProjectLocationConnectionEventSubscriptionRetryCall<'a, C> {
8254 self._request = new_value;
8255 self
8256 }
8257 /// Required. Resource name of the form: `projects/*/locations/*/connections/*/eventSubscriptions/*`
8258 ///
8259 /// Sets the *name* path property to the given value.
8260 ///
8261 /// Even though the property as already been set when instantiating this call,
8262 /// we provide this method for API completeness.
8263 pub fn name(
8264 mut self,
8265 new_value: &str,
8266 ) -> ProjectLocationConnectionEventSubscriptionRetryCall<'a, C> {
8267 self._name = new_value.to_string();
8268 self
8269 }
8270 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8271 /// while executing the actual API request.
8272 ///
8273 /// ````text
8274 /// It should be used to handle progress information, and to implement a certain level of resilience.
8275 /// ````
8276 ///
8277 /// Sets the *delegate* property to the given value.
8278 pub fn delegate(
8279 mut self,
8280 new_value: &'a mut dyn common::Delegate,
8281 ) -> ProjectLocationConnectionEventSubscriptionRetryCall<'a, C> {
8282 self._delegate = Some(new_value);
8283 self
8284 }
8285
8286 /// Set any additional parameter of the query string used in the request.
8287 /// It should be used to set parameters which are not yet available through their own
8288 /// setters.
8289 ///
8290 /// Please note that this method must not be used to set any of the known parameters
8291 /// which have their own setter method. If done anyway, the request will fail.
8292 ///
8293 /// # Additional Parameters
8294 ///
8295 /// * *$.xgafv* (query-string) - V1 error format.
8296 /// * *access_token* (query-string) - OAuth access token.
8297 /// * *alt* (query-string) - Data format for response.
8298 /// * *callback* (query-string) - JSONP
8299 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8300 /// * *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.
8301 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8302 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8303 /// * *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.
8304 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8305 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8306 pub fn param<T>(
8307 mut self,
8308 name: T,
8309 value: T,
8310 ) -> ProjectLocationConnectionEventSubscriptionRetryCall<'a, C>
8311 where
8312 T: AsRef<str>,
8313 {
8314 self._additional_params
8315 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8316 self
8317 }
8318
8319 /// Identifies the authorization scope for the method you are building.
8320 ///
8321 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8322 /// [`Scope::CloudPlatform`].
8323 ///
8324 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8325 /// tokens for more than one scope.
8326 ///
8327 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8328 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8329 /// sufficient, a read-write scope will do as well.
8330 pub fn add_scope<St>(
8331 mut self,
8332 scope: St,
8333 ) -> ProjectLocationConnectionEventSubscriptionRetryCall<'a, C>
8334 where
8335 St: AsRef<str>,
8336 {
8337 self._scopes.insert(String::from(scope.as_ref()));
8338 self
8339 }
8340 /// Identifies the authorization scope(s) for the method you are building.
8341 ///
8342 /// See [`Self::add_scope()`] for details.
8343 pub fn add_scopes<I, St>(
8344 mut self,
8345 scopes: I,
8346 ) -> ProjectLocationConnectionEventSubscriptionRetryCall<'a, C>
8347 where
8348 I: IntoIterator<Item = St>,
8349 St: AsRef<str>,
8350 {
8351 self._scopes
8352 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8353 self
8354 }
8355
8356 /// Removes all scopes, and no default scope will be used either.
8357 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8358 /// for details).
8359 pub fn clear_scopes(mut self) -> ProjectLocationConnectionEventSubscriptionRetryCall<'a, C> {
8360 self._scopes.clear();
8361 self
8362 }
8363}
8364
8365/// List schema of a runtime actions filtered by action name.
8366///
8367/// A builder for the *locations.connections.runtimeActionSchemas.list* method supported by a *project* resource.
8368/// It is not used directly, but through a [`ProjectMethods`] instance.
8369///
8370/// # Example
8371///
8372/// Instantiate a resource method builder
8373///
8374/// ```test_harness,no_run
8375/// # extern crate hyper;
8376/// # extern crate hyper_rustls;
8377/// # extern crate google_connectors1 as connectors1;
8378/// # async fn dox() {
8379/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8380///
8381/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8382/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8383/// # secret,
8384/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8385/// # ).build().await.unwrap();
8386///
8387/// # let client = hyper_util::client::legacy::Client::builder(
8388/// # hyper_util::rt::TokioExecutor::new()
8389/// # )
8390/// # .build(
8391/// # hyper_rustls::HttpsConnectorBuilder::new()
8392/// # .with_native_roots()
8393/// # .unwrap()
8394/// # .https_or_http()
8395/// # .enable_http1()
8396/// # .build()
8397/// # );
8398/// # let mut hub = Connectors::new(client, auth);
8399/// // You can configure optional parameters by calling the respective setters at will, and
8400/// // execute the final call using `doit()`.
8401/// // Values shown here are possibly random and not representative !
8402/// let result = hub.projects().locations_connections_runtime_action_schemas_list("parent")
8403/// .page_token("ea")
8404/// .page_size(-99)
8405/// .filter("Lorem")
8406/// .doit().await;
8407/// # }
8408/// ```
8409pub struct ProjectLocationConnectionRuntimeActionSchemaListCall<'a, C>
8410where
8411 C: 'a,
8412{
8413 hub: &'a Connectors<C>,
8414 _parent: String,
8415 _page_token: Option<String>,
8416 _page_size: Option<i32>,
8417 _filter: Option<String>,
8418 _delegate: Option<&'a mut dyn common::Delegate>,
8419 _additional_params: HashMap<String, String>,
8420 _scopes: BTreeSet<String>,
8421}
8422
8423impl<'a, C> common::CallBuilder for ProjectLocationConnectionRuntimeActionSchemaListCall<'a, C> {}
8424
8425impl<'a, C> ProjectLocationConnectionRuntimeActionSchemaListCall<'a, C>
8426where
8427 C: common::Connector,
8428{
8429 /// Perform the operation you have build so far.
8430 pub async fn doit(
8431 mut self,
8432 ) -> common::Result<(common::Response, ListRuntimeActionSchemasResponse)> {
8433 use std::borrow::Cow;
8434 use std::io::{Read, Seek};
8435
8436 use common::{url::Params, ToParts};
8437 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8438
8439 let mut dd = common::DefaultDelegate;
8440 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8441 dlg.begin(common::MethodInfo {
8442 id: "connectors.projects.locations.connections.runtimeActionSchemas.list",
8443 http_method: hyper::Method::GET,
8444 });
8445
8446 for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
8447 if self._additional_params.contains_key(field) {
8448 dlg.finished(false);
8449 return Err(common::Error::FieldClash(field));
8450 }
8451 }
8452
8453 let mut params = Params::with_capacity(6 + self._additional_params.len());
8454 params.push("parent", self._parent);
8455 if let Some(value) = self._page_token.as_ref() {
8456 params.push("pageToken", value);
8457 }
8458 if let Some(value) = self._page_size.as_ref() {
8459 params.push("pageSize", value.to_string());
8460 }
8461 if let Some(value) = self._filter.as_ref() {
8462 params.push("filter", value);
8463 }
8464
8465 params.extend(self._additional_params.iter());
8466
8467 params.push("alt", "json");
8468 let mut url = self.hub._base_url.clone() + "v1/{+parent}/runtimeActionSchemas";
8469 if self._scopes.is_empty() {
8470 self._scopes
8471 .insert(Scope::CloudPlatform.as_ref().to_string());
8472 }
8473
8474 #[allow(clippy::single_element_loop)]
8475 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8476 url = params.uri_replacement(url, param_name, find_this, true);
8477 }
8478 {
8479 let to_remove = ["parent"];
8480 params.remove_params(&to_remove);
8481 }
8482
8483 let url = params.parse_with_url(&url);
8484
8485 loop {
8486 let token = match self
8487 .hub
8488 .auth
8489 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8490 .await
8491 {
8492 Ok(token) => token,
8493 Err(e) => match dlg.token(e) {
8494 Ok(token) => token,
8495 Err(e) => {
8496 dlg.finished(false);
8497 return Err(common::Error::MissingToken(e));
8498 }
8499 },
8500 };
8501 let mut req_result = {
8502 let client = &self.hub.client;
8503 dlg.pre_request();
8504 let mut req_builder = hyper::Request::builder()
8505 .method(hyper::Method::GET)
8506 .uri(url.as_str())
8507 .header(USER_AGENT, self.hub._user_agent.clone());
8508
8509 if let Some(token) = token.as_ref() {
8510 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8511 }
8512
8513 let request = req_builder
8514 .header(CONTENT_LENGTH, 0_u64)
8515 .body(common::to_body::<String>(None));
8516
8517 client.request(request.unwrap()).await
8518 };
8519
8520 match req_result {
8521 Err(err) => {
8522 if let common::Retry::After(d) = dlg.http_error(&err) {
8523 sleep(d).await;
8524 continue;
8525 }
8526 dlg.finished(false);
8527 return Err(common::Error::HttpError(err));
8528 }
8529 Ok(res) => {
8530 let (mut parts, body) = res.into_parts();
8531 let mut body = common::Body::new(body);
8532 if !parts.status.is_success() {
8533 let bytes = common::to_bytes(body).await.unwrap_or_default();
8534 let error = serde_json::from_str(&common::to_string(&bytes));
8535 let response = common::to_response(parts, bytes.into());
8536
8537 if let common::Retry::After(d) =
8538 dlg.http_failure(&response, error.as_ref().ok())
8539 {
8540 sleep(d).await;
8541 continue;
8542 }
8543
8544 dlg.finished(false);
8545
8546 return Err(match error {
8547 Ok(value) => common::Error::BadRequest(value),
8548 _ => common::Error::Failure(response),
8549 });
8550 }
8551 let response = {
8552 let bytes = common::to_bytes(body).await.unwrap_or_default();
8553 let encoded = common::to_string(&bytes);
8554 match serde_json::from_str(&encoded) {
8555 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8556 Err(error) => {
8557 dlg.response_json_decode_error(&encoded, &error);
8558 return Err(common::Error::JsonDecodeError(
8559 encoded.to_string(),
8560 error,
8561 ));
8562 }
8563 }
8564 };
8565
8566 dlg.finished(true);
8567 return Ok(response);
8568 }
8569 }
8570 }
8571 }
8572
8573 /// Required. Parent resource of RuntimeActionSchema Format: projects/{project}/locations/{location}/connections/{connection}
8574 ///
8575 /// Sets the *parent* path property to the given value.
8576 ///
8577 /// Even though the property as already been set when instantiating this call,
8578 /// we provide this method for API completeness.
8579 pub fn parent(
8580 mut self,
8581 new_value: &str,
8582 ) -> ProjectLocationConnectionRuntimeActionSchemaListCall<'a, C> {
8583 self._parent = new_value.to_string();
8584 self
8585 }
8586 /// Page token.
8587 ///
8588 /// Sets the *page token* query property to the given value.
8589 pub fn page_token(
8590 mut self,
8591 new_value: &str,
8592 ) -> ProjectLocationConnectionRuntimeActionSchemaListCall<'a, C> {
8593 self._page_token = Some(new_value.to_string());
8594 self
8595 }
8596 /// Page size.
8597 ///
8598 /// Sets the *page size* query property to the given value.
8599 pub fn page_size(
8600 mut self,
8601 new_value: i32,
8602 ) -> ProjectLocationConnectionRuntimeActionSchemaListCall<'a, C> {
8603 self._page_size = Some(new_value);
8604 self
8605 }
8606 /// 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.
8607 ///
8608 /// Sets the *filter* query property to the given value.
8609 pub fn filter(
8610 mut self,
8611 new_value: &str,
8612 ) -> ProjectLocationConnectionRuntimeActionSchemaListCall<'a, C> {
8613 self._filter = Some(new_value.to_string());
8614 self
8615 }
8616 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8617 /// while executing the actual API request.
8618 ///
8619 /// ````text
8620 /// It should be used to handle progress information, and to implement a certain level of resilience.
8621 /// ````
8622 ///
8623 /// Sets the *delegate* property to the given value.
8624 pub fn delegate(
8625 mut self,
8626 new_value: &'a mut dyn common::Delegate,
8627 ) -> ProjectLocationConnectionRuntimeActionSchemaListCall<'a, C> {
8628 self._delegate = Some(new_value);
8629 self
8630 }
8631
8632 /// Set any additional parameter of the query string used in the request.
8633 /// It should be used to set parameters which are not yet available through their own
8634 /// setters.
8635 ///
8636 /// Please note that this method must not be used to set any of the known parameters
8637 /// which have their own setter method. If done anyway, the request will fail.
8638 ///
8639 /// # Additional Parameters
8640 ///
8641 /// * *$.xgafv* (query-string) - V1 error format.
8642 /// * *access_token* (query-string) - OAuth access token.
8643 /// * *alt* (query-string) - Data format for response.
8644 /// * *callback* (query-string) - JSONP
8645 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8646 /// * *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.
8647 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8648 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8649 /// * *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.
8650 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8651 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8652 pub fn param<T>(
8653 mut self,
8654 name: T,
8655 value: T,
8656 ) -> ProjectLocationConnectionRuntimeActionSchemaListCall<'a, C>
8657 where
8658 T: AsRef<str>,
8659 {
8660 self._additional_params
8661 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8662 self
8663 }
8664
8665 /// Identifies the authorization scope for the method you are building.
8666 ///
8667 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8668 /// [`Scope::CloudPlatform`].
8669 ///
8670 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8671 /// tokens for more than one scope.
8672 ///
8673 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8674 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8675 /// sufficient, a read-write scope will do as well.
8676 pub fn add_scope<St>(
8677 mut self,
8678 scope: St,
8679 ) -> ProjectLocationConnectionRuntimeActionSchemaListCall<'a, C>
8680 where
8681 St: AsRef<str>,
8682 {
8683 self._scopes.insert(String::from(scope.as_ref()));
8684 self
8685 }
8686 /// Identifies the authorization scope(s) for the method you are building.
8687 ///
8688 /// See [`Self::add_scope()`] for details.
8689 pub fn add_scopes<I, St>(
8690 mut self,
8691 scopes: I,
8692 ) -> ProjectLocationConnectionRuntimeActionSchemaListCall<'a, C>
8693 where
8694 I: IntoIterator<Item = St>,
8695 St: AsRef<str>,
8696 {
8697 self._scopes
8698 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8699 self
8700 }
8701
8702 /// Removes all scopes, and no default scope will be used either.
8703 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8704 /// for details).
8705 pub fn clear_scopes(mut self) -> ProjectLocationConnectionRuntimeActionSchemaListCall<'a, C> {
8706 self._scopes.clear();
8707 self
8708 }
8709}
8710
8711/// List schema of a runtime entities filtered by entity name.
8712///
8713/// A builder for the *locations.connections.runtimeEntitySchemas.list* method supported by a *project* resource.
8714/// It is not used directly, but through a [`ProjectMethods`] instance.
8715///
8716/// # Example
8717///
8718/// Instantiate a resource method builder
8719///
8720/// ```test_harness,no_run
8721/// # extern crate hyper;
8722/// # extern crate hyper_rustls;
8723/// # extern crate google_connectors1 as connectors1;
8724/// # async fn dox() {
8725/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8726///
8727/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8728/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8729/// # secret,
8730/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8731/// # ).build().await.unwrap();
8732///
8733/// # let client = hyper_util::client::legacy::Client::builder(
8734/// # hyper_util::rt::TokioExecutor::new()
8735/// # )
8736/// # .build(
8737/// # hyper_rustls::HttpsConnectorBuilder::new()
8738/// # .with_native_roots()
8739/// # .unwrap()
8740/// # .https_or_http()
8741/// # .enable_http1()
8742/// # .build()
8743/// # );
8744/// # let mut hub = Connectors::new(client, auth);
8745/// // You can configure optional parameters by calling the respective setters at will, and
8746/// // execute the final call using `doit()`.
8747/// // Values shown here are possibly random and not representative !
8748/// let result = hub.projects().locations_connections_runtime_entity_schemas_list("parent")
8749/// .page_token("labore")
8750/// .page_size(-43)
8751/// .filter("duo")
8752/// .doit().await;
8753/// # }
8754/// ```
8755pub struct ProjectLocationConnectionRuntimeEntitySchemaListCall<'a, C>
8756where
8757 C: 'a,
8758{
8759 hub: &'a Connectors<C>,
8760 _parent: String,
8761 _page_token: Option<String>,
8762 _page_size: Option<i32>,
8763 _filter: Option<String>,
8764 _delegate: Option<&'a mut dyn common::Delegate>,
8765 _additional_params: HashMap<String, String>,
8766 _scopes: BTreeSet<String>,
8767}
8768
8769impl<'a, C> common::CallBuilder for ProjectLocationConnectionRuntimeEntitySchemaListCall<'a, C> {}
8770
8771impl<'a, C> ProjectLocationConnectionRuntimeEntitySchemaListCall<'a, C>
8772where
8773 C: common::Connector,
8774{
8775 /// Perform the operation you have build so far.
8776 pub async fn doit(
8777 mut self,
8778 ) -> common::Result<(common::Response, ListRuntimeEntitySchemasResponse)> {
8779 use std::borrow::Cow;
8780 use std::io::{Read, Seek};
8781
8782 use common::{url::Params, ToParts};
8783 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8784
8785 let mut dd = common::DefaultDelegate;
8786 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8787 dlg.begin(common::MethodInfo {
8788 id: "connectors.projects.locations.connections.runtimeEntitySchemas.list",
8789 http_method: hyper::Method::GET,
8790 });
8791
8792 for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
8793 if self._additional_params.contains_key(field) {
8794 dlg.finished(false);
8795 return Err(common::Error::FieldClash(field));
8796 }
8797 }
8798
8799 let mut params = Params::with_capacity(6 + self._additional_params.len());
8800 params.push("parent", self._parent);
8801 if let Some(value) = self._page_token.as_ref() {
8802 params.push("pageToken", value);
8803 }
8804 if let Some(value) = self._page_size.as_ref() {
8805 params.push("pageSize", value.to_string());
8806 }
8807 if let Some(value) = self._filter.as_ref() {
8808 params.push("filter", value);
8809 }
8810
8811 params.extend(self._additional_params.iter());
8812
8813 params.push("alt", "json");
8814 let mut url = self.hub._base_url.clone() + "v1/{+parent}/runtimeEntitySchemas";
8815 if self._scopes.is_empty() {
8816 self._scopes
8817 .insert(Scope::CloudPlatform.as_ref().to_string());
8818 }
8819
8820 #[allow(clippy::single_element_loop)]
8821 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8822 url = params.uri_replacement(url, param_name, find_this, true);
8823 }
8824 {
8825 let to_remove = ["parent"];
8826 params.remove_params(&to_remove);
8827 }
8828
8829 let url = params.parse_with_url(&url);
8830
8831 loop {
8832 let token = match self
8833 .hub
8834 .auth
8835 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8836 .await
8837 {
8838 Ok(token) => token,
8839 Err(e) => match dlg.token(e) {
8840 Ok(token) => token,
8841 Err(e) => {
8842 dlg.finished(false);
8843 return Err(common::Error::MissingToken(e));
8844 }
8845 },
8846 };
8847 let mut req_result = {
8848 let client = &self.hub.client;
8849 dlg.pre_request();
8850 let mut req_builder = hyper::Request::builder()
8851 .method(hyper::Method::GET)
8852 .uri(url.as_str())
8853 .header(USER_AGENT, self.hub._user_agent.clone());
8854
8855 if let Some(token) = token.as_ref() {
8856 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8857 }
8858
8859 let request = req_builder
8860 .header(CONTENT_LENGTH, 0_u64)
8861 .body(common::to_body::<String>(None));
8862
8863 client.request(request.unwrap()).await
8864 };
8865
8866 match req_result {
8867 Err(err) => {
8868 if let common::Retry::After(d) = dlg.http_error(&err) {
8869 sleep(d).await;
8870 continue;
8871 }
8872 dlg.finished(false);
8873 return Err(common::Error::HttpError(err));
8874 }
8875 Ok(res) => {
8876 let (mut parts, body) = res.into_parts();
8877 let mut body = common::Body::new(body);
8878 if !parts.status.is_success() {
8879 let bytes = common::to_bytes(body).await.unwrap_or_default();
8880 let error = serde_json::from_str(&common::to_string(&bytes));
8881 let response = common::to_response(parts, bytes.into());
8882
8883 if let common::Retry::After(d) =
8884 dlg.http_failure(&response, error.as_ref().ok())
8885 {
8886 sleep(d).await;
8887 continue;
8888 }
8889
8890 dlg.finished(false);
8891
8892 return Err(match error {
8893 Ok(value) => common::Error::BadRequest(value),
8894 _ => common::Error::Failure(response),
8895 });
8896 }
8897 let response = {
8898 let bytes = common::to_bytes(body).await.unwrap_or_default();
8899 let encoded = common::to_string(&bytes);
8900 match serde_json::from_str(&encoded) {
8901 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8902 Err(error) => {
8903 dlg.response_json_decode_error(&encoded, &error);
8904 return Err(common::Error::JsonDecodeError(
8905 encoded.to_string(),
8906 error,
8907 ));
8908 }
8909 }
8910 };
8911
8912 dlg.finished(true);
8913 return Ok(response);
8914 }
8915 }
8916 }
8917 }
8918
8919 /// Required. Parent resource of RuntimeEntitySchema Format: projects/{project}/locations/{location}/connections/{connection}
8920 ///
8921 /// Sets the *parent* path property to the given value.
8922 ///
8923 /// Even though the property as already been set when instantiating this call,
8924 /// we provide this method for API completeness.
8925 pub fn parent(
8926 mut self,
8927 new_value: &str,
8928 ) -> ProjectLocationConnectionRuntimeEntitySchemaListCall<'a, C> {
8929 self._parent = new_value.to_string();
8930 self
8931 }
8932 /// Page token.
8933 ///
8934 /// Sets the *page token* query property to the given value.
8935 pub fn page_token(
8936 mut self,
8937 new_value: &str,
8938 ) -> ProjectLocationConnectionRuntimeEntitySchemaListCall<'a, C> {
8939 self._page_token = Some(new_value.to_string());
8940 self
8941 }
8942 /// Page size.
8943 ///
8944 /// Sets the *page size* query property to the given value.
8945 pub fn page_size(
8946 mut self,
8947 new_value: i32,
8948 ) -> ProjectLocationConnectionRuntimeEntitySchemaListCall<'a, C> {
8949 self._page_size = Some(new_value);
8950 self
8951 }
8952 /// 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.
8953 ///
8954 /// Sets the *filter* query property to the given value.
8955 pub fn filter(
8956 mut self,
8957 new_value: &str,
8958 ) -> ProjectLocationConnectionRuntimeEntitySchemaListCall<'a, C> {
8959 self._filter = Some(new_value.to_string());
8960 self
8961 }
8962 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8963 /// while executing the actual API request.
8964 ///
8965 /// ````text
8966 /// It should be used to handle progress information, and to implement a certain level of resilience.
8967 /// ````
8968 ///
8969 /// Sets the *delegate* property to the given value.
8970 pub fn delegate(
8971 mut self,
8972 new_value: &'a mut dyn common::Delegate,
8973 ) -> ProjectLocationConnectionRuntimeEntitySchemaListCall<'a, C> {
8974 self._delegate = Some(new_value);
8975 self
8976 }
8977
8978 /// Set any additional parameter of the query string used in the request.
8979 /// It should be used to set parameters which are not yet available through their own
8980 /// setters.
8981 ///
8982 /// Please note that this method must not be used to set any of the known parameters
8983 /// which have their own setter method. If done anyway, the request will fail.
8984 ///
8985 /// # Additional Parameters
8986 ///
8987 /// * *$.xgafv* (query-string) - V1 error format.
8988 /// * *access_token* (query-string) - OAuth access token.
8989 /// * *alt* (query-string) - Data format for response.
8990 /// * *callback* (query-string) - JSONP
8991 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8992 /// * *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.
8993 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8994 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8995 /// * *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.
8996 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8997 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8998 pub fn param<T>(
8999 mut self,
9000 name: T,
9001 value: T,
9002 ) -> ProjectLocationConnectionRuntimeEntitySchemaListCall<'a, C>
9003 where
9004 T: AsRef<str>,
9005 {
9006 self._additional_params
9007 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9008 self
9009 }
9010
9011 /// Identifies the authorization scope for the method you are building.
9012 ///
9013 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9014 /// [`Scope::CloudPlatform`].
9015 ///
9016 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9017 /// tokens for more than one scope.
9018 ///
9019 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9020 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9021 /// sufficient, a read-write scope will do as well.
9022 pub fn add_scope<St>(
9023 mut self,
9024 scope: St,
9025 ) -> ProjectLocationConnectionRuntimeEntitySchemaListCall<'a, C>
9026 where
9027 St: AsRef<str>,
9028 {
9029 self._scopes.insert(String::from(scope.as_ref()));
9030 self
9031 }
9032 /// Identifies the authorization scope(s) for the method you are building.
9033 ///
9034 /// See [`Self::add_scope()`] for details.
9035 pub fn add_scopes<I, St>(
9036 mut self,
9037 scopes: I,
9038 ) -> ProjectLocationConnectionRuntimeEntitySchemaListCall<'a, C>
9039 where
9040 I: IntoIterator<Item = St>,
9041 St: AsRef<str>,
9042 {
9043 self._scopes
9044 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9045 self
9046 }
9047
9048 /// Removes all scopes, and no default scope will be used either.
9049 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9050 /// for details).
9051 pub fn clear_scopes(mut self) -> ProjectLocationConnectionRuntimeEntitySchemaListCall<'a, C> {
9052 self._scopes.clear();
9053 self
9054 }
9055}
9056
9057/// Creates a new Connection in a given project and location.
9058///
9059/// A builder for the *locations.connections.create* method supported by a *project* resource.
9060/// It is not used directly, but through a [`ProjectMethods`] instance.
9061///
9062/// # Example
9063///
9064/// Instantiate a resource method builder
9065///
9066/// ```test_harness,no_run
9067/// # extern crate hyper;
9068/// # extern crate hyper_rustls;
9069/// # extern crate google_connectors1 as connectors1;
9070/// use connectors1::api::Connection;
9071/// # async fn dox() {
9072/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9073///
9074/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9075/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9076/// # secret,
9077/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9078/// # ).build().await.unwrap();
9079///
9080/// # let client = hyper_util::client::legacy::Client::builder(
9081/// # hyper_util::rt::TokioExecutor::new()
9082/// # )
9083/// # .build(
9084/// # hyper_rustls::HttpsConnectorBuilder::new()
9085/// # .with_native_roots()
9086/// # .unwrap()
9087/// # .https_or_http()
9088/// # .enable_http1()
9089/// # .build()
9090/// # );
9091/// # let mut hub = Connectors::new(client, auth);
9092/// // As the method needs a request, you would usually fill it with the desired information
9093/// // into the respective structure. Some of the parts shown here might not be applicable !
9094/// // Values shown here are possibly random and not representative !
9095/// let mut req = Connection::default();
9096///
9097/// // You can configure optional parameters by calling the respective setters at will, and
9098/// // execute the final call using `doit()`.
9099/// // Values shown here are possibly random and not representative !
9100/// let result = hub.projects().locations_connections_create(req, "parent")
9101/// .connection_id("no")
9102/// .doit().await;
9103/// # }
9104/// ```
9105pub struct ProjectLocationConnectionCreateCall<'a, C>
9106where
9107 C: 'a,
9108{
9109 hub: &'a Connectors<C>,
9110 _request: Connection,
9111 _parent: String,
9112 _connection_id: Option<String>,
9113 _delegate: Option<&'a mut dyn common::Delegate>,
9114 _additional_params: HashMap<String, String>,
9115 _scopes: BTreeSet<String>,
9116}
9117
9118impl<'a, C> common::CallBuilder for ProjectLocationConnectionCreateCall<'a, C> {}
9119
9120impl<'a, C> ProjectLocationConnectionCreateCall<'a, C>
9121where
9122 C: common::Connector,
9123{
9124 /// Perform the operation you have build so far.
9125 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
9126 use std::borrow::Cow;
9127 use std::io::{Read, Seek};
9128
9129 use common::{url::Params, ToParts};
9130 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9131
9132 let mut dd = common::DefaultDelegate;
9133 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9134 dlg.begin(common::MethodInfo {
9135 id: "connectors.projects.locations.connections.create",
9136 http_method: hyper::Method::POST,
9137 });
9138
9139 for &field in ["alt", "parent", "connectionId"].iter() {
9140 if self._additional_params.contains_key(field) {
9141 dlg.finished(false);
9142 return Err(common::Error::FieldClash(field));
9143 }
9144 }
9145
9146 let mut params = Params::with_capacity(5 + self._additional_params.len());
9147 params.push("parent", self._parent);
9148 if let Some(value) = self._connection_id.as_ref() {
9149 params.push("connectionId", value);
9150 }
9151
9152 params.extend(self._additional_params.iter());
9153
9154 params.push("alt", "json");
9155 let mut url = self.hub._base_url.clone() + "v1/{+parent}/connections";
9156 if self._scopes.is_empty() {
9157 self._scopes
9158 .insert(Scope::CloudPlatform.as_ref().to_string());
9159 }
9160
9161 #[allow(clippy::single_element_loop)]
9162 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
9163 url = params.uri_replacement(url, param_name, find_this, true);
9164 }
9165 {
9166 let to_remove = ["parent"];
9167 params.remove_params(&to_remove);
9168 }
9169
9170 let url = params.parse_with_url(&url);
9171
9172 let mut json_mime_type = mime::APPLICATION_JSON;
9173 let mut request_value_reader = {
9174 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9175 common::remove_json_null_values(&mut value);
9176 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9177 serde_json::to_writer(&mut dst, &value).unwrap();
9178 dst
9179 };
9180 let request_size = request_value_reader
9181 .seek(std::io::SeekFrom::End(0))
9182 .unwrap();
9183 request_value_reader
9184 .seek(std::io::SeekFrom::Start(0))
9185 .unwrap();
9186
9187 loop {
9188 let token = match self
9189 .hub
9190 .auth
9191 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9192 .await
9193 {
9194 Ok(token) => token,
9195 Err(e) => match dlg.token(e) {
9196 Ok(token) => token,
9197 Err(e) => {
9198 dlg.finished(false);
9199 return Err(common::Error::MissingToken(e));
9200 }
9201 },
9202 };
9203 request_value_reader
9204 .seek(std::io::SeekFrom::Start(0))
9205 .unwrap();
9206 let mut req_result = {
9207 let client = &self.hub.client;
9208 dlg.pre_request();
9209 let mut req_builder = hyper::Request::builder()
9210 .method(hyper::Method::POST)
9211 .uri(url.as_str())
9212 .header(USER_AGENT, self.hub._user_agent.clone());
9213
9214 if let Some(token) = token.as_ref() {
9215 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9216 }
9217
9218 let request = req_builder
9219 .header(CONTENT_TYPE, json_mime_type.to_string())
9220 .header(CONTENT_LENGTH, request_size as u64)
9221 .body(common::to_body(
9222 request_value_reader.get_ref().clone().into(),
9223 ));
9224
9225 client.request(request.unwrap()).await
9226 };
9227
9228 match req_result {
9229 Err(err) => {
9230 if let common::Retry::After(d) = dlg.http_error(&err) {
9231 sleep(d).await;
9232 continue;
9233 }
9234 dlg.finished(false);
9235 return Err(common::Error::HttpError(err));
9236 }
9237 Ok(res) => {
9238 let (mut parts, body) = res.into_parts();
9239 let mut body = common::Body::new(body);
9240 if !parts.status.is_success() {
9241 let bytes = common::to_bytes(body).await.unwrap_or_default();
9242 let error = serde_json::from_str(&common::to_string(&bytes));
9243 let response = common::to_response(parts, bytes.into());
9244
9245 if let common::Retry::After(d) =
9246 dlg.http_failure(&response, error.as_ref().ok())
9247 {
9248 sleep(d).await;
9249 continue;
9250 }
9251
9252 dlg.finished(false);
9253
9254 return Err(match error {
9255 Ok(value) => common::Error::BadRequest(value),
9256 _ => common::Error::Failure(response),
9257 });
9258 }
9259 let response = {
9260 let bytes = common::to_bytes(body).await.unwrap_or_default();
9261 let encoded = common::to_string(&bytes);
9262 match serde_json::from_str(&encoded) {
9263 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9264 Err(error) => {
9265 dlg.response_json_decode_error(&encoded, &error);
9266 return Err(common::Error::JsonDecodeError(
9267 encoded.to_string(),
9268 error,
9269 ));
9270 }
9271 }
9272 };
9273
9274 dlg.finished(true);
9275 return Ok(response);
9276 }
9277 }
9278 }
9279 }
9280
9281 ///
9282 /// Sets the *request* property to the given value.
9283 ///
9284 /// Even though the property as already been set when instantiating this call,
9285 /// we provide this method for API completeness.
9286 pub fn request(mut self, new_value: Connection) -> ProjectLocationConnectionCreateCall<'a, C> {
9287 self._request = new_value;
9288 self
9289 }
9290 /// Required. Parent resource of the Connection, of the form: `projects/*/locations/*`
9291 ///
9292 /// Sets the *parent* path property to the given value.
9293 ///
9294 /// Even though the property as already been set when instantiating this call,
9295 /// we provide this method for API completeness.
9296 pub fn parent(mut self, new_value: &str) -> ProjectLocationConnectionCreateCall<'a, C> {
9297 self._parent = new_value.to_string();
9298 self
9299 }
9300 /// Required. Identifier to assign to the Connection. Must be unique within scope of the parent resource.
9301 ///
9302 /// Sets the *connection id* query property to the given value.
9303 pub fn connection_id(mut self, new_value: &str) -> ProjectLocationConnectionCreateCall<'a, C> {
9304 self._connection_id = Some(new_value.to_string());
9305 self
9306 }
9307 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9308 /// while executing the actual API request.
9309 ///
9310 /// ````text
9311 /// It should be used to handle progress information, and to implement a certain level of resilience.
9312 /// ````
9313 ///
9314 /// Sets the *delegate* property to the given value.
9315 pub fn delegate(
9316 mut self,
9317 new_value: &'a mut dyn common::Delegate,
9318 ) -> ProjectLocationConnectionCreateCall<'a, C> {
9319 self._delegate = Some(new_value);
9320 self
9321 }
9322
9323 /// Set any additional parameter of the query string used in the request.
9324 /// It should be used to set parameters which are not yet available through their own
9325 /// setters.
9326 ///
9327 /// Please note that this method must not be used to set any of the known parameters
9328 /// which have their own setter method. If done anyway, the request will fail.
9329 ///
9330 /// # Additional Parameters
9331 ///
9332 /// * *$.xgafv* (query-string) - V1 error format.
9333 /// * *access_token* (query-string) - OAuth access token.
9334 /// * *alt* (query-string) - Data format for response.
9335 /// * *callback* (query-string) - JSONP
9336 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9337 /// * *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.
9338 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9339 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9340 /// * *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.
9341 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9342 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9343 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationConnectionCreateCall<'a, C>
9344 where
9345 T: AsRef<str>,
9346 {
9347 self._additional_params
9348 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9349 self
9350 }
9351
9352 /// Identifies the authorization scope for the method you are building.
9353 ///
9354 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9355 /// [`Scope::CloudPlatform`].
9356 ///
9357 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9358 /// tokens for more than one scope.
9359 ///
9360 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9361 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9362 /// sufficient, a read-write scope will do as well.
9363 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionCreateCall<'a, C>
9364 where
9365 St: AsRef<str>,
9366 {
9367 self._scopes.insert(String::from(scope.as_ref()));
9368 self
9369 }
9370 /// Identifies the authorization scope(s) for the method you are building.
9371 ///
9372 /// See [`Self::add_scope()`] for details.
9373 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationConnectionCreateCall<'a, C>
9374 where
9375 I: IntoIterator<Item = St>,
9376 St: AsRef<str>,
9377 {
9378 self._scopes
9379 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9380 self
9381 }
9382
9383 /// Removes all scopes, and no default scope will be used either.
9384 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9385 /// for details).
9386 pub fn clear_scopes(mut self) -> ProjectLocationConnectionCreateCall<'a, C> {
9387 self._scopes.clear();
9388 self
9389 }
9390}
9391
9392/// Deletes a single Connection.
9393///
9394/// A builder for the *locations.connections.delete* method supported by a *project* resource.
9395/// It is not used directly, but through a [`ProjectMethods`] instance.
9396///
9397/// # Example
9398///
9399/// Instantiate a resource method builder
9400///
9401/// ```test_harness,no_run
9402/// # extern crate hyper;
9403/// # extern crate hyper_rustls;
9404/// # extern crate google_connectors1 as connectors1;
9405/// # async fn dox() {
9406/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9407///
9408/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9409/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9410/// # secret,
9411/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9412/// # ).build().await.unwrap();
9413///
9414/// # let client = hyper_util::client::legacy::Client::builder(
9415/// # hyper_util::rt::TokioExecutor::new()
9416/// # )
9417/// # .build(
9418/// # hyper_rustls::HttpsConnectorBuilder::new()
9419/// # .with_native_roots()
9420/// # .unwrap()
9421/// # .https_or_http()
9422/// # .enable_http1()
9423/// # .build()
9424/// # );
9425/// # let mut hub = Connectors::new(client, auth);
9426/// // You can configure optional parameters by calling the respective setters at will, and
9427/// // execute the final call using `doit()`.
9428/// // Values shown here are possibly random and not representative !
9429/// let result = hub.projects().locations_connections_delete("name")
9430/// .doit().await;
9431/// # }
9432/// ```
9433pub struct ProjectLocationConnectionDeleteCall<'a, C>
9434where
9435 C: 'a,
9436{
9437 hub: &'a Connectors<C>,
9438 _name: String,
9439 _delegate: Option<&'a mut dyn common::Delegate>,
9440 _additional_params: HashMap<String, String>,
9441 _scopes: BTreeSet<String>,
9442}
9443
9444impl<'a, C> common::CallBuilder for ProjectLocationConnectionDeleteCall<'a, C> {}
9445
9446impl<'a, C> ProjectLocationConnectionDeleteCall<'a, C>
9447where
9448 C: common::Connector,
9449{
9450 /// Perform the operation you have build so far.
9451 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
9452 use std::borrow::Cow;
9453 use std::io::{Read, Seek};
9454
9455 use common::{url::Params, ToParts};
9456 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9457
9458 let mut dd = common::DefaultDelegate;
9459 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9460 dlg.begin(common::MethodInfo {
9461 id: "connectors.projects.locations.connections.delete",
9462 http_method: hyper::Method::DELETE,
9463 });
9464
9465 for &field in ["alt", "name"].iter() {
9466 if self._additional_params.contains_key(field) {
9467 dlg.finished(false);
9468 return Err(common::Error::FieldClash(field));
9469 }
9470 }
9471
9472 let mut params = Params::with_capacity(3 + self._additional_params.len());
9473 params.push("name", self._name);
9474
9475 params.extend(self._additional_params.iter());
9476
9477 params.push("alt", "json");
9478 let mut url = self.hub._base_url.clone() + "v1/{+name}";
9479 if self._scopes.is_empty() {
9480 self._scopes
9481 .insert(Scope::CloudPlatform.as_ref().to_string());
9482 }
9483
9484 #[allow(clippy::single_element_loop)]
9485 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9486 url = params.uri_replacement(url, param_name, find_this, true);
9487 }
9488 {
9489 let to_remove = ["name"];
9490 params.remove_params(&to_remove);
9491 }
9492
9493 let url = params.parse_with_url(&url);
9494
9495 loop {
9496 let token = match self
9497 .hub
9498 .auth
9499 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9500 .await
9501 {
9502 Ok(token) => token,
9503 Err(e) => match dlg.token(e) {
9504 Ok(token) => token,
9505 Err(e) => {
9506 dlg.finished(false);
9507 return Err(common::Error::MissingToken(e));
9508 }
9509 },
9510 };
9511 let mut req_result = {
9512 let client = &self.hub.client;
9513 dlg.pre_request();
9514 let mut req_builder = hyper::Request::builder()
9515 .method(hyper::Method::DELETE)
9516 .uri(url.as_str())
9517 .header(USER_AGENT, self.hub._user_agent.clone());
9518
9519 if let Some(token) = token.as_ref() {
9520 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9521 }
9522
9523 let request = req_builder
9524 .header(CONTENT_LENGTH, 0_u64)
9525 .body(common::to_body::<String>(None));
9526
9527 client.request(request.unwrap()).await
9528 };
9529
9530 match req_result {
9531 Err(err) => {
9532 if let common::Retry::After(d) = dlg.http_error(&err) {
9533 sleep(d).await;
9534 continue;
9535 }
9536 dlg.finished(false);
9537 return Err(common::Error::HttpError(err));
9538 }
9539 Ok(res) => {
9540 let (mut parts, body) = res.into_parts();
9541 let mut body = common::Body::new(body);
9542 if !parts.status.is_success() {
9543 let bytes = common::to_bytes(body).await.unwrap_or_default();
9544 let error = serde_json::from_str(&common::to_string(&bytes));
9545 let response = common::to_response(parts, bytes.into());
9546
9547 if let common::Retry::After(d) =
9548 dlg.http_failure(&response, error.as_ref().ok())
9549 {
9550 sleep(d).await;
9551 continue;
9552 }
9553
9554 dlg.finished(false);
9555
9556 return Err(match error {
9557 Ok(value) => common::Error::BadRequest(value),
9558 _ => common::Error::Failure(response),
9559 });
9560 }
9561 let response = {
9562 let bytes = common::to_bytes(body).await.unwrap_or_default();
9563 let encoded = common::to_string(&bytes);
9564 match serde_json::from_str(&encoded) {
9565 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9566 Err(error) => {
9567 dlg.response_json_decode_error(&encoded, &error);
9568 return Err(common::Error::JsonDecodeError(
9569 encoded.to_string(),
9570 error,
9571 ));
9572 }
9573 }
9574 };
9575
9576 dlg.finished(true);
9577 return Ok(response);
9578 }
9579 }
9580 }
9581 }
9582
9583 /// Required. Resource name of the form: `projects/*/locations/*/connections/*`
9584 ///
9585 /// Sets the *name* path property to the given value.
9586 ///
9587 /// Even though the property as already been set when instantiating this call,
9588 /// we provide this method for API completeness.
9589 pub fn name(mut self, new_value: &str) -> ProjectLocationConnectionDeleteCall<'a, C> {
9590 self._name = new_value.to_string();
9591 self
9592 }
9593 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9594 /// while executing the actual API request.
9595 ///
9596 /// ````text
9597 /// It should be used to handle progress information, and to implement a certain level of resilience.
9598 /// ````
9599 ///
9600 /// Sets the *delegate* property to the given value.
9601 pub fn delegate(
9602 mut self,
9603 new_value: &'a mut dyn common::Delegate,
9604 ) -> ProjectLocationConnectionDeleteCall<'a, C> {
9605 self._delegate = Some(new_value);
9606 self
9607 }
9608
9609 /// Set any additional parameter of the query string used in the request.
9610 /// It should be used to set parameters which are not yet available through their own
9611 /// setters.
9612 ///
9613 /// Please note that this method must not be used to set any of the known parameters
9614 /// which have their own setter method. If done anyway, the request will fail.
9615 ///
9616 /// # Additional Parameters
9617 ///
9618 /// * *$.xgafv* (query-string) - V1 error format.
9619 /// * *access_token* (query-string) - OAuth access token.
9620 /// * *alt* (query-string) - Data format for response.
9621 /// * *callback* (query-string) - JSONP
9622 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9623 /// * *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.
9624 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9625 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9626 /// * *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.
9627 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9628 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9629 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationConnectionDeleteCall<'a, C>
9630 where
9631 T: AsRef<str>,
9632 {
9633 self._additional_params
9634 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9635 self
9636 }
9637
9638 /// Identifies the authorization scope for the method you are building.
9639 ///
9640 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9641 /// [`Scope::CloudPlatform`].
9642 ///
9643 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9644 /// tokens for more than one scope.
9645 ///
9646 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9647 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9648 /// sufficient, a read-write scope will do as well.
9649 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionDeleteCall<'a, C>
9650 where
9651 St: AsRef<str>,
9652 {
9653 self._scopes.insert(String::from(scope.as_ref()));
9654 self
9655 }
9656 /// Identifies the authorization scope(s) for the method you are building.
9657 ///
9658 /// See [`Self::add_scope()`] for details.
9659 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationConnectionDeleteCall<'a, C>
9660 where
9661 I: IntoIterator<Item = St>,
9662 St: AsRef<str>,
9663 {
9664 self._scopes
9665 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9666 self
9667 }
9668
9669 /// Removes all scopes, and no default scope will be used either.
9670 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9671 /// for details).
9672 pub fn clear_scopes(mut self) -> ProjectLocationConnectionDeleteCall<'a, C> {
9673 self._scopes.clear();
9674 self
9675 }
9676}
9677
9678/// Gets details of a single Connection.
9679///
9680/// A builder for the *locations.connections.get* method supported by a *project* resource.
9681/// It is not used directly, but through a [`ProjectMethods`] instance.
9682///
9683/// # Example
9684///
9685/// Instantiate a resource method builder
9686///
9687/// ```test_harness,no_run
9688/// # extern crate hyper;
9689/// # extern crate hyper_rustls;
9690/// # extern crate google_connectors1 as connectors1;
9691/// # async fn dox() {
9692/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9693///
9694/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9695/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9696/// # secret,
9697/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9698/// # ).build().await.unwrap();
9699///
9700/// # let client = hyper_util::client::legacy::Client::builder(
9701/// # hyper_util::rt::TokioExecutor::new()
9702/// # )
9703/// # .build(
9704/// # hyper_rustls::HttpsConnectorBuilder::new()
9705/// # .with_native_roots()
9706/// # .unwrap()
9707/// # .https_or_http()
9708/// # .enable_http1()
9709/// # .build()
9710/// # );
9711/// # let mut hub = Connectors::new(client, auth);
9712/// // You can configure optional parameters by calling the respective setters at will, and
9713/// // execute the final call using `doit()`.
9714/// // Values shown here are possibly random and not representative !
9715/// let result = hub.projects().locations_connections_get("name")
9716/// .view("et")
9717/// .doit().await;
9718/// # }
9719/// ```
9720pub struct ProjectLocationConnectionGetCall<'a, C>
9721where
9722 C: 'a,
9723{
9724 hub: &'a Connectors<C>,
9725 _name: String,
9726 _view: Option<String>,
9727 _delegate: Option<&'a mut dyn common::Delegate>,
9728 _additional_params: HashMap<String, String>,
9729 _scopes: BTreeSet<String>,
9730}
9731
9732impl<'a, C> common::CallBuilder for ProjectLocationConnectionGetCall<'a, C> {}
9733
9734impl<'a, C> ProjectLocationConnectionGetCall<'a, C>
9735where
9736 C: common::Connector,
9737{
9738 /// Perform the operation you have build so far.
9739 pub async fn doit(mut self) -> common::Result<(common::Response, Connection)> {
9740 use std::borrow::Cow;
9741 use std::io::{Read, Seek};
9742
9743 use common::{url::Params, ToParts};
9744 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9745
9746 let mut dd = common::DefaultDelegate;
9747 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9748 dlg.begin(common::MethodInfo {
9749 id: "connectors.projects.locations.connections.get",
9750 http_method: hyper::Method::GET,
9751 });
9752
9753 for &field in ["alt", "name", "view"].iter() {
9754 if self._additional_params.contains_key(field) {
9755 dlg.finished(false);
9756 return Err(common::Error::FieldClash(field));
9757 }
9758 }
9759
9760 let mut params = Params::with_capacity(4 + self._additional_params.len());
9761 params.push("name", self._name);
9762 if let Some(value) = self._view.as_ref() {
9763 params.push("view", value);
9764 }
9765
9766 params.extend(self._additional_params.iter());
9767
9768 params.push("alt", "json");
9769 let mut url = self.hub._base_url.clone() + "v1/{+name}";
9770 if self._scopes.is_empty() {
9771 self._scopes
9772 .insert(Scope::CloudPlatform.as_ref().to_string());
9773 }
9774
9775 #[allow(clippy::single_element_loop)]
9776 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9777 url = params.uri_replacement(url, param_name, find_this, true);
9778 }
9779 {
9780 let to_remove = ["name"];
9781 params.remove_params(&to_remove);
9782 }
9783
9784 let url = params.parse_with_url(&url);
9785
9786 loop {
9787 let token = match self
9788 .hub
9789 .auth
9790 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9791 .await
9792 {
9793 Ok(token) => token,
9794 Err(e) => match dlg.token(e) {
9795 Ok(token) => token,
9796 Err(e) => {
9797 dlg.finished(false);
9798 return Err(common::Error::MissingToken(e));
9799 }
9800 },
9801 };
9802 let mut req_result = {
9803 let client = &self.hub.client;
9804 dlg.pre_request();
9805 let mut req_builder = hyper::Request::builder()
9806 .method(hyper::Method::GET)
9807 .uri(url.as_str())
9808 .header(USER_AGENT, self.hub._user_agent.clone());
9809
9810 if let Some(token) = token.as_ref() {
9811 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9812 }
9813
9814 let request = req_builder
9815 .header(CONTENT_LENGTH, 0_u64)
9816 .body(common::to_body::<String>(None));
9817
9818 client.request(request.unwrap()).await
9819 };
9820
9821 match req_result {
9822 Err(err) => {
9823 if let common::Retry::After(d) = dlg.http_error(&err) {
9824 sleep(d).await;
9825 continue;
9826 }
9827 dlg.finished(false);
9828 return Err(common::Error::HttpError(err));
9829 }
9830 Ok(res) => {
9831 let (mut parts, body) = res.into_parts();
9832 let mut body = common::Body::new(body);
9833 if !parts.status.is_success() {
9834 let bytes = common::to_bytes(body).await.unwrap_or_default();
9835 let error = serde_json::from_str(&common::to_string(&bytes));
9836 let response = common::to_response(parts, bytes.into());
9837
9838 if let common::Retry::After(d) =
9839 dlg.http_failure(&response, error.as_ref().ok())
9840 {
9841 sleep(d).await;
9842 continue;
9843 }
9844
9845 dlg.finished(false);
9846
9847 return Err(match error {
9848 Ok(value) => common::Error::BadRequest(value),
9849 _ => common::Error::Failure(response),
9850 });
9851 }
9852 let response = {
9853 let bytes = common::to_bytes(body).await.unwrap_or_default();
9854 let encoded = common::to_string(&bytes);
9855 match serde_json::from_str(&encoded) {
9856 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9857 Err(error) => {
9858 dlg.response_json_decode_error(&encoded, &error);
9859 return Err(common::Error::JsonDecodeError(
9860 encoded.to_string(),
9861 error,
9862 ));
9863 }
9864 }
9865 };
9866
9867 dlg.finished(true);
9868 return Ok(response);
9869 }
9870 }
9871 }
9872 }
9873
9874 /// Required. Resource name of the form: `projects/*/locations/*/connections/*`
9875 ///
9876 /// Sets the *name* path property to the given value.
9877 ///
9878 /// Even though the property as already been set when instantiating this call,
9879 /// we provide this method for API completeness.
9880 pub fn name(mut self, new_value: &str) -> ProjectLocationConnectionGetCall<'a, C> {
9881 self._name = new_value.to_string();
9882 self
9883 }
9884 /// Specifies which fields of the Connection are returned in the response. Defaults to `BASIC` view.
9885 ///
9886 /// Sets the *view* query property to the given value.
9887 pub fn view(mut self, new_value: &str) -> ProjectLocationConnectionGetCall<'a, C> {
9888 self._view = Some(new_value.to_string());
9889 self
9890 }
9891 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9892 /// while executing the actual API request.
9893 ///
9894 /// ````text
9895 /// It should be used to handle progress information, and to implement a certain level of resilience.
9896 /// ````
9897 ///
9898 /// Sets the *delegate* property to the given value.
9899 pub fn delegate(
9900 mut self,
9901 new_value: &'a mut dyn common::Delegate,
9902 ) -> ProjectLocationConnectionGetCall<'a, C> {
9903 self._delegate = Some(new_value);
9904 self
9905 }
9906
9907 /// Set any additional parameter of the query string used in the request.
9908 /// It should be used to set parameters which are not yet available through their own
9909 /// setters.
9910 ///
9911 /// Please note that this method must not be used to set any of the known parameters
9912 /// which have their own setter method. If done anyway, the request will fail.
9913 ///
9914 /// # Additional Parameters
9915 ///
9916 /// * *$.xgafv* (query-string) - V1 error format.
9917 /// * *access_token* (query-string) - OAuth access token.
9918 /// * *alt* (query-string) - Data format for response.
9919 /// * *callback* (query-string) - JSONP
9920 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9921 /// * *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.
9922 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9923 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9924 /// * *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.
9925 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9926 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9927 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationConnectionGetCall<'a, C>
9928 where
9929 T: AsRef<str>,
9930 {
9931 self._additional_params
9932 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9933 self
9934 }
9935
9936 /// Identifies the authorization scope for the method you are building.
9937 ///
9938 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9939 /// [`Scope::CloudPlatform`].
9940 ///
9941 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9942 /// tokens for more than one scope.
9943 ///
9944 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9945 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9946 /// sufficient, a read-write scope will do as well.
9947 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionGetCall<'a, C>
9948 where
9949 St: AsRef<str>,
9950 {
9951 self._scopes.insert(String::from(scope.as_ref()));
9952 self
9953 }
9954 /// Identifies the authorization scope(s) for the method you are building.
9955 ///
9956 /// See [`Self::add_scope()`] for details.
9957 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationConnectionGetCall<'a, C>
9958 where
9959 I: IntoIterator<Item = St>,
9960 St: AsRef<str>,
9961 {
9962 self._scopes
9963 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9964 self
9965 }
9966
9967 /// Removes all scopes, and no default scope will be used either.
9968 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9969 /// for details).
9970 pub fn clear_scopes(mut self) -> ProjectLocationConnectionGetCall<'a, C> {
9971 self._scopes.clear();
9972 self
9973 }
9974}
9975
9976/// Gets schema metadata of a connection. SchemaMetadata is a singleton resource for each connection.
9977///
9978/// A builder for the *locations.connections.getConnectionSchemaMetadata* method supported by a *project* resource.
9979/// It is not used directly, but through a [`ProjectMethods`] instance.
9980///
9981/// # Example
9982///
9983/// Instantiate a resource method builder
9984///
9985/// ```test_harness,no_run
9986/// # extern crate hyper;
9987/// # extern crate hyper_rustls;
9988/// # extern crate google_connectors1 as connectors1;
9989/// # async fn dox() {
9990/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9991///
9992/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9993/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9994/// # secret,
9995/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9996/// # ).build().await.unwrap();
9997///
9998/// # let client = hyper_util::client::legacy::Client::builder(
9999/// # hyper_util::rt::TokioExecutor::new()
10000/// # )
10001/// # .build(
10002/// # hyper_rustls::HttpsConnectorBuilder::new()
10003/// # .with_native_roots()
10004/// # .unwrap()
10005/// # .https_or_http()
10006/// # .enable_http1()
10007/// # .build()
10008/// # );
10009/// # let mut hub = Connectors::new(client, auth);
10010/// // You can configure optional parameters by calling the respective setters at will, and
10011/// // execute the final call using `doit()`.
10012/// // Values shown here are possibly random and not representative !
10013/// let result = hub.projects().locations_connections_get_connection_schema_metadata("name")
10014/// .doit().await;
10015/// # }
10016/// ```
10017pub struct ProjectLocationConnectionGetConnectionSchemaMetadataCall<'a, C>
10018where
10019 C: 'a,
10020{
10021 hub: &'a Connectors<C>,
10022 _name: String,
10023 _delegate: Option<&'a mut dyn common::Delegate>,
10024 _additional_params: HashMap<String, String>,
10025 _scopes: BTreeSet<String>,
10026}
10027
10028impl<'a, C> common::CallBuilder
10029 for ProjectLocationConnectionGetConnectionSchemaMetadataCall<'a, C>
10030{
10031}
10032
10033impl<'a, C> ProjectLocationConnectionGetConnectionSchemaMetadataCall<'a, C>
10034where
10035 C: common::Connector,
10036{
10037 /// Perform the operation you have build so far.
10038 pub async fn doit(mut self) -> common::Result<(common::Response, ConnectionSchemaMetadata)> {
10039 use std::borrow::Cow;
10040 use std::io::{Read, Seek};
10041
10042 use common::{url::Params, ToParts};
10043 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10044
10045 let mut dd = common::DefaultDelegate;
10046 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10047 dlg.begin(common::MethodInfo {
10048 id: "connectors.projects.locations.connections.getConnectionSchemaMetadata",
10049 http_method: hyper::Method::GET,
10050 });
10051
10052 for &field in ["alt", "name"].iter() {
10053 if self._additional_params.contains_key(field) {
10054 dlg.finished(false);
10055 return Err(common::Error::FieldClash(field));
10056 }
10057 }
10058
10059 let mut params = Params::with_capacity(3 + self._additional_params.len());
10060 params.push("name", self._name);
10061
10062 params.extend(self._additional_params.iter());
10063
10064 params.push("alt", "json");
10065 let mut url = self.hub._base_url.clone() + "v1/{+name}";
10066 if self._scopes.is_empty() {
10067 self._scopes
10068 .insert(Scope::CloudPlatform.as_ref().to_string());
10069 }
10070
10071 #[allow(clippy::single_element_loop)]
10072 for &(find_this, param_name) in [("{+name}", "name")].iter() {
10073 url = params.uri_replacement(url, param_name, find_this, true);
10074 }
10075 {
10076 let to_remove = ["name"];
10077 params.remove_params(&to_remove);
10078 }
10079
10080 let url = params.parse_with_url(&url);
10081
10082 loop {
10083 let token = match self
10084 .hub
10085 .auth
10086 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10087 .await
10088 {
10089 Ok(token) => token,
10090 Err(e) => match dlg.token(e) {
10091 Ok(token) => token,
10092 Err(e) => {
10093 dlg.finished(false);
10094 return Err(common::Error::MissingToken(e));
10095 }
10096 },
10097 };
10098 let mut req_result = {
10099 let client = &self.hub.client;
10100 dlg.pre_request();
10101 let mut req_builder = hyper::Request::builder()
10102 .method(hyper::Method::GET)
10103 .uri(url.as_str())
10104 .header(USER_AGENT, self.hub._user_agent.clone());
10105
10106 if let Some(token) = token.as_ref() {
10107 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10108 }
10109
10110 let request = req_builder
10111 .header(CONTENT_LENGTH, 0_u64)
10112 .body(common::to_body::<String>(None));
10113
10114 client.request(request.unwrap()).await
10115 };
10116
10117 match req_result {
10118 Err(err) => {
10119 if let common::Retry::After(d) = dlg.http_error(&err) {
10120 sleep(d).await;
10121 continue;
10122 }
10123 dlg.finished(false);
10124 return Err(common::Error::HttpError(err));
10125 }
10126 Ok(res) => {
10127 let (mut parts, body) = res.into_parts();
10128 let mut body = common::Body::new(body);
10129 if !parts.status.is_success() {
10130 let bytes = common::to_bytes(body).await.unwrap_or_default();
10131 let error = serde_json::from_str(&common::to_string(&bytes));
10132 let response = common::to_response(parts, bytes.into());
10133
10134 if let common::Retry::After(d) =
10135 dlg.http_failure(&response, error.as_ref().ok())
10136 {
10137 sleep(d).await;
10138 continue;
10139 }
10140
10141 dlg.finished(false);
10142
10143 return Err(match error {
10144 Ok(value) => common::Error::BadRequest(value),
10145 _ => common::Error::Failure(response),
10146 });
10147 }
10148 let response = {
10149 let bytes = common::to_bytes(body).await.unwrap_or_default();
10150 let encoded = common::to_string(&bytes);
10151 match serde_json::from_str(&encoded) {
10152 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10153 Err(error) => {
10154 dlg.response_json_decode_error(&encoded, &error);
10155 return Err(common::Error::JsonDecodeError(
10156 encoded.to_string(),
10157 error,
10158 ));
10159 }
10160 }
10161 };
10162
10163 dlg.finished(true);
10164 return Ok(response);
10165 }
10166 }
10167 }
10168 }
10169
10170 /// Required. Connection name Format: projects/{project}/locations/{location}/connections/{connection}/connectionSchemaMetadata
10171 ///
10172 /// Sets the *name* path property to the given value.
10173 ///
10174 /// Even though the property as already been set when instantiating this call,
10175 /// we provide this method for API completeness.
10176 pub fn name(
10177 mut self,
10178 new_value: &str,
10179 ) -> ProjectLocationConnectionGetConnectionSchemaMetadataCall<'a, C> {
10180 self._name = new_value.to_string();
10181 self
10182 }
10183 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10184 /// while executing the actual API request.
10185 ///
10186 /// ````text
10187 /// It should be used to handle progress information, and to implement a certain level of resilience.
10188 /// ````
10189 ///
10190 /// Sets the *delegate* property to the given value.
10191 pub fn delegate(
10192 mut self,
10193 new_value: &'a mut dyn common::Delegate,
10194 ) -> ProjectLocationConnectionGetConnectionSchemaMetadataCall<'a, C> {
10195 self._delegate = Some(new_value);
10196 self
10197 }
10198
10199 /// Set any additional parameter of the query string used in the request.
10200 /// It should be used to set parameters which are not yet available through their own
10201 /// setters.
10202 ///
10203 /// Please note that this method must not be used to set any of the known parameters
10204 /// which have their own setter method. If done anyway, the request will fail.
10205 ///
10206 /// # Additional Parameters
10207 ///
10208 /// * *$.xgafv* (query-string) - V1 error format.
10209 /// * *access_token* (query-string) - OAuth access token.
10210 /// * *alt* (query-string) - Data format for response.
10211 /// * *callback* (query-string) - JSONP
10212 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10213 /// * *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.
10214 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10215 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10216 /// * *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.
10217 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10218 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10219 pub fn param<T>(
10220 mut self,
10221 name: T,
10222 value: T,
10223 ) -> ProjectLocationConnectionGetConnectionSchemaMetadataCall<'a, C>
10224 where
10225 T: AsRef<str>,
10226 {
10227 self._additional_params
10228 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10229 self
10230 }
10231
10232 /// Identifies the authorization scope for the method you are building.
10233 ///
10234 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10235 /// [`Scope::CloudPlatform`].
10236 ///
10237 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10238 /// tokens for more than one scope.
10239 ///
10240 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10241 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10242 /// sufficient, a read-write scope will do as well.
10243 pub fn add_scope<St>(
10244 mut self,
10245 scope: St,
10246 ) -> ProjectLocationConnectionGetConnectionSchemaMetadataCall<'a, C>
10247 where
10248 St: AsRef<str>,
10249 {
10250 self._scopes.insert(String::from(scope.as_ref()));
10251 self
10252 }
10253 /// Identifies the authorization scope(s) for the method you are building.
10254 ///
10255 /// See [`Self::add_scope()`] for details.
10256 pub fn add_scopes<I, St>(
10257 mut self,
10258 scopes: I,
10259 ) -> ProjectLocationConnectionGetConnectionSchemaMetadataCall<'a, C>
10260 where
10261 I: IntoIterator<Item = St>,
10262 St: AsRef<str>,
10263 {
10264 self._scopes
10265 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10266 self
10267 }
10268
10269 /// Removes all scopes, and no default scope will be used either.
10270 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10271 /// for details).
10272 pub fn clear_scopes(
10273 mut self,
10274 ) -> ProjectLocationConnectionGetConnectionSchemaMetadataCall<'a, C> {
10275 self._scopes.clear();
10276 self
10277 }
10278}
10279
10280/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
10281///
10282/// A builder for the *locations.connections.getIamPolicy* method supported by a *project* resource.
10283/// It is not used directly, but through a [`ProjectMethods`] instance.
10284///
10285/// # Example
10286///
10287/// Instantiate a resource method builder
10288///
10289/// ```test_harness,no_run
10290/// # extern crate hyper;
10291/// # extern crate hyper_rustls;
10292/// # extern crate google_connectors1 as connectors1;
10293/// # async fn dox() {
10294/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10295///
10296/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10297/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10298/// # secret,
10299/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10300/// # ).build().await.unwrap();
10301///
10302/// # let client = hyper_util::client::legacy::Client::builder(
10303/// # hyper_util::rt::TokioExecutor::new()
10304/// # )
10305/// # .build(
10306/// # hyper_rustls::HttpsConnectorBuilder::new()
10307/// # .with_native_roots()
10308/// # .unwrap()
10309/// # .https_or_http()
10310/// # .enable_http1()
10311/// # .build()
10312/// # );
10313/// # let mut hub = Connectors::new(client, auth);
10314/// // You can configure optional parameters by calling the respective setters at will, and
10315/// // execute the final call using `doit()`.
10316/// // Values shown here are possibly random and not representative !
10317/// let result = hub.projects().locations_connections_get_iam_policy("resource")
10318/// .options_requested_policy_version(-68)
10319/// .doit().await;
10320/// # }
10321/// ```
10322pub struct ProjectLocationConnectionGetIamPolicyCall<'a, C>
10323where
10324 C: 'a,
10325{
10326 hub: &'a Connectors<C>,
10327 _resource: String,
10328 _options_requested_policy_version: Option<i32>,
10329 _delegate: Option<&'a mut dyn common::Delegate>,
10330 _additional_params: HashMap<String, String>,
10331 _scopes: BTreeSet<String>,
10332}
10333
10334impl<'a, C> common::CallBuilder for ProjectLocationConnectionGetIamPolicyCall<'a, C> {}
10335
10336impl<'a, C> ProjectLocationConnectionGetIamPolicyCall<'a, C>
10337where
10338 C: common::Connector,
10339{
10340 /// Perform the operation you have build so far.
10341 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
10342 use std::borrow::Cow;
10343 use std::io::{Read, Seek};
10344
10345 use common::{url::Params, ToParts};
10346 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10347
10348 let mut dd = common::DefaultDelegate;
10349 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10350 dlg.begin(common::MethodInfo {
10351 id: "connectors.projects.locations.connections.getIamPolicy",
10352 http_method: hyper::Method::GET,
10353 });
10354
10355 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
10356 if self._additional_params.contains_key(field) {
10357 dlg.finished(false);
10358 return Err(common::Error::FieldClash(field));
10359 }
10360 }
10361
10362 let mut params = Params::with_capacity(4 + self._additional_params.len());
10363 params.push("resource", self._resource);
10364 if let Some(value) = self._options_requested_policy_version.as_ref() {
10365 params.push("options.requestedPolicyVersion", value.to_string());
10366 }
10367
10368 params.extend(self._additional_params.iter());
10369
10370 params.push("alt", "json");
10371 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
10372 if self._scopes.is_empty() {
10373 self._scopes
10374 .insert(Scope::CloudPlatform.as_ref().to_string());
10375 }
10376
10377 #[allow(clippy::single_element_loop)]
10378 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
10379 url = params.uri_replacement(url, param_name, find_this, true);
10380 }
10381 {
10382 let to_remove = ["resource"];
10383 params.remove_params(&to_remove);
10384 }
10385
10386 let url = params.parse_with_url(&url);
10387
10388 loop {
10389 let token = match self
10390 .hub
10391 .auth
10392 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10393 .await
10394 {
10395 Ok(token) => token,
10396 Err(e) => match dlg.token(e) {
10397 Ok(token) => token,
10398 Err(e) => {
10399 dlg.finished(false);
10400 return Err(common::Error::MissingToken(e));
10401 }
10402 },
10403 };
10404 let mut req_result = {
10405 let client = &self.hub.client;
10406 dlg.pre_request();
10407 let mut req_builder = hyper::Request::builder()
10408 .method(hyper::Method::GET)
10409 .uri(url.as_str())
10410 .header(USER_AGENT, self.hub._user_agent.clone());
10411
10412 if let Some(token) = token.as_ref() {
10413 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10414 }
10415
10416 let request = req_builder
10417 .header(CONTENT_LENGTH, 0_u64)
10418 .body(common::to_body::<String>(None));
10419
10420 client.request(request.unwrap()).await
10421 };
10422
10423 match req_result {
10424 Err(err) => {
10425 if let common::Retry::After(d) = dlg.http_error(&err) {
10426 sleep(d).await;
10427 continue;
10428 }
10429 dlg.finished(false);
10430 return Err(common::Error::HttpError(err));
10431 }
10432 Ok(res) => {
10433 let (mut parts, body) = res.into_parts();
10434 let mut body = common::Body::new(body);
10435 if !parts.status.is_success() {
10436 let bytes = common::to_bytes(body).await.unwrap_or_default();
10437 let error = serde_json::from_str(&common::to_string(&bytes));
10438 let response = common::to_response(parts, bytes.into());
10439
10440 if let common::Retry::After(d) =
10441 dlg.http_failure(&response, error.as_ref().ok())
10442 {
10443 sleep(d).await;
10444 continue;
10445 }
10446
10447 dlg.finished(false);
10448
10449 return Err(match error {
10450 Ok(value) => common::Error::BadRequest(value),
10451 _ => common::Error::Failure(response),
10452 });
10453 }
10454 let response = {
10455 let bytes = common::to_bytes(body).await.unwrap_or_default();
10456 let encoded = common::to_string(&bytes);
10457 match serde_json::from_str(&encoded) {
10458 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10459 Err(error) => {
10460 dlg.response_json_decode_error(&encoded, &error);
10461 return Err(common::Error::JsonDecodeError(
10462 encoded.to_string(),
10463 error,
10464 ));
10465 }
10466 }
10467 };
10468
10469 dlg.finished(true);
10470 return Ok(response);
10471 }
10472 }
10473 }
10474 }
10475
10476 /// 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.
10477 ///
10478 /// Sets the *resource* path property to the given value.
10479 ///
10480 /// Even though the property as already been set when instantiating this call,
10481 /// we provide this method for API completeness.
10482 pub fn resource(mut self, new_value: &str) -> ProjectLocationConnectionGetIamPolicyCall<'a, C> {
10483 self._resource = new_value.to_string();
10484 self
10485 }
10486 /// 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).
10487 ///
10488 /// Sets the *options.requested policy version* query property to the given value.
10489 pub fn options_requested_policy_version(
10490 mut self,
10491 new_value: i32,
10492 ) -> ProjectLocationConnectionGetIamPolicyCall<'a, C> {
10493 self._options_requested_policy_version = Some(new_value);
10494 self
10495 }
10496 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10497 /// while executing the actual API request.
10498 ///
10499 /// ````text
10500 /// It should be used to handle progress information, and to implement a certain level of resilience.
10501 /// ````
10502 ///
10503 /// Sets the *delegate* property to the given value.
10504 pub fn delegate(
10505 mut self,
10506 new_value: &'a mut dyn common::Delegate,
10507 ) -> ProjectLocationConnectionGetIamPolicyCall<'a, C> {
10508 self._delegate = Some(new_value);
10509 self
10510 }
10511
10512 /// Set any additional parameter of the query string used in the request.
10513 /// It should be used to set parameters which are not yet available through their own
10514 /// setters.
10515 ///
10516 /// Please note that this method must not be used to set any of the known parameters
10517 /// which have their own setter method. If done anyway, the request will fail.
10518 ///
10519 /// # Additional Parameters
10520 ///
10521 /// * *$.xgafv* (query-string) - V1 error format.
10522 /// * *access_token* (query-string) - OAuth access token.
10523 /// * *alt* (query-string) - Data format for response.
10524 /// * *callback* (query-string) - JSONP
10525 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10526 /// * *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.
10527 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10528 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10529 /// * *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.
10530 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10531 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10532 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationConnectionGetIamPolicyCall<'a, C>
10533 where
10534 T: AsRef<str>,
10535 {
10536 self._additional_params
10537 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10538 self
10539 }
10540
10541 /// Identifies the authorization scope for the method you are building.
10542 ///
10543 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10544 /// [`Scope::CloudPlatform`].
10545 ///
10546 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10547 /// tokens for more than one scope.
10548 ///
10549 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10550 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10551 /// sufficient, a read-write scope will do as well.
10552 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionGetIamPolicyCall<'a, C>
10553 where
10554 St: AsRef<str>,
10555 {
10556 self._scopes.insert(String::from(scope.as_ref()));
10557 self
10558 }
10559 /// Identifies the authorization scope(s) for the method you are building.
10560 ///
10561 /// See [`Self::add_scope()`] for details.
10562 pub fn add_scopes<I, St>(
10563 mut self,
10564 scopes: I,
10565 ) -> ProjectLocationConnectionGetIamPolicyCall<'a, C>
10566 where
10567 I: IntoIterator<Item = St>,
10568 St: AsRef<str>,
10569 {
10570 self._scopes
10571 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10572 self
10573 }
10574
10575 /// Removes all scopes, and no default scope will be used either.
10576 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10577 /// for details).
10578 pub fn clear_scopes(mut self) -> ProjectLocationConnectionGetIamPolicyCall<'a, C> {
10579 self._scopes.clear();
10580 self
10581 }
10582}
10583
10584/// Lists Connections in a given project and location.
10585///
10586/// A builder for the *locations.connections.list* method supported by a *project* resource.
10587/// It is not used directly, but through a [`ProjectMethods`] instance.
10588///
10589/// # Example
10590///
10591/// Instantiate a resource method builder
10592///
10593/// ```test_harness,no_run
10594/// # extern crate hyper;
10595/// # extern crate hyper_rustls;
10596/// # extern crate google_connectors1 as connectors1;
10597/// # async fn dox() {
10598/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10599///
10600/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10601/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10602/// # secret,
10603/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10604/// # ).build().await.unwrap();
10605///
10606/// # let client = hyper_util::client::legacy::Client::builder(
10607/// # hyper_util::rt::TokioExecutor::new()
10608/// # )
10609/// # .build(
10610/// # hyper_rustls::HttpsConnectorBuilder::new()
10611/// # .with_native_roots()
10612/// # .unwrap()
10613/// # .https_or_http()
10614/// # .enable_http1()
10615/// # .build()
10616/// # );
10617/// # let mut hub = Connectors::new(client, auth);
10618/// // You can configure optional parameters by calling the respective setters at will, and
10619/// // execute the final call using `doit()`.
10620/// // Values shown here are possibly random and not representative !
10621/// let result = hub.projects().locations_connections_list("parent")
10622/// .view("erat")
10623/// .page_token("sed")
10624/// .page_size(-20)
10625/// .order_by("dolore")
10626/// .filter("et")
10627/// .doit().await;
10628/// # }
10629/// ```
10630pub struct ProjectLocationConnectionListCall<'a, C>
10631where
10632 C: 'a,
10633{
10634 hub: &'a Connectors<C>,
10635 _parent: String,
10636 _view: Option<String>,
10637 _page_token: Option<String>,
10638 _page_size: Option<i32>,
10639 _order_by: Option<String>,
10640 _filter: Option<String>,
10641 _delegate: Option<&'a mut dyn common::Delegate>,
10642 _additional_params: HashMap<String, String>,
10643 _scopes: BTreeSet<String>,
10644}
10645
10646impl<'a, C> common::CallBuilder for ProjectLocationConnectionListCall<'a, C> {}
10647
10648impl<'a, C> ProjectLocationConnectionListCall<'a, C>
10649where
10650 C: common::Connector,
10651{
10652 /// Perform the operation you have build so far.
10653 pub async fn doit(mut self) -> common::Result<(common::Response, ListConnectionsResponse)> {
10654 use std::borrow::Cow;
10655 use std::io::{Read, Seek};
10656
10657 use common::{url::Params, ToParts};
10658 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10659
10660 let mut dd = common::DefaultDelegate;
10661 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10662 dlg.begin(common::MethodInfo {
10663 id: "connectors.projects.locations.connections.list",
10664 http_method: hyper::Method::GET,
10665 });
10666
10667 for &field in [
10668 "alt",
10669 "parent",
10670 "view",
10671 "pageToken",
10672 "pageSize",
10673 "orderBy",
10674 "filter",
10675 ]
10676 .iter()
10677 {
10678 if self._additional_params.contains_key(field) {
10679 dlg.finished(false);
10680 return Err(common::Error::FieldClash(field));
10681 }
10682 }
10683
10684 let mut params = Params::with_capacity(8 + self._additional_params.len());
10685 params.push("parent", self._parent);
10686 if let Some(value) = self._view.as_ref() {
10687 params.push("view", value);
10688 }
10689 if let Some(value) = self._page_token.as_ref() {
10690 params.push("pageToken", value);
10691 }
10692 if let Some(value) = self._page_size.as_ref() {
10693 params.push("pageSize", value.to_string());
10694 }
10695 if let Some(value) = self._order_by.as_ref() {
10696 params.push("orderBy", value);
10697 }
10698 if let Some(value) = self._filter.as_ref() {
10699 params.push("filter", value);
10700 }
10701
10702 params.extend(self._additional_params.iter());
10703
10704 params.push("alt", "json");
10705 let mut url = self.hub._base_url.clone() + "v1/{+parent}/connections";
10706 if self._scopes.is_empty() {
10707 self._scopes
10708 .insert(Scope::CloudPlatform.as_ref().to_string());
10709 }
10710
10711 #[allow(clippy::single_element_loop)]
10712 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10713 url = params.uri_replacement(url, param_name, find_this, true);
10714 }
10715 {
10716 let to_remove = ["parent"];
10717 params.remove_params(&to_remove);
10718 }
10719
10720 let url = params.parse_with_url(&url);
10721
10722 loop {
10723 let token = match self
10724 .hub
10725 .auth
10726 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10727 .await
10728 {
10729 Ok(token) => token,
10730 Err(e) => match dlg.token(e) {
10731 Ok(token) => token,
10732 Err(e) => {
10733 dlg.finished(false);
10734 return Err(common::Error::MissingToken(e));
10735 }
10736 },
10737 };
10738 let mut req_result = {
10739 let client = &self.hub.client;
10740 dlg.pre_request();
10741 let mut req_builder = hyper::Request::builder()
10742 .method(hyper::Method::GET)
10743 .uri(url.as_str())
10744 .header(USER_AGENT, self.hub._user_agent.clone());
10745
10746 if let Some(token) = token.as_ref() {
10747 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10748 }
10749
10750 let request = req_builder
10751 .header(CONTENT_LENGTH, 0_u64)
10752 .body(common::to_body::<String>(None));
10753
10754 client.request(request.unwrap()).await
10755 };
10756
10757 match req_result {
10758 Err(err) => {
10759 if let common::Retry::After(d) = dlg.http_error(&err) {
10760 sleep(d).await;
10761 continue;
10762 }
10763 dlg.finished(false);
10764 return Err(common::Error::HttpError(err));
10765 }
10766 Ok(res) => {
10767 let (mut parts, body) = res.into_parts();
10768 let mut body = common::Body::new(body);
10769 if !parts.status.is_success() {
10770 let bytes = common::to_bytes(body).await.unwrap_or_default();
10771 let error = serde_json::from_str(&common::to_string(&bytes));
10772 let response = common::to_response(parts, bytes.into());
10773
10774 if let common::Retry::After(d) =
10775 dlg.http_failure(&response, error.as_ref().ok())
10776 {
10777 sleep(d).await;
10778 continue;
10779 }
10780
10781 dlg.finished(false);
10782
10783 return Err(match error {
10784 Ok(value) => common::Error::BadRequest(value),
10785 _ => common::Error::Failure(response),
10786 });
10787 }
10788 let response = {
10789 let bytes = common::to_bytes(body).await.unwrap_or_default();
10790 let encoded = common::to_string(&bytes);
10791 match serde_json::from_str(&encoded) {
10792 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10793 Err(error) => {
10794 dlg.response_json_decode_error(&encoded, &error);
10795 return Err(common::Error::JsonDecodeError(
10796 encoded.to_string(),
10797 error,
10798 ));
10799 }
10800 }
10801 };
10802
10803 dlg.finished(true);
10804 return Ok(response);
10805 }
10806 }
10807 }
10808 }
10809
10810 /// Required. Parent resource of the Connection, of the form: `projects/*/locations/*`
10811 ///
10812 /// Sets the *parent* path property to the given value.
10813 ///
10814 /// Even though the property as already been set when instantiating this call,
10815 /// we provide this method for API completeness.
10816 pub fn parent(mut self, new_value: &str) -> ProjectLocationConnectionListCall<'a, C> {
10817 self._parent = new_value.to_string();
10818 self
10819 }
10820 /// Specifies which fields of the Connection are returned in the response. Defaults to `BASIC` view.
10821 ///
10822 /// Sets the *view* query property to the given value.
10823 pub fn view(mut self, new_value: &str) -> ProjectLocationConnectionListCall<'a, C> {
10824 self._view = Some(new_value.to_string());
10825 self
10826 }
10827 /// Page token.
10828 ///
10829 /// Sets the *page token* query property to the given value.
10830 pub fn page_token(mut self, new_value: &str) -> ProjectLocationConnectionListCall<'a, C> {
10831 self._page_token = Some(new_value.to_string());
10832 self
10833 }
10834 /// Page size.
10835 ///
10836 /// Sets the *page size* query property to the given value.
10837 pub fn page_size(mut self, new_value: i32) -> ProjectLocationConnectionListCall<'a, C> {
10838 self._page_size = Some(new_value);
10839 self
10840 }
10841 /// Order by parameters.
10842 ///
10843 /// Sets the *order by* query property to the given value.
10844 pub fn order_by(mut self, new_value: &str) -> ProjectLocationConnectionListCall<'a, C> {
10845 self._order_by = Some(new_value.to_string());
10846 self
10847 }
10848 /// Filter.
10849 ///
10850 /// Sets the *filter* query property to the given value.
10851 pub fn filter(mut self, new_value: &str) -> ProjectLocationConnectionListCall<'a, C> {
10852 self._filter = Some(new_value.to_string());
10853 self
10854 }
10855 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10856 /// while executing the actual API request.
10857 ///
10858 /// ````text
10859 /// It should be used to handle progress information, and to implement a certain level of resilience.
10860 /// ````
10861 ///
10862 /// Sets the *delegate* property to the given value.
10863 pub fn delegate(
10864 mut self,
10865 new_value: &'a mut dyn common::Delegate,
10866 ) -> ProjectLocationConnectionListCall<'a, C> {
10867 self._delegate = Some(new_value);
10868 self
10869 }
10870
10871 /// Set any additional parameter of the query string used in the request.
10872 /// It should be used to set parameters which are not yet available through their own
10873 /// setters.
10874 ///
10875 /// Please note that this method must not be used to set any of the known parameters
10876 /// which have their own setter method. If done anyway, the request will fail.
10877 ///
10878 /// # Additional Parameters
10879 ///
10880 /// * *$.xgafv* (query-string) - V1 error format.
10881 /// * *access_token* (query-string) - OAuth access token.
10882 /// * *alt* (query-string) - Data format for response.
10883 /// * *callback* (query-string) - JSONP
10884 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10885 /// * *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.
10886 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10887 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10888 /// * *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.
10889 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10890 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10891 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationConnectionListCall<'a, C>
10892 where
10893 T: AsRef<str>,
10894 {
10895 self._additional_params
10896 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10897 self
10898 }
10899
10900 /// Identifies the authorization scope for the method you are building.
10901 ///
10902 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10903 /// [`Scope::CloudPlatform`].
10904 ///
10905 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10906 /// tokens for more than one scope.
10907 ///
10908 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10909 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10910 /// sufficient, a read-write scope will do as well.
10911 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionListCall<'a, C>
10912 where
10913 St: AsRef<str>,
10914 {
10915 self._scopes.insert(String::from(scope.as_ref()));
10916 self
10917 }
10918 /// Identifies the authorization scope(s) for the method you are building.
10919 ///
10920 /// See [`Self::add_scope()`] for details.
10921 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationConnectionListCall<'a, C>
10922 where
10923 I: IntoIterator<Item = St>,
10924 St: AsRef<str>,
10925 {
10926 self._scopes
10927 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10928 self
10929 }
10930
10931 /// Removes all scopes, and no default scope will be used either.
10932 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10933 /// for details).
10934 pub fn clear_scopes(mut self) -> ProjectLocationConnectionListCall<'a, C> {
10935 self._scopes.clear();
10936 self
10937 }
10938}
10939
10940/// ListenEvent listens to the event.
10941///
10942/// A builder for the *locations.connections.listenEvent* method supported by a *project* resource.
10943/// It is not used directly, but through a [`ProjectMethods`] instance.
10944///
10945/// # Example
10946///
10947/// Instantiate a resource method builder
10948///
10949/// ```test_harness,no_run
10950/// # extern crate hyper;
10951/// # extern crate hyper_rustls;
10952/// # extern crate google_connectors1 as connectors1;
10953/// use connectors1::api::ListenEventRequest;
10954/// # async fn dox() {
10955/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10956///
10957/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10958/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10959/// # secret,
10960/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10961/// # ).build().await.unwrap();
10962///
10963/// # let client = hyper_util::client::legacy::Client::builder(
10964/// # hyper_util::rt::TokioExecutor::new()
10965/// # )
10966/// # .build(
10967/// # hyper_rustls::HttpsConnectorBuilder::new()
10968/// # .with_native_roots()
10969/// # .unwrap()
10970/// # .https_or_http()
10971/// # .enable_http1()
10972/// # .build()
10973/// # );
10974/// # let mut hub = Connectors::new(client, auth);
10975/// // As the method needs a request, you would usually fill it with the desired information
10976/// // into the respective structure. Some of the parts shown here might not be applicable !
10977/// // Values shown here are possibly random and not representative !
10978/// let mut req = ListenEventRequest::default();
10979///
10980/// // You can configure optional parameters by calling the respective setters at will, and
10981/// // execute the final call using `doit()`.
10982/// // Values shown here are possibly random and not representative !
10983/// let result = hub.projects().locations_connections_listen_event(req, "resourcePath")
10984/// .doit().await;
10985/// # }
10986/// ```
10987pub struct ProjectLocationConnectionListenEventCall<'a, C>
10988where
10989 C: 'a,
10990{
10991 hub: &'a Connectors<C>,
10992 _request: ListenEventRequest,
10993 _resource_path: String,
10994 _delegate: Option<&'a mut dyn common::Delegate>,
10995 _additional_params: HashMap<String, String>,
10996 _scopes: BTreeSet<String>,
10997}
10998
10999impl<'a, C> common::CallBuilder for ProjectLocationConnectionListenEventCall<'a, C> {}
11000
11001impl<'a, C> ProjectLocationConnectionListenEventCall<'a, C>
11002where
11003 C: common::Connector,
11004{
11005 /// Perform the operation you have build so far.
11006 pub async fn doit(mut self) -> common::Result<(common::Response, ListenEventResponse)> {
11007 use std::borrow::Cow;
11008 use std::io::{Read, Seek};
11009
11010 use common::{url::Params, ToParts};
11011 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11012
11013 let mut dd = common::DefaultDelegate;
11014 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11015 dlg.begin(common::MethodInfo {
11016 id: "connectors.projects.locations.connections.listenEvent",
11017 http_method: hyper::Method::POST,
11018 });
11019
11020 for &field in ["alt", "resourcePath"].iter() {
11021 if self._additional_params.contains_key(field) {
11022 dlg.finished(false);
11023 return Err(common::Error::FieldClash(field));
11024 }
11025 }
11026
11027 let mut params = Params::with_capacity(4 + self._additional_params.len());
11028 params.push("resourcePath", self._resource_path);
11029
11030 params.extend(self._additional_params.iter());
11031
11032 params.push("alt", "json");
11033 let mut url = self.hub._base_url.clone() + "v1/{+resourcePath}:listenEvent";
11034 if self._scopes.is_empty() {
11035 self._scopes
11036 .insert(Scope::CloudPlatform.as_ref().to_string());
11037 }
11038
11039 #[allow(clippy::single_element_loop)]
11040 for &(find_this, param_name) in [("{+resourcePath}", "resourcePath")].iter() {
11041 url = params.uri_replacement(url, param_name, find_this, true);
11042 }
11043 {
11044 let to_remove = ["resourcePath"];
11045 params.remove_params(&to_remove);
11046 }
11047
11048 let url = params.parse_with_url(&url);
11049
11050 let mut json_mime_type = mime::APPLICATION_JSON;
11051 let mut request_value_reader = {
11052 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11053 common::remove_json_null_values(&mut value);
11054 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11055 serde_json::to_writer(&mut dst, &value).unwrap();
11056 dst
11057 };
11058 let request_size = request_value_reader
11059 .seek(std::io::SeekFrom::End(0))
11060 .unwrap();
11061 request_value_reader
11062 .seek(std::io::SeekFrom::Start(0))
11063 .unwrap();
11064
11065 loop {
11066 let token = match self
11067 .hub
11068 .auth
11069 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11070 .await
11071 {
11072 Ok(token) => token,
11073 Err(e) => match dlg.token(e) {
11074 Ok(token) => token,
11075 Err(e) => {
11076 dlg.finished(false);
11077 return Err(common::Error::MissingToken(e));
11078 }
11079 },
11080 };
11081 request_value_reader
11082 .seek(std::io::SeekFrom::Start(0))
11083 .unwrap();
11084 let mut req_result = {
11085 let client = &self.hub.client;
11086 dlg.pre_request();
11087 let mut req_builder = hyper::Request::builder()
11088 .method(hyper::Method::POST)
11089 .uri(url.as_str())
11090 .header(USER_AGENT, self.hub._user_agent.clone());
11091
11092 if let Some(token) = token.as_ref() {
11093 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11094 }
11095
11096 let request = req_builder
11097 .header(CONTENT_TYPE, json_mime_type.to_string())
11098 .header(CONTENT_LENGTH, request_size as u64)
11099 .body(common::to_body(
11100 request_value_reader.get_ref().clone().into(),
11101 ));
11102
11103 client.request(request.unwrap()).await
11104 };
11105
11106 match req_result {
11107 Err(err) => {
11108 if let common::Retry::After(d) = dlg.http_error(&err) {
11109 sleep(d).await;
11110 continue;
11111 }
11112 dlg.finished(false);
11113 return Err(common::Error::HttpError(err));
11114 }
11115 Ok(res) => {
11116 let (mut parts, body) = res.into_parts();
11117 let mut body = common::Body::new(body);
11118 if !parts.status.is_success() {
11119 let bytes = common::to_bytes(body).await.unwrap_or_default();
11120 let error = serde_json::from_str(&common::to_string(&bytes));
11121 let response = common::to_response(parts, bytes.into());
11122
11123 if let common::Retry::After(d) =
11124 dlg.http_failure(&response, error.as_ref().ok())
11125 {
11126 sleep(d).await;
11127 continue;
11128 }
11129
11130 dlg.finished(false);
11131
11132 return Err(match error {
11133 Ok(value) => common::Error::BadRequest(value),
11134 _ => common::Error::Failure(response),
11135 });
11136 }
11137 let response = {
11138 let bytes = common::to_bytes(body).await.unwrap_or_default();
11139 let encoded = common::to_string(&bytes);
11140 match serde_json::from_str(&encoded) {
11141 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11142 Err(error) => {
11143 dlg.response_json_decode_error(&encoded, &error);
11144 return Err(common::Error::JsonDecodeError(
11145 encoded.to_string(),
11146 error,
11147 ));
11148 }
11149 }
11150 };
11151
11152 dlg.finished(true);
11153 return Ok(response);
11154 }
11155 }
11156 }
11157 }
11158
11159 ///
11160 /// Sets the *request* property to the given value.
11161 ///
11162 /// Even though the property as already been set when instantiating this call,
11163 /// we provide this method for API completeness.
11164 pub fn request(
11165 mut self,
11166 new_value: ListenEventRequest,
11167 ) -> ProjectLocationConnectionListenEventCall<'a, C> {
11168 self._request = new_value;
11169 self
11170 }
11171 /// Required. Resource path for request.
11172 ///
11173 /// Sets the *resource path* path property to the given value.
11174 ///
11175 /// Even though the property as already been set when instantiating this call,
11176 /// we provide this method for API completeness.
11177 pub fn resource_path(
11178 mut self,
11179 new_value: &str,
11180 ) -> ProjectLocationConnectionListenEventCall<'a, C> {
11181 self._resource_path = new_value.to_string();
11182 self
11183 }
11184 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11185 /// while executing the actual API request.
11186 ///
11187 /// ````text
11188 /// It should be used to handle progress information, and to implement a certain level of resilience.
11189 /// ````
11190 ///
11191 /// Sets the *delegate* property to the given value.
11192 pub fn delegate(
11193 mut self,
11194 new_value: &'a mut dyn common::Delegate,
11195 ) -> ProjectLocationConnectionListenEventCall<'a, C> {
11196 self._delegate = Some(new_value);
11197 self
11198 }
11199
11200 /// Set any additional parameter of the query string used in the request.
11201 /// It should be used to set parameters which are not yet available through their own
11202 /// setters.
11203 ///
11204 /// Please note that this method must not be used to set any of the known parameters
11205 /// which have their own setter method. If done anyway, the request will fail.
11206 ///
11207 /// # Additional Parameters
11208 ///
11209 /// * *$.xgafv* (query-string) - V1 error format.
11210 /// * *access_token* (query-string) - OAuth access token.
11211 /// * *alt* (query-string) - Data format for response.
11212 /// * *callback* (query-string) - JSONP
11213 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11214 /// * *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.
11215 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11216 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11217 /// * *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.
11218 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11219 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11220 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationConnectionListenEventCall<'a, C>
11221 where
11222 T: AsRef<str>,
11223 {
11224 self._additional_params
11225 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11226 self
11227 }
11228
11229 /// Identifies the authorization scope for the method you are building.
11230 ///
11231 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11232 /// [`Scope::CloudPlatform`].
11233 ///
11234 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11235 /// tokens for more than one scope.
11236 ///
11237 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11238 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11239 /// sufficient, a read-write scope will do as well.
11240 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionListenEventCall<'a, C>
11241 where
11242 St: AsRef<str>,
11243 {
11244 self._scopes.insert(String::from(scope.as_ref()));
11245 self
11246 }
11247 /// Identifies the authorization scope(s) for the method you are building.
11248 ///
11249 /// See [`Self::add_scope()`] for details.
11250 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationConnectionListenEventCall<'a, C>
11251 where
11252 I: IntoIterator<Item = St>,
11253 St: AsRef<str>,
11254 {
11255 self._scopes
11256 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11257 self
11258 }
11259
11260 /// Removes all scopes, and no default scope will be used either.
11261 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11262 /// for details).
11263 pub fn clear_scopes(mut self) -> ProjectLocationConnectionListenEventCall<'a, C> {
11264 self._scopes.clear();
11265 self
11266 }
11267}
11268
11269/// Updates the parameters of a single Connection.
11270///
11271/// A builder for the *locations.connections.patch* method supported by a *project* resource.
11272/// It is not used directly, but through a [`ProjectMethods`] instance.
11273///
11274/// # Example
11275///
11276/// Instantiate a resource method builder
11277///
11278/// ```test_harness,no_run
11279/// # extern crate hyper;
11280/// # extern crate hyper_rustls;
11281/// # extern crate google_connectors1 as connectors1;
11282/// use connectors1::api::Connection;
11283/// # async fn dox() {
11284/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11285///
11286/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11287/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11288/// # secret,
11289/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11290/// # ).build().await.unwrap();
11291///
11292/// # let client = hyper_util::client::legacy::Client::builder(
11293/// # hyper_util::rt::TokioExecutor::new()
11294/// # )
11295/// # .build(
11296/// # hyper_rustls::HttpsConnectorBuilder::new()
11297/// # .with_native_roots()
11298/// # .unwrap()
11299/// # .https_or_http()
11300/// # .enable_http1()
11301/// # .build()
11302/// # );
11303/// # let mut hub = Connectors::new(client, auth);
11304/// // As the method needs a request, you would usually fill it with the desired information
11305/// // into the respective structure. Some of the parts shown here might not be applicable !
11306/// // Values shown here are possibly random and not representative !
11307/// let mut req = Connection::default();
11308///
11309/// // You can configure optional parameters by calling the respective setters at will, and
11310/// // execute the final call using `doit()`.
11311/// // Values shown here are possibly random and not representative !
11312/// let result = hub.projects().locations_connections_patch(req, "name")
11313/// .update_mask(FieldMask::new::<&str>(&[]))
11314/// .doit().await;
11315/// # }
11316/// ```
11317pub struct ProjectLocationConnectionPatchCall<'a, C>
11318where
11319 C: 'a,
11320{
11321 hub: &'a Connectors<C>,
11322 _request: Connection,
11323 _name: String,
11324 _update_mask: Option<common::FieldMask>,
11325 _delegate: Option<&'a mut dyn common::Delegate>,
11326 _additional_params: HashMap<String, String>,
11327 _scopes: BTreeSet<String>,
11328}
11329
11330impl<'a, C> common::CallBuilder for ProjectLocationConnectionPatchCall<'a, C> {}
11331
11332impl<'a, C> ProjectLocationConnectionPatchCall<'a, C>
11333where
11334 C: common::Connector,
11335{
11336 /// Perform the operation you have build so far.
11337 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
11338 use std::borrow::Cow;
11339 use std::io::{Read, Seek};
11340
11341 use common::{url::Params, ToParts};
11342 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11343
11344 let mut dd = common::DefaultDelegate;
11345 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11346 dlg.begin(common::MethodInfo {
11347 id: "connectors.projects.locations.connections.patch",
11348 http_method: hyper::Method::PATCH,
11349 });
11350
11351 for &field in ["alt", "name", "updateMask"].iter() {
11352 if self._additional_params.contains_key(field) {
11353 dlg.finished(false);
11354 return Err(common::Error::FieldClash(field));
11355 }
11356 }
11357
11358 let mut params = Params::with_capacity(5 + self._additional_params.len());
11359 params.push("name", self._name);
11360 if let Some(value) = self._update_mask.as_ref() {
11361 params.push("updateMask", value.to_string());
11362 }
11363
11364 params.extend(self._additional_params.iter());
11365
11366 params.push("alt", "json");
11367 let mut url = self.hub._base_url.clone() + "v1/{+name}";
11368 if self._scopes.is_empty() {
11369 self._scopes
11370 .insert(Scope::CloudPlatform.as_ref().to_string());
11371 }
11372
11373 #[allow(clippy::single_element_loop)]
11374 for &(find_this, param_name) in [("{+name}", "name")].iter() {
11375 url = params.uri_replacement(url, param_name, find_this, true);
11376 }
11377 {
11378 let to_remove = ["name"];
11379 params.remove_params(&to_remove);
11380 }
11381
11382 let url = params.parse_with_url(&url);
11383
11384 let mut json_mime_type = mime::APPLICATION_JSON;
11385 let mut request_value_reader = {
11386 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11387 common::remove_json_null_values(&mut value);
11388 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11389 serde_json::to_writer(&mut dst, &value).unwrap();
11390 dst
11391 };
11392 let request_size = request_value_reader
11393 .seek(std::io::SeekFrom::End(0))
11394 .unwrap();
11395 request_value_reader
11396 .seek(std::io::SeekFrom::Start(0))
11397 .unwrap();
11398
11399 loop {
11400 let token = match self
11401 .hub
11402 .auth
11403 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11404 .await
11405 {
11406 Ok(token) => token,
11407 Err(e) => match dlg.token(e) {
11408 Ok(token) => token,
11409 Err(e) => {
11410 dlg.finished(false);
11411 return Err(common::Error::MissingToken(e));
11412 }
11413 },
11414 };
11415 request_value_reader
11416 .seek(std::io::SeekFrom::Start(0))
11417 .unwrap();
11418 let mut req_result = {
11419 let client = &self.hub.client;
11420 dlg.pre_request();
11421 let mut req_builder = hyper::Request::builder()
11422 .method(hyper::Method::PATCH)
11423 .uri(url.as_str())
11424 .header(USER_AGENT, self.hub._user_agent.clone());
11425
11426 if let Some(token) = token.as_ref() {
11427 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11428 }
11429
11430 let request = req_builder
11431 .header(CONTENT_TYPE, json_mime_type.to_string())
11432 .header(CONTENT_LENGTH, request_size as u64)
11433 .body(common::to_body(
11434 request_value_reader.get_ref().clone().into(),
11435 ));
11436
11437 client.request(request.unwrap()).await
11438 };
11439
11440 match req_result {
11441 Err(err) => {
11442 if let common::Retry::After(d) = dlg.http_error(&err) {
11443 sleep(d).await;
11444 continue;
11445 }
11446 dlg.finished(false);
11447 return Err(common::Error::HttpError(err));
11448 }
11449 Ok(res) => {
11450 let (mut parts, body) = res.into_parts();
11451 let mut body = common::Body::new(body);
11452 if !parts.status.is_success() {
11453 let bytes = common::to_bytes(body).await.unwrap_or_default();
11454 let error = serde_json::from_str(&common::to_string(&bytes));
11455 let response = common::to_response(parts, bytes.into());
11456
11457 if let common::Retry::After(d) =
11458 dlg.http_failure(&response, error.as_ref().ok())
11459 {
11460 sleep(d).await;
11461 continue;
11462 }
11463
11464 dlg.finished(false);
11465
11466 return Err(match error {
11467 Ok(value) => common::Error::BadRequest(value),
11468 _ => common::Error::Failure(response),
11469 });
11470 }
11471 let response = {
11472 let bytes = common::to_bytes(body).await.unwrap_or_default();
11473 let encoded = common::to_string(&bytes);
11474 match serde_json::from_str(&encoded) {
11475 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11476 Err(error) => {
11477 dlg.response_json_decode_error(&encoded, &error);
11478 return Err(common::Error::JsonDecodeError(
11479 encoded.to_string(),
11480 error,
11481 ));
11482 }
11483 }
11484 };
11485
11486 dlg.finished(true);
11487 return Ok(response);
11488 }
11489 }
11490 }
11491 }
11492
11493 ///
11494 /// Sets the *request* property to the given value.
11495 ///
11496 /// Even though the property as already been set when instantiating this call,
11497 /// we provide this method for API completeness.
11498 pub fn request(mut self, new_value: Connection) -> ProjectLocationConnectionPatchCall<'a, C> {
11499 self._request = new_value;
11500 self
11501 }
11502 /// Output only. Resource name of the Connection. Format: projects/{project}/locations/{location}/connections/{connection}
11503 ///
11504 /// Sets the *name* path property to the given value.
11505 ///
11506 /// Even though the property as already been set when instantiating this call,
11507 /// we provide this method for API completeness.
11508 pub fn name(mut self, new_value: &str) -> ProjectLocationConnectionPatchCall<'a, C> {
11509 self._name = new_value.to_string();
11510 self
11511 }
11512 /// Required. 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`
11513 ///
11514 /// Sets the *update mask* query property to the given value.
11515 pub fn update_mask(
11516 mut self,
11517 new_value: common::FieldMask,
11518 ) -> ProjectLocationConnectionPatchCall<'a, C> {
11519 self._update_mask = Some(new_value);
11520 self
11521 }
11522 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11523 /// while executing the actual API request.
11524 ///
11525 /// ````text
11526 /// It should be used to handle progress information, and to implement a certain level of resilience.
11527 /// ````
11528 ///
11529 /// Sets the *delegate* property to the given value.
11530 pub fn delegate(
11531 mut self,
11532 new_value: &'a mut dyn common::Delegate,
11533 ) -> ProjectLocationConnectionPatchCall<'a, C> {
11534 self._delegate = Some(new_value);
11535 self
11536 }
11537
11538 /// Set any additional parameter of the query string used in the request.
11539 /// It should be used to set parameters which are not yet available through their own
11540 /// setters.
11541 ///
11542 /// Please note that this method must not be used to set any of the known parameters
11543 /// which have their own setter method. If done anyway, the request will fail.
11544 ///
11545 /// # Additional Parameters
11546 ///
11547 /// * *$.xgafv* (query-string) - V1 error format.
11548 /// * *access_token* (query-string) - OAuth access token.
11549 /// * *alt* (query-string) - Data format for response.
11550 /// * *callback* (query-string) - JSONP
11551 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11552 /// * *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.
11553 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11554 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11555 /// * *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.
11556 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11557 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11558 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationConnectionPatchCall<'a, C>
11559 where
11560 T: AsRef<str>,
11561 {
11562 self._additional_params
11563 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11564 self
11565 }
11566
11567 /// Identifies the authorization scope for the method you are building.
11568 ///
11569 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11570 /// [`Scope::CloudPlatform`].
11571 ///
11572 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11573 /// tokens for more than one scope.
11574 ///
11575 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11576 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11577 /// sufficient, a read-write scope will do as well.
11578 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionPatchCall<'a, C>
11579 where
11580 St: AsRef<str>,
11581 {
11582 self._scopes.insert(String::from(scope.as_ref()));
11583 self
11584 }
11585 /// Identifies the authorization scope(s) for the method you are building.
11586 ///
11587 /// See [`Self::add_scope()`] for details.
11588 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationConnectionPatchCall<'a, C>
11589 where
11590 I: IntoIterator<Item = St>,
11591 St: AsRef<str>,
11592 {
11593 self._scopes
11594 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11595 self
11596 }
11597
11598 /// Removes all scopes, and no default scope will be used either.
11599 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11600 /// for details).
11601 pub fn clear_scopes(mut self) -> ProjectLocationConnectionPatchCall<'a, C> {
11602 self._scopes.clear();
11603 self
11604 }
11605}
11606
11607/// RepaiEventing tries to repair eventing related event subscriptions.
11608///
11609/// A builder for the *locations.connections.repairEventing* method supported by a *project* resource.
11610/// It is not used directly, but through a [`ProjectMethods`] instance.
11611///
11612/// # Example
11613///
11614/// Instantiate a resource method builder
11615///
11616/// ```test_harness,no_run
11617/// # extern crate hyper;
11618/// # extern crate hyper_rustls;
11619/// # extern crate google_connectors1 as connectors1;
11620/// use connectors1::api::RepairEventingRequest;
11621/// # async fn dox() {
11622/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11623///
11624/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11625/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11626/// # secret,
11627/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11628/// # ).build().await.unwrap();
11629///
11630/// # let client = hyper_util::client::legacy::Client::builder(
11631/// # hyper_util::rt::TokioExecutor::new()
11632/// # )
11633/// # .build(
11634/// # hyper_rustls::HttpsConnectorBuilder::new()
11635/// # .with_native_roots()
11636/// # .unwrap()
11637/// # .https_or_http()
11638/// # .enable_http1()
11639/// # .build()
11640/// # );
11641/// # let mut hub = Connectors::new(client, auth);
11642/// // As the method needs a request, you would usually fill it with the desired information
11643/// // into the respective structure. Some of the parts shown here might not be applicable !
11644/// // Values shown here are possibly random and not representative !
11645/// let mut req = RepairEventingRequest::default();
11646///
11647/// // You can configure optional parameters by calling the respective setters at will, and
11648/// // execute the final call using `doit()`.
11649/// // Values shown here are possibly random and not representative !
11650/// let result = hub.projects().locations_connections_repair_eventing(req, "name")
11651/// .doit().await;
11652/// # }
11653/// ```
11654pub struct ProjectLocationConnectionRepairEventingCall<'a, C>
11655where
11656 C: 'a,
11657{
11658 hub: &'a Connectors<C>,
11659 _request: RepairEventingRequest,
11660 _name: String,
11661 _delegate: Option<&'a mut dyn common::Delegate>,
11662 _additional_params: HashMap<String, String>,
11663 _scopes: BTreeSet<String>,
11664}
11665
11666impl<'a, C> common::CallBuilder for ProjectLocationConnectionRepairEventingCall<'a, C> {}
11667
11668impl<'a, C> ProjectLocationConnectionRepairEventingCall<'a, C>
11669where
11670 C: common::Connector,
11671{
11672 /// Perform the operation you have build so far.
11673 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
11674 use std::borrow::Cow;
11675 use std::io::{Read, Seek};
11676
11677 use common::{url::Params, ToParts};
11678 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11679
11680 let mut dd = common::DefaultDelegate;
11681 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11682 dlg.begin(common::MethodInfo {
11683 id: "connectors.projects.locations.connections.repairEventing",
11684 http_method: hyper::Method::POST,
11685 });
11686
11687 for &field in ["alt", "name"].iter() {
11688 if self._additional_params.contains_key(field) {
11689 dlg.finished(false);
11690 return Err(common::Error::FieldClash(field));
11691 }
11692 }
11693
11694 let mut params = Params::with_capacity(4 + self._additional_params.len());
11695 params.push("name", self._name);
11696
11697 params.extend(self._additional_params.iter());
11698
11699 params.push("alt", "json");
11700 let mut url = self.hub._base_url.clone() + "v1/{+name}:repairEventing";
11701 if self._scopes.is_empty() {
11702 self._scopes
11703 .insert(Scope::CloudPlatform.as_ref().to_string());
11704 }
11705
11706 #[allow(clippy::single_element_loop)]
11707 for &(find_this, param_name) in [("{+name}", "name")].iter() {
11708 url = params.uri_replacement(url, param_name, find_this, true);
11709 }
11710 {
11711 let to_remove = ["name"];
11712 params.remove_params(&to_remove);
11713 }
11714
11715 let url = params.parse_with_url(&url);
11716
11717 let mut json_mime_type = mime::APPLICATION_JSON;
11718 let mut request_value_reader = {
11719 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11720 common::remove_json_null_values(&mut value);
11721 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11722 serde_json::to_writer(&mut dst, &value).unwrap();
11723 dst
11724 };
11725 let request_size = request_value_reader
11726 .seek(std::io::SeekFrom::End(0))
11727 .unwrap();
11728 request_value_reader
11729 .seek(std::io::SeekFrom::Start(0))
11730 .unwrap();
11731
11732 loop {
11733 let token = match self
11734 .hub
11735 .auth
11736 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11737 .await
11738 {
11739 Ok(token) => token,
11740 Err(e) => match dlg.token(e) {
11741 Ok(token) => token,
11742 Err(e) => {
11743 dlg.finished(false);
11744 return Err(common::Error::MissingToken(e));
11745 }
11746 },
11747 };
11748 request_value_reader
11749 .seek(std::io::SeekFrom::Start(0))
11750 .unwrap();
11751 let mut req_result = {
11752 let client = &self.hub.client;
11753 dlg.pre_request();
11754 let mut req_builder = hyper::Request::builder()
11755 .method(hyper::Method::POST)
11756 .uri(url.as_str())
11757 .header(USER_AGENT, self.hub._user_agent.clone());
11758
11759 if let Some(token) = token.as_ref() {
11760 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11761 }
11762
11763 let request = req_builder
11764 .header(CONTENT_TYPE, json_mime_type.to_string())
11765 .header(CONTENT_LENGTH, request_size as u64)
11766 .body(common::to_body(
11767 request_value_reader.get_ref().clone().into(),
11768 ));
11769
11770 client.request(request.unwrap()).await
11771 };
11772
11773 match req_result {
11774 Err(err) => {
11775 if let common::Retry::After(d) = dlg.http_error(&err) {
11776 sleep(d).await;
11777 continue;
11778 }
11779 dlg.finished(false);
11780 return Err(common::Error::HttpError(err));
11781 }
11782 Ok(res) => {
11783 let (mut parts, body) = res.into_parts();
11784 let mut body = common::Body::new(body);
11785 if !parts.status.is_success() {
11786 let bytes = common::to_bytes(body).await.unwrap_or_default();
11787 let error = serde_json::from_str(&common::to_string(&bytes));
11788 let response = common::to_response(parts, bytes.into());
11789
11790 if let common::Retry::After(d) =
11791 dlg.http_failure(&response, error.as_ref().ok())
11792 {
11793 sleep(d).await;
11794 continue;
11795 }
11796
11797 dlg.finished(false);
11798
11799 return Err(match error {
11800 Ok(value) => common::Error::BadRequest(value),
11801 _ => common::Error::Failure(response),
11802 });
11803 }
11804 let response = {
11805 let bytes = common::to_bytes(body).await.unwrap_or_default();
11806 let encoded = common::to_string(&bytes);
11807 match serde_json::from_str(&encoded) {
11808 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11809 Err(error) => {
11810 dlg.response_json_decode_error(&encoded, &error);
11811 return Err(common::Error::JsonDecodeError(
11812 encoded.to_string(),
11813 error,
11814 ));
11815 }
11816 }
11817 };
11818
11819 dlg.finished(true);
11820 return Ok(response);
11821 }
11822 }
11823 }
11824 }
11825
11826 ///
11827 /// Sets the *request* property to the given value.
11828 ///
11829 /// Even though the property as already been set when instantiating this call,
11830 /// we provide this method for API completeness.
11831 pub fn request(
11832 mut self,
11833 new_value: RepairEventingRequest,
11834 ) -> ProjectLocationConnectionRepairEventingCall<'a, C> {
11835 self._request = new_value;
11836 self
11837 }
11838 /// Required. Resource name of the form: `projects/*/locations/*/connections/*`
11839 ///
11840 /// Sets the *name* path property to the given value.
11841 ///
11842 /// Even though the property as already been set when instantiating this call,
11843 /// we provide this method for API completeness.
11844 pub fn name(mut self, new_value: &str) -> ProjectLocationConnectionRepairEventingCall<'a, C> {
11845 self._name = new_value.to_string();
11846 self
11847 }
11848 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11849 /// while executing the actual API request.
11850 ///
11851 /// ````text
11852 /// It should be used to handle progress information, and to implement a certain level of resilience.
11853 /// ````
11854 ///
11855 /// Sets the *delegate* property to the given value.
11856 pub fn delegate(
11857 mut self,
11858 new_value: &'a mut dyn common::Delegate,
11859 ) -> ProjectLocationConnectionRepairEventingCall<'a, C> {
11860 self._delegate = Some(new_value);
11861 self
11862 }
11863
11864 /// Set any additional parameter of the query string used in the request.
11865 /// It should be used to set parameters which are not yet available through their own
11866 /// setters.
11867 ///
11868 /// Please note that this method must not be used to set any of the known parameters
11869 /// which have their own setter method. If done anyway, the request will fail.
11870 ///
11871 /// # Additional Parameters
11872 ///
11873 /// * *$.xgafv* (query-string) - V1 error format.
11874 /// * *access_token* (query-string) - OAuth access token.
11875 /// * *alt* (query-string) - Data format for response.
11876 /// * *callback* (query-string) - JSONP
11877 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11878 /// * *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.
11879 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11880 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11881 /// * *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.
11882 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11883 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11884 pub fn param<T>(
11885 mut self,
11886 name: T,
11887 value: T,
11888 ) -> ProjectLocationConnectionRepairEventingCall<'a, C>
11889 where
11890 T: AsRef<str>,
11891 {
11892 self._additional_params
11893 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11894 self
11895 }
11896
11897 /// Identifies the authorization scope for the method you are building.
11898 ///
11899 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11900 /// [`Scope::CloudPlatform`].
11901 ///
11902 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11903 /// tokens for more than one scope.
11904 ///
11905 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11906 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11907 /// sufficient, a read-write scope will do as well.
11908 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionRepairEventingCall<'a, C>
11909 where
11910 St: AsRef<str>,
11911 {
11912 self._scopes.insert(String::from(scope.as_ref()));
11913 self
11914 }
11915 /// Identifies the authorization scope(s) for the method you are building.
11916 ///
11917 /// See [`Self::add_scope()`] for details.
11918 pub fn add_scopes<I, St>(
11919 mut self,
11920 scopes: I,
11921 ) -> ProjectLocationConnectionRepairEventingCall<'a, C>
11922 where
11923 I: IntoIterator<Item = St>,
11924 St: AsRef<str>,
11925 {
11926 self._scopes
11927 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11928 self
11929 }
11930
11931 /// Removes all scopes, and no default scope will be used either.
11932 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11933 /// for details).
11934 pub fn clear_scopes(mut self) -> ProjectLocationConnectionRepairEventingCall<'a, C> {
11935 self._scopes.clear();
11936 self
11937 }
11938}
11939
11940/// Returns Top matching Connections for a given query.
11941///
11942/// A builder for the *locations.connections.search* method supported by a *project* resource.
11943/// It is not used directly, but through a [`ProjectMethods`] instance.
11944///
11945/// # Example
11946///
11947/// Instantiate a resource method builder
11948///
11949/// ```test_harness,no_run
11950/// # extern crate hyper;
11951/// # extern crate hyper_rustls;
11952/// # extern crate google_connectors1 as connectors1;
11953/// # async fn dox() {
11954/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11955///
11956/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11957/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11958/// # secret,
11959/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11960/// # ).build().await.unwrap();
11961///
11962/// # let client = hyper_util::client::legacy::Client::builder(
11963/// # hyper_util::rt::TokioExecutor::new()
11964/// # )
11965/// # .build(
11966/// # hyper_rustls::HttpsConnectorBuilder::new()
11967/// # .with_native_roots()
11968/// # .unwrap()
11969/// # .https_or_http()
11970/// # .enable_http1()
11971/// # .build()
11972/// # );
11973/// # let mut hub = Connectors::new(client, auth);
11974/// // You can configure optional parameters by calling the respective setters at will, and
11975/// // execute the final call using `doit()`.
11976/// // Values shown here are possibly random and not representative !
11977/// let result = hub.projects().locations_connections_search("name")
11978/// .query("dolor")
11979/// .page_token("et")
11980/// .page_size(-22)
11981/// .doit().await;
11982/// # }
11983/// ```
11984pub struct ProjectLocationConnectionSearchCall<'a, C>
11985where
11986 C: 'a,
11987{
11988 hub: &'a Connectors<C>,
11989 _name: String,
11990 _query: Option<String>,
11991 _page_token: Option<String>,
11992 _page_size: Option<i32>,
11993 _delegate: Option<&'a mut dyn common::Delegate>,
11994 _additional_params: HashMap<String, String>,
11995 _scopes: BTreeSet<String>,
11996}
11997
11998impl<'a, C> common::CallBuilder for ProjectLocationConnectionSearchCall<'a, C> {}
11999
12000impl<'a, C> ProjectLocationConnectionSearchCall<'a, C>
12001where
12002 C: common::Connector,
12003{
12004 /// Perform the operation you have build so far.
12005 pub async fn doit(mut self) -> common::Result<(common::Response, SearchConnectionsResponse)> {
12006 use std::borrow::Cow;
12007 use std::io::{Read, Seek};
12008
12009 use common::{url::Params, ToParts};
12010 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12011
12012 let mut dd = common::DefaultDelegate;
12013 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12014 dlg.begin(common::MethodInfo {
12015 id: "connectors.projects.locations.connections.search",
12016 http_method: hyper::Method::GET,
12017 });
12018
12019 for &field in ["alt", "name", "query", "pageToken", "pageSize"].iter() {
12020 if self._additional_params.contains_key(field) {
12021 dlg.finished(false);
12022 return Err(common::Error::FieldClash(field));
12023 }
12024 }
12025
12026 let mut params = Params::with_capacity(6 + self._additional_params.len());
12027 params.push("name", self._name);
12028 if let Some(value) = self._query.as_ref() {
12029 params.push("query", value);
12030 }
12031 if let Some(value) = self._page_token.as_ref() {
12032 params.push("pageToken", value);
12033 }
12034 if let Some(value) = self._page_size.as_ref() {
12035 params.push("pageSize", value.to_string());
12036 }
12037
12038 params.extend(self._additional_params.iter());
12039
12040 params.push("alt", "json");
12041 let mut url = self.hub._base_url.clone() + "v1/{+name}:search";
12042 if self._scopes.is_empty() {
12043 self._scopes
12044 .insert(Scope::CloudPlatform.as_ref().to_string());
12045 }
12046
12047 #[allow(clippy::single_element_loop)]
12048 for &(find_this, param_name) in [("{+name}", "name")].iter() {
12049 url = params.uri_replacement(url, param_name, find_this, true);
12050 }
12051 {
12052 let to_remove = ["name"];
12053 params.remove_params(&to_remove);
12054 }
12055
12056 let url = params.parse_with_url(&url);
12057
12058 loop {
12059 let token = match self
12060 .hub
12061 .auth
12062 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12063 .await
12064 {
12065 Ok(token) => token,
12066 Err(e) => match dlg.token(e) {
12067 Ok(token) => token,
12068 Err(e) => {
12069 dlg.finished(false);
12070 return Err(common::Error::MissingToken(e));
12071 }
12072 },
12073 };
12074 let mut req_result = {
12075 let client = &self.hub.client;
12076 dlg.pre_request();
12077 let mut req_builder = hyper::Request::builder()
12078 .method(hyper::Method::GET)
12079 .uri(url.as_str())
12080 .header(USER_AGENT, self.hub._user_agent.clone());
12081
12082 if let Some(token) = token.as_ref() {
12083 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12084 }
12085
12086 let request = req_builder
12087 .header(CONTENT_LENGTH, 0_u64)
12088 .body(common::to_body::<String>(None));
12089
12090 client.request(request.unwrap()).await
12091 };
12092
12093 match req_result {
12094 Err(err) => {
12095 if let common::Retry::After(d) = dlg.http_error(&err) {
12096 sleep(d).await;
12097 continue;
12098 }
12099 dlg.finished(false);
12100 return Err(common::Error::HttpError(err));
12101 }
12102 Ok(res) => {
12103 let (mut parts, body) = res.into_parts();
12104 let mut body = common::Body::new(body);
12105 if !parts.status.is_success() {
12106 let bytes = common::to_bytes(body).await.unwrap_or_default();
12107 let error = serde_json::from_str(&common::to_string(&bytes));
12108 let response = common::to_response(parts, bytes.into());
12109
12110 if let common::Retry::After(d) =
12111 dlg.http_failure(&response, error.as_ref().ok())
12112 {
12113 sleep(d).await;
12114 continue;
12115 }
12116
12117 dlg.finished(false);
12118
12119 return Err(match error {
12120 Ok(value) => common::Error::BadRequest(value),
12121 _ => common::Error::Failure(response),
12122 });
12123 }
12124 let response = {
12125 let bytes = common::to_bytes(body).await.unwrap_or_default();
12126 let encoded = common::to_string(&bytes);
12127 match serde_json::from_str(&encoded) {
12128 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12129 Err(error) => {
12130 dlg.response_json_decode_error(&encoded, &error);
12131 return Err(common::Error::JsonDecodeError(
12132 encoded.to_string(),
12133 error,
12134 ));
12135 }
12136 }
12137 };
12138
12139 dlg.finished(true);
12140 return Ok(response);
12141 }
12142 }
12143 }
12144 }
12145
12146 /// Required. Parent resource of the Connection, of the form: `projects/*/locations/*/connections`
12147 ///
12148 /// Sets the *name* path property to the given value.
12149 ///
12150 /// Even though the property as already been set when instantiating this call,
12151 /// we provide this method for API completeness.
12152 pub fn name(mut self, new_value: &str) -> ProjectLocationConnectionSearchCall<'a, C> {
12153 self._name = new_value.to_string();
12154 self
12155 }
12156 /// Required. The query against which the search needs to be done.
12157 ///
12158 /// Sets the *query* query property to the given value.
12159 pub fn query(mut self, new_value: &str) -> ProjectLocationConnectionSearchCall<'a, C> {
12160 self._query = Some(new_value.to_string());
12161 self
12162 }
12163 /// Optional. page_token
12164 ///
12165 /// Sets the *page token* query property to the given value.
12166 pub fn page_token(mut self, new_value: &str) -> ProjectLocationConnectionSearchCall<'a, C> {
12167 self._page_token = Some(new_value.to_string());
12168 self
12169 }
12170 /// Optional. The number of top matching connectors to return
12171 ///
12172 /// Sets the *page size* query property to the given value.
12173 pub fn page_size(mut self, new_value: i32) -> ProjectLocationConnectionSearchCall<'a, C> {
12174 self._page_size = Some(new_value);
12175 self
12176 }
12177 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12178 /// while executing the actual API request.
12179 ///
12180 /// ````text
12181 /// It should be used to handle progress information, and to implement a certain level of resilience.
12182 /// ````
12183 ///
12184 /// Sets the *delegate* property to the given value.
12185 pub fn delegate(
12186 mut self,
12187 new_value: &'a mut dyn common::Delegate,
12188 ) -> ProjectLocationConnectionSearchCall<'a, C> {
12189 self._delegate = Some(new_value);
12190 self
12191 }
12192
12193 /// Set any additional parameter of the query string used in the request.
12194 /// It should be used to set parameters which are not yet available through their own
12195 /// setters.
12196 ///
12197 /// Please note that this method must not be used to set any of the known parameters
12198 /// which have their own setter method. If done anyway, the request will fail.
12199 ///
12200 /// # Additional Parameters
12201 ///
12202 /// * *$.xgafv* (query-string) - V1 error format.
12203 /// * *access_token* (query-string) - OAuth access token.
12204 /// * *alt* (query-string) - Data format for response.
12205 /// * *callback* (query-string) - JSONP
12206 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12207 /// * *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.
12208 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12209 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12210 /// * *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.
12211 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12212 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12213 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationConnectionSearchCall<'a, C>
12214 where
12215 T: AsRef<str>,
12216 {
12217 self._additional_params
12218 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12219 self
12220 }
12221
12222 /// Identifies the authorization scope for the method you are building.
12223 ///
12224 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12225 /// [`Scope::CloudPlatform`].
12226 ///
12227 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12228 /// tokens for more than one scope.
12229 ///
12230 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12231 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12232 /// sufficient, a read-write scope will do as well.
12233 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionSearchCall<'a, C>
12234 where
12235 St: AsRef<str>,
12236 {
12237 self._scopes.insert(String::from(scope.as_ref()));
12238 self
12239 }
12240 /// Identifies the authorization scope(s) for the method you are building.
12241 ///
12242 /// See [`Self::add_scope()`] for details.
12243 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationConnectionSearchCall<'a, C>
12244 where
12245 I: IntoIterator<Item = St>,
12246 St: AsRef<str>,
12247 {
12248 self._scopes
12249 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12250 self
12251 }
12252
12253 /// Removes all scopes, and no default scope will be used either.
12254 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12255 /// for details).
12256 pub fn clear_scopes(mut self) -> ProjectLocationConnectionSearchCall<'a, C> {
12257 self._scopes.clear();
12258 self
12259 }
12260}
12261
12262/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
12263///
12264/// A builder for the *locations.connections.setIamPolicy* method supported by a *project* resource.
12265/// It is not used directly, but through a [`ProjectMethods`] instance.
12266///
12267/// # Example
12268///
12269/// Instantiate a resource method builder
12270///
12271/// ```test_harness,no_run
12272/// # extern crate hyper;
12273/// # extern crate hyper_rustls;
12274/// # extern crate google_connectors1 as connectors1;
12275/// use connectors1::api::SetIamPolicyRequest;
12276/// # async fn dox() {
12277/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12278///
12279/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12280/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12281/// # secret,
12282/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12283/// # ).build().await.unwrap();
12284///
12285/// # let client = hyper_util::client::legacy::Client::builder(
12286/// # hyper_util::rt::TokioExecutor::new()
12287/// # )
12288/// # .build(
12289/// # hyper_rustls::HttpsConnectorBuilder::new()
12290/// # .with_native_roots()
12291/// # .unwrap()
12292/// # .https_or_http()
12293/// # .enable_http1()
12294/// # .build()
12295/// # );
12296/// # let mut hub = Connectors::new(client, auth);
12297/// // As the method needs a request, you would usually fill it with the desired information
12298/// // into the respective structure. Some of the parts shown here might not be applicable !
12299/// // Values shown here are possibly random and not representative !
12300/// let mut req = SetIamPolicyRequest::default();
12301///
12302/// // You can configure optional parameters by calling the respective setters at will, and
12303/// // execute the final call using `doit()`.
12304/// // Values shown here are possibly random and not representative !
12305/// let result = hub.projects().locations_connections_set_iam_policy(req, "resource")
12306/// .doit().await;
12307/// # }
12308/// ```
12309pub struct ProjectLocationConnectionSetIamPolicyCall<'a, C>
12310where
12311 C: 'a,
12312{
12313 hub: &'a Connectors<C>,
12314 _request: SetIamPolicyRequest,
12315 _resource: String,
12316 _delegate: Option<&'a mut dyn common::Delegate>,
12317 _additional_params: HashMap<String, String>,
12318 _scopes: BTreeSet<String>,
12319}
12320
12321impl<'a, C> common::CallBuilder for ProjectLocationConnectionSetIamPolicyCall<'a, C> {}
12322
12323impl<'a, C> ProjectLocationConnectionSetIamPolicyCall<'a, C>
12324where
12325 C: common::Connector,
12326{
12327 /// Perform the operation you have build so far.
12328 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
12329 use std::borrow::Cow;
12330 use std::io::{Read, Seek};
12331
12332 use common::{url::Params, ToParts};
12333 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12334
12335 let mut dd = common::DefaultDelegate;
12336 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12337 dlg.begin(common::MethodInfo {
12338 id: "connectors.projects.locations.connections.setIamPolicy",
12339 http_method: hyper::Method::POST,
12340 });
12341
12342 for &field in ["alt", "resource"].iter() {
12343 if self._additional_params.contains_key(field) {
12344 dlg.finished(false);
12345 return Err(common::Error::FieldClash(field));
12346 }
12347 }
12348
12349 let mut params = Params::with_capacity(4 + self._additional_params.len());
12350 params.push("resource", self._resource);
12351
12352 params.extend(self._additional_params.iter());
12353
12354 params.push("alt", "json");
12355 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
12356 if self._scopes.is_empty() {
12357 self._scopes
12358 .insert(Scope::CloudPlatform.as_ref().to_string());
12359 }
12360
12361 #[allow(clippy::single_element_loop)]
12362 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
12363 url = params.uri_replacement(url, param_name, find_this, true);
12364 }
12365 {
12366 let to_remove = ["resource"];
12367 params.remove_params(&to_remove);
12368 }
12369
12370 let url = params.parse_with_url(&url);
12371
12372 let mut json_mime_type = mime::APPLICATION_JSON;
12373 let mut request_value_reader = {
12374 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12375 common::remove_json_null_values(&mut value);
12376 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12377 serde_json::to_writer(&mut dst, &value).unwrap();
12378 dst
12379 };
12380 let request_size = request_value_reader
12381 .seek(std::io::SeekFrom::End(0))
12382 .unwrap();
12383 request_value_reader
12384 .seek(std::io::SeekFrom::Start(0))
12385 .unwrap();
12386
12387 loop {
12388 let token = match self
12389 .hub
12390 .auth
12391 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12392 .await
12393 {
12394 Ok(token) => token,
12395 Err(e) => match dlg.token(e) {
12396 Ok(token) => token,
12397 Err(e) => {
12398 dlg.finished(false);
12399 return Err(common::Error::MissingToken(e));
12400 }
12401 },
12402 };
12403 request_value_reader
12404 .seek(std::io::SeekFrom::Start(0))
12405 .unwrap();
12406 let mut req_result = {
12407 let client = &self.hub.client;
12408 dlg.pre_request();
12409 let mut req_builder = hyper::Request::builder()
12410 .method(hyper::Method::POST)
12411 .uri(url.as_str())
12412 .header(USER_AGENT, self.hub._user_agent.clone());
12413
12414 if let Some(token) = token.as_ref() {
12415 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12416 }
12417
12418 let request = req_builder
12419 .header(CONTENT_TYPE, json_mime_type.to_string())
12420 .header(CONTENT_LENGTH, request_size as u64)
12421 .body(common::to_body(
12422 request_value_reader.get_ref().clone().into(),
12423 ));
12424
12425 client.request(request.unwrap()).await
12426 };
12427
12428 match req_result {
12429 Err(err) => {
12430 if let common::Retry::After(d) = dlg.http_error(&err) {
12431 sleep(d).await;
12432 continue;
12433 }
12434 dlg.finished(false);
12435 return Err(common::Error::HttpError(err));
12436 }
12437 Ok(res) => {
12438 let (mut parts, body) = res.into_parts();
12439 let mut body = common::Body::new(body);
12440 if !parts.status.is_success() {
12441 let bytes = common::to_bytes(body).await.unwrap_or_default();
12442 let error = serde_json::from_str(&common::to_string(&bytes));
12443 let response = common::to_response(parts, bytes.into());
12444
12445 if let common::Retry::After(d) =
12446 dlg.http_failure(&response, error.as_ref().ok())
12447 {
12448 sleep(d).await;
12449 continue;
12450 }
12451
12452 dlg.finished(false);
12453
12454 return Err(match error {
12455 Ok(value) => common::Error::BadRequest(value),
12456 _ => common::Error::Failure(response),
12457 });
12458 }
12459 let response = {
12460 let bytes = common::to_bytes(body).await.unwrap_or_default();
12461 let encoded = common::to_string(&bytes);
12462 match serde_json::from_str(&encoded) {
12463 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12464 Err(error) => {
12465 dlg.response_json_decode_error(&encoded, &error);
12466 return Err(common::Error::JsonDecodeError(
12467 encoded.to_string(),
12468 error,
12469 ));
12470 }
12471 }
12472 };
12473
12474 dlg.finished(true);
12475 return Ok(response);
12476 }
12477 }
12478 }
12479 }
12480
12481 ///
12482 /// Sets the *request* property to the given value.
12483 ///
12484 /// Even though the property as already been set when instantiating this call,
12485 /// we provide this method for API completeness.
12486 pub fn request(
12487 mut self,
12488 new_value: SetIamPolicyRequest,
12489 ) -> ProjectLocationConnectionSetIamPolicyCall<'a, C> {
12490 self._request = new_value;
12491 self
12492 }
12493 /// 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.
12494 ///
12495 /// Sets the *resource* path property to the given value.
12496 ///
12497 /// Even though the property as already been set when instantiating this call,
12498 /// we provide this method for API completeness.
12499 pub fn resource(mut self, new_value: &str) -> ProjectLocationConnectionSetIamPolicyCall<'a, C> {
12500 self._resource = new_value.to_string();
12501 self
12502 }
12503 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12504 /// while executing the actual API request.
12505 ///
12506 /// ````text
12507 /// It should be used to handle progress information, and to implement a certain level of resilience.
12508 /// ````
12509 ///
12510 /// Sets the *delegate* property to the given value.
12511 pub fn delegate(
12512 mut self,
12513 new_value: &'a mut dyn common::Delegate,
12514 ) -> ProjectLocationConnectionSetIamPolicyCall<'a, C> {
12515 self._delegate = Some(new_value);
12516 self
12517 }
12518
12519 /// Set any additional parameter of the query string used in the request.
12520 /// It should be used to set parameters which are not yet available through their own
12521 /// setters.
12522 ///
12523 /// Please note that this method must not be used to set any of the known parameters
12524 /// which have their own setter method. If done anyway, the request will fail.
12525 ///
12526 /// # Additional Parameters
12527 ///
12528 /// * *$.xgafv* (query-string) - V1 error format.
12529 /// * *access_token* (query-string) - OAuth access token.
12530 /// * *alt* (query-string) - Data format for response.
12531 /// * *callback* (query-string) - JSONP
12532 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12533 /// * *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.
12534 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12535 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12536 /// * *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.
12537 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12538 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12539 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationConnectionSetIamPolicyCall<'a, C>
12540 where
12541 T: AsRef<str>,
12542 {
12543 self._additional_params
12544 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12545 self
12546 }
12547
12548 /// Identifies the authorization scope for the method you are building.
12549 ///
12550 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12551 /// [`Scope::CloudPlatform`].
12552 ///
12553 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12554 /// tokens for more than one scope.
12555 ///
12556 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12557 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12558 /// sufficient, a read-write scope will do as well.
12559 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationConnectionSetIamPolicyCall<'a, C>
12560 where
12561 St: AsRef<str>,
12562 {
12563 self._scopes.insert(String::from(scope.as_ref()));
12564 self
12565 }
12566 /// Identifies the authorization scope(s) for the method you are building.
12567 ///
12568 /// See [`Self::add_scope()`] for details.
12569 pub fn add_scopes<I, St>(
12570 mut self,
12571 scopes: I,
12572 ) -> ProjectLocationConnectionSetIamPolicyCall<'a, C>
12573 where
12574 I: IntoIterator<Item = St>,
12575 St: AsRef<str>,
12576 {
12577 self._scopes
12578 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12579 self
12580 }
12581
12582 /// Removes all scopes, and no default scope will be used either.
12583 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12584 /// for details).
12585 pub fn clear_scopes(mut self) -> ProjectLocationConnectionSetIamPolicyCall<'a, C> {
12586 self._scopes.clear();
12587 self
12588 }
12589}
12590
12591/// 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.
12592///
12593/// A builder for the *locations.connections.testIamPermissions* method supported by a *project* resource.
12594/// It is not used directly, but through a [`ProjectMethods`] instance.
12595///
12596/// # Example
12597///
12598/// Instantiate a resource method builder
12599///
12600/// ```test_harness,no_run
12601/// # extern crate hyper;
12602/// # extern crate hyper_rustls;
12603/// # extern crate google_connectors1 as connectors1;
12604/// use connectors1::api::TestIamPermissionsRequest;
12605/// # async fn dox() {
12606/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12607///
12608/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12609/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12610/// # secret,
12611/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12612/// # ).build().await.unwrap();
12613///
12614/// # let client = hyper_util::client::legacy::Client::builder(
12615/// # hyper_util::rt::TokioExecutor::new()
12616/// # )
12617/// # .build(
12618/// # hyper_rustls::HttpsConnectorBuilder::new()
12619/// # .with_native_roots()
12620/// # .unwrap()
12621/// # .https_or_http()
12622/// # .enable_http1()
12623/// # .build()
12624/// # );
12625/// # let mut hub = Connectors::new(client, auth);
12626/// // As the method needs a request, you would usually fill it with the desired information
12627/// // into the respective structure. Some of the parts shown here might not be applicable !
12628/// // Values shown here are possibly random and not representative !
12629/// let mut req = TestIamPermissionsRequest::default();
12630///
12631/// // You can configure optional parameters by calling the respective setters at will, and
12632/// // execute the final call using `doit()`.
12633/// // Values shown here are possibly random and not representative !
12634/// let result = hub.projects().locations_connections_test_iam_permissions(req, "resource")
12635/// .doit().await;
12636/// # }
12637/// ```
12638pub struct ProjectLocationConnectionTestIamPermissionCall<'a, C>
12639where
12640 C: 'a,
12641{
12642 hub: &'a Connectors<C>,
12643 _request: TestIamPermissionsRequest,
12644 _resource: String,
12645 _delegate: Option<&'a mut dyn common::Delegate>,
12646 _additional_params: HashMap<String, String>,
12647 _scopes: BTreeSet<String>,
12648}
12649
12650impl<'a, C> common::CallBuilder for ProjectLocationConnectionTestIamPermissionCall<'a, C> {}
12651
12652impl<'a, C> ProjectLocationConnectionTestIamPermissionCall<'a, C>
12653where
12654 C: common::Connector,
12655{
12656 /// Perform the operation you have build so far.
12657 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
12658 use std::borrow::Cow;
12659 use std::io::{Read, Seek};
12660
12661 use common::{url::Params, ToParts};
12662 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12663
12664 let mut dd = common::DefaultDelegate;
12665 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12666 dlg.begin(common::MethodInfo {
12667 id: "connectors.projects.locations.connections.testIamPermissions",
12668 http_method: hyper::Method::POST,
12669 });
12670
12671 for &field in ["alt", "resource"].iter() {
12672 if self._additional_params.contains_key(field) {
12673 dlg.finished(false);
12674 return Err(common::Error::FieldClash(field));
12675 }
12676 }
12677
12678 let mut params = Params::with_capacity(4 + self._additional_params.len());
12679 params.push("resource", self._resource);
12680
12681 params.extend(self._additional_params.iter());
12682
12683 params.push("alt", "json");
12684 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
12685 if self._scopes.is_empty() {
12686 self._scopes
12687 .insert(Scope::CloudPlatform.as_ref().to_string());
12688 }
12689
12690 #[allow(clippy::single_element_loop)]
12691 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
12692 url = params.uri_replacement(url, param_name, find_this, true);
12693 }
12694 {
12695 let to_remove = ["resource"];
12696 params.remove_params(&to_remove);
12697 }
12698
12699 let url = params.parse_with_url(&url);
12700
12701 let mut json_mime_type = mime::APPLICATION_JSON;
12702 let mut request_value_reader = {
12703 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12704 common::remove_json_null_values(&mut value);
12705 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12706 serde_json::to_writer(&mut dst, &value).unwrap();
12707 dst
12708 };
12709 let request_size = request_value_reader
12710 .seek(std::io::SeekFrom::End(0))
12711 .unwrap();
12712 request_value_reader
12713 .seek(std::io::SeekFrom::Start(0))
12714 .unwrap();
12715
12716 loop {
12717 let token = match self
12718 .hub
12719 .auth
12720 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12721 .await
12722 {
12723 Ok(token) => token,
12724 Err(e) => match dlg.token(e) {
12725 Ok(token) => token,
12726 Err(e) => {
12727 dlg.finished(false);
12728 return Err(common::Error::MissingToken(e));
12729 }
12730 },
12731 };
12732 request_value_reader
12733 .seek(std::io::SeekFrom::Start(0))
12734 .unwrap();
12735 let mut req_result = {
12736 let client = &self.hub.client;
12737 dlg.pre_request();
12738 let mut req_builder = hyper::Request::builder()
12739 .method(hyper::Method::POST)
12740 .uri(url.as_str())
12741 .header(USER_AGENT, self.hub._user_agent.clone());
12742
12743 if let Some(token) = token.as_ref() {
12744 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12745 }
12746
12747 let request = req_builder
12748 .header(CONTENT_TYPE, json_mime_type.to_string())
12749 .header(CONTENT_LENGTH, request_size as u64)
12750 .body(common::to_body(
12751 request_value_reader.get_ref().clone().into(),
12752 ));
12753
12754 client.request(request.unwrap()).await
12755 };
12756
12757 match req_result {
12758 Err(err) => {
12759 if let common::Retry::After(d) = dlg.http_error(&err) {
12760 sleep(d).await;
12761 continue;
12762 }
12763 dlg.finished(false);
12764 return Err(common::Error::HttpError(err));
12765 }
12766 Ok(res) => {
12767 let (mut parts, body) = res.into_parts();
12768 let mut body = common::Body::new(body);
12769 if !parts.status.is_success() {
12770 let bytes = common::to_bytes(body).await.unwrap_or_default();
12771 let error = serde_json::from_str(&common::to_string(&bytes));
12772 let response = common::to_response(parts, bytes.into());
12773
12774 if let common::Retry::After(d) =
12775 dlg.http_failure(&response, error.as_ref().ok())
12776 {
12777 sleep(d).await;
12778 continue;
12779 }
12780
12781 dlg.finished(false);
12782
12783 return Err(match error {
12784 Ok(value) => common::Error::BadRequest(value),
12785 _ => common::Error::Failure(response),
12786 });
12787 }
12788 let response = {
12789 let bytes = common::to_bytes(body).await.unwrap_or_default();
12790 let encoded = common::to_string(&bytes);
12791 match serde_json::from_str(&encoded) {
12792 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12793 Err(error) => {
12794 dlg.response_json_decode_error(&encoded, &error);
12795 return Err(common::Error::JsonDecodeError(
12796 encoded.to_string(),
12797 error,
12798 ));
12799 }
12800 }
12801 };
12802
12803 dlg.finished(true);
12804 return Ok(response);
12805 }
12806 }
12807 }
12808 }
12809
12810 ///
12811 /// Sets the *request* property to the given value.
12812 ///
12813 /// Even though the property as already been set when instantiating this call,
12814 /// we provide this method for API completeness.
12815 pub fn request(
12816 mut self,
12817 new_value: TestIamPermissionsRequest,
12818 ) -> ProjectLocationConnectionTestIamPermissionCall<'a, C> {
12819 self._request = new_value;
12820 self
12821 }
12822 /// 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.
12823 ///
12824 /// Sets the *resource* path property to the given value.
12825 ///
12826 /// Even though the property as already been set when instantiating this call,
12827 /// we provide this method for API completeness.
12828 pub fn resource(
12829 mut self,
12830 new_value: &str,
12831 ) -> ProjectLocationConnectionTestIamPermissionCall<'a, C> {
12832 self._resource = new_value.to_string();
12833 self
12834 }
12835 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12836 /// while executing the actual API request.
12837 ///
12838 /// ````text
12839 /// It should be used to handle progress information, and to implement a certain level of resilience.
12840 /// ````
12841 ///
12842 /// Sets the *delegate* property to the given value.
12843 pub fn delegate(
12844 mut self,
12845 new_value: &'a mut dyn common::Delegate,
12846 ) -> ProjectLocationConnectionTestIamPermissionCall<'a, C> {
12847 self._delegate = Some(new_value);
12848 self
12849 }
12850
12851 /// Set any additional parameter of the query string used in the request.
12852 /// It should be used to set parameters which are not yet available through their own
12853 /// setters.
12854 ///
12855 /// Please note that this method must not be used to set any of the known parameters
12856 /// which have their own setter method. If done anyway, the request will fail.
12857 ///
12858 /// # Additional Parameters
12859 ///
12860 /// * *$.xgafv* (query-string) - V1 error format.
12861 /// * *access_token* (query-string) - OAuth access token.
12862 /// * *alt* (query-string) - Data format for response.
12863 /// * *callback* (query-string) - JSONP
12864 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12865 /// * *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.
12866 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12867 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12868 /// * *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.
12869 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12870 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12871 pub fn param<T>(
12872 mut self,
12873 name: T,
12874 value: T,
12875 ) -> ProjectLocationConnectionTestIamPermissionCall<'a, C>
12876 where
12877 T: AsRef<str>,
12878 {
12879 self._additional_params
12880 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12881 self
12882 }
12883
12884 /// Identifies the authorization scope for the method you are building.
12885 ///
12886 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12887 /// [`Scope::CloudPlatform`].
12888 ///
12889 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12890 /// tokens for more than one scope.
12891 ///
12892 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12893 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12894 /// sufficient, a read-write scope will do as well.
12895 pub fn add_scope<St>(
12896 mut self,
12897 scope: St,
12898 ) -> ProjectLocationConnectionTestIamPermissionCall<'a, C>
12899 where
12900 St: AsRef<str>,
12901 {
12902 self._scopes.insert(String::from(scope.as_ref()));
12903 self
12904 }
12905 /// Identifies the authorization scope(s) for the method you are building.
12906 ///
12907 /// See [`Self::add_scope()`] for details.
12908 pub fn add_scopes<I, St>(
12909 mut self,
12910 scopes: I,
12911 ) -> ProjectLocationConnectionTestIamPermissionCall<'a, C>
12912 where
12913 I: IntoIterator<Item = St>,
12914 St: AsRef<str>,
12915 {
12916 self._scopes
12917 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12918 self
12919 }
12920
12921 /// Removes all scopes, and no default scope will be used either.
12922 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12923 /// for details).
12924 pub fn clear_scopes(mut self) -> ProjectLocationConnectionTestIamPermissionCall<'a, C> {
12925 self._scopes.clear();
12926 self
12927 }
12928}
12929
12930/// Deletes a single CustomConnectorVersion.
12931///
12932/// A builder for the *locations.customConnectors.customConnectorVersions.delete* method supported by a *project* resource.
12933/// It is not used directly, but through a [`ProjectMethods`] instance.
12934///
12935/// # Example
12936///
12937/// Instantiate a resource method builder
12938///
12939/// ```test_harness,no_run
12940/// # extern crate hyper;
12941/// # extern crate hyper_rustls;
12942/// # extern crate google_connectors1 as connectors1;
12943/// # async fn dox() {
12944/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12945///
12946/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12947/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12948/// # secret,
12949/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12950/// # ).build().await.unwrap();
12951///
12952/// # let client = hyper_util::client::legacy::Client::builder(
12953/// # hyper_util::rt::TokioExecutor::new()
12954/// # )
12955/// # .build(
12956/// # hyper_rustls::HttpsConnectorBuilder::new()
12957/// # .with_native_roots()
12958/// # .unwrap()
12959/// # .https_or_http()
12960/// # .enable_http1()
12961/// # .build()
12962/// # );
12963/// # let mut hub = Connectors::new(client, auth);
12964/// // You can configure optional parameters by calling the respective setters at will, and
12965/// // execute the final call using `doit()`.
12966/// // Values shown here are possibly random and not representative !
12967/// let result = hub.projects().locations_custom_connectors_custom_connector_versions_delete("name")
12968/// .doit().await;
12969/// # }
12970/// ```
12971pub struct ProjectLocationCustomConnectorCustomConnectorVersionDeleteCall<'a, C>
12972where
12973 C: 'a,
12974{
12975 hub: &'a Connectors<C>,
12976 _name: String,
12977 _delegate: Option<&'a mut dyn common::Delegate>,
12978 _additional_params: HashMap<String, String>,
12979 _scopes: BTreeSet<String>,
12980}
12981
12982impl<'a, C> common::CallBuilder
12983 for ProjectLocationCustomConnectorCustomConnectorVersionDeleteCall<'a, C>
12984{
12985}
12986
12987impl<'a, C> ProjectLocationCustomConnectorCustomConnectorVersionDeleteCall<'a, C>
12988where
12989 C: common::Connector,
12990{
12991 /// Perform the operation you have build so far.
12992 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
12993 use std::borrow::Cow;
12994 use std::io::{Read, Seek};
12995
12996 use common::{url::Params, ToParts};
12997 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12998
12999 let mut dd = common::DefaultDelegate;
13000 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13001 dlg.begin(common::MethodInfo {
13002 id: "connectors.projects.locations.customConnectors.customConnectorVersions.delete",
13003 http_method: hyper::Method::DELETE,
13004 });
13005
13006 for &field in ["alt", "name"].iter() {
13007 if self._additional_params.contains_key(field) {
13008 dlg.finished(false);
13009 return Err(common::Error::FieldClash(field));
13010 }
13011 }
13012
13013 let mut params = Params::with_capacity(3 + self._additional_params.len());
13014 params.push("name", self._name);
13015
13016 params.extend(self._additional_params.iter());
13017
13018 params.push("alt", "json");
13019 let mut url = self.hub._base_url.clone() + "v1/{+name}";
13020 if self._scopes.is_empty() {
13021 self._scopes
13022 .insert(Scope::CloudPlatform.as_ref().to_string());
13023 }
13024
13025 #[allow(clippy::single_element_loop)]
13026 for &(find_this, param_name) in [("{+name}", "name")].iter() {
13027 url = params.uri_replacement(url, param_name, find_this, true);
13028 }
13029 {
13030 let to_remove = ["name"];
13031 params.remove_params(&to_remove);
13032 }
13033
13034 let url = params.parse_with_url(&url);
13035
13036 loop {
13037 let token = match self
13038 .hub
13039 .auth
13040 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13041 .await
13042 {
13043 Ok(token) => token,
13044 Err(e) => match dlg.token(e) {
13045 Ok(token) => token,
13046 Err(e) => {
13047 dlg.finished(false);
13048 return Err(common::Error::MissingToken(e));
13049 }
13050 },
13051 };
13052 let mut req_result = {
13053 let client = &self.hub.client;
13054 dlg.pre_request();
13055 let mut req_builder = hyper::Request::builder()
13056 .method(hyper::Method::DELETE)
13057 .uri(url.as_str())
13058 .header(USER_AGENT, self.hub._user_agent.clone());
13059
13060 if let Some(token) = token.as_ref() {
13061 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13062 }
13063
13064 let request = req_builder
13065 .header(CONTENT_LENGTH, 0_u64)
13066 .body(common::to_body::<String>(None));
13067
13068 client.request(request.unwrap()).await
13069 };
13070
13071 match req_result {
13072 Err(err) => {
13073 if let common::Retry::After(d) = dlg.http_error(&err) {
13074 sleep(d).await;
13075 continue;
13076 }
13077 dlg.finished(false);
13078 return Err(common::Error::HttpError(err));
13079 }
13080 Ok(res) => {
13081 let (mut parts, body) = res.into_parts();
13082 let mut body = common::Body::new(body);
13083 if !parts.status.is_success() {
13084 let bytes = common::to_bytes(body).await.unwrap_or_default();
13085 let error = serde_json::from_str(&common::to_string(&bytes));
13086 let response = common::to_response(parts, bytes.into());
13087
13088 if let common::Retry::After(d) =
13089 dlg.http_failure(&response, error.as_ref().ok())
13090 {
13091 sleep(d).await;
13092 continue;
13093 }
13094
13095 dlg.finished(false);
13096
13097 return Err(match error {
13098 Ok(value) => common::Error::BadRequest(value),
13099 _ => common::Error::Failure(response),
13100 });
13101 }
13102 let response = {
13103 let bytes = common::to_bytes(body).await.unwrap_or_default();
13104 let encoded = common::to_string(&bytes);
13105 match serde_json::from_str(&encoded) {
13106 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13107 Err(error) => {
13108 dlg.response_json_decode_error(&encoded, &error);
13109 return Err(common::Error::JsonDecodeError(
13110 encoded.to_string(),
13111 error,
13112 ));
13113 }
13114 }
13115 };
13116
13117 dlg.finished(true);
13118 return Ok(response);
13119 }
13120 }
13121 }
13122 }
13123
13124 /// Required. Resource name of the form: `projects/{project}/locations/{location}/customConnectors/{custom_connector}/customConnectorVersions/{custom_connector_version}`
13125 ///
13126 /// Sets the *name* path property to the given value.
13127 ///
13128 /// Even though the property as already been set when instantiating this call,
13129 /// we provide this method for API completeness.
13130 pub fn name(
13131 mut self,
13132 new_value: &str,
13133 ) -> ProjectLocationCustomConnectorCustomConnectorVersionDeleteCall<'a, C> {
13134 self._name = new_value.to_string();
13135 self
13136 }
13137 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13138 /// while executing the actual API request.
13139 ///
13140 /// ````text
13141 /// It should be used to handle progress information, and to implement a certain level of resilience.
13142 /// ````
13143 ///
13144 /// Sets the *delegate* property to the given value.
13145 pub fn delegate(
13146 mut self,
13147 new_value: &'a mut dyn common::Delegate,
13148 ) -> ProjectLocationCustomConnectorCustomConnectorVersionDeleteCall<'a, C> {
13149 self._delegate = Some(new_value);
13150 self
13151 }
13152
13153 /// Set any additional parameter of the query string used in the request.
13154 /// It should be used to set parameters which are not yet available through their own
13155 /// setters.
13156 ///
13157 /// Please note that this method must not be used to set any of the known parameters
13158 /// which have their own setter method. If done anyway, the request will fail.
13159 ///
13160 /// # Additional Parameters
13161 ///
13162 /// * *$.xgafv* (query-string) - V1 error format.
13163 /// * *access_token* (query-string) - OAuth access token.
13164 /// * *alt* (query-string) - Data format for response.
13165 /// * *callback* (query-string) - JSONP
13166 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13167 /// * *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.
13168 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13169 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13170 /// * *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.
13171 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13172 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13173 pub fn param<T>(
13174 mut self,
13175 name: T,
13176 value: T,
13177 ) -> ProjectLocationCustomConnectorCustomConnectorVersionDeleteCall<'a, C>
13178 where
13179 T: AsRef<str>,
13180 {
13181 self._additional_params
13182 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13183 self
13184 }
13185
13186 /// Identifies the authorization scope for the method you are building.
13187 ///
13188 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13189 /// [`Scope::CloudPlatform`].
13190 ///
13191 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13192 /// tokens for more than one scope.
13193 ///
13194 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13195 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13196 /// sufficient, a read-write scope will do as well.
13197 pub fn add_scope<St>(
13198 mut self,
13199 scope: St,
13200 ) -> ProjectLocationCustomConnectorCustomConnectorVersionDeleteCall<'a, C>
13201 where
13202 St: AsRef<str>,
13203 {
13204 self._scopes.insert(String::from(scope.as_ref()));
13205 self
13206 }
13207 /// Identifies the authorization scope(s) for the method you are building.
13208 ///
13209 /// See [`Self::add_scope()`] for details.
13210 pub fn add_scopes<I, St>(
13211 mut self,
13212 scopes: I,
13213 ) -> ProjectLocationCustomConnectorCustomConnectorVersionDeleteCall<'a, C>
13214 where
13215 I: IntoIterator<Item = St>,
13216 St: AsRef<str>,
13217 {
13218 self._scopes
13219 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13220 self
13221 }
13222
13223 /// Removes all scopes, and no default scope will be used either.
13224 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13225 /// for details).
13226 pub fn clear_scopes(
13227 mut self,
13228 ) -> ProjectLocationCustomConnectorCustomConnectorVersionDeleteCall<'a, C> {
13229 self._scopes.clear();
13230 self
13231 }
13232}
13233
13234/// Deprecates a single CustomConnectorVersion.
13235///
13236/// A builder for the *locations.customConnectors.customConnectorVersions.deprecate* method supported by a *project* resource.
13237/// It is not used directly, but through a [`ProjectMethods`] instance.
13238///
13239/// # Example
13240///
13241/// Instantiate a resource method builder
13242///
13243/// ```test_harness,no_run
13244/// # extern crate hyper;
13245/// # extern crate hyper_rustls;
13246/// # extern crate google_connectors1 as connectors1;
13247/// use connectors1::api::DeprecateCustomConnectorVersionRequest;
13248/// # async fn dox() {
13249/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13250///
13251/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13252/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13253/// # secret,
13254/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13255/// # ).build().await.unwrap();
13256///
13257/// # let client = hyper_util::client::legacy::Client::builder(
13258/// # hyper_util::rt::TokioExecutor::new()
13259/// # )
13260/// # .build(
13261/// # hyper_rustls::HttpsConnectorBuilder::new()
13262/// # .with_native_roots()
13263/// # .unwrap()
13264/// # .https_or_http()
13265/// # .enable_http1()
13266/// # .build()
13267/// # );
13268/// # let mut hub = Connectors::new(client, auth);
13269/// // As the method needs a request, you would usually fill it with the desired information
13270/// // into the respective structure. Some of the parts shown here might not be applicable !
13271/// // Values shown here are possibly random and not representative !
13272/// let mut req = DeprecateCustomConnectorVersionRequest::default();
13273///
13274/// // You can configure optional parameters by calling the respective setters at will, and
13275/// // execute the final call using `doit()`.
13276/// // Values shown here are possibly random and not representative !
13277/// let result = hub.projects().locations_custom_connectors_custom_connector_versions_deprecate(req, "name")
13278/// .doit().await;
13279/// # }
13280/// ```
13281pub struct ProjectLocationCustomConnectorCustomConnectorVersionDeprecateCall<'a, C>
13282where
13283 C: 'a,
13284{
13285 hub: &'a Connectors<C>,
13286 _request: DeprecateCustomConnectorVersionRequest,
13287 _name: String,
13288 _delegate: Option<&'a mut dyn common::Delegate>,
13289 _additional_params: HashMap<String, String>,
13290 _scopes: BTreeSet<String>,
13291}
13292
13293impl<'a, C> common::CallBuilder
13294 for ProjectLocationCustomConnectorCustomConnectorVersionDeprecateCall<'a, C>
13295{
13296}
13297
13298impl<'a, C> ProjectLocationCustomConnectorCustomConnectorVersionDeprecateCall<'a, C>
13299where
13300 C: common::Connector,
13301{
13302 /// Perform the operation you have build so far.
13303 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
13304 use std::borrow::Cow;
13305 use std::io::{Read, Seek};
13306
13307 use common::{url::Params, ToParts};
13308 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13309
13310 let mut dd = common::DefaultDelegate;
13311 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13312 dlg.begin(common::MethodInfo {
13313 id: "connectors.projects.locations.customConnectors.customConnectorVersions.deprecate",
13314 http_method: hyper::Method::POST,
13315 });
13316
13317 for &field in ["alt", "name"].iter() {
13318 if self._additional_params.contains_key(field) {
13319 dlg.finished(false);
13320 return Err(common::Error::FieldClash(field));
13321 }
13322 }
13323
13324 let mut params = Params::with_capacity(4 + self._additional_params.len());
13325 params.push("name", self._name);
13326
13327 params.extend(self._additional_params.iter());
13328
13329 params.push("alt", "json");
13330 let mut url = self.hub._base_url.clone() + "v1/{+name}:deprecate";
13331 if self._scopes.is_empty() {
13332 self._scopes
13333 .insert(Scope::CloudPlatform.as_ref().to_string());
13334 }
13335
13336 #[allow(clippy::single_element_loop)]
13337 for &(find_this, param_name) in [("{+name}", "name")].iter() {
13338 url = params.uri_replacement(url, param_name, find_this, true);
13339 }
13340 {
13341 let to_remove = ["name"];
13342 params.remove_params(&to_remove);
13343 }
13344
13345 let url = params.parse_with_url(&url);
13346
13347 let mut json_mime_type = mime::APPLICATION_JSON;
13348 let mut request_value_reader = {
13349 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13350 common::remove_json_null_values(&mut value);
13351 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13352 serde_json::to_writer(&mut dst, &value).unwrap();
13353 dst
13354 };
13355 let request_size = request_value_reader
13356 .seek(std::io::SeekFrom::End(0))
13357 .unwrap();
13358 request_value_reader
13359 .seek(std::io::SeekFrom::Start(0))
13360 .unwrap();
13361
13362 loop {
13363 let token = match self
13364 .hub
13365 .auth
13366 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13367 .await
13368 {
13369 Ok(token) => token,
13370 Err(e) => match dlg.token(e) {
13371 Ok(token) => token,
13372 Err(e) => {
13373 dlg.finished(false);
13374 return Err(common::Error::MissingToken(e));
13375 }
13376 },
13377 };
13378 request_value_reader
13379 .seek(std::io::SeekFrom::Start(0))
13380 .unwrap();
13381 let mut req_result = {
13382 let client = &self.hub.client;
13383 dlg.pre_request();
13384 let mut req_builder = hyper::Request::builder()
13385 .method(hyper::Method::POST)
13386 .uri(url.as_str())
13387 .header(USER_AGENT, self.hub._user_agent.clone());
13388
13389 if let Some(token) = token.as_ref() {
13390 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13391 }
13392
13393 let request = req_builder
13394 .header(CONTENT_TYPE, json_mime_type.to_string())
13395 .header(CONTENT_LENGTH, request_size as u64)
13396 .body(common::to_body(
13397 request_value_reader.get_ref().clone().into(),
13398 ));
13399
13400 client.request(request.unwrap()).await
13401 };
13402
13403 match req_result {
13404 Err(err) => {
13405 if let common::Retry::After(d) = dlg.http_error(&err) {
13406 sleep(d).await;
13407 continue;
13408 }
13409 dlg.finished(false);
13410 return Err(common::Error::HttpError(err));
13411 }
13412 Ok(res) => {
13413 let (mut parts, body) = res.into_parts();
13414 let mut body = common::Body::new(body);
13415 if !parts.status.is_success() {
13416 let bytes = common::to_bytes(body).await.unwrap_or_default();
13417 let error = serde_json::from_str(&common::to_string(&bytes));
13418 let response = common::to_response(parts, bytes.into());
13419
13420 if let common::Retry::After(d) =
13421 dlg.http_failure(&response, error.as_ref().ok())
13422 {
13423 sleep(d).await;
13424 continue;
13425 }
13426
13427 dlg.finished(false);
13428
13429 return Err(match error {
13430 Ok(value) => common::Error::BadRequest(value),
13431 _ => common::Error::Failure(response),
13432 });
13433 }
13434 let response = {
13435 let bytes = common::to_bytes(body).await.unwrap_or_default();
13436 let encoded = common::to_string(&bytes);
13437 match serde_json::from_str(&encoded) {
13438 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13439 Err(error) => {
13440 dlg.response_json_decode_error(&encoded, &error);
13441 return Err(common::Error::JsonDecodeError(
13442 encoded.to_string(),
13443 error,
13444 ));
13445 }
13446 }
13447 };
13448
13449 dlg.finished(true);
13450 return Ok(response);
13451 }
13452 }
13453 }
13454 }
13455
13456 ///
13457 /// Sets the *request* property to the given value.
13458 ///
13459 /// Even though the property as already been set when instantiating this call,
13460 /// we provide this method for API completeness.
13461 pub fn request(
13462 mut self,
13463 new_value: DeprecateCustomConnectorVersionRequest,
13464 ) -> ProjectLocationCustomConnectorCustomConnectorVersionDeprecateCall<'a, C> {
13465 self._request = new_value;
13466 self
13467 }
13468 /// Required. Resource name of the form: `projects/{project}/locations/{location}/customConnectors/{custom_connector}/customConnectorVersions/{custom_connector_version}`
13469 ///
13470 /// Sets the *name* path property to the given value.
13471 ///
13472 /// Even though the property as already been set when instantiating this call,
13473 /// we provide this method for API completeness.
13474 pub fn name(
13475 mut self,
13476 new_value: &str,
13477 ) -> ProjectLocationCustomConnectorCustomConnectorVersionDeprecateCall<'a, C> {
13478 self._name = new_value.to_string();
13479 self
13480 }
13481 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13482 /// while executing the actual API request.
13483 ///
13484 /// ````text
13485 /// It should be used to handle progress information, and to implement a certain level of resilience.
13486 /// ````
13487 ///
13488 /// Sets the *delegate* property to the given value.
13489 pub fn delegate(
13490 mut self,
13491 new_value: &'a mut dyn common::Delegate,
13492 ) -> ProjectLocationCustomConnectorCustomConnectorVersionDeprecateCall<'a, C> {
13493 self._delegate = Some(new_value);
13494 self
13495 }
13496
13497 /// Set any additional parameter of the query string used in the request.
13498 /// It should be used to set parameters which are not yet available through their own
13499 /// setters.
13500 ///
13501 /// Please note that this method must not be used to set any of the known parameters
13502 /// which have their own setter method. If done anyway, the request will fail.
13503 ///
13504 /// # Additional Parameters
13505 ///
13506 /// * *$.xgafv* (query-string) - V1 error format.
13507 /// * *access_token* (query-string) - OAuth access token.
13508 /// * *alt* (query-string) - Data format for response.
13509 /// * *callback* (query-string) - JSONP
13510 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13511 /// * *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.
13512 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13513 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13514 /// * *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.
13515 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13516 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13517 pub fn param<T>(
13518 mut self,
13519 name: T,
13520 value: T,
13521 ) -> ProjectLocationCustomConnectorCustomConnectorVersionDeprecateCall<'a, C>
13522 where
13523 T: AsRef<str>,
13524 {
13525 self._additional_params
13526 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13527 self
13528 }
13529
13530 /// Identifies the authorization scope for the method you are building.
13531 ///
13532 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13533 /// [`Scope::CloudPlatform`].
13534 ///
13535 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13536 /// tokens for more than one scope.
13537 ///
13538 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13539 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13540 /// sufficient, a read-write scope will do as well.
13541 pub fn add_scope<St>(
13542 mut self,
13543 scope: St,
13544 ) -> ProjectLocationCustomConnectorCustomConnectorVersionDeprecateCall<'a, C>
13545 where
13546 St: AsRef<str>,
13547 {
13548 self._scopes.insert(String::from(scope.as_ref()));
13549 self
13550 }
13551 /// Identifies the authorization scope(s) for the method you are building.
13552 ///
13553 /// See [`Self::add_scope()`] for details.
13554 pub fn add_scopes<I, St>(
13555 mut self,
13556 scopes: I,
13557 ) -> ProjectLocationCustomConnectorCustomConnectorVersionDeprecateCall<'a, C>
13558 where
13559 I: IntoIterator<Item = St>,
13560 St: AsRef<str>,
13561 {
13562 self._scopes
13563 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13564 self
13565 }
13566
13567 /// Removes all scopes, and no default scope will be used either.
13568 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13569 /// for details).
13570 pub fn clear_scopes(
13571 mut self,
13572 ) -> ProjectLocationCustomConnectorCustomConnectorVersionDeprecateCall<'a, C> {
13573 self._scopes.clear();
13574 self
13575 }
13576}
13577
13578/// Validates a Custom Connector Spec.
13579///
13580/// A builder for the *locations.customConnectors.validateCustomConnectorSpec* method supported by a *project* resource.
13581/// It is not used directly, but through a [`ProjectMethods`] instance.
13582///
13583/// # Example
13584///
13585/// Instantiate a resource method builder
13586///
13587/// ```test_harness,no_run
13588/// # extern crate hyper;
13589/// # extern crate hyper_rustls;
13590/// # extern crate google_connectors1 as connectors1;
13591/// use connectors1::api::ValidateCustomConnectorSpecRequest;
13592/// # async fn dox() {
13593/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13594///
13595/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13596/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13597/// # secret,
13598/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13599/// # ).build().await.unwrap();
13600///
13601/// # let client = hyper_util::client::legacy::Client::builder(
13602/// # hyper_util::rt::TokioExecutor::new()
13603/// # )
13604/// # .build(
13605/// # hyper_rustls::HttpsConnectorBuilder::new()
13606/// # .with_native_roots()
13607/// # .unwrap()
13608/// # .https_or_http()
13609/// # .enable_http1()
13610/// # .build()
13611/// # );
13612/// # let mut hub = Connectors::new(client, auth);
13613/// // As the method needs a request, you would usually fill it with the desired information
13614/// // into the respective structure. Some of the parts shown here might not be applicable !
13615/// // Values shown here are possibly random and not representative !
13616/// let mut req = ValidateCustomConnectorSpecRequest::default();
13617///
13618/// // You can configure optional parameters by calling the respective setters at will, and
13619/// // execute the final call using `doit()`.
13620/// // Values shown here are possibly random and not representative !
13621/// let result = hub.projects().locations_custom_connectors_validate_custom_connector_spec(req, "parent")
13622/// .doit().await;
13623/// # }
13624/// ```
13625pub struct ProjectLocationCustomConnectorValidateCustomConnectorSpecCall<'a, C>
13626where
13627 C: 'a,
13628{
13629 hub: &'a Connectors<C>,
13630 _request: ValidateCustomConnectorSpecRequest,
13631 _parent: String,
13632 _delegate: Option<&'a mut dyn common::Delegate>,
13633 _additional_params: HashMap<String, String>,
13634 _scopes: BTreeSet<String>,
13635}
13636
13637impl<'a, C> common::CallBuilder
13638 for ProjectLocationCustomConnectorValidateCustomConnectorSpecCall<'a, C>
13639{
13640}
13641
13642impl<'a, C> ProjectLocationCustomConnectorValidateCustomConnectorSpecCall<'a, C>
13643where
13644 C: common::Connector,
13645{
13646 /// Perform the operation you have build so far.
13647 pub async fn doit(
13648 mut self,
13649 ) -> common::Result<(common::Response, ValidateCustomConnectorSpecResponse)> {
13650 use std::borrow::Cow;
13651 use std::io::{Read, Seek};
13652
13653 use common::{url::Params, ToParts};
13654 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13655
13656 let mut dd = common::DefaultDelegate;
13657 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13658 dlg.begin(common::MethodInfo {
13659 id: "connectors.projects.locations.customConnectors.validateCustomConnectorSpec",
13660 http_method: hyper::Method::POST,
13661 });
13662
13663 for &field in ["alt", "parent"].iter() {
13664 if self._additional_params.contains_key(field) {
13665 dlg.finished(false);
13666 return Err(common::Error::FieldClash(field));
13667 }
13668 }
13669
13670 let mut params = Params::with_capacity(4 + self._additional_params.len());
13671 params.push("parent", self._parent);
13672
13673 params.extend(self._additional_params.iter());
13674
13675 params.push("alt", "json");
13676 let mut url = self.hub._base_url.clone()
13677 + "v1/{+parent}/customConnectors:validateCustomConnectorSpec";
13678 if self._scopes.is_empty() {
13679 self._scopes
13680 .insert(Scope::CloudPlatform.as_ref().to_string());
13681 }
13682
13683 #[allow(clippy::single_element_loop)]
13684 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
13685 url = params.uri_replacement(url, param_name, find_this, true);
13686 }
13687 {
13688 let to_remove = ["parent"];
13689 params.remove_params(&to_remove);
13690 }
13691
13692 let url = params.parse_with_url(&url);
13693
13694 let mut json_mime_type = mime::APPLICATION_JSON;
13695 let mut request_value_reader = {
13696 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13697 common::remove_json_null_values(&mut value);
13698 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13699 serde_json::to_writer(&mut dst, &value).unwrap();
13700 dst
13701 };
13702 let request_size = request_value_reader
13703 .seek(std::io::SeekFrom::End(0))
13704 .unwrap();
13705 request_value_reader
13706 .seek(std::io::SeekFrom::Start(0))
13707 .unwrap();
13708
13709 loop {
13710 let token = match self
13711 .hub
13712 .auth
13713 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13714 .await
13715 {
13716 Ok(token) => token,
13717 Err(e) => match dlg.token(e) {
13718 Ok(token) => token,
13719 Err(e) => {
13720 dlg.finished(false);
13721 return Err(common::Error::MissingToken(e));
13722 }
13723 },
13724 };
13725 request_value_reader
13726 .seek(std::io::SeekFrom::Start(0))
13727 .unwrap();
13728 let mut req_result = {
13729 let client = &self.hub.client;
13730 dlg.pre_request();
13731 let mut req_builder = hyper::Request::builder()
13732 .method(hyper::Method::POST)
13733 .uri(url.as_str())
13734 .header(USER_AGENT, self.hub._user_agent.clone());
13735
13736 if let Some(token) = token.as_ref() {
13737 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13738 }
13739
13740 let request = req_builder
13741 .header(CONTENT_TYPE, json_mime_type.to_string())
13742 .header(CONTENT_LENGTH, request_size as u64)
13743 .body(common::to_body(
13744 request_value_reader.get_ref().clone().into(),
13745 ));
13746
13747 client.request(request.unwrap()).await
13748 };
13749
13750 match req_result {
13751 Err(err) => {
13752 if let common::Retry::After(d) = dlg.http_error(&err) {
13753 sleep(d).await;
13754 continue;
13755 }
13756 dlg.finished(false);
13757 return Err(common::Error::HttpError(err));
13758 }
13759 Ok(res) => {
13760 let (mut parts, body) = res.into_parts();
13761 let mut body = common::Body::new(body);
13762 if !parts.status.is_success() {
13763 let bytes = common::to_bytes(body).await.unwrap_or_default();
13764 let error = serde_json::from_str(&common::to_string(&bytes));
13765 let response = common::to_response(parts, bytes.into());
13766
13767 if let common::Retry::After(d) =
13768 dlg.http_failure(&response, error.as_ref().ok())
13769 {
13770 sleep(d).await;
13771 continue;
13772 }
13773
13774 dlg.finished(false);
13775
13776 return Err(match error {
13777 Ok(value) => common::Error::BadRequest(value),
13778 _ => common::Error::Failure(response),
13779 });
13780 }
13781 let response = {
13782 let bytes = common::to_bytes(body).await.unwrap_or_default();
13783 let encoded = common::to_string(&bytes);
13784 match serde_json::from_str(&encoded) {
13785 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13786 Err(error) => {
13787 dlg.response_json_decode_error(&encoded, &error);
13788 return Err(common::Error::JsonDecodeError(
13789 encoded.to_string(),
13790 error,
13791 ));
13792 }
13793 }
13794 };
13795
13796 dlg.finished(true);
13797 return Ok(response);
13798 }
13799 }
13800 }
13801 }
13802
13803 ///
13804 /// Sets the *request* property to the given value.
13805 ///
13806 /// Even though the property as already been set when instantiating this call,
13807 /// we provide this method for API completeness.
13808 pub fn request(
13809 mut self,
13810 new_value: ValidateCustomConnectorSpecRequest,
13811 ) -> ProjectLocationCustomConnectorValidateCustomConnectorSpecCall<'a, C> {
13812 self._request = new_value;
13813 self
13814 }
13815 /// Required. Location at which the custom connector is being created.
13816 ///
13817 /// Sets the *parent* path property to the given value.
13818 ///
13819 /// Even though the property as already been set when instantiating this call,
13820 /// we provide this method for API completeness.
13821 pub fn parent(
13822 mut self,
13823 new_value: &str,
13824 ) -> ProjectLocationCustomConnectorValidateCustomConnectorSpecCall<'a, C> {
13825 self._parent = new_value.to_string();
13826 self
13827 }
13828 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13829 /// while executing the actual API request.
13830 ///
13831 /// ````text
13832 /// It should be used to handle progress information, and to implement a certain level of resilience.
13833 /// ````
13834 ///
13835 /// Sets the *delegate* property to the given value.
13836 pub fn delegate(
13837 mut self,
13838 new_value: &'a mut dyn common::Delegate,
13839 ) -> ProjectLocationCustomConnectorValidateCustomConnectorSpecCall<'a, C> {
13840 self._delegate = Some(new_value);
13841 self
13842 }
13843
13844 /// Set any additional parameter of the query string used in the request.
13845 /// It should be used to set parameters which are not yet available through their own
13846 /// setters.
13847 ///
13848 /// Please note that this method must not be used to set any of the known parameters
13849 /// which have their own setter method. If done anyway, the request will fail.
13850 ///
13851 /// # Additional Parameters
13852 ///
13853 /// * *$.xgafv* (query-string) - V1 error format.
13854 /// * *access_token* (query-string) - OAuth access token.
13855 /// * *alt* (query-string) - Data format for response.
13856 /// * *callback* (query-string) - JSONP
13857 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13858 /// * *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.
13859 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13860 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13861 /// * *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.
13862 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13863 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13864 pub fn param<T>(
13865 mut self,
13866 name: T,
13867 value: T,
13868 ) -> ProjectLocationCustomConnectorValidateCustomConnectorSpecCall<'a, C>
13869 where
13870 T: AsRef<str>,
13871 {
13872 self._additional_params
13873 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13874 self
13875 }
13876
13877 /// Identifies the authorization scope for the method you are building.
13878 ///
13879 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13880 /// [`Scope::CloudPlatform`].
13881 ///
13882 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13883 /// tokens for more than one scope.
13884 ///
13885 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13886 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13887 /// sufficient, a read-write scope will do as well.
13888 pub fn add_scope<St>(
13889 mut self,
13890 scope: St,
13891 ) -> ProjectLocationCustomConnectorValidateCustomConnectorSpecCall<'a, C>
13892 where
13893 St: AsRef<str>,
13894 {
13895 self._scopes.insert(String::from(scope.as_ref()));
13896 self
13897 }
13898 /// Identifies the authorization scope(s) for the method you are building.
13899 ///
13900 /// See [`Self::add_scope()`] for details.
13901 pub fn add_scopes<I, St>(
13902 mut self,
13903 scopes: I,
13904 ) -> ProjectLocationCustomConnectorValidateCustomConnectorSpecCall<'a, C>
13905 where
13906 I: IntoIterator<Item = St>,
13907 St: AsRef<str>,
13908 {
13909 self._scopes
13910 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13911 self
13912 }
13913
13914 /// Removes all scopes, and no default scope will be used either.
13915 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13916 /// for details).
13917 pub fn clear_scopes(
13918 mut self,
13919 ) -> ProjectLocationCustomConnectorValidateCustomConnectorSpecCall<'a, C> {
13920 self._scopes.clear();
13921 self
13922 }
13923}
13924
13925/// Creates a new EndpointAttachment in a given project and location.
13926///
13927/// A builder for the *locations.endpointAttachments.create* method supported by a *project* resource.
13928/// It is not used directly, but through a [`ProjectMethods`] instance.
13929///
13930/// # Example
13931///
13932/// Instantiate a resource method builder
13933///
13934/// ```test_harness,no_run
13935/// # extern crate hyper;
13936/// # extern crate hyper_rustls;
13937/// # extern crate google_connectors1 as connectors1;
13938/// use connectors1::api::EndpointAttachment;
13939/// # async fn dox() {
13940/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13941///
13942/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13943/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13944/// # secret,
13945/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13946/// # ).build().await.unwrap();
13947///
13948/// # let client = hyper_util::client::legacy::Client::builder(
13949/// # hyper_util::rt::TokioExecutor::new()
13950/// # )
13951/// # .build(
13952/// # hyper_rustls::HttpsConnectorBuilder::new()
13953/// # .with_native_roots()
13954/// # .unwrap()
13955/// # .https_or_http()
13956/// # .enable_http1()
13957/// # .build()
13958/// # );
13959/// # let mut hub = Connectors::new(client, auth);
13960/// // As the method needs a request, you would usually fill it with the desired information
13961/// // into the respective structure. Some of the parts shown here might not be applicable !
13962/// // Values shown here are possibly random and not representative !
13963/// let mut req = EndpointAttachment::default();
13964///
13965/// // You can configure optional parameters by calling the respective setters at will, and
13966/// // execute the final call using `doit()`.
13967/// // Values shown here are possibly random and not representative !
13968/// let result = hub.projects().locations_endpoint_attachments_create(req, "parent")
13969/// .endpoint_attachment_id("invidunt")
13970/// .doit().await;
13971/// # }
13972/// ```
13973pub struct ProjectLocationEndpointAttachmentCreateCall<'a, C>
13974where
13975 C: 'a,
13976{
13977 hub: &'a Connectors<C>,
13978 _request: EndpointAttachment,
13979 _parent: String,
13980 _endpoint_attachment_id: Option<String>,
13981 _delegate: Option<&'a mut dyn common::Delegate>,
13982 _additional_params: HashMap<String, String>,
13983 _scopes: BTreeSet<String>,
13984}
13985
13986impl<'a, C> common::CallBuilder for ProjectLocationEndpointAttachmentCreateCall<'a, C> {}
13987
13988impl<'a, C> ProjectLocationEndpointAttachmentCreateCall<'a, C>
13989where
13990 C: common::Connector,
13991{
13992 /// Perform the operation you have build so far.
13993 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
13994 use std::borrow::Cow;
13995 use std::io::{Read, Seek};
13996
13997 use common::{url::Params, ToParts};
13998 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13999
14000 let mut dd = common::DefaultDelegate;
14001 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14002 dlg.begin(common::MethodInfo {
14003 id: "connectors.projects.locations.endpointAttachments.create",
14004 http_method: hyper::Method::POST,
14005 });
14006
14007 for &field in ["alt", "parent", "endpointAttachmentId"].iter() {
14008 if self._additional_params.contains_key(field) {
14009 dlg.finished(false);
14010 return Err(common::Error::FieldClash(field));
14011 }
14012 }
14013
14014 let mut params = Params::with_capacity(5 + self._additional_params.len());
14015 params.push("parent", self._parent);
14016 if let Some(value) = self._endpoint_attachment_id.as_ref() {
14017 params.push("endpointAttachmentId", value);
14018 }
14019
14020 params.extend(self._additional_params.iter());
14021
14022 params.push("alt", "json");
14023 let mut url = self.hub._base_url.clone() + "v1/{+parent}/endpointAttachments";
14024 if self._scopes.is_empty() {
14025 self._scopes
14026 .insert(Scope::CloudPlatform.as_ref().to_string());
14027 }
14028
14029 #[allow(clippy::single_element_loop)]
14030 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
14031 url = params.uri_replacement(url, param_name, find_this, true);
14032 }
14033 {
14034 let to_remove = ["parent"];
14035 params.remove_params(&to_remove);
14036 }
14037
14038 let url = params.parse_with_url(&url);
14039
14040 let mut json_mime_type = mime::APPLICATION_JSON;
14041 let mut request_value_reader = {
14042 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14043 common::remove_json_null_values(&mut value);
14044 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14045 serde_json::to_writer(&mut dst, &value).unwrap();
14046 dst
14047 };
14048 let request_size = request_value_reader
14049 .seek(std::io::SeekFrom::End(0))
14050 .unwrap();
14051 request_value_reader
14052 .seek(std::io::SeekFrom::Start(0))
14053 .unwrap();
14054
14055 loop {
14056 let token = match self
14057 .hub
14058 .auth
14059 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14060 .await
14061 {
14062 Ok(token) => token,
14063 Err(e) => match dlg.token(e) {
14064 Ok(token) => token,
14065 Err(e) => {
14066 dlg.finished(false);
14067 return Err(common::Error::MissingToken(e));
14068 }
14069 },
14070 };
14071 request_value_reader
14072 .seek(std::io::SeekFrom::Start(0))
14073 .unwrap();
14074 let mut req_result = {
14075 let client = &self.hub.client;
14076 dlg.pre_request();
14077 let mut req_builder = hyper::Request::builder()
14078 .method(hyper::Method::POST)
14079 .uri(url.as_str())
14080 .header(USER_AGENT, self.hub._user_agent.clone());
14081
14082 if let Some(token) = token.as_ref() {
14083 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14084 }
14085
14086 let request = req_builder
14087 .header(CONTENT_TYPE, json_mime_type.to_string())
14088 .header(CONTENT_LENGTH, request_size as u64)
14089 .body(common::to_body(
14090 request_value_reader.get_ref().clone().into(),
14091 ));
14092
14093 client.request(request.unwrap()).await
14094 };
14095
14096 match req_result {
14097 Err(err) => {
14098 if let common::Retry::After(d) = dlg.http_error(&err) {
14099 sleep(d).await;
14100 continue;
14101 }
14102 dlg.finished(false);
14103 return Err(common::Error::HttpError(err));
14104 }
14105 Ok(res) => {
14106 let (mut parts, body) = res.into_parts();
14107 let mut body = common::Body::new(body);
14108 if !parts.status.is_success() {
14109 let bytes = common::to_bytes(body).await.unwrap_or_default();
14110 let error = serde_json::from_str(&common::to_string(&bytes));
14111 let response = common::to_response(parts, bytes.into());
14112
14113 if let common::Retry::After(d) =
14114 dlg.http_failure(&response, error.as_ref().ok())
14115 {
14116 sleep(d).await;
14117 continue;
14118 }
14119
14120 dlg.finished(false);
14121
14122 return Err(match error {
14123 Ok(value) => common::Error::BadRequest(value),
14124 _ => common::Error::Failure(response),
14125 });
14126 }
14127 let response = {
14128 let bytes = common::to_bytes(body).await.unwrap_or_default();
14129 let encoded = common::to_string(&bytes);
14130 match serde_json::from_str(&encoded) {
14131 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14132 Err(error) => {
14133 dlg.response_json_decode_error(&encoded, &error);
14134 return Err(common::Error::JsonDecodeError(
14135 encoded.to_string(),
14136 error,
14137 ));
14138 }
14139 }
14140 };
14141
14142 dlg.finished(true);
14143 return Ok(response);
14144 }
14145 }
14146 }
14147 }
14148
14149 ///
14150 /// Sets the *request* property to the given value.
14151 ///
14152 /// Even though the property as already been set when instantiating this call,
14153 /// we provide this method for API completeness.
14154 pub fn request(
14155 mut self,
14156 new_value: EndpointAttachment,
14157 ) -> ProjectLocationEndpointAttachmentCreateCall<'a, C> {
14158 self._request = new_value;
14159 self
14160 }
14161 /// Required. Parent resource of the EndpointAttachment, of the form: `projects/*/locations/*`
14162 ///
14163 /// Sets the *parent* path property to the given value.
14164 ///
14165 /// Even though the property as already been set when instantiating this call,
14166 /// we provide this method for API completeness.
14167 pub fn parent(mut self, new_value: &str) -> ProjectLocationEndpointAttachmentCreateCall<'a, C> {
14168 self._parent = new_value.to_string();
14169 self
14170 }
14171 /// Required. Identifier to assign to the EndpointAttachment. Must be unique within scope of the parent resource.
14172 ///
14173 /// Sets the *endpoint attachment id* query property to the given value.
14174 pub fn endpoint_attachment_id(
14175 mut self,
14176 new_value: &str,
14177 ) -> ProjectLocationEndpointAttachmentCreateCall<'a, C> {
14178 self._endpoint_attachment_id = Some(new_value.to_string());
14179 self
14180 }
14181 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14182 /// while executing the actual API request.
14183 ///
14184 /// ````text
14185 /// It should be used to handle progress information, and to implement a certain level of resilience.
14186 /// ````
14187 ///
14188 /// Sets the *delegate* property to the given value.
14189 pub fn delegate(
14190 mut self,
14191 new_value: &'a mut dyn common::Delegate,
14192 ) -> ProjectLocationEndpointAttachmentCreateCall<'a, C> {
14193 self._delegate = Some(new_value);
14194 self
14195 }
14196
14197 /// Set any additional parameter of the query string used in the request.
14198 /// It should be used to set parameters which are not yet available through their own
14199 /// setters.
14200 ///
14201 /// Please note that this method must not be used to set any of the known parameters
14202 /// which have their own setter method. If done anyway, the request will fail.
14203 ///
14204 /// # Additional Parameters
14205 ///
14206 /// * *$.xgafv* (query-string) - V1 error format.
14207 /// * *access_token* (query-string) - OAuth access token.
14208 /// * *alt* (query-string) - Data format for response.
14209 /// * *callback* (query-string) - JSONP
14210 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14211 /// * *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.
14212 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14213 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14214 /// * *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.
14215 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14216 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14217 pub fn param<T>(
14218 mut self,
14219 name: T,
14220 value: T,
14221 ) -> ProjectLocationEndpointAttachmentCreateCall<'a, C>
14222 where
14223 T: AsRef<str>,
14224 {
14225 self._additional_params
14226 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14227 self
14228 }
14229
14230 /// Identifies the authorization scope for the method you are building.
14231 ///
14232 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14233 /// [`Scope::CloudPlatform`].
14234 ///
14235 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14236 /// tokens for more than one scope.
14237 ///
14238 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14239 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14240 /// sufficient, a read-write scope will do as well.
14241 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEndpointAttachmentCreateCall<'a, C>
14242 where
14243 St: AsRef<str>,
14244 {
14245 self._scopes.insert(String::from(scope.as_ref()));
14246 self
14247 }
14248 /// Identifies the authorization scope(s) for the method you are building.
14249 ///
14250 /// See [`Self::add_scope()`] for details.
14251 pub fn add_scopes<I, St>(
14252 mut self,
14253 scopes: I,
14254 ) -> ProjectLocationEndpointAttachmentCreateCall<'a, C>
14255 where
14256 I: IntoIterator<Item = St>,
14257 St: AsRef<str>,
14258 {
14259 self._scopes
14260 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14261 self
14262 }
14263
14264 /// Removes all scopes, and no default scope will be used either.
14265 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14266 /// for details).
14267 pub fn clear_scopes(mut self) -> ProjectLocationEndpointAttachmentCreateCall<'a, C> {
14268 self._scopes.clear();
14269 self
14270 }
14271}
14272
14273/// Deletes a single EndpointAttachment.
14274///
14275/// A builder for the *locations.endpointAttachments.delete* method supported by a *project* resource.
14276/// It is not used directly, but through a [`ProjectMethods`] instance.
14277///
14278/// # Example
14279///
14280/// Instantiate a resource method builder
14281///
14282/// ```test_harness,no_run
14283/// # extern crate hyper;
14284/// # extern crate hyper_rustls;
14285/// # extern crate google_connectors1 as connectors1;
14286/// # async fn dox() {
14287/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14288///
14289/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14290/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14291/// # secret,
14292/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14293/// # ).build().await.unwrap();
14294///
14295/// # let client = hyper_util::client::legacy::Client::builder(
14296/// # hyper_util::rt::TokioExecutor::new()
14297/// # )
14298/// # .build(
14299/// # hyper_rustls::HttpsConnectorBuilder::new()
14300/// # .with_native_roots()
14301/// # .unwrap()
14302/// # .https_or_http()
14303/// # .enable_http1()
14304/// # .build()
14305/// # );
14306/// # let mut hub = Connectors::new(client, auth);
14307/// // You can configure optional parameters by calling the respective setters at will, and
14308/// // execute the final call using `doit()`.
14309/// // Values shown here are possibly random and not representative !
14310/// let result = hub.projects().locations_endpoint_attachments_delete("name")
14311/// .doit().await;
14312/// # }
14313/// ```
14314pub struct ProjectLocationEndpointAttachmentDeleteCall<'a, C>
14315where
14316 C: 'a,
14317{
14318 hub: &'a Connectors<C>,
14319 _name: String,
14320 _delegate: Option<&'a mut dyn common::Delegate>,
14321 _additional_params: HashMap<String, String>,
14322 _scopes: BTreeSet<String>,
14323}
14324
14325impl<'a, C> common::CallBuilder for ProjectLocationEndpointAttachmentDeleteCall<'a, C> {}
14326
14327impl<'a, C> ProjectLocationEndpointAttachmentDeleteCall<'a, C>
14328where
14329 C: common::Connector,
14330{
14331 /// Perform the operation you have build so far.
14332 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
14333 use std::borrow::Cow;
14334 use std::io::{Read, Seek};
14335
14336 use common::{url::Params, ToParts};
14337 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14338
14339 let mut dd = common::DefaultDelegate;
14340 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14341 dlg.begin(common::MethodInfo {
14342 id: "connectors.projects.locations.endpointAttachments.delete",
14343 http_method: hyper::Method::DELETE,
14344 });
14345
14346 for &field in ["alt", "name"].iter() {
14347 if self._additional_params.contains_key(field) {
14348 dlg.finished(false);
14349 return Err(common::Error::FieldClash(field));
14350 }
14351 }
14352
14353 let mut params = Params::with_capacity(3 + self._additional_params.len());
14354 params.push("name", self._name);
14355
14356 params.extend(self._additional_params.iter());
14357
14358 params.push("alt", "json");
14359 let mut url = self.hub._base_url.clone() + "v1/{+name}";
14360 if self._scopes.is_empty() {
14361 self._scopes
14362 .insert(Scope::CloudPlatform.as_ref().to_string());
14363 }
14364
14365 #[allow(clippy::single_element_loop)]
14366 for &(find_this, param_name) in [("{+name}", "name")].iter() {
14367 url = params.uri_replacement(url, param_name, find_this, true);
14368 }
14369 {
14370 let to_remove = ["name"];
14371 params.remove_params(&to_remove);
14372 }
14373
14374 let url = params.parse_with_url(&url);
14375
14376 loop {
14377 let token = match self
14378 .hub
14379 .auth
14380 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14381 .await
14382 {
14383 Ok(token) => token,
14384 Err(e) => match dlg.token(e) {
14385 Ok(token) => token,
14386 Err(e) => {
14387 dlg.finished(false);
14388 return Err(common::Error::MissingToken(e));
14389 }
14390 },
14391 };
14392 let mut req_result = {
14393 let client = &self.hub.client;
14394 dlg.pre_request();
14395 let mut req_builder = hyper::Request::builder()
14396 .method(hyper::Method::DELETE)
14397 .uri(url.as_str())
14398 .header(USER_AGENT, self.hub._user_agent.clone());
14399
14400 if let Some(token) = token.as_ref() {
14401 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14402 }
14403
14404 let request = req_builder
14405 .header(CONTENT_LENGTH, 0_u64)
14406 .body(common::to_body::<String>(None));
14407
14408 client.request(request.unwrap()).await
14409 };
14410
14411 match req_result {
14412 Err(err) => {
14413 if let common::Retry::After(d) = dlg.http_error(&err) {
14414 sleep(d).await;
14415 continue;
14416 }
14417 dlg.finished(false);
14418 return Err(common::Error::HttpError(err));
14419 }
14420 Ok(res) => {
14421 let (mut parts, body) = res.into_parts();
14422 let mut body = common::Body::new(body);
14423 if !parts.status.is_success() {
14424 let bytes = common::to_bytes(body).await.unwrap_or_default();
14425 let error = serde_json::from_str(&common::to_string(&bytes));
14426 let response = common::to_response(parts, bytes.into());
14427
14428 if let common::Retry::After(d) =
14429 dlg.http_failure(&response, error.as_ref().ok())
14430 {
14431 sleep(d).await;
14432 continue;
14433 }
14434
14435 dlg.finished(false);
14436
14437 return Err(match error {
14438 Ok(value) => common::Error::BadRequest(value),
14439 _ => common::Error::Failure(response),
14440 });
14441 }
14442 let response = {
14443 let bytes = common::to_bytes(body).await.unwrap_or_default();
14444 let encoded = common::to_string(&bytes);
14445 match serde_json::from_str(&encoded) {
14446 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14447 Err(error) => {
14448 dlg.response_json_decode_error(&encoded, &error);
14449 return Err(common::Error::JsonDecodeError(
14450 encoded.to_string(),
14451 error,
14452 ));
14453 }
14454 }
14455 };
14456
14457 dlg.finished(true);
14458 return Ok(response);
14459 }
14460 }
14461 }
14462 }
14463
14464 /// Required. Resource name of the form: `projects/*/locations/*/endpointAttachments/*`
14465 ///
14466 /// Sets the *name* path property to the given value.
14467 ///
14468 /// Even though the property as already been set when instantiating this call,
14469 /// we provide this method for API completeness.
14470 pub fn name(mut self, new_value: &str) -> ProjectLocationEndpointAttachmentDeleteCall<'a, C> {
14471 self._name = new_value.to_string();
14472 self
14473 }
14474 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14475 /// while executing the actual API request.
14476 ///
14477 /// ````text
14478 /// It should be used to handle progress information, and to implement a certain level of resilience.
14479 /// ````
14480 ///
14481 /// Sets the *delegate* property to the given value.
14482 pub fn delegate(
14483 mut self,
14484 new_value: &'a mut dyn common::Delegate,
14485 ) -> ProjectLocationEndpointAttachmentDeleteCall<'a, C> {
14486 self._delegate = Some(new_value);
14487 self
14488 }
14489
14490 /// Set any additional parameter of the query string used in the request.
14491 /// It should be used to set parameters which are not yet available through their own
14492 /// setters.
14493 ///
14494 /// Please note that this method must not be used to set any of the known parameters
14495 /// which have their own setter method. If done anyway, the request will fail.
14496 ///
14497 /// # Additional Parameters
14498 ///
14499 /// * *$.xgafv* (query-string) - V1 error format.
14500 /// * *access_token* (query-string) - OAuth access token.
14501 /// * *alt* (query-string) - Data format for response.
14502 /// * *callback* (query-string) - JSONP
14503 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14504 /// * *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.
14505 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14506 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14507 /// * *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.
14508 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14509 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14510 pub fn param<T>(
14511 mut self,
14512 name: T,
14513 value: T,
14514 ) -> ProjectLocationEndpointAttachmentDeleteCall<'a, C>
14515 where
14516 T: AsRef<str>,
14517 {
14518 self._additional_params
14519 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14520 self
14521 }
14522
14523 /// Identifies the authorization scope for the method you are building.
14524 ///
14525 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14526 /// [`Scope::CloudPlatform`].
14527 ///
14528 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14529 /// tokens for more than one scope.
14530 ///
14531 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14532 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14533 /// sufficient, a read-write scope will do as well.
14534 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEndpointAttachmentDeleteCall<'a, C>
14535 where
14536 St: AsRef<str>,
14537 {
14538 self._scopes.insert(String::from(scope.as_ref()));
14539 self
14540 }
14541 /// Identifies the authorization scope(s) for the method you are building.
14542 ///
14543 /// See [`Self::add_scope()`] for details.
14544 pub fn add_scopes<I, St>(
14545 mut self,
14546 scopes: I,
14547 ) -> ProjectLocationEndpointAttachmentDeleteCall<'a, C>
14548 where
14549 I: IntoIterator<Item = St>,
14550 St: AsRef<str>,
14551 {
14552 self._scopes
14553 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14554 self
14555 }
14556
14557 /// Removes all scopes, and no default scope will be used either.
14558 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14559 /// for details).
14560 pub fn clear_scopes(mut self) -> ProjectLocationEndpointAttachmentDeleteCall<'a, C> {
14561 self._scopes.clear();
14562 self
14563 }
14564}
14565
14566/// Gets details of a single EndpointAttachment.
14567///
14568/// A builder for the *locations.endpointAttachments.get* method supported by a *project* resource.
14569/// It is not used directly, but through a [`ProjectMethods`] instance.
14570///
14571/// # Example
14572///
14573/// Instantiate a resource method builder
14574///
14575/// ```test_harness,no_run
14576/// # extern crate hyper;
14577/// # extern crate hyper_rustls;
14578/// # extern crate google_connectors1 as connectors1;
14579/// # async fn dox() {
14580/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14581///
14582/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14583/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14584/// # secret,
14585/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14586/// # ).build().await.unwrap();
14587///
14588/// # let client = hyper_util::client::legacy::Client::builder(
14589/// # hyper_util::rt::TokioExecutor::new()
14590/// # )
14591/// # .build(
14592/// # hyper_rustls::HttpsConnectorBuilder::new()
14593/// # .with_native_roots()
14594/// # .unwrap()
14595/// # .https_or_http()
14596/// # .enable_http1()
14597/// # .build()
14598/// # );
14599/// # let mut hub = Connectors::new(client, auth);
14600/// // You can configure optional parameters by calling the respective setters at will, and
14601/// // execute the final call using `doit()`.
14602/// // Values shown here are possibly random and not representative !
14603/// let result = hub.projects().locations_endpoint_attachments_get("name")
14604/// .doit().await;
14605/// # }
14606/// ```
14607pub struct ProjectLocationEndpointAttachmentGetCall<'a, C>
14608where
14609 C: 'a,
14610{
14611 hub: &'a Connectors<C>,
14612 _name: String,
14613 _delegate: Option<&'a mut dyn common::Delegate>,
14614 _additional_params: HashMap<String, String>,
14615 _scopes: BTreeSet<String>,
14616}
14617
14618impl<'a, C> common::CallBuilder for ProjectLocationEndpointAttachmentGetCall<'a, C> {}
14619
14620impl<'a, C> ProjectLocationEndpointAttachmentGetCall<'a, C>
14621where
14622 C: common::Connector,
14623{
14624 /// Perform the operation you have build so far.
14625 pub async fn doit(mut self) -> common::Result<(common::Response, EndpointAttachment)> {
14626 use std::borrow::Cow;
14627 use std::io::{Read, Seek};
14628
14629 use common::{url::Params, ToParts};
14630 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14631
14632 let mut dd = common::DefaultDelegate;
14633 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14634 dlg.begin(common::MethodInfo {
14635 id: "connectors.projects.locations.endpointAttachments.get",
14636 http_method: hyper::Method::GET,
14637 });
14638
14639 for &field in ["alt", "name"].iter() {
14640 if self._additional_params.contains_key(field) {
14641 dlg.finished(false);
14642 return Err(common::Error::FieldClash(field));
14643 }
14644 }
14645
14646 let mut params = Params::with_capacity(3 + self._additional_params.len());
14647 params.push("name", self._name);
14648
14649 params.extend(self._additional_params.iter());
14650
14651 params.push("alt", "json");
14652 let mut url = self.hub._base_url.clone() + "v1/{+name}";
14653 if self._scopes.is_empty() {
14654 self._scopes
14655 .insert(Scope::CloudPlatform.as_ref().to_string());
14656 }
14657
14658 #[allow(clippy::single_element_loop)]
14659 for &(find_this, param_name) in [("{+name}", "name")].iter() {
14660 url = params.uri_replacement(url, param_name, find_this, true);
14661 }
14662 {
14663 let to_remove = ["name"];
14664 params.remove_params(&to_remove);
14665 }
14666
14667 let url = params.parse_with_url(&url);
14668
14669 loop {
14670 let token = match self
14671 .hub
14672 .auth
14673 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14674 .await
14675 {
14676 Ok(token) => token,
14677 Err(e) => match dlg.token(e) {
14678 Ok(token) => token,
14679 Err(e) => {
14680 dlg.finished(false);
14681 return Err(common::Error::MissingToken(e));
14682 }
14683 },
14684 };
14685 let mut req_result = {
14686 let client = &self.hub.client;
14687 dlg.pre_request();
14688 let mut req_builder = hyper::Request::builder()
14689 .method(hyper::Method::GET)
14690 .uri(url.as_str())
14691 .header(USER_AGENT, self.hub._user_agent.clone());
14692
14693 if let Some(token) = token.as_ref() {
14694 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14695 }
14696
14697 let request = req_builder
14698 .header(CONTENT_LENGTH, 0_u64)
14699 .body(common::to_body::<String>(None));
14700
14701 client.request(request.unwrap()).await
14702 };
14703
14704 match req_result {
14705 Err(err) => {
14706 if let common::Retry::After(d) = dlg.http_error(&err) {
14707 sleep(d).await;
14708 continue;
14709 }
14710 dlg.finished(false);
14711 return Err(common::Error::HttpError(err));
14712 }
14713 Ok(res) => {
14714 let (mut parts, body) = res.into_parts();
14715 let mut body = common::Body::new(body);
14716 if !parts.status.is_success() {
14717 let bytes = common::to_bytes(body).await.unwrap_or_default();
14718 let error = serde_json::from_str(&common::to_string(&bytes));
14719 let response = common::to_response(parts, bytes.into());
14720
14721 if let common::Retry::After(d) =
14722 dlg.http_failure(&response, error.as_ref().ok())
14723 {
14724 sleep(d).await;
14725 continue;
14726 }
14727
14728 dlg.finished(false);
14729
14730 return Err(match error {
14731 Ok(value) => common::Error::BadRequest(value),
14732 _ => common::Error::Failure(response),
14733 });
14734 }
14735 let response = {
14736 let bytes = common::to_bytes(body).await.unwrap_or_default();
14737 let encoded = common::to_string(&bytes);
14738 match serde_json::from_str(&encoded) {
14739 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14740 Err(error) => {
14741 dlg.response_json_decode_error(&encoded, &error);
14742 return Err(common::Error::JsonDecodeError(
14743 encoded.to_string(),
14744 error,
14745 ));
14746 }
14747 }
14748 };
14749
14750 dlg.finished(true);
14751 return Ok(response);
14752 }
14753 }
14754 }
14755 }
14756
14757 /// Required. Resource name of the form: `projects/*/locations/*/endpointAttachments/*`
14758 ///
14759 /// Sets the *name* path property to the given value.
14760 ///
14761 /// Even though the property as already been set when instantiating this call,
14762 /// we provide this method for API completeness.
14763 pub fn name(mut self, new_value: &str) -> ProjectLocationEndpointAttachmentGetCall<'a, C> {
14764 self._name = new_value.to_string();
14765 self
14766 }
14767 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14768 /// while executing the actual API request.
14769 ///
14770 /// ````text
14771 /// It should be used to handle progress information, and to implement a certain level of resilience.
14772 /// ````
14773 ///
14774 /// Sets the *delegate* property to the given value.
14775 pub fn delegate(
14776 mut self,
14777 new_value: &'a mut dyn common::Delegate,
14778 ) -> ProjectLocationEndpointAttachmentGetCall<'a, C> {
14779 self._delegate = Some(new_value);
14780 self
14781 }
14782
14783 /// Set any additional parameter of the query string used in the request.
14784 /// It should be used to set parameters which are not yet available through their own
14785 /// setters.
14786 ///
14787 /// Please note that this method must not be used to set any of the known parameters
14788 /// which have their own setter method. If done anyway, the request will fail.
14789 ///
14790 /// # Additional Parameters
14791 ///
14792 /// * *$.xgafv* (query-string) - V1 error format.
14793 /// * *access_token* (query-string) - OAuth access token.
14794 /// * *alt* (query-string) - Data format for response.
14795 /// * *callback* (query-string) - JSONP
14796 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14797 /// * *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.
14798 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14799 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14800 /// * *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.
14801 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14802 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14803 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEndpointAttachmentGetCall<'a, C>
14804 where
14805 T: AsRef<str>,
14806 {
14807 self._additional_params
14808 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14809 self
14810 }
14811
14812 /// Identifies the authorization scope for the method you are building.
14813 ///
14814 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14815 /// [`Scope::CloudPlatform`].
14816 ///
14817 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14818 /// tokens for more than one scope.
14819 ///
14820 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14821 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14822 /// sufficient, a read-write scope will do as well.
14823 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEndpointAttachmentGetCall<'a, C>
14824 where
14825 St: AsRef<str>,
14826 {
14827 self._scopes.insert(String::from(scope.as_ref()));
14828 self
14829 }
14830 /// Identifies the authorization scope(s) for the method you are building.
14831 ///
14832 /// See [`Self::add_scope()`] for details.
14833 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEndpointAttachmentGetCall<'a, C>
14834 where
14835 I: IntoIterator<Item = St>,
14836 St: AsRef<str>,
14837 {
14838 self._scopes
14839 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14840 self
14841 }
14842
14843 /// Removes all scopes, and no default scope will be used either.
14844 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14845 /// for details).
14846 pub fn clear_scopes(mut self) -> ProjectLocationEndpointAttachmentGetCall<'a, C> {
14847 self._scopes.clear();
14848 self
14849 }
14850}
14851
14852/// List EndpointAttachments in a given project
14853///
14854/// A builder for the *locations.endpointAttachments.list* method supported by a *project* resource.
14855/// It is not used directly, but through a [`ProjectMethods`] instance.
14856///
14857/// # Example
14858///
14859/// Instantiate a resource method builder
14860///
14861/// ```test_harness,no_run
14862/// # extern crate hyper;
14863/// # extern crate hyper_rustls;
14864/// # extern crate google_connectors1 as connectors1;
14865/// # async fn dox() {
14866/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14867///
14868/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14869/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14870/// # secret,
14871/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14872/// # ).build().await.unwrap();
14873///
14874/// # let client = hyper_util::client::legacy::Client::builder(
14875/// # hyper_util::rt::TokioExecutor::new()
14876/// # )
14877/// # .build(
14878/// # hyper_rustls::HttpsConnectorBuilder::new()
14879/// # .with_native_roots()
14880/// # .unwrap()
14881/// # .https_or_http()
14882/// # .enable_http1()
14883/// # .build()
14884/// # );
14885/// # let mut hub = Connectors::new(client, auth);
14886/// // You can configure optional parameters by calling the respective setters at will, and
14887/// // execute the final call using `doit()`.
14888/// // Values shown here are possibly random and not representative !
14889/// let result = hub.projects().locations_endpoint_attachments_list("parent")
14890/// .page_token("Lorem")
14891/// .page_size(-29)
14892/// .order_by("no")
14893/// .filter("ipsum")
14894/// .doit().await;
14895/// # }
14896/// ```
14897pub struct ProjectLocationEndpointAttachmentListCall<'a, C>
14898where
14899 C: 'a,
14900{
14901 hub: &'a Connectors<C>,
14902 _parent: String,
14903 _page_token: Option<String>,
14904 _page_size: Option<i32>,
14905 _order_by: Option<String>,
14906 _filter: Option<String>,
14907 _delegate: Option<&'a mut dyn common::Delegate>,
14908 _additional_params: HashMap<String, String>,
14909 _scopes: BTreeSet<String>,
14910}
14911
14912impl<'a, C> common::CallBuilder for ProjectLocationEndpointAttachmentListCall<'a, C> {}
14913
14914impl<'a, C> ProjectLocationEndpointAttachmentListCall<'a, C>
14915where
14916 C: common::Connector,
14917{
14918 /// Perform the operation you have build so far.
14919 pub async fn doit(
14920 mut self,
14921 ) -> common::Result<(common::Response, ListEndpointAttachmentsResponse)> {
14922 use std::borrow::Cow;
14923 use std::io::{Read, Seek};
14924
14925 use common::{url::Params, ToParts};
14926 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14927
14928 let mut dd = common::DefaultDelegate;
14929 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14930 dlg.begin(common::MethodInfo {
14931 id: "connectors.projects.locations.endpointAttachments.list",
14932 http_method: hyper::Method::GET,
14933 });
14934
14935 for &field in [
14936 "alt",
14937 "parent",
14938 "pageToken",
14939 "pageSize",
14940 "orderBy",
14941 "filter",
14942 ]
14943 .iter()
14944 {
14945 if self._additional_params.contains_key(field) {
14946 dlg.finished(false);
14947 return Err(common::Error::FieldClash(field));
14948 }
14949 }
14950
14951 let mut params = Params::with_capacity(7 + self._additional_params.len());
14952 params.push("parent", self._parent);
14953 if let Some(value) = self._page_token.as_ref() {
14954 params.push("pageToken", value);
14955 }
14956 if let Some(value) = self._page_size.as_ref() {
14957 params.push("pageSize", value.to_string());
14958 }
14959 if let Some(value) = self._order_by.as_ref() {
14960 params.push("orderBy", value);
14961 }
14962 if let Some(value) = self._filter.as_ref() {
14963 params.push("filter", value);
14964 }
14965
14966 params.extend(self._additional_params.iter());
14967
14968 params.push("alt", "json");
14969 let mut url = self.hub._base_url.clone() + "v1/{+parent}/endpointAttachments";
14970 if self._scopes.is_empty() {
14971 self._scopes
14972 .insert(Scope::CloudPlatform.as_ref().to_string());
14973 }
14974
14975 #[allow(clippy::single_element_loop)]
14976 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
14977 url = params.uri_replacement(url, param_name, find_this, true);
14978 }
14979 {
14980 let to_remove = ["parent"];
14981 params.remove_params(&to_remove);
14982 }
14983
14984 let url = params.parse_with_url(&url);
14985
14986 loop {
14987 let token = match self
14988 .hub
14989 .auth
14990 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14991 .await
14992 {
14993 Ok(token) => token,
14994 Err(e) => match dlg.token(e) {
14995 Ok(token) => token,
14996 Err(e) => {
14997 dlg.finished(false);
14998 return Err(common::Error::MissingToken(e));
14999 }
15000 },
15001 };
15002 let mut req_result = {
15003 let client = &self.hub.client;
15004 dlg.pre_request();
15005 let mut req_builder = hyper::Request::builder()
15006 .method(hyper::Method::GET)
15007 .uri(url.as_str())
15008 .header(USER_AGENT, self.hub._user_agent.clone());
15009
15010 if let Some(token) = token.as_ref() {
15011 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15012 }
15013
15014 let request = req_builder
15015 .header(CONTENT_LENGTH, 0_u64)
15016 .body(common::to_body::<String>(None));
15017
15018 client.request(request.unwrap()).await
15019 };
15020
15021 match req_result {
15022 Err(err) => {
15023 if let common::Retry::After(d) = dlg.http_error(&err) {
15024 sleep(d).await;
15025 continue;
15026 }
15027 dlg.finished(false);
15028 return Err(common::Error::HttpError(err));
15029 }
15030 Ok(res) => {
15031 let (mut parts, body) = res.into_parts();
15032 let mut body = common::Body::new(body);
15033 if !parts.status.is_success() {
15034 let bytes = common::to_bytes(body).await.unwrap_or_default();
15035 let error = serde_json::from_str(&common::to_string(&bytes));
15036 let response = common::to_response(parts, bytes.into());
15037
15038 if let common::Retry::After(d) =
15039 dlg.http_failure(&response, error.as_ref().ok())
15040 {
15041 sleep(d).await;
15042 continue;
15043 }
15044
15045 dlg.finished(false);
15046
15047 return Err(match error {
15048 Ok(value) => common::Error::BadRequest(value),
15049 _ => common::Error::Failure(response),
15050 });
15051 }
15052 let response = {
15053 let bytes = common::to_bytes(body).await.unwrap_or_default();
15054 let encoded = common::to_string(&bytes);
15055 match serde_json::from_str(&encoded) {
15056 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15057 Err(error) => {
15058 dlg.response_json_decode_error(&encoded, &error);
15059 return Err(common::Error::JsonDecodeError(
15060 encoded.to_string(),
15061 error,
15062 ));
15063 }
15064 }
15065 };
15066
15067 dlg.finished(true);
15068 return Ok(response);
15069 }
15070 }
15071 }
15072 }
15073
15074 /// Required. Parent resource od the EndpointAttachment, of the form: `projects/*/locations/*`
15075 ///
15076 /// Sets the *parent* path property to the given value.
15077 ///
15078 /// Even though the property as already been set when instantiating this call,
15079 /// we provide this method for API completeness.
15080 pub fn parent(mut self, new_value: &str) -> ProjectLocationEndpointAttachmentListCall<'a, C> {
15081 self._parent = new_value.to_string();
15082 self
15083 }
15084 /// Page token.
15085 ///
15086 /// Sets the *page token* query property to the given value.
15087 pub fn page_token(
15088 mut self,
15089 new_value: &str,
15090 ) -> ProjectLocationEndpointAttachmentListCall<'a, C> {
15091 self._page_token = Some(new_value.to_string());
15092 self
15093 }
15094 /// Page size.
15095 ///
15096 /// Sets the *page size* query property to the given value.
15097 pub fn page_size(mut self, new_value: i32) -> ProjectLocationEndpointAttachmentListCall<'a, C> {
15098 self._page_size = Some(new_value);
15099 self
15100 }
15101 /// Order by parameters.
15102 ///
15103 /// Sets the *order by* query property to the given value.
15104 pub fn order_by(mut self, new_value: &str) -> ProjectLocationEndpointAttachmentListCall<'a, C> {
15105 self._order_by = Some(new_value.to_string());
15106 self
15107 }
15108 /// Filter.
15109 ///
15110 /// Sets the *filter* query property to the given value.
15111 pub fn filter(mut self, new_value: &str) -> ProjectLocationEndpointAttachmentListCall<'a, C> {
15112 self._filter = Some(new_value.to_string());
15113 self
15114 }
15115 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15116 /// while executing the actual API request.
15117 ///
15118 /// ````text
15119 /// It should be used to handle progress information, and to implement a certain level of resilience.
15120 /// ````
15121 ///
15122 /// Sets the *delegate* property to the given value.
15123 pub fn delegate(
15124 mut self,
15125 new_value: &'a mut dyn common::Delegate,
15126 ) -> ProjectLocationEndpointAttachmentListCall<'a, C> {
15127 self._delegate = Some(new_value);
15128 self
15129 }
15130
15131 /// Set any additional parameter of the query string used in the request.
15132 /// It should be used to set parameters which are not yet available through their own
15133 /// setters.
15134 ///
15135 /// Please note that this method must not be used to set any of the known parameters
15136 /// which have their own setter method. If done anyway, the request will fail.
15137 ///
15138 /// # Additional Parameters
15139 ///
15140 /// * *$.xgafv* (query-string) - V1 error format.
15141 /// * *access_token* (query-string) - OAuth access token.
15142 /// * *alt* (query-string) - Data format for response.
15143 /// * *callback* (query-string) - JSONP
15144 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15145 /// * *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.
15146 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15147 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15148 /// * *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.
15149 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15150 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15151 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEndpointAttachmentListCall<'a, C>
15152 where
15153 T: AsRef<str>,
15154 {
15155 self._additional_params
15156 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15157 self
15158 }
15159
15160 /// Identifies the authorization scope for the method you are building.
15161 ///
15162 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15163 /// [`Scope::CloudPlatform`].
15164 ///
15165 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15166 /// tokens for more than one scope.
15167 ///
15168 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15169 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15170 /// sufficient, a read-write scope will do as well.
15171 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEndpointAttachmentListCall<'a, C>
15172 where
15173 St: AsRef<str>,
15174 {
15175 self._scopes.insert(String::from(scope.as_ref()));
15176 self
15177 }
15178 /// Identifies the authorization scope(s) for the method you are building.
15179 ///
15180 /// See [`Self::add_scope()`] for details.
15181 pub fn add_scopes<I, St>(
15182 mut self,
15183 scopes: I,
15184 ) -> ProjectLocationEndpointAttachmentListCall<'a, C>
15185 where
15186 I: IntoIterator<Item = St>,
15187 St: AsRef<str>,
15188 {
15189 self._scopes
15190 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15191 self
15192 }
15193
15194 /// Removes all scopes, and no default scope will be used either.
15195 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15196 /// for details).
15197 pub fn clear_scopes(mut self) -> ProjectLocationEndpointAttachmentListCall<'a, C> {
15198 self._scopes.clear();
15199 self
15200 }
15201}
15202
15203/// Updates the parameters of a single EndpointAttachment.
15204///
15205/// A builder for the *locations.endpointAttachments.patch* method supported by a *project* resource.
15206/// It is not used directly, but through a [`ProjectMethods`] instance.
15207///
15208/// # Example
15209///
15210/// Instantiate a resource method builder
15211///
15212/// ```test_harness,no_run
15213/// # extern crate hyper;
15214/// # extern crate hyper_rustls;
15215/// # extern crate google_connectors1 as connectors1;
15216/// use connectors1::api::EndpointAttachment;
15217/// # async fn dox() {
15218/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15219///
15220/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15221/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15222/// # secret,
15223/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15224/// # ).build().await.unwrap();
15225///
15226/// # let client = hyper_util::client::legacy::Client::builder(
15227/// # hyper_util::rt::TokioExecutor::new()
15228/// # )
15229/// # .build(
15230/// # hyper_rustls::HttpsConnectorBuilder::new()
15231/// # .with_native_roots()
15232/// # .unwrap()
15233/// # .https_or_http()
15234/// # .enable_http1()
15235/// # .build()
15236/// # );
15237/// # let mut hub = Connectors::new(client, auth);
15238/// // As the method needs a request, you would usually fill it with the desired information
15239/// // into the respective structure. Some of the parts shown here might not be applicable !
15240/// // Values shown here are possibly random and not representative !
15241/// let mut req = EndpointAttachment::default();
15242///
15243/// // You can configure optional parameters by calling the respective setters at will, and
15244/// // execute the final call using `doit()`.
15245/// // Values shown here are possibly random and not representative !
15246/// let result = hub.projects().locations_endpoint_attachments_patch(req, "name")
15247/// .update_mask(FieldMask::new::<&str>(&[]))
15248/// .doit().await;
15249/// # }
15250/// ```
15251pub struct ProjectLocationEndpointAttachmentPatchCall<'a, C>
15252where
15253 C: 'a,
15254{
15255 hub: &'a Connectors<C>,
15256 _request: EndpointAttachment,
15257 _name: String,
15258 _update_mask: Option<common::FieldMask>,
15259 _delegate: Option<&'a mut dyn common::Delegate>,
15260 _additional_params: HashMap<String, String>,
15261 _scopes: BTreeSet<String>,
15262}
15263
15264impl<'a, C> common::CallBuilder for ProjectLocationEndpointAttachmentPatchCall<'a, C> {}
15265
15266impl<'a, C> ProjectLocationEndpointAttachmentPatchCall<'a, C>
15267where
15268 C: common::Connector,
15269{
15270 /// Perform the operation you have build so far.
15271 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
15272 use std::borrow::Cow;
15273 use std::io::{Read, Seek};
15274
15275 use common::{url::Params, ToParts};
15276 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15277
15278 let mut dd = common::DefaultDelegate;
15279 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15280 dlg.begin(common::MethodInfo {
15281 id: "connectors.projects.locations.endpointAttachments.patch",
15282 http_method: hyper::Method::PATCH,
15283 });
15284
15285 for &field in ["alt", "name", "updateMask"].iter() {
15286 if self._additional_params.contains_key(field) {
15287 dlg.finished(false);
15288 return Err(common::Error::FieldClash(field));
15289 }
15290 }
15291
15292 let mut params = Params::with_capacity(5 + self._additional_params.len());
15293 params.push("name", self._name);
15294 if let Some(value) = self._update_mask.as_ref() {
15295 params.push("updateMask", value.to_string());
15296 }
15297
15298 params.extend(self._additional_params.iter());
15299
15300 params.push("alt", "json");
15301 let mut url = self.hub._base_url.clone() + "v1/{+name}";
15302 if self._scopes.is_empty() {
15303 self._scopes
15304 .insert(Scope::CloudPlatform.as_ref().to_string());
15305 }
15306
15307 #[allow(clippy::single_element_loop)]
15308 for &(find_this, param_name) in [("{+name}", "name")].iter() {
15309 url = params.uri_replacement(url, param_name, find_this, true);
15310 }
15311 {
15312 let to_remove = ["name"];
15313 params.remove_params(&to_remove);
15314 }
15315
15316 let url = params.parse_with_url(&url);
15317
15318 let mut json_mime_type = mime::APPLICATION_JSON;
15319 let mut request_value_reader = {
15320 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15321 common::remove_json_null_values(&mut value);
15322 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15323 serde_json::to_writer(&mut dst, &value).unwrap();
15324 dst
15325 };
15326 let request_size = request_value_reader
15327 .seek(std::io::SeekFrom::End(0))
15328 .unwrap();
15329 request_value_reader
15330 .seek(std::io::SeekFrom::Start(0))
15331 .unwrap();
15332
15333 loop {
15334 let token = match self
15335 .hub
15336 .auth
15337 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15338 .await
15339 {
15340 Ok(token) => token,
15341 Err(e) => match dlg.token(e) {
15342 Ok(token) => token,
15343 Err(e) => {
15344 dlg.finished(false);
15345 return Err(common::Error::MissingToken(e));
15346 }
15347 },
15348 };
15349 request_value_reader
15350 .seek(std::io::SeekFrom::Start(0))
15351 .unwrap();
15352 let mut req_result = {
15353 let client = &self.hub.client;
15354 dlg.pre_request();
15355 let mut req_builder = hyper::Request::builder()
15356 .method(hyper::Method::PATCH)
15357 .uri(url.as_str())
15358 .header(USER_AGENT, self.hub._user_agent.clone());
15359
15360 if let Some(token) = token.as_ref() {
15361 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15362 }
15363
15364 let request = req_builder
15365 .header(CONTENT_TYPE, json_mime_type.to_string())
15366 .header(CONTENT_LENGTH, request_size as u64)
15367 .body(common::to_body(
15368 request_value_reader.get_ref().clone().into(),
15369 ));
15370
15371 client.request(request.unwrap()).await
15372 };
15373
15374 match req_result {
15375 Err(err) => {
15376 if let common::Retry::After(d) = dlg.http_error(&err) {
15377 sleep(d).await;
15378 continue;
15379 }
15380 dlg.finished(false);
15381 return Err(common::Error::HttpError(err));
15382 }
15383 Ok(res) => {
15384 let (mut parts, body) = res.into_parts();
15385 let mut body = common::Body::new(body);
15386 if !parts.status.is_success() {
15387 let bytes = common::to_bytes(body).await.unwrap_or_default();
15388 let error = serde_json::from_str(&common::to_string(&bytes));
15389 let response = common::to_response(parts, bytes.into());
15390
15391 if let common::Retry::After(d) =
15392 dlg.http_failure(&response, error.as_ref().ok())
15393 {
15394 sleep(d).await;
15395 continue;
15396 }
15397
15398 dlg.finished(false);
15399
15400 return Err(match error {
15401 Ok(value) => common::Error::BadRequest(value),
15402 _ => common::Error::Failure(response),
15403 });
15404 }
15405 let response = {
15406 let bytes = common::to_bytes(body).await.unwrap_or_default();
15407 let encoded = common::to_string(&bytes);
15408 match serde_json::from_str(&encoded) {
15409 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15410 Err(error) => {
15411 dlg.response_json_decode_error(&encoded, &error);
15412 return Err(common::Error::JsonDecodeError(
15413 encoded.to_string(),
15414 error,
15415 ));
15416 }
15417 }
15418 };
15419
15420 dlg.finished(true);
15421 return Ok(response);
15422 }
15423 }
15424 }
15425 }
15426
15427 ///
15428 /// Sets the *request* property to the given value.
15429 ///
15430 /// Even though the property as already been set when instantiating this call,
15431 /// we provide this method for API completeness.
15432 pub fn request(
15433 mut self,
15434 new_value: EndpointAttachment,
15435 ) -> ProjectLocationEndpointAttachmentPatchCall<'a, C> {
15436 self._request = new_value;
15437 self
15438 }
15439 /// Output only. Resource name of the Endpoint Attachment. Format: projects/{project}/locations/{location}/endpointAttachments/{endpoint_attachment}
15440 ///
15441 /// Sets the *name* path property to the given value.
15442 ///
15443 /// Even though the property as already been set when instantiating this call,
15444 /// we provide this method for API completeness.
15445 pub fn name(mut self, new_value: &str) -> ProjectLocationEndpointAttachmentPatchCall<'a, C> {
15446 self._name = new_value.to_string();
15447 self
15448 }
15449 /// 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`
15450 ///
15451 /// Sets the *update mask* query property to the given value.
15452 pub fn update_mask(
15453 mut self,
15454 new_value: common::FieldMask,
15455 ) -> ProjectLocationEndpointAttachmentPatchCall<'a, C> {
15456 self._update_mask = Some(new_value);
15457 self
15458 }
15459 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15460 /// while executing the actual API request.
15461 ///
15462 /// ````text
15463 /// It should be used to handle progress information, and to implement a certain level of resilience.
15464 /// ````
15465 ///
15466 /// Sets the *delegate* property to the given value.
15467 pub fn delegate(
15468 mut self,
15469 new_value: &'a mut dyn common::Delegate,
15470 ) -> ProjectLocationEndpointAttachmentPatchCall<'a, C> {
15471 self._delegate = Some(new_value);
15472 self
15473 }
15474
15475 /// Set any additional parameter of the query string used in the request.
15476 /// It should be used to set parameters which are not yet available through their own
15477 /// setters.
15478 ///
15479 /// Please note that this method must not be used to set any of the known parameters
15480 /// which have their own setter method. If done anyway, the request will fail.
15481 ///
15482 /// # Additional Parameters
15483 ///
15484 /// * *$.xgafv* (query-string) - V1 error format.
15485 /// * *access_token* (query-string) - OAuth access token.
15486 /// * *alt* (query-string) - Data format for response.
15487 /// * *callback* (query-string) - JSONP
15488 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15489 /// * *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.
15490 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15491 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15492 /// * *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.
15493 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15494 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15495 pub fn param<T>(
15496 mut self,
15497 name: T,
15498 value: T,
15499 ) -> ProjectLocationEndpointAttachmentPatchCall<'a, C>
15500 where
15501 T: AsRef<str>,
15502 {
15503 self._additional_params
15504 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15505 self
15506 }
15507
15508 /// Identifies the authorization scope for the method you are building.
15509 ///
15510 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15511 /// [`Scope::CloudPlatform`].
15512 ///
15513 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15514 /// tokens for more than one scope.
15515 ///
15516 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15517 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15518 /// sufficient, a read-write scope will do as well.
15519 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEndpointAttachmentPatchCall<'a, C>
15520 where
15521 St: AsRef<str>,
15522 {
15523 self._scopes.insert(String::from(scope.as_ref()));
15524 self
15525 }
15526 /// Identifies the authorization scope(s) for the method you are building.
15527 ///
15528 /// See [`Self::add_scope()`] for details.
15529 pub fn add_scopes<I, St>(
15530 mut self,
15531 scopes: I,
15532 ) -> ProjectLocationEndpointAttachmentPatchCall<'a, C>
15533 where
15534 I: IntoIterator<Item = St>,
15535 St: AsRef<str>,
15536 {
15537 self._scopes
15538 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15539 self
15540 }
15541
15542 /// Removes all scopes, and no default scope will be used either.
15543 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15544 /// for details).
15545 pub fn clear_scopes(mut self) -> ProjectLocationEndpointAttachmentPatchCall<'a, C> {
15546 self._scopes.clear();
15547 self
15548 }
15549}
15550
15551/// Creates a new CustomConnectorVersion in a given project and location.
15552///
15553/// A builder for the *locations.global.customConnectors.customConnectorVersions.create* method supported by a *project* resource.
15554/// It is not used directly, but through a [`ProjectMethods`] instance.
15555///
15556/// # Example
15557///
15558/// Instantiate a resource method builder
15559///
15560/// ```test_harness,no_run
15561/// # extern crate hyper;
15562/// # extern crate hyper_rustls;
15563/// # extern crate google_connectors1 as connectors1;
15564/// use connectors1::api::CustomConnectorVersion;
15565/// # async fn dox() {
15566/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15567///
15568/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15569/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15570/// # secret,
15571/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15572/// # ).build().await.unwrap();
15573///
15574/// # let client = hyper_util::client::legacy::Client::builder(
15575/// # hyper_util::rt::TokioExecutor::new()
15576/// # )
15577/// # .build(
15578/// # hyper_rustls::HttpsConnectorBuilder::new()
15579/// # .with_native_roots()
15580/// # .unwrap()
15581/// # .https_or_http()
15582/// # .enable_http1()
15583/// # .build()
15584/// # );
15585/// # let mut hub = Connectors::new(client, auth);
15586/// // As the method needs a request, you would usually fill it with the desired information
15587/// // into the respective structure. Some of the parts shown here might not be applicable !
15588/// // Values shown here are possibly random and not representative !
15589/// let mut req = CustomConnectorVersion::default();
15590///
15591/// // You can configure optional parameters by calling the respective setters at will, and
15592/// // execute the final call using `doit()`.
15593/// // Values shown here are possibly random and not representative !
15594/// let result = hub.projects().locations_global_custom_connectors_custom_connector_versions_create(req, "parent")
15595/// .custom_connector_version_id("consetetur")
15596/// .doit().await;
15597/// # }
15598/// ```
15599pub struct ProjectLocationGlobalCustomConnectorCustomConnectorVersionCreateCall<'a, C>
15600where
15601 C: 'a,
15602{
15603 hub: &'a Connectors<C>,
15604 _request: CustomConnectorVersion,
15605 _parent: String,
15606 _custom_connector_version_id: Option<String>,
15607 _delegate: Option<&'a mut dyn common::Delegate>,
15608 _additional_params: HashMap<String, String>,
15609 _scopes: BTreeSet<String>,
15610}
15611
15612impl<'a, C> common::CallBuilder
15613 for ProjectLocationGlobalCustomConnectorCustomConnectorVersionCreateCall<'a, C>
15614{
15615}
15616
15617impl<'a, C> ProjectLocationGlobalCustomConnectorCustomConnectorVersionCreateCall<'a, C>
15618where
15619 C: common::Connector,
15620{
15621 /// Perform the operation you have build so far.
15622 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
15623 use std::borrow::Cow;
15624 use std::io::{Read, Seek};
15625
15626 use common::{url::Params, ToParts};
15627 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15628
15629 let mut dd = common::DefaultDelegate;
15630 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15631 dlg.begin(common::MethodInfo { id: "connectors.projects.locations.global.customConnectors.customConnectorVersions.create",
15632 http_method: hyper::Method::POST });
15633
15634 for &field in ["alt", "parent", "customConnectorVersionId"].iter() {
15635 if self._additional_params.contains_key(field) {
15636 dlg.finished(false);
15637 return Err(common::Error::FieldClash(field));
15638 }
15639 }
15640
15641 let mut params = Params::with_capacity(5 + self._additional_params.len());
15642 params.push("parent", self._parent);
15643 if let Some(value) = self._custom_connector_version_id.as_ref() {
15644 params.push("customConnectorVersionId", value);
15645 }
15646
15647 params.extend(self._additional_params.iter());
15648
15649 params.push("alt", "json");
15650 let mut url = self.hub._base_url.clone() + "v1/{+parent}/customConnectorVersions";
15651 if self._scopes.is_empty() {
15652 self._scopes
15653 .insert(Scope::CloudPlatform.as_ref().to_string());
15654 }
15655
15656 #[allow(clippy::single_element_loop)]
15657 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
15658 url = params.uri_replacement(url, param_name, find_this, true);
15659 }
15660 {
15661 let to_remove = ["parent"];
15662 params.remove_params(&to_remove);
15663 }
15664
15665 let url = params.parse_with_url(&url);
15666
15667 let mut json_mime_type = mime::APPLICATION_JSON;
15668 let mut request_value_reader = {
15669 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15670 common::remove_json_null_values(&mut value);
15671 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15672 serde_json::to_writer(&mut dst, &value).unwrap();
15673 dst
15674 };
15675 let request_size = request_value_reader
15676 .seek(std::io::SeekFrom::End(0))
15677 .unwrap();
15678 request_value_reader
15679 .seek(std::io::SeekFrom::Start(0))
15680 .unwrap();
15681
15682 loop {
15683 let token = match self
15684 .hub
15685 .auth
15686 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15687 .await
15688 {
15689 Ok(token) => token,
15690 Err(e) => match dlg.token(e) {
15691 Ok(token) => token,
15692 Err(e) => {
15693 dlg.finished(false);
15694 return Err(common::Error::MissingToken(e));
15695 }
15696 },
15697 };
15698 request_value_reader
15699 .seek(std::io::SeekFrom::Start(0))
15700 .unwrap();
15701 let mut req_result = {
15702 let client = &self.hub.client;
15703 dlg.pre_request();
15704 let mut req_builder = hyper::Request::builder()
15705 .method(hyper::Method::POST)
15706 .uri(url.as_str())
15707 .header(USER_AGENT, self.hub._user_agent.clone());
15708
15709 if let Some(token) = token.as_ref() {
15710 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15711 }
15712
15713 let request = req_builder
15714 .header(CONTENT_TYPE, json_mime_type.to_string())
15715 .header(CONTENT_LENGTH, request_size as u64)
15716 .body(common::to_body(
15717 request_value_reader.get_ref().clone().into(),
15718 ));
15719
15720 client.request(request.unwrap()).await
15721 };
15722
15723 match req_result {
15724 Err(err) => {
15725 if let common::Retry::After(d) = dlg.http_error(&err) {
15726 sleep(d).await;
15727 continue;
15728 }
15729 dlg.finished(false);
15730 return Err(common::Error::HttpError(err));
15731 }
15732 Ok(res) => {
15733 let (mut parts, body) = res.into_parts();
15734 let mut body = common::Body::new(body);
15735 if !parts.status.is_success() {
15736 let bytes = common::to_bytes(body).await.unwrap_or_default();
15737 let error = serde_json::from_str(&common::to_string(&bytes));
15738 let response = common::to_response(parts, bytes.into());
15739
15740 if let common::Retry::After(d) =
15741 dlg.http_failure(&response, error.as_ref().ok())
15742 {
15743 sleep(d).await;
15744 continue;
15745 }
15746
15747 dlg.finished(false);
15748
15749 return Err(match error {
15750 Ok(value) => common::Error::BadRequest(value),
15751 _ => common::Error::Failure(response),
15752 });
15753 }
15754 let response = {
15755 let bytes = common::to_bytes(body).await.unwrap_or_default();
15756 let encoded = common::to_string(&bytes);
15757 match serde_json::from_str(&encoded) {
15758 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15759 Err(error) => {
15760 dlg.response_json_decode_error(&encoded, &error);
15761 return Err(common::Error::JsonDecodeError(
15762 encoded.to_string(),
15763 error,
15764 ));
15765 }
15766 }
15767 };
15768
15769 dlg.finished(true);
15770 return Ok(response);
15771 }
15772 }
15773 }
15774 }
15775
15776 ///
15777 /// Sets the *request* property to the given value.
15778 ///
15779 /// Even though the property as already been set when instantiating this call,
15780 /// we provide this method for API completeness.
15781 pub fn request(
15782 mut self,
15783 new_value: CustomConnectorVersion,
15784 ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionCreateCall<'a, C> {
15785 self._request = new_value;
15786 self
15787 }
15788 /// Required. Parent resource of the CreateCustomConnector, of the form: `projects/{project}/locations/{location}/customConnectors/{custom_connector}`
15789 ///
15790 /// Sets the *parent* path property to the given value.
15791 ///
15792 /// Even though the property as already been set when instantiating this call,
15793 /// we provide this method for API completeness.
15794 pub fn parent(
15795 mut self,
15796 new_value: &str,
15797 ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionCreateCall<'a, C> {
15798 self._parent = new_value.to_string();
15799 self
15800 }
15801 /// Required. Identifier to assign to the CreateCustomConnectorVersion. Must be unique within scope of the parent resource.
15802 ///
15803 /// Sets the *custom connector version id* query property to the given value.
15804 pub fn custom_connector_version_id(
15805 mut self,
15806 new_value: &str,
15807 ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionCreateCall<'a, C> {
15808 self._custom_connector_version_id = Some(new_value.to_string());
15809 self
15810 }
15811 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15812 /// while executing the actual API request.
15813 ///
15814 /// ````text
15815 /// It should be used to handle progress information, and to implement a certain level of resilience.
15816 /// ````
15817 ///
15818 /// Sets the *delegate* property to the given value.
15819 pub fn delegate(
15820 mut self,
15821 new_value: &'a mut dyn common::Delegate,
15822 ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionCreateCall<'a, C> {
15823 self._delegate = Some(new_value);
15824 self
15825 }
15826
15827 /// Set any additional parameter of the query string used in the request.
15828 /// It should be used to set parameters which are not yet available through their own
15829 /// setters.
15830 ///
15831 /// Please note that this method must not be used to set any of the known parameters
15832 /// which have their own setter method. If done anyway, the request will fail.
15833 ///
15834 /// # Additional Parameters
15835 ///
15836 /// * *$.xgafv* (query-string) - V1 error format.
15837 /// * *access_token* (query-string) - OAuth access token.
15838 /// * *alt* (query-string) - Data format for response.
15839 /// * *callback* (query-string) - JSONP
15840 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15841 /// * *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.
15842 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15843 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15844 /// * *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.
15845 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15846 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15847 pub fn param<T>(
15848 mut self,
15849 name: T,
15850 value: T,
15851 ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionCreateCall<'a, C>
15852 where
15853 T: AsRef<str>,
15854 {
15855 self._additional_params
15856 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15857 self
15858 }
15859
15860 /// Identifies the authorization scope for the method you are building.
15861 ///
15862 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15863 /// [`Scope::CloudPlatform`].
15864 ///
15865 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15866 /// tokens for more than one scope.
15867 ///
15868 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15869 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15870 /// sufficient, a read-write scope will do as well.
15871 pub fn add_scope<St>(
15872 mut self,
15873 scope: St,
15874 ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionCreateCall<'a, C>
15875 where
15876 St: AsRef<str>,
15877 {
15878 self._scopes.insert(String::from(scope.as_ref()));
15879 self
15880 }
15881 /// Identifies the authorization scope(s) for the method you are building.
15882 ///
15883 /// See [`Self::add_scope()`] for details.
15884 pub fn add_scopes<I, St>(
15885 mut self,
15886 scopes: I,
15887 ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionCreateCall<'a, C>
15888 where
15889 I: IntoIterator<Item = St>,
15890 St: AsRef<str>,
15891 {
15892 self._scopes
15893 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15894 self
15895 }
15896
15897 /// Removes all scopes, and no default scope will be used either.
15898 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15899 /// for details).
15900 pub fn clear_scopes(
15901 mut self,
15902 ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionCreateCall<'a, C> {
15903 self._scopes.clear();
15904 self
15905 }
15906}
15907
15908/// Gets details of a single CustomConnectorVersion.
15909///
15910/// A builder for the *locations.global.customConnectors.customConnectorVersions.get* method supported by a *project* resource.
15911/// It is not used directly, but through a [`ProjectMethods`] instance.
15912///
15913/// # Example
15914///
15915/// Instantiate a resource method builder
15916///
15917/// ```test_harness,no_run
15918/// # extern crate hyper;
15919/// # extern crate hyper_rustls;
15920/// # extern crate google_connectors1 as connectors1;
15921/// # async fn dox() {
15922/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15923///
15924/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15925/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15926/// # secret,
15927/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15928/// # ).build().await.unwrap();
15929///
15930/// # let client = hyper_util::client::legacy::Client::builder(
15931/// # hyper_util::rt::TokioExecutor::new()
15932/// # )
15933/// # .build(
15934/// # hyper_rustls::HttpsConnectorBuilder::new()
15935/// # .with_native_roots()
15936/// # .unwrap()
15937/// # .https_or_http()
15938/// # .enable_http1()
15939/// # .build()
15940/// # );
15941/// # let mut hub = Connectors::new(client, auth);
15942/// // You can configure optional parameters by calling the respective setters at will, and
15943/// // execute the final call using `doit()`.
15944/// // Values shown here are possibly random and not representative !
15945/// let result = hub.projects().locations_global_custom_connectors_custom_connector_versions_get("name")
15946/// .doit().await;
15947/// # }
15948/// ```
15949pub struct ProjectLocationGlobalCustomConnectorCustomConnectorVersionGetCall<'a, C>
15950where
15951 C: 'a,
15952{
15953 hub: &'a Connectors<C>,
15954 _name: String,
15955 _delegate: Option<&'a mut dyn common::Delegate>,
15956 _additional_params: HashMap<String, String>,
15957 _scopes: BTreeSet<String>,
15958}
15959
15960impl<'a, C> common::CallBuilder
15961 for ProjectLocationGlobalCustomConnectorCustomConnectorVersionGetCall<'a, C>
15962{
15963}
15964
15965impl<'a, C> ProjectLocationGlobalCustomConnectorCustomConnectorVersionGetCall<'a, C>
15966where
15967 C: common::Connector,
15968{
15969 /// Perform the operation you have build so far.
15970 pub async fn doit(mut self) -> common::Result<(common::Response, CustomConnectorVersion)> {
15971 use std::borrow::Cow;
15972 use std::io::{Read, Seek};
15973
15974 use common::{url::Params, ToParts};
15975 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15976
15977 let mut dd = common::DefaultDelegate;
15978 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15979 dlg.begin(common::MethodInfo {
15980 id: "connectors.projects.locations.global.customConnectors.customConnectorVersions.get",
15981 http_method: hyper::Method::GET,
15982 });
15983
15984 for &field in ["alt", "name"].iter() {
15985 if self._additional_params.contains_key(field) {
15986 dlg.finished(false);
15987 return Err(common::Error::FieldClash(field));
15988 }
15989 }
15990
15991 let mut params = Params::with_capacity(3 + self._additional_params.len());
15992 params.push("name", self._name);
15993
15994 params.extend(self._additional_params.iter());
15995
15996 params.push("alt", "json");
15997 let mut url = self.hub._base_url.clone() + "v1/{+name}";
15998 if self._scopes.is_empty() {
15999 self._scopes
16000 .insert(Scope::CloudPlatform.as_ref().to_string());
16001 }
16002
16003 #[allow(clippy::single_element_loop)]
16004 for &(find_this, param_name) in [("{+name}", "name")].iter() {
16005 url = params.uri_replacement(url, param_name, find_this, true);
16006 }
16007 {
16008 let to_remove = ["name"];
16009 params.remove_params(&to_remove);
16010 }
16011
16012 let url = params.parse_with_url(&url);
16013
16014 loop {
16015 let token = match self
16016 .hub
16017 .auth
16018 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16019 .await
16020 {
16021 Ok(token) => token,
16022 Err(e) => match dlg.token(e) {
16023 Ok(token) => token,
16024 Err(e) => {
16025 dlg.finished(false);
16026 return Err(common::Error::MissingToken(e));
16027 }
16028 },
16029 };
16030 let mut req_result = {
16031 let client = &self.hub.client;
16032 dlg.pre_request();
16033 let mut req_builder = hyper::Request::builder()
16034 .method(hyper::Method::GET)
16035 .uri(url.as_str())
16036 .header(USER_AGENT, self.hub._user_agent.clone());
16037
16038 if let Some(token) = token.as_ref() {
16039 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16040 }
16041
16042 let request = req_builder
16043 .header(CONTENT_LENGTH, 0_u64)
16044 .body(common::to_body::<String>(None));
16045
16046 client.request(request.unwrap()).await
16047 };
16048
16049 match req_result {
16050 Err(err) => {
16051 if let common::Retry::After(d) = dlg.http_error(&err) {
16052 sleep(d).await;
16053 continue;
16054 }
16055 dlg.finished(false);
16056 return Err(common::Error::HttpError(err));
16057 }
16058 Ok(res) => {
16059 let (mut parts, body) = res.into_parts();
16060 let mut body = common::Body::new(body);
16061 if !parts.status.is_success() {
16062 let bytes = common::to_bytes(body).await.unwrap_or_default();
16063 let error = serde_json::from_str(&common::to_string(&bytes));
16064 let response = common::to_response(parts, bytes.into());
16065
16066 if let common::Retry::After(d) =
16067 dlg.http_failure(&response, error.as_ref().ok())
16068 {
16069 sleep(d).await;
16070 continue;
16071 }
16072
16073 dlg.finished(false);
16074
16075 return Err(match error {
16076 Ok(value) => common::Error::BadRequest(value),
16077 _ => common::Error::Failure(response),
16078 });
16079 }
16080 let response = {
16081 let bytes = common::to_bytes(body).await.unwrap_or_default();
16082 let encoded = common::to_string(&bytes);
16083 match serde_json::from_str(&encoded) {
16084 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16085 Err(error) => {
16086 dlg.response_json_decode_error(&encoded, &error);
16087 return Err(common::Error::JsonDecodeError(
16088 encoded.to_string(),
16089 error,
16090 ));
16091 }
16092 }
16093 };
16094
16095 dlg.finished(true);
16096 return Ok(response);
16097 }
16098 }
16099 }
16100 }
16101
16102 /// Required. Resource name of the form: `projects/*/locations/{location}/customConnectors/*/customConnectorVersions/*`
16103 ///
16104 /// Sets the *name* path property to the given value.
16105 ///
16106 /// Even though the property as already been set when instantiating this call,
16107 /// we provide this method for API completeness.
16108 pub fn name(
16109 mut self,
16110 new_value: &str,
16111 ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionGetCall<'a, C> {
16112 self._name = new_value.to_string();
16113 self
16114 }
16115 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16116 /// while executing the actual API request.
16117 ///
16118 /// ````text
16119 /// It should be used to handle progress information, and to implement a certain level of resilience.
16120 /// ````
16121 ///
16122 /// Sets the *delegate* property to the given value.
16123 pub fn delegate(
16124 mut self,
16125 new_value: &'a mut dyn common::Delegate,
16126 ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionGetCall<'a, C> {
16127 self._delegate = Some(new_value);
16128 self
16129 }
16130
16131 /// Set any additional parameter of the query string used in the request.
16132 /// It should be used to set parameters which are not yet available through their own
16133 /// setters.
16134 ///
16135 /// Please note that this method must not be used to set any of the known parameters
16136 /// which have their own setter method. If done anyway, the request will fail.
16137 ///
16138 /// # Additional Parameters
16139 ///
16140 /// * *$.xgafv* (query-string) - V1 error format.
16141 /// * *access_token* (query-string) - OAuth access token.
16142 /// * *alt* (query-string) - Data format for response.
16143 /// * *callback* (query-string) - JSONP
16144 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16145 /// * *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.
16146 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16147 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16148 /// * *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.
16149 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16150 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16151 pub fn param<T>(
16152 mut self,
16153 name: T,
16154 value: T,
16155 ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionGetCall<'a, C>
16156 where
16157 T: AsRef<str>,
16158 {
16159 self._additional_params
16160 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16161 self
16162 }
16163
16164 /// Identifies the authorization scope for the method you are building.
16165 ///
16166 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16167 /// [`Scope::CloudPlatform`].
16168 ///
16169 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16170 /// tokens for more than one scope.
16171 ///
16172 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16173 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16174 /// sufficient, a read-write scope will do as well.
16175 pub fn add_scope<St>(
16176 mut self,
16177 scope: St,
16178 ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionGetCall<'a, C>
16179 where
16180 St: AsRef<str>,
16181 {
16182 self._scopes.insert(String::from(scope.as_ref()));
16183 self
16184 }
16185 /// Identifies the authorization scope(s) for the method you are building.
16186 ///
16187 /// See [`Self::add_scope()`] for details.
16188 pub fn add_scopes<I, St>(
16189 mut self,
16190 scopes: I,
16191 ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionGetCall<'a, C>
16192 where
16193 I: IntoIterator<Item = St>,
16194 St: AsRef<str>,
16195 {
16196 self._scopes
16197 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16198 self
16199 }
16200
16201 /// Removes all scopes, and no default scope will be used either.
16202 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16203 /// for details).
16204 pub fn clear_scopes(
16205 mut self,
16206 ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionGetCall<'a, C> {
16207 self._scopes.clear();
16208 self
16209 }
16210}
16211
16212/// List CustomConnectorVersions in a given project
16213///
16214/// A builder for the *locations.global.customConnectors.customConnectorVersions.list* method supported by a *project* resource.
16215/// It is not used directly, but through a [`ProjectMethods`] instance.
16216///
16217/// # Example
16218///
16219/// Instantiate a resource method builder
16220///
16221/// ```test_harness,no_run
16222/// # extern crate hyper;
16223/// # extern crate hyper_rustls;
16224/// # extern crate google_connectors1 as connectors1;
16225/// # async fn dox() {
16226/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16227///
16228/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16229/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16230/// # secret,
16231/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
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_http1()
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_global_custom_connectors_custom_connector_versions_list("parent")
16250/// .page_token("erat")
16251/// .page_size(-96)
16252/// .doit().await;
16253/// # }
16254/// ```
16255pub struct ProjectLocationGlobalCustomConnectorCustomConnectorVersionListCall<'a, C>
16256where
16257 C: 'a,
16258{
16259 hub: &'a Connectors<C>,
16260 _parent: String,
16261 _page_token: Option<String>,
16262 _page_size: Option<i32>,
16263 _delegate: Option<&'a mut dyn common::Delegate>,
16264 _additional_params: HashMap<String, String>,
16265 _scopes: BTreeSet<String>,
16266}
16267
16268impl<'a, C> common::CallBuilder
16269 for ProjectLocationGlobalCustomConnectorCustomConnectorVersionListCall<'a, C>
16270{
16271}
16272
16273impl<'a, C> ProjectLocationGlobalCustomConnectorCustomConnectorVersionListCall<'a, C>
16274where
16275 C: common::Connector,
16276{
16277 /// Perform the operation you have build so far.
16278 pub async fn doit(
16279 mut self,
16280 ) -> common::Result<(common::Response, ListCustomConnectorVersionsResponse)> {
16281 use std::borrow::Cow;
16282 use std::io::{Read, Seek};
16283
16284 use common::{url::Params, ToParts};
16285 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16286
16287 let mut dd = common::DefaultDelegate;
16288 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16289 dlg.begin(common::MethodInfo { id: "connectors.projects.locations.global.customConnectors.customConnectorVersions.list",
16290 http_method: hyper::Method::GET });
16291
16292 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
16293 if self._additional_params.contains_key(field) {
16294 dlg.finished(false);
16295 return Err(common::Error::FieldClash(field));
16296 }
16297 }
16298
16299 let mut params = Params::with_capacity(5 + self._additional_params.len());
16300 params.push("parent", self._parent);
16301 if let Some(value) = self._page_token.as_ref() {
16302 params.push("pageToken", value);
16303 }
16304 if let Some(value) = self._page_size.as_ref() {
16305 params.push("pageSize", value.to_string());
16306 }
16307
16308 params.extend(self._additional_params.iter());
16309
16310 params.push("alt", "json");
16311 let mut url = self.hub._base_url.clone() + "v1/{+parent}/customConnectorVersions";
16312 if self._scopes.is_empty() {
16313 self._scopes
16314 .insert(Scope::CloudPlatform.as_ref().to_string());
16315 }
16316
16317 #[allow(clippy::single_element_loop)]
16318 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
16319 url = params.uri_replacement(url, param_name, find_this, true);
16320 }
16321 {
16322 let to_remove = ["parent"];
16323 params.remove_params(&to_remove);
16324 }
16325
16326 let url = params.parse_with_url(&url);
16327
16328 loop {
16329 let token = match self
16330 .hub
16331 .auth
16332 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16333 .await
16334 {
16335 Ok(token) => token,
16336 Err(e) => match dlg.token(e) {
16337 Ok(token) => token,
16338 Err(e) => {
16339 dlg.finished(false);
16340 return Err(common::Error::MissingToken(e));
16341 }
16342 },
16343 };
16344 let mut req_result = {
16345 let client = &self.hub.client;
16346 dlg.pre_request();
16347 let mut req_builder = hyper::Request::builder()
16348 .method(hyper::Method::GET)
16349 .uri(url.as_str())
16350 .header(USER_AGENT, self.hub._user_agent.clone());
16351
16352 if let Some(token) = token.as_ref() {
16353 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16354 }
16355
16356 let request = req_builder
16357 .header(CONTENT_LENGTH, 0_u64)
16358 .body(common::to_body::<String>(None));
16359
16360 client.request(request.unwrap()).await
16361 };
16362
16363 match req_result {
16364 Err(err) => {
16365 if let common::Retry::After(d) = dlg.http_error(&err) {
16366 sleep(d).await;
16367 continue;
16368 }
16369 dlg.finished(false);
16370 return Err(common::Error::HttpError(err));
16371 }
16372 Ok(res) => {
16373 let (mut parts, body) = res.into_parts();
16374 let mut body = common::Body::new(body);
16375 if !parts.status.is_success() {
16376 let bytes = common::to_bytes(body).await.unwrap_or_default();
16377 let error = serde_json::from_str(&common::to_string(&bytes));
16378 let response = common::to_response(parts, bytes.into());
16379
16380 if let common::Retry::After(d) =
16381 dlg.http_failure(&response, error.as_ref().ok())
16382 {
16383 sleep(d).await;
16384 continue;
16385 }
16386
16387 dlg.finished(false);
16388
16389 return Err(match error {
16390 Ok(value) => common::Error::BadRequest(value),
16391 _ => common::Error::Failure(response),
16392 });
16393 }
16394 let response = {
16395 let bytes = common::to_bytes(body).await.unwrap_or_default();
16396 let encoded = common::to_string(&bytes);
16397 match serde_json::from_str(&encoded) {
16398 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16399 Err(error) => {
16400 dlg.response_json_decode_error(&encoded, &error);
16401 return Err(common::Error::JsonDecodeError(
16402 encoded.to_string(),
16403 error,
16404 ));
16405 }
16406 }
16407 };
16408
16409 dlg.finished(true);
16410 return Ok(response);
16411 }
16412 }
16413 }
16414 }
16415
16416 /// Required. Parent resource of the connectors, of the form: `projects/*/locations/{location}/customConnectors/*/customConnectorVersions/*`
16417 ///
16418 /// Sets the *parent* path property to the given value.
16419 ///
16420 /// Even though the property as already been set when instantiating this call,
16421 /// we provide this method for API completeness.
16422 pub fn parent(
16423 mut self,
16424 new_value: &str,
16425 ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionListCall<'a, C> {
16426 self._parent = new_value.to_string();
16427 self
16428 }
16429 /// Page token.
16430 ///
16431 /// Sets the *page token* query property to the given value.
16432 pub fn page_token(
16433 mut self,
16434 new_value: &str,
16435 ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionListCall<'a, C> {
16436 self._page_token = Some(new_value.to_string());
16437 self
16438 }
16439 /// Page size.
16440 ///
16441 /// Sets the *page size* query property to the given value.
16442 pub fn page_size(
16443 mut self,
16444 new_value: i32,
16445 ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionListCall<'a, C> {
16446 self._page_size = Some(new_value);
16447 self
16448 }
16449 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16450 /// while executing the actual API request.
16451 ///
16452 /// ````text
16453 /// It should be used to handle progress information, and to implement a certain level of resilience.
16454 /// ````
16455 ///
16456 /// Sets the *delegate* property to the given value.
16457 pub fn delegate(
16458 mut self,
16459 new_value: &'a mut dyn common::Delegate,
16460 ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionListCall<'a, C> {
16461 self._delegate = Some(new_value);
16462 self
16463 }
16464
16465 /// Set any additional parameter of the query string used in the request.
16466 /// It should be used to set parameters which are not yet available through their own
16467 /// setters.
16468 ///
16469 /// Please note that this method must not be used to set any of the known parameters
16470 /// which have their own setter method. If done anyway, the request will fail.
16471 ///
16472 /// # Additional Parameters
16473 ///
16474 /// * *$.xgafv* (query-string) - V1 error format.
16475 /// * *access_token* (query-string) - OAuth access token.
16476 /// * *alt* (query-string) - Data format for response.
16477 /// * *callback* (query-string) - JSONP
16478 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16479 /// * *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.
16480 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16481 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16482 /// * *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.
16483 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16484 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16485 pub fn param<T>(
16486 mut self,
16487 name: T,
16488 value: T,
16489 ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionListCall<'a, C>
16490 where
16491 T: AsRef<str>,
16492 {
16493 self._additional_params
16494 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16495 self
16496 }
16497
16498 /// Identifies the authorization scope for the method you are building.
16499 ///
16500 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16501 /// [`Scope::CloudPlatform`].
16502 ///
16503 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16504 /// tokens for more than one scope.
16505 ///
16506 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16507 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16508 /// sufficient, a read-write scope will do as well.
16509 pub fn add_scope<St>(
16510 mut self,
16511 scope: St,
16512 ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionListCall<'a, C>
16513 where
16514 St: AsRef<str>,
16515 {
16516 self._scopes.insert(String::from(scope.as_ref()));
16517 self
16518 }
16519 /// Identifies the authorization scope(s) for the method you are building.
16520 ///
16521 /// See [`Self::add_scope()`] for details.
16522 pub fn add_scopes<I, St>(
16523 mut self,
16524 scopes: I,
16525 ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionListCall<'a, C>
16526 where
16527 I: IntoIterator<Item = St>,
16528 St: AsRef<str>,
16529 {
16530 self._scopes
16531 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16532 self
16533 }
16534
16535 /// Removes all scopes, and no default scope will be used either.
16536 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16537 /// for details).
16538 pub fn clear_scopes(
16539 mut self,
16540 ) -> ProjectLocationGlobalCustomConnectorCustomConnectorVersionListCall<'a, C> {
16541 self._scopes.clear();
16542 self
16543 }
16544}
16545
16546/// Creates a new CustomConnector in a given project and location.
16547///
16548/// A builder for the *locations.global.customConnectors.create* method supported by a *project* resource.
16549/// It is not used directly, but through a [`ProjectMethods`] instance.
16550///
16551/// # Example
16552///
16553/// Instantiate a resource method builder
16554///
16555/// ```test_harness,no_run
16556/// # extern crate hyper;
16557/// # extern crate hyper_rustls;
16558/// # extern crate google_connectors1 as connectors1;
16559/// use connectors1::api::CustomConnector;
16560/// # async fn dox() {
16561/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16562///
16563/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16564/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16565/// # secret,
16566/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16567/// # ).build().await.unwrap();
16568///
16569/// # let client = hyper_util::client::legacy::Client::builder(
16570/// # hyper_util::rt::TokioExecutor::new()
16571/// # )
16572/// # .build(
16573/// # hyper_rustls::HttpsConnectorBuilder::new()
16574/// # .with_native_roots()
16575/// # .unwrap()
16576/// # .https_or_http()
16577/// # .enable_http1()
16578/// # .build()
16579/// # );
16580/// # let mut hub = Connectors::new(client, auth);
16581/// // As the method needs a request, you would usually fill it with the desired information
16582/// // into the respective structure. Some of the parts shown here might not be applicable !
16583/// // Values shown here are possibly random and not representative !
16584/// let mut req = CustomConnector::default();
16585///
16586/// // You can configure optional parameters by calling the respective setters at will, and
16587/// // execute the final call using `doit()`.
16588/// // Values shown here are possibly random and not representative !
16589/// let result = hub.projects().locations_global_custom_connectors_create(req, "parent")
16590/// .custom_connector_id("sed")
16591/// .doit().await;
16592/// # }
16593/// ```
16594pub struct ProjectLocationGlobalCustomConnectorCreateCall<'a, C>
16595where
16596 C: 'a,
16597{
16598 hub: &'a Connectors<C>,
16599 _request: CustomConnector,
16600 _parent: String,
16601 _custom_connector_id: Option<String>,
16602 _delegate: Option<&'a mut dyn common::Delegate>,
16603 _additional_params: HashMap<String, String>,
16604 _scopes: BTreeSet<String>,
16605}
16606
16607impl<'a, C> common::CallBuilder for ProjectLocationGlobalCustomConnectorCreateCall<'a, C> {}
16608
16609impl<'a, C> ProjectLocationGlobalCustomConnectorCreateCall<'a, C>
16610where
16611 C: common::Connector,
16612{
16613 /// Perform the operation you have build so far.
16614 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
16615 use std::borrow::Cow;
16616 use std::io::{Read, Seek};
16617
16618 use common::{url::Params, ToParts};
16619 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16620
16621 let mut dd = common::DefaultDelegate;
16622 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16623 dlg.begin(common::MethodInfo {
16624 id: "connectors.projects.locations.global.customConnectors.create",
16625 http_method: hyper::Method::POST,
16626 });
16627
16628 for &field in ["alt", "parent", "customConnectorId"].iter() {
16629 if self._additional_params.contains_key(field) {
16630 dlg.finished(false);
16631 return Err(common::Error::FieldClash(field));
16632 }
16633 }
16634
16635 let mut params = Params::with_capacity(5 + self._additional_params.len());
16636 params.push("parent", self._parent);
16637 if let Some(value) = self._custom_connector_id.as_ref() {
16638 params.push("customConnectorId", value);
16639 }
16640
16641 params.extend(self._additional_params.iter());
16642
16643 params.push("alt", "json");
16644 let mut url = self.hub._base_url.clone() + "v1/{+parent}/customConnectors";
16645 if self._scopes.is_empty() {
16646 self._scopes
16647 .insert(Scope::CloudPlatform.as_ref().to_string());
16648 }
16649
16650 #[allow(clippy::single_element_loop)]
16651 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
16652 url = params.uri_replacement(url, param_name, find_this, true);
16653 }
16654 {
16655 let to_remove = ["parent"];
16656 params.remove_params(&to_remove);
16657 }
16658
16659 let url = params.parse_with_url(&url);
16660
16661 let mut json_mime_type = mime::APPLICATION_JSON;
16662 let mut request_value_reader = {
16663 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16664 common::remove_json_null_values(&mut value);
16665 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16666 serde_json::to_writer(&mut dst, &value).unwrap();
16667 dst
16668 };
16669 let request_size = request_value_reader
16670 .seek(std::io::SeekFrom::End(0))
16671 .unwrap();
16672 request_value_reader
16673 .seek(std::io::SeekFrom::Start(0))
16674 .unwrap();
16675
16676 loop {
16677 let token = match self
16678 .hub
16679 .auth
16680 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16681 .await
16682 {
16683 Ok(token) => token,
16684 Err(e) => match dlg.token(e) {
16685 Ok(token) => token,
16686 Err(e) => {
16687 dlg.finished(false);
16688 return Err(common::Error::MissingToken(e));
16689 }
16690 },
16691 };
16692 request_value_reader
16693 .seek(std::io::SeekFrom::Start(0))
16694 .unwrap();
16695 let mut req_result = {
16696 let client = &self.hub.client;
16697 dlg.pre_request();
16698 let mut req_builder = hyper::Request::builder()
16699 .method(hyper::Method::POST)
16700 .uri(url.as_str())
16701 .header(USER_AGENT, self.hub._user_agent.clone());
16702
16703 if let Some(token) = token.as_ref() {
16704 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16705 }
16706
16707 let request = req_builder
16708 .header(CONTENT_TYPE, json_mime_type.to_string())
16709 .header(CONTENT_LENGTH, request_size as u64)
16710 .body(common::to_body(
16711 request_value_reader.get_ref().clone().into(),
16712 ));
16713
16714 client.request(request.unwrap()).await
16715 };
16716
16717 match req_result {
16718 Err(err) => {
16719 if let common::Retry::After(d) = dlg.http_error(&err) {
16720 sleep(d).await;
16721 continue;
16722 }
16723 dlg.finished(false);
16724 return Err(common::Error::HttpError(err));
16725 }
16726 Ok(res) => {
16727 let (mut parts, body) = res.into_parts();
16728 let mut body = common::Body::new(body);
16729 if !parts.status.is_success() {
16730 let bytes = common::to_bytes(body).await.unwrap_or_default();
16731 let error = serde_json::from_str(&common::to_string(&bytes));
16732 let response = common::to_response(parts, bytes.into());
16733
16734 if let common::Retry::After(d) =
16735 dlg.http_failure(&response, error.as_ref().ok())
16736 {
16737 sleep(d).await;
16738 continue;
16739 }
16740
16741 dlg.finished(false);
16742
16743 return Err(match error {
16744 Ok(value) => common::Error::BadRequest(value),
16745 _ => common::Error::Failure(response),
16746 });
16747 }
16748 let response = {
16749 let bytes = common::to_bytes(body).await.unwrap_or_default();
16750 let encoded = common::to_string(&bytes);
16751 match serde_json::from_str(&encoded) {
16752 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16753 Err(error) => {
16754 dlg.response_json_decode_error(&encoded, &error);
16755 return Err(common::Error::JsonDecodeError(
16756 encoded.to_string(),
16757 error,
16758 ));
16759 }
16760 }
16761 };
16762
16763 dlg.finished(true);
16764 return Ok(response);
16765 }
16766 }
16767 }
16768 }
16769
16770 ///
16771 /// Sets the *request* property to the given value.
16772 ///
16773 /// Even though the property as already been set when instantiating this call,
16774 /// we provide this method for API completeness.
16775 pub fn request(
16776 mut self,
16777 new_value: CustomConnector,
16778 ) -> ProjectLocationGlobalCustomConnectorCreateCall<'a, C> {
16779 self._request = new_value;
16780 self
16781 }
16782 /// Required. Parent resource of the CreateCustomConnector, of the form: `projects/{project}/locations/*`
16783 ///
16784 /// Sets the *parent* path property to the given value.
16785 ///
16786 /// Even though the property as already been set when instantiating this call,
16787 /// we provide this method for API completeness.
16788 pub fn parent(
16789 mut self,
16790 new_value: &str,
16791 ) -> ProjectLocationGlobalCustomConnectorCreateCall<'a, C> {
16792 self._parent = new_value.to_string();
16793 self
16794 }
16795 /// Required. Identifier to assign to the CreateCustomConnector. Must be unique within scope of the parent resource.
16796 ///
16797 /// Sets the *custom connector id* query property to the given value.
16798 pub fn custom_connector_id(
16799 mut self,
16800 new_value: &str,
16801 ) -> ProjectLocationGlobalCustomConnectorCreateCall<'a, C> {
16802 self._custom_connector_id = Some(new_value.to_string());
16803 self
16804 }
16805 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16806 /// while executing the actual API request.
16807 ///
16808 /// ````text
16809 /// It should be used to handle progress information, and to implement a certain level of resilience.
16810 /// ````
16811 ///
16812 /// Sets the *delegate* property to the given value.
16813 pub fn delegate(
16814 mut self,
16815 new_value: &'a mut dyn common::Delegate,
16816 ) -> ProjectLocationGlobalCustomConnectorCreateCall<'a, C> {
16817 self._delegate = Some(new_value);
16818 self
16819 }
16820
16821 /// Set any additional parameter of the query string used in the request.
16822 /// It should be used to set parameters which are not yet available through their own
16823 /// setters.
16824 ///
16825 /// Please note that this method must not be used to set any of the known parameters
16826 /// which have their own setter method. If done anyway, the request will fail.
16827 ///
16828 /// # Additional Parameters
16829 ///
16830 /// * *$.xgafv* (query-string) - V1 error format.
16831 /// * *access_token* (query-string) - OAuth access token.
16832 /// * *alt* (query-string) - Data format for response.
16833 /// * *callback* (query-string) - JSONP
16834 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16835 /// * *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.
16836 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16837 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16838 /// * *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.
16839 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16840 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16841 pub fn param<T>(
16842 mut self,
16843 name: T,
16844 value: T,
16845 ) -> ProjectLocationGlobalCustomConnectorCreateCall<'a, C>
16846 where
16847 T: AsRef<str>,
16848 {
16849 self._additional_params
16850 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16851 self
16852 }
16853
16854 /// Identifies the authorization scope for the method you are building.
16855 ///
16856 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16857 /// [`Scope::CloudPlatform`].
16858 ///
16859 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16860 /// tokens for more than one scope.
16861 ///
16862 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16863 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16864 /// sufficient, a read-write scope will do as well.
16865 pub fn add_scope<St>(
16866 mut self,
16867 scope: St,
16868 ) -> ProjectLocationGlobalCustomConnectorCreateCall<'a, C>
16869 where
16870 St: AsRef<str>,
16871 {
16872 self._scopes.insert(String::from(scope.as_ref()));
16873 self
16874 }
16875 /// Identifies the authorization scope(s) for the method you are building.
16876 ///
16877 /// See [`Self::add_scope()`] for details.
16878 pub fn add_scopes<I, St>(
16879 mut self,
16880 scopes: I,
16881 ) -> ProjectLocationGlobalCustomConnectorCreateCall<'a, C>
16882 where
16883 I: IntoIterator<Item = St>,
16884 St: AsRef<str>,
16885 {
16886 self._scopes
16887 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16888 self
16889 }
16890
16891 /// Removes all scopes, and no default scope will be used either.
16892 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16893 /// for details).
16894 pub fn clear_scopes(mut self) -> ProjectLocationGlobalCustomConnectorCreateCall<'a, C> {
16895 self._scopes.clear();
16896 self
16897 }
16898}
16899
16900/// Deletes a single CustomConnector.
16901///
16902/// A builder for the *locations.global.customConnectors.delete* method supported by a *project* resource.
16903/// It is not used directly, but through a [`ProjectMethods`] instance.
16904///
16905/// # Example
16906///
16907/// Instantiate a resource method builder
16908///
16909/// ```test_harness,no_run
16910/// # extern crate hyper;
16911/// # extern crate hyper_rustls;
16912/// # extern crate google_connectors1 as connectors1;
16913/// # async fn dox() {
16914/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16915///
16916/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16917/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16918/// # secret,
16919/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16920/// # ).build().await.unwrap();
16921///
16922/// # let client = hyper_util::client::legacy::Client::builder(
16923/// # hyper_util::rt::TokioExecutor::new()
16924/// # )
16925/// # .build(
16926/// # hyper_rustls::HttpsConnectorBuilder::new()
16927/// # .with_native_roots()
16928/// # .unwrap()
16929/// # .https_or_http()
16930/// # .enable_http1()
16931/// # .build()
16932/// # );
16933/// # let mut hub = Connectors::new(client, auth);
16934/// // You can configure optional parameters by calling the respective setters at will, and
16935/// // execute the final call using `doit()`.
16936/// // Values shown here are possibly random and not representative !
16937/// let result = hub.projects().locations_global_custom_connectors_delete("name")
16938/// .force(true)
16939/// .doit().await;
16940/// # }
16941/// ```
16942pub struct ProjectLocationGlobalCustomConnectorDeleteCall<'a, C>
16943where
16944 C: 'a,
16945{
16946 hub: &'a Connectors<C>,
16947 _name: String,
16948 _force: Option<bool>,
16949 _delegate: Option<&'a mut dyn common::Delegate>,
16950 _additional_params: HashMap<String, String>,
16951 _scopes: BTreeSet<String>,
16952}
16953
16954impl<'a, C> common::CallBuilder for ProjectLocationGlobalCustomConnectorDeleteCall<'a, C> {}
16955
16956impl<'a, C> ProjectLocationGlobalCustomConnectorDeleteCall<'a, C>
16957where
16958 C: common::Connector,
16959{
16960 /// Perform the operation you have build so far.
16961 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
16962 use std::borrow::Cow;
16963 use std::io::{Read, Seek};
16964
16965 use common::{url::Params, ToParts};
16966 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16967
16968 let mut dd = common::DefaultDelegate;
16969 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16970 dlg.begin(common::MethodInfo {
16971 id: "connectors.projects.locations.global.customConnectors.delete",
16972 http_method: hyper::Method::DELETE,
16973 });
16974
16975 for &field in ["alt", "name", "force"].iter() {
16976 if self._additional_params.contains_key(field) {
16977 dlg.finished(false);
16978 return Err(common::Error::FieldClash(field));
16979 }
16980 }
16981
16982 let mut params = Params::with_capacity(4 + self._additional_params.len());
16983 params.push("name", self._name);
16984 if let Some(value) = self._force.as_ref() {
16985 params.push("force", value.to_string());
16986 }
16987
16988 params.extend(self._additional_params.iter());
16989
16990 params.push("alt", "json");
16991 let mut url = self.hub._base_url.clone() + "v1/{+name}";
16992 if self._scopes.is_empty() {
16993 self._scopes
16994 .insert(Scope::CloudPlatform.as_ref().to_string());
16995 }
16996
16997 #[allow(clippy::single_element_loop)]
16998 for &(find_this, param_name) in [("{+name}", "name")].iter() {
16999 url = params.uri_replacement(url, param_name, find_this, true);
17000 }
17001 {
17002 let to_remove = ["name"];
17003 params.remove_params(&to_remove);
17004 }
17005
17006 let url = params.parse_with_url(&url);
17007
17008 loop {
17009 let token = match self
17010 .hub
17011 .auth
17012 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17013 .await
17014 {
17015 Ok(token) => token,
17016 Err(e) => match dlg.token(e) {
17017 Ok(token) => token,
17018 Err(e) => {
17019 dlg.finished(false);
17020 return Err(common::Error::MissingToken(e));
17021 }
17022 },
17023 };
17024 let mut req_result = {
17025 let client = &self.hub.client;
17026 dlg.pre_request();
17027 let mut req_builder = hyper::Request::builder()
17028 .method(hyper::Method::DELETE)
17029 .uri(url.as_str())
17030 .header(USER_AGENT, self.hub._user_agent.clone());
17031
17032 if let Some(token) = token.as_ref() {
17033 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17034 }
17035
17036 let request = req_builder
17037 .header(CONTENT_LENGTH, 0_u64)
17038 .body(common::to_body::<String>(None));
17039
17040 client.request(request.unwrap()).await
17041 };
17042
17043 match req_result {
17044 Err(err) => {
17045 if let common::Retry::After(d) = dlg.http_error(&err) {
17046 sleep(d).await;
17047 continue;
17048 }
17049 dlg.finished(false);
17050 return Err(common::Error::HttpError(err));
17051 }
17052 Ok(res) => {
17053 let (mut parts, body) = res.into_parts();
17054 let mut body = common::Body::new(body);
17055 if !parts.status.is_success() {
17056 let bytes = common::to_bytes(body).await.unwrap_or_default();
17057 let error = serde_json::from_str(&common::to_string(&bytes));
17058 let response = common::to_response(parts, bytes.into());
17059
17060 if let common::Retry::After(d) =
17061 dlg.http_failure(&response, error.as_ref().ok())
17062 {
17063 sleep(d).await;
17064 continue;
17065 }
17066
17067 dlg.finished(false);
17068
17069 return Err(match error {
17070 Ok(value) => common::Error::BadRequest(value),
17071 _ => common::Error::Failure(response),
17072 });
17073 }
17074 let response = {
17075 let bytes = common::to_bytes(body).await.unwrap_or_default();
17076 let encoded = common::to_string(&bytes);
17077 match serde_json::from_str(&encoded) {
17078 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17079 Err(error) => {
17080 dlg.response_json_decode_error(&encoded, &error);
17081 return Err(common::Error::JsonDecodeError(
17082 encoded.to_string(),
17083 error,
17084 ));
17085 }
17086 }
17087 };
17088
17089 dlg.finished(true);
17090 return Ok(response);
17091 }
17092 }
17093 }
17094 }
17095
17096 /// Required. Resource name of the form: `projects/{project}/locations/{location}/customConnectors/{connector}`
17097 ///
17098 /// Sets the *name* path property to the given value.
17099 ///
17100 /// Even though the property as already been set when instantiating this call,
17101 /// we provide this method for API completeness.
17102 pub fn name(
17103 mut self,
17104 new_value: &str,
17105 ) -> ProjectLocationGlobalCustomConnectorDeleteCall<'a, C> {
17106 self._name = new_value.to_string();
17107 self
17108 }
17109 /// Optional. If set to true, any customConnectorVersion which is a child resource will also be deleted. https://aip.dev/135#cascading-delete
17110 ///
17111 /// Sets the *force* query property to the given value.
17112 pub fn force(
17113 mut self,
17114 new_value: bool,
17115 ) -> ProjectLocationGlobalCustomConnectorDeleteCall<'a, C> {
17116 self._force = Some(new_value);
17117 self
17118 }
17119 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17120 /// while executing the actual API request.
17121 ///
17122 /// ````text
17123 /// It should be used to handle progress information, and to implement a certain level of resilience.
17124 /// ````
17125 ///
17126 /// Sets the *delegate* property to the given value.
17127 pub fn delegate(
17128 mut self,
17129 new_value: &'a mut dyn common::Delegate,
17130 ) -> ProjectLocationGlobalCustomConnectorDeleteCall<'a, C> {
17131 self._delegate = Some(new_value);
17132 self
17133 }
17134
17135 /// Set any additional parameter of the query string used in the request.
17136 /// It should be used to set parameters which are not yet available through their own
17137 /// setters.
17138 ///
17139 /// Please note that this method must not be used to set any of the known parameters
17140 /// which have their own setter method. If done anyway, the request will fail.
17141 ///
17142 /// # Additional Parameters
17143 ///
17144 /// * *$.xgafv* (query-string) - V1 error format.
17145 /// * *access_token* (query-string) - OAuth access token.
17146 /// * *alt* (query-string) - Data format for response.
17147 /// * *callback* (query-string) - JSONP
17148 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17149 /// * *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.
17150 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17151 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17152 /// * *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.
17153 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17154 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17155 pub fn param<T>(
17156 mut self,
17157 name: T,
17158 value: T,
17159 ) -> ProjectLocationGlobalCustomConnectorDeleteCall<'a, C>
17160 where
17161 T: AsRef<str>,
17162 {
17163 self._additional_params
17164 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17165 self
17166 }
17167
17168 /// Identifies the authorization scope for the method you are building.
17169 ///
17170 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17171 /// [`Scope::CloudPlatform`].
17172 ///
17173 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17174 /// tokens for more than one scope.
17175 ///
17176 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17177 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17178 /// sufficient, a read-write scope will do as well.
17179 pub fn add_scope<St>(
17180 mut self,
17181 scope: St,
17182 ) -> ProjectLocationGlobalCustomConnectorDeleteCall<'a, C>
17183 where
17184 St: AsRef<str>,
17185 {
17186 self._scopes.insert(String::from(scope.as_ref()));
17187 self
17188 }
17189 /// Identifies the authorization scope(s) for the method you are building.
17190 ///
17191 /// See [`Self::add_scope()`] for details.
17192 pub fn add_scopes<I, St>(
17193 mut self,
17194 scopes: I,
17195 ) -> ProjectLocationGlobalCustomConnectorDeleteCall<'a, C>
17196 where
17197 I: IntoIterator<Item = St>,
17198 St: AsRef<str>,
17199 {
17200 self._scopes
17201 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17202 self
17203 }
17204
17205 /// Removes all scopes, and no default scope will be used either.
17206 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17207 /// for details).
17208 pub fn clear_scopes(mut self) -> ProjectLocationGlobalCustomConnectorDeleteCall<'a, C> {
17209 self._scopes.clear();
17210 self
17211 }
17212}
17213
17214/// Gets details of a single CustomConnector.
17215///
17216/// A builder for the *locations.global.customConnectors.get* method supported by a *project* resource.
17217/// It is not used directly, but through a [`ProjectMethods`] instance.
17218///
17219/// # Example
17220///
17221/// Instantiate a resource method builder
17222///
17223/// ```test_harness,no_run
17224/// # extern crate hyper;
17225/// # extern crate hyper_rustls;
17226/// # extern crate google_connectors1 as connectors1;
17227/// # async fn dox() {
17228/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17229///
17230/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17231/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17232/// # secret,
17233/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17234/// # ).build().await.unwrap();
17235///
17236/// # let client = hyper_util::client::legacy::Client::builder(
17237/// # hyper_util::rt::TokioExecutor::new()
17238/// # )
17239/// # .build(
17240/// # hyper_rustls::HttpsConnectorBuilder::new()
17241/// # .with_native_roots()
17242/// # .unwrap()
17243/// # .https_or_http()
17244/// # .enable_http1()
17245/// # .build()
17246/// # );
17247/// # let mut hub = Connectors::new(client, auth);
17248/// // You can configure optional parameters by calling the respective setters at will, and
17249/// // execute the final call using `doit()`.
17250/// // Values shown here are possibly random and not representative !
17251/// let result = hub.projects().locations_global_custom_connectors_get("name")
17252/// .doit().await;
17253/// # }
17254/// ```
17255pub struct ProjectLocationGlobalCustomConnectorGetCall<'a, C>
17256where
17257 C: 'a,
17258{
17259 hub: &'a Connectors<C>,
17260 _name: String,
17261 _delegate: Option<&'a mut dyn common::Delegate>,
17262 _additional_params: HashMap<String, String>,
17263 _scopes: BTreeSet<String>,
17264}
17265
17266impl<'a, C> common::CallBuilder for ProjectLocationGlobalCustomConnectorGetCall<'a, C> {}
17267
17268impl<'a, C> ProjectLocationGlobalCustomConnectorGetCall<'a, C>
17269where
17270 C: common::Connector,
17271{
17272 /// Perform the operation you have build so far.
17273 pub async fn doit(mut self) -> common::Result<(common::Response, CustomConnector)> {
17274 use std::borrow::Cow;
17275 use std::io::{Read, Seek};
17276
17277 use common::{url::Params, ToParts};
17278 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17279
17280 let mut dd = common::DefaultDelegate;
17281 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17282 dlg.begin(common::MethodInfo {
17283 id: "connectors.projects.locations.global.customConnectors.get",
17284 http_method: hyper::Method::GET,
17285 });
17286
17287 for &field in ["alt", "name"].iter() {
17288 if self._additional_params.contains_key(field) {
17289 dlg.finished(false);
17290 return Err(common::Error::FieldClash(field));
17291 }
17292 }
17293
17294 let mut params = Params::with_capacity(3 + self._additional_params.len());
17295 params.push("name", self._name);
17296
17297 params.extend(self._additional_params.iter());
17298
17299 params.push("alt", "json");
17300 let mut url = self.hub._base_url.clone() + "v1/{+name}";
17301 if self._scopes.is_empty() {
17302 self._scopes
17303 .insert(Scope::CloudPlatform.as_ref().to_string());
17304 }
17305
17306 #[allow(clippy::single_element_loop)]
17307 for &(find_this, param_name) in [("{+name}", "name")].iter() {
17308 url = params.uri_replacement(url, param_name, find_this, true);
17309 }
17310 {
17311 let to_remove = ["name"];
17312 params.remove_params(&to_remove);
17313 }
17314
17315 let url = params.parse_with_url(&url);
17316
17317 loop {
17318 let token = match self
17319 .hub
17320 .auth
17321 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17322 .await
17323 {
17324 Ok(token) => token,
17325 Err(e) => match dlg.token(e) {
17326 Ok(token) => token,
17327 Err(e) => {
17328 dlg.finished(false);
17329 return Err(common::Error::MissingToken(e));
17330 }
17331 },
17332 };
17333 let mut req_result = {
17334 let client = &self.hub.client;
17335 dlg.pre_request();
17336 let mut req_builder = hyper::Request::builder()
17337 .method(hyper::Method::GET)
17338 .uri(url.as_str())
17339 .header(USER_AGENT, self.hub._user_agent.clone());
17340
17341 if let Some(token) = token.as_ref() {
17342 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17343 }
17344
17345 let request = req_builder
17346 .header(CONTENT_LENGTH, 0_u64)
17347 .body(common::to_body::<String>(None));
17348
17349 client.request(request.unwrap()).await
17350 };
17351
17352 match req_result {
17353 Err(err) => {
17354 if let common::Retry::After(d) = dlg.http_error(&err) {
17355 sleep(d).await;
17356 continue;
17357 }
17358 dlg.finished(false);
17359 return Err(common::Error::HttpError(err));
17360 }
17361 Ok(res) => {
17362 let (mut parts, body) = res.into_parts();
17363 let mut body = common::Body::new(body);
17364 if !parts.status.is_success() {
17365 let bytes = common::to_bytes(body).await.unwrap_or_default();
17366 let error = serde_json::from_str(&common::to_string(&bytes));
17367 let response = common::to_response(parts, bytes.into());
17368
17369 if let common::Retry::After(d) =
17370 dlg.http_failure(&response, error.as_ref().ok())
17371 {
17372 sleep(d).await;
17373 continue;
17374 }
17375
17376 dlg.finished(false);
17377
17378 return Err(match error {
17379 Ok(value) => common::Error::BadRequest(value),
17380 _ => common::Error::Failure(response),
17381 });
17382 }
17383 let response = {
17384 let bytes = common::to_bytes(body).await.unwrap_or_default();
17385 let encoded = common::to_string(&bytes);
17386 match serde_json::from_str(&encoded) {
17387 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17388 Err(error) => {
17389 dlg.response_json_decode_error(&encoded, &error);
17390 return Err(common::Error::JsonDecodeError(
17391 encoded.to_string(),
17392 error,
17393 ));
17394 }
17395 }
17396 };
17397
17398 dlg.finished(true);
17399 return Ok(response);
17400 }
17401 }
17402 }
17403 }
17404
17405 /// Required. Resource name of the form: `projects/*/locations/*/customConnectors/*`
17406 ///
17407 /// Sets the *name* path property to the given value.
17408 ///
17409 /// Even though the property as already been set when instantiating this call,
17410 /// we provide this method for API completeness.
17411 pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalCustomConnectorGetCall<'a, C> {
17412 self._name = new_value.to_string();
17413 self
17414 }
17415 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17416 /// while executing the actual API request.
17417 ///
17418 /// ````text
17419 /// It should be used to handle progress information, and to implement a certain level of resilience.
17420 /// ````
17421 ///
17422 /// Sets the *delegate* property to the given value.
17423 pub fn delegate(
17424 mut self,
17425 new_value: &'a mut dyn common::Delegate,
17426 ) -> ProjectLocationGlobalCustomConnectorGetCall<'a, C> {
17427 self._delegate = Some(new_value);
17428 self
17429 }
17430
17431 /// Set any additional parameter of the query string used in the request.
17432 /// It should be used to set parameters which are not yet available through their own
17433 /// setters.
17434 ///
17435 /// Please note that this method must not be used to set any of the known parameters
17436 /// which have their own setter method. If done anyway, the request will fail.
17437 ///
17438 /// # Additional Parameters
17439 ///
17440 /// * *$.xgafv* (query-string) - V1 error format.
17441 /// * *access_token* (query-string) - OAuth access token.
17442 /// * *alt* (query-string) - Data format for response.
17443 /// * *callback* (query-string) - JSONP
17444 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17445 /// * *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.
17446 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17447 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17448 /// * *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.
17449 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17450 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17451 pub fn param<T>(
17452 mut self,
17453 name: T,
17454 value: T,
17455 ) -> ProjectLocationGlobalCustomConnectorGetCall<'a, C>
17456 where
17457 T: AsRef<str>,
17458 {
17459 self._additional_params
17460 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17461 self
17462 }
17463
17464 /// Identifies the authorization scope for the method you are building.
17465 ///
17466 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17467 /// [`Scope::CloudPlatform`].
17468 ///
17469 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17470 /// tokens for more than one scope.
17471 ///
17472 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17473 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17474 /// sufficient, a read-write scope will do as well.
17475 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalCustomConnectorGetCall<'a, C>
17476 where
17477 St: AsRef<str>,
17478 {
17479 self._scopes.insert(String::from(scope.as_ref()));
17480 self
17481 }
17482 /// Identifies the authorization scope(s) for the method you are building.
17483 ///
17484 /// See [`Self::add_scope()`] for details.
17485 pub fn add_scopes<I, St>(
17486 mut self,
17487 scopes: I,
17488 ) -> ProjectLocationGlobalCustomConnectorGetCall<'a, C>
17489 where
17490 I: IntoIterator<Item = St>,
17491 St: AsRef<str>,
17492 {
17493 self._scopes
17494 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17495 self
17496 }
17497
17498 /// Removes all scopes, and no default scope will be used either.
17499 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17500 /// for details).
17501 pub fn clear_scopes(mut self) -> ProjectLocationGlobalCustomConnectorGetCall<'a, C> {
17502 self._scopes.clear();
17503 self
17504 }
17505}
17506
17507/// List CustomConnectorVersions in a given project
17508///
17509/// A builder for the *locations.global.customConnectors.list* method supported by a *project* resource.
17510/// It is not used directly, but through a [`ProjectMethods`] instance.
17511///
17512/// # Example
17513///
17514/// Instantiate a resource method builder
17515///
17516/// ```test_harness,no_run
17517/// # extern crate hyper;
17518/// # extern crate hyper_rustls;
17519/// # extern crate google_connectors1 as connectors1;
17520/// # async fn dox() {
17521/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17522///
17523/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17524/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17525/// # secret,
17526/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17527/// # ).build().await.unwrap();
17528///
17529/// # let client = hyper_util::client::legacy::Client::builder(
17530/// # hyper_util::rt::TokioExecutor::new()
17531/// # )
17532/// # .build(
17533/// # hyper_rustls::HttpsConnectorBuilder::new()
17534/// # .with_native_roots()
17535/// # .unwrap()
17536/// # .https_or_http()
17537/// # .enable_http1()
17538/// # .build()
17539/// # );
17540/// # let mut hub = Connectors::new(client, auth);
17541/// // You can configure optional parameters by calling the respective setters at will, and
17542/// // execute the final call using `doit()`.
17543/// // Values shown here are possibly random and not representative !
17544/// let result = hub.projects().locations_global_custom_connectors_list("parent")
17545/// .page_token("voluptua.")
17546/// .page_size(-34)
17547/// .filter("dolore")
17548/// .doit().await;
17549/// # }
17550/// ```
17551pub struct ProjectLocationGlobalCustomConnectorListCall<'a, C>
17552where
17553 C: 'a,
17554{
17555 hub: &'a Connectors<C>,
17556 _parent: String,
17557 _page_token: Option<String>,
17558 _page_size: Option<i32>,
17559 _filter: Option<String>,
17560 _delegate: Option<&'a mut dyn common::Delegate>,
17561 _additional_params: HashMap<String, String>,
17562 _scopes: BTreeSet<String>,
17563}
17564
17565impl<'a, C> common::CallBuilder for ProjectLocationGlobalCustomConnectorListCall<'a, C> {}
17566
17567impl<'a, C> ProjectLocationGlobalCustomConnectorListCall<'a, C>
17568where
17569 C: common::Connector,
17570{
17571 /// Perform the operation you have build so far.
17572 pub async fn doit(
17573 mut self,
17574 ) -> common::Result<(common::Response, ListCustomConnectorsResponse)> {
17575 use std::borrow::Cow;
17576 use std::io::{Read, Seek};
17577
17578 use common::{url::Params, ToParts};
17579 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17580
17581 let mut dd = common::DefaultDelegate;
17582 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17583 dlg.begin(common::MethodInfo {
17584 id: "connectors.projects.locations.global.customConnectors.list",
17585 http_method: hyper::Method::GET,
17586 });
17587
17588 for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
17589 if self._additional_params.contains_key(field) {
17590 dlg.finished(false);
17591 return Err(common::Error::FieldClash(field));
17592 }
17593 }
17594
17595 let mut params = Params::with_capacity(6 + self._additional_params.len());
17596 params.push("parent", self._parent);
17597 if let Some(value) = self._page_token.as_ref() {
17598 params.push("pageToken", value);
17599 }
17600 if let Some(value) = self._page_size.as_ref() {
17601 params.push("pageSize", value.to_string());
17602 }
17603 if let Some(value) = self._filter.as_ref() {
17604 params.push("filter", value);
17605 }
17606
17607 params.extend(self._additional_params.iter());
17608
17609 params.push("alt", "json");
17610 let mut url = self.hub._base_url.clone() + "v1/{+parent}/customConnectors";
17611 if self._scopes.is_empty() {
17612 self._scopes
17613 .insert(Scope::CloudPlatform.as_ref().to_string());
17614 }
17615
17616 #[allow(clippy::single_element_loop)]
17617 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
17618 url = params.uri_replacement(url, param_name, find_this, true);
17619 }
17620 {
17621 let to_remove = ["parent"];
17622 params.remove_params(&to_remove);
17623 }
17624
17625 let url = params.parse_with_url(&url);
17626
17627 loop {
17628 let token = match self
17629 .hub
17630 .auth
17631 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17632 .await
17633 {
17634 Ok(token) => token,
17635 Err(e) => match dlg.token(e) {
17636 Ok(token) => token,
17637 Err(e) => {
17638 dlg.finished(false);
17639 return Err(common::Error::MissingToken(e));
17640 }
17641 },
17642 };
17643 let mut req_result = {
17644 let client = &self.hub.client;
17645 dlg.pre_request();
17646 let mut req_builder = hyper::Request::builder()
17647 .method(hyper::Method::GET)
17648 .uri(url.as_str())
17649 .header(USER_AGENT, self.hub._user_agent.clone());
17650
17651 if let Some(token) = token.as_ref() {
17652 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17653 }
17654
17655 let request = req_builder
17656 .header(CONTENT_LENGTH, 0_u64)
17657 .body(common::to_body::<String>(None));
17658
17659 client.request(request.unwrap()).await
17660 };
17661
17662 match req_result {
17663 Err(err) => {
17664 if let common::Retry::After(d) = dlg.http_error(&err) {
17665 sleep(d).await;
17666 continue;
17667 }
17668 dlg.finished(false);
17669 return Err(common::Error::HttpError(err));
17670 }
17671 Ok(res) => {
17672 let (mut parts, body) = res.into_parts();
17673 let mut body = common::Body::new(body);
17674 if !parts.status.is_success() {
17675 let bytes = common::to_bytes(body).await.unwrap_or_default();
17676 let error = serde_json::from_str(&common::to_string(&bytes));
17677 let response = common::to_response(parts, bytes.into());
17678
17679 if let common::Retry::After(d) =
17680 dlg.http_failure(&response, error.as_ref().ok())
17681 {
17682 sleep(d).await;
17683 continue;
17684 }
17685
17686 dlg.finished(false);
17687
17688 return Err(match error {
17689 Ok(value) => common::Error::BadRequest(value),
17690 _ => common::Error::Failure(response),
17691 });
17692 }
17693 let response = {
17694 let bytes = common::to_bytes(body).await.unwrap_or_default();
17695 let encoded = common::to_string(&bytes);
17696 match serde_json::from_str(&encoded) {
17697 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17698 Err(error) => {
17699 dlg.response_json_decode_error(&encoded, &error);
17700 return Err(common::Error::JsonDecodeError(
17701 encoded.to_string(),
17702 error,
17703 ));
17704 }
17705 }
17706 };
17707
17708 dlg.finished(true);
17709 return Ok(response);
17710 }
17711 }
17712 }
17713 }
17714
17715 /// Required. Parent resource of the custom connectors, of the form: `projects/*/locations/*` Only global location is supported for CustomConnector resource.
17716 ///
17717 /// Sets the *parent* path property to the given value.
17718 ///
17719 /// Even though the property as already been set when instantiating this call,
17720 /// we provide this method for API completeness.
17721 pub fn parent(
17722 mut self,
17723 new_value: &str,
17724 ) -> ProjectLocationGlobalCustomConnectorListCall<'a, C> {
17725 self._parent = new_value.to_string();
17726 self
17727 }
17728 /// Page token.
17729 ///
17730 /// Sets the *page token* query property to the given value.
17731 pub fn page_token(
17732 mut self,
17733 new_value: &str,
17734 ) -> ProjectLocationGlobalCustomConnectorListCall<'a, C> {
17735 self._page_token = Some(new_value.to_string());
17736 self
17737 }
17738 /// Page size.
17739 ///
17740 /// Sets the *page size* query property to the given value.
17741 pub fn page_size(
17742 mut self,
17743 new_value: i32,
17744 ) -> ProjectLocationGlobalCustomConnectorListCall<'a, C> {
17745 self._page_size = Some(new_value);
17746 self
17747 }
17748 /// Filter string.
17749 ///
17750 /// Sets the *filter* query property to the given value.
17751 pub fn filter(
17752 mut self,
17753 new_value: &str,
17754 ) -> ProjectLocationGlobalCustomConnectorListCall<'a, C> {
17755 self._filter = Some(new_value.to_string());
17756 self
17757 }
17758 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17759 /// while executing the actual API request.
17760 ///
17761 /// ````text
17762 /// It should be used to handle progress information, and to implement a certain level of resilience.
17763 /// ````
17764 ///
17765 /// Sets the *delegate* property to the given value.
17766 pub fn delegate(
17767 mut self,
17768 new_value: &'a mut dyn common::Delegate,
17769 ) -> ProjectLocationGlobalCustomConnectorListCall<'a, C> {
17770 self._delegate = Some(new_value);
17771 self
17772 }
17773
17774 /// Set any additional parameter of the query string used in the request.
17775 /// It should be used to set parameters which are not yet available through their own
17776 /// setters.
17777 ///
17778 /// Please note that this method must not be used to set any of the known parameters
17779 /// which have their own setter method. If done anyway, the request will fail.
17780 ///
17781 /// # Additional Parameters
17782 ///
17783 /// * *$.xgafv* (query-string) - V1 error format.
17784 /// * *access_token* (query-string) - OAuth access token.
17785 /// * *alt* (query-string) - Data format for response.
17786 /// * *callback* (query-string) - JSONP
17787 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17788 /// * *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.
17789 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17790 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17791 /// * *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.
17792 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17793 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17794 pub fn param<T>(
17795 mut self,
17796 name: T,
17797 value: T,
17798 ) -> ProjectLocationGlobalCustomConnectorListCall<'a, C>
17799 where
17800 T: AsRef<str>,
17801 {
17802 self._additional_params
17803 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17804 self
17805 }
17806
17807 /// Identifies the authorization scope for the method you are building.
17808 ///
17809 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17810 /// [`Scope::CloudPlatform`].
17811 ///
17812 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17813 /// tokens for more than one scope.
17814 ///
17815 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17816 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17817 /// sufficient, a read-write scope will do as well.
17818 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalCustomConnectorListCall<'a, C>
17819 where
17820 St: AsRef<str>,
17821 {
17822 self._scopes.insert(String::from(scope.as_ref()));
17823 self
17824 }
17825 /// Identifies the authorization scope(s) for the method you are building.
17826 ///
17827 /// See [`Self::add_scope()`] for details.
17828 pub fn add_scopes<I, St>(
17829 mut self,
17830 scopes: I,
17831 ) -> ProjectLocationGlobalCustomConnectorListCall<'a, C>
17832 where
17833 I: IntoIterator<Item = St>,
17834 St: AsRef<str>,
17835 {
17836 self._scopes
17837 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17838 self
17839 }
17840
17841 /// Removes all scopes, and no default scope will be used either.
17842 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17843 /// for details).
17844 pub fn clear_scopes(mut self) -> ProjectLocationGlobalCustomConnectorListCall<'a, C> {
17845 self._scopes.clear();
17846 self
17847 }
17848}
17849
17850/// Updates the parameters of a CustomConnector.
17851///
17852/// A builder for the *locations.global.customConnectors.patch* method supported by a *project* resource.
17853/// It is not used directly, but through a [`ProjectMethods`] instance.
17854///
17855/// # Example
17856///
17857/// Instantiate a resource method builder
17858///
17859/// ```test_harness,no_run
17860/// # extern crate hyper;
17861/// # extern crate hyper_rustls;
17862/// # extern crate google_connectors1 as connectors1;
17863/// use connectors1::api::CustomConnector;
17864/// # async fn dox() {
17865/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17866///
17867/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17868/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17869/// # secret,
17870/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17871/// # ).build().await.unwrap();
17872///
17873/// # let client = hyper_util::client::legacy::Client::builder(
17874/// # hyper_util::rt::TokioExecutor::new()
17875/// # )
17876/// # .build(
17877/// # hyper_rustls::HttpsConnectorBuilder::new()
17878/// # .with_native_roots()
17879/// # .unwrap()
17880/// # .https_or_http()
17881/// # .enable_http1()
17882/// # .build()
17883/// # );
17884/// # let mut hub = Connectors::new(client, auth);
17885/// // As the method needs a request, you would usually fill it with the desired information
17886/// // into the respective structure. Some of the parts shown here might not be applicable !
17887/// // Values shown here are possibly random and not representative !
17888/// let mut req = CustomConnector::default();
17889///
17890/// // You can configure optional parameters by calling the respective setters at will, and
17891/// // execute the final call using `doit()`.
17892/// // Values shown here are possibly random and not representative !
17893/// let result = hub.projects().locations_global_custom_connectors_patch(req, "name")
17894/// .update_mask(FieldMask::new::<&str>(&[]))
17895/// .doit().await;
17896/// # }
17897/// ```
17898pub struct ProjectLocationGlobalCustomConnectorPatchCall<'a, C>
17899where
17900 C: 'a,
17901{
17902 hub: &'a Connectors<C>,
17903 _request: CustomConnector,
17904 _name: String,
17905 _update_mask: Option<common::FieldMask>,
17906 _delegate: Option<&'a mut dyn common::Delegate>,
17907 _additional_params: HashMap<String, String>,
17908 _scopes: BTreeSet<String>,
17909}
17910
17911impl<'a, C> common::CallBuilder for ProjectLocationGlobalCustomConnectorPatchCall<'a, C> {}
17912
17913impl<'a, C> ProjectLocationGlobalCustomConnectorPatchCall<'a, C>
17914where
17915 C: common::Connector,
17916{
17917 /// Perform the operation you have build so far.
17918 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
17919 use std::borrow::Cow;
17920 use std::io::{Read, Seek};
17921
17922 use common::{url::Params, ToParts};
17923 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17924
17925 let mut dd = common::DefaultDelegate;
17926 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17927 dlg.begin(common::MethodInfo {
17928 id: "connectors.projects.locations.global.customConnectors.patch",
17929 http_method: hyper::Method::PATCH,
17930 });
17931
17932 for &field in ["alt", "name", "updateMask"].iter() {
17933 if self._additional_params.contains_key(field) {
17934 dlg.finished(false);
17935 return Err(common::Error::FieldClash(field));
17936 }
17937 }
17938
17939 let mut params = Params::with_capacity(5 + self._additional_params.len());
17940 params.push("name", self._name);
17941 if let Some(value) = self._update_mask.as_ref() {
17942 params.push("updateMask", value.to_string());
17943 }
17944
17945 params.extend(self._additional_params.iter());
17946
17947 params.push("alt", "json");
17948 let mut url = self.hub._base_url.clone() + "v1/{+name}";
17949 if self._scopes.is_empty() {
17950 self._scopes
17951 .insert(Scope::CloudPlatform.as_ref().to_string());
17952 }
17953
17954 #[allow(clippy::single_element_loop)]
17955 for &(find_this, param_name) in [("{+name}", "name")].iter() {
17956 url = params.uri_replacement(url, param_name, find_this, true);
17957 }
17958 {
17959 let to_remove = ["name"];
17960 params.remove_params(&to_remove);
17961 }
17962
17963 let url = params.parse_with_url(&url);
17964
17965 let mut json_mime_type = mime::APPLICATION_JSON;
17966 let mut request_value_reader = {
17967 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17968 common::remove_json_null_values(&mut value);
17969 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17970 serde_json::to_writer(&mut dst, &value).unwrap();
17971 dst
17972 };
17973 let request_size = request_value_reader
17974 .seek(std::io::SeekFrom::End(0))
17975 .unwrap();
17976 request_value_reader
17977 .seek(std::io::SeekFrom::Start(0))
17978 .unwrap();
17979
17980 loop {
17981 let token = match self
17982 .hub
17983 .auth
17984 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17985 .await
17986 {
17987 Ok(token) => token,
17988 Err(e) => match dlg.token(e) {
17989 Ok(token) => token,
17990 Err(e) => {
17991 dlg.finished(false);
17992 return Err(common::Error::MissingToken(e));
17993 }
17994 },
17995 };
17996 request_value_reader
17997 .seek(std::io::SeekFrom::Start(0))
17998 .unwrap();
17999 let mut req_result = {
18000 let client = &self.hub.client;
18001 dlg.pre_request();
18002 let mut req_builder = hyper::Request::builder()
18003 .method(hyper::Method::PATCH)
18004 .uri(url.as_str())
18005 .header(USER_AGENT, self.hub._user_agent.clone());
18006
18007 if let Some(token) = token.as_ref() {
18008 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18009 }
18010
18011 let request = req_builder
18012 .header(CONTENT_TYPE, json_mime_type.to_string())
18013 .header(CONTENT_LENGTH, request_size as u64)
18014 .body(common::to_body(
18015 request_value_reader.get_ref().clone().into(),
18016 ));
18017
18018 client.request(request.unwrap()).await
18019 };
18020
18021 match req_result {
18022 Err(err) => {
18023 if let common::Retry::After(d) = dlg.http_error(&err) {
18024 sleep(d).await;
18025 continue;
18026 }
18027 dlg.finished(false);
18028 return Err(common::Error::HttpError(err));
18029 }
18030 Ok(res) => {
18031 let (mut parts, body) = res.into_parts();
18032 let mut body = common::Body::new(body);
18033 if !parts.status.is_success() {
18034 let bytes = common::to_bytes(body).await.unwrap_or_default();
18035 let error = serde_json::from_str(&common::to_string(&bytes));
18036 let response = common::to_response(parts, bytes.into());
18037
18038 if let common::Retry::After(d) =
18039 dlg.http_failure(&response, error.as_ref().ok())
18040 {
18041 sleep(d).await;
18042 continue;
18043 }
18044
18045 dlg.finished(false);
18046
18047 return Err(match error {
18048 Ok(value) => common::Error::BadRequest(value),
18049 _ => common::Error::Failure(response),
18050 });
18051 }
18052 let response = {
18053 let bytes = common::to_bytes(body).await.unwrap_or_default();
18054 let encoded = common::to_string(&bytes);
18055 match serde_json::from_str(&encoded) {
18056 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18057 Err(error) => {
18058 dlg.response_json_decode_error(&encoded, &error);
18059 return Err(common::Error::JsonDecodeError(
18060 encoded.to_string(),
18061 error,
18062 ));
18063 }
18064 }
18065 };
18066
18067 dlg.finished(true);
18068 return Ok(response);
18069 }
18070 }
18071 }
18072 }
18073
18074 ///
18075 /// Sets the *request* property to the given value.
18076 ///
18077 /// Even though the property as already been set when instantiating this call,
18078 /// we provide this method for API completeness.
18079 pub fn request(
18080 mut self,
18081 new_value: CustomConnector,
18082 ) -> ProjectLocationGlobalCustomConnectorPatchCall<'a, C> {
18083 self._request = new_value;
18084 self
18085 }
18086 /// Identifier. Resource name of the CustomConnector. Format: projects/{project}/locations/{location}/customConnectors/{connector}
18087 ///
18088 /// Sets the *name* path property to the given value.
18089 ///
18090 /// Even though the property as already been set when instantiating this call,
18091 /// we provide this method for API completeness.
18092 pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalCustomConnectorPatchCall<'a, C> {
18093 self._name = new_value.to_string();
18094 self
18095 }
18096 /// 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.
18097 ///
18098 /// Sets the *update mask* query property to the given value.
18099 pub fn update_mask(
18100 mut self,
18101 new_value: common::FieldMask,
18102 ) -> ProjectLocationGlobalCustomConnectorPatchCall<'a, C> {
18103 self._update_mask = Some(new_value);
18104 self
18105 }
18106 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18107 /// while executing the actual API request.
18108 ///
18109 /// ````text
18110 /// It should be used to handle progress information, and to implement a certain level of resilience.
18111 /// ````
18112 ///
18113 /// Sets the *delegate* property to the given value.
18114 pub fn delegate(
18115 mut self,
18116 new_value: &'a mut dyn common::Delegate,
18117 ) -> ProjectLocationGlobalCustomConnectorPatchCall<'a, C> {
18118 self._delegate = Some(new_value);
18119 self
18120 }
18121
18122 /// Set any additional parameter of the query string used in the request.
18123 /// It should be used to set parameters which are not yet available through their own
18124 /// setters.
18125 ///
18126 /// Please note that this method must not be used to set any of the known parameters
18127 /// which have their own setter method. If done anyway, the request will fail.
18128 ///
18129 /// # Additional Parameters
18130 ///
18131 /// * *$.xgafv* (query-string) - V1 error format.
18132 /// * *access_token* (query-string) - OAuth access token.
18133 /// * *alt* (query-string) - Data format for response.
18134 /// * *callback* (query-string) - JSONP
18135 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18136 /// * *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.
18137 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18138 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18139 /// * *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.
18140 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18141 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18142 pub fn param<T>(
18143 mut self,
18144 name: T,
18145 value: T,
18146 ) -> ProjectLocationGlobalCustomConnectorPatchCall<'a, C>
18147 where
18148 T: AsRef<str>,
18149 {
18150 self._additional_params
18151 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18152 self
18153 }
18154
18155 /// Identifies the authorization scope for the method you are building.
18156 ///
18157 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18158 /// [`Scope::CloudPlatform`].
18159 ///
18160 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18161 /// tokens for more than one scope.
18162 ///
18163 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18164 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18165 /// sufficient, a read-write scope will do as well.
18166 pub fn add_scope<St>(
18167 mut self,
18168 scope: St,
18169 ) -> ProjectLocationGlobalCustomConnectorPatchCall<'a, C>
18170 where
18171 St: AsRef<str>,
18172 {
18173 self._scopes.insert(String::from(scope.as_ref()));
18174 self
18175 }
18176 /// Identifies the authorization scope(s) for the method you are building.
18177 ///
18178 /// See [`Self::add_scope()`] for details.
18179 pub fn add_scopes<I, St>(
18180 mut self,
18181 scopes: I,
18182 ) -> ProjectLocationGlobalCustomConnectorPatchCall<'a, C>
18183 where
18184 I: IntoIterator<Item = St>,
18185 St: AsRef<str>,
18186 {
18187 self._scopes
18188 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18189 self
18190 }
18191
18192 /// Removes all scopes, and no default scope will be used either.
18193 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18194 /// for details).
18195 pub fn clear_scopes(mut self) -> ProjectLocationGlobalCustomConnectorPatchCall<'a, C> {
18196 self._scopes.clear();
18197 self
18198 }
18199}
18200
18201/// Creates a new ManagedZone in a given project and location.
18202///
18203/// A builder for the *locations.global.managedZones.create* method supported by a *project* resource.
18204/// It is not used directly, but through a [`ProjectMethods`] instance.
18205///
18206/// # Example
18207///
18208/// Instantiate a resource method builder
18209///
18210/// ```test_harness,no_run
18211/// # extern crate hyper;
18212/// # extern crate hyper_rustls;
18213/// # extern crate google_connectors1 as connectors1;
18214/// use connectors1::api::ManagedZone;
18215/// # async fn dox() {
18216/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18217///
18218/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18219/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18220/// # secret,
18221/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18222/// # ).build().await.unwrap();
18223///
18224/// # let client = hyper_util::client::legacy::Client::builder(
18225/// # hyper_util::rt::TokioExecutor::new()
18226/// # )
18227/// # .build(
18228/// # hyper_rustls::HttpsConnectorBuilder::new()
18229/// # .with_native_roots()
18230/// # .unwrap()
18231/// # .https_or_http()
18232/// # .enable_http1()
18233/// # .build()
18234/// # );
18235/// # let mut hub = Connectors::new(client, auth);
18236/// // As the method needs a request, you would usually fill it with the desired information
18237/// // into the respective structure. Some of the parts shown here might not be applicable !
18238/// // Values shown here are possibly random and not representative !
18239/// let mut req = ManagedZone::default();
18240///
18241/// // You can configure optional parameters by calling the respective setters at will, and
18242/// // execute the final call using `doit()`.
18243/// // Values shown here are possibly random and not representative !
18244/// let result = hub.projects().locations_global_managed_zones_create(req, "parent")
18245/// .managed_zone_id("amet.")
18246/// .doit().await;
18247/// # }
18248/// ```
18249pub struct ProjectLocationGlobalManagedZoneCreateCall<'a, C>
18250where
18251 C: 'a,
18252{
18253 hub: &'a Connectors<C>,
18254 _request: ManagedZone,
18255 _parent: String,
18256 _managed_zone_id: Option<String>,
18257 _delegate: Option<&'a mut dyn common::Delegate>,
18258 _additional_params: HashMap<String, String>,
18259 _scopes: BTreeSet<String>,
18260}
18261
18262impl<'a, C> common::CallBuilder for ProjectLocationGlobalManagedZoneCreateCall<'a, C> {}
18263
18264impl<'a, C> ProjectLocationGlobalManagedZoneCreateCall<'a, C>
18265where
18266 C: common::Connector,
18267{
18268 /// Perform the operation you have build so far.
18269 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
18270 use std::borrow::Cow;
18271 use std::io::{Read, Seek};
18272
18273 use common::{url::Params, ToParts};
18274 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18275
18276 let mut dd = common::DefaultDelegate;
18277 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18278 dlg.begin(common::MethodInfo {
18279 id: "connectors.projects.locations.global.managedZones.create",
18280 http_method: hyper::Method::POST,
18281 });
18282
18283 for &field in ["alt", "parent", "managedZoneId"].iter() {
18284 if self._additional_params.contains_key(field) {
18285 dlg.finished(false);
18286 return Err(common::Error::FieldClash(field));
18287 }
18288 }
18289
18290 let mut params = Params::with_capacity(5 + self._additional_params.len());
18291 params.push("parent", self._parent);
18292 if let Some(value) = self._managed_zone_id.as_ref() {
18293 params.push("managedZoneId", value);
18294 }
18295
18296 params.extend(self._additional_params.iter());
18297
18298 params.push("alt", "json");
18299 let mut url = self.hub._base_url.clone() + "v1/{+parent}/managedZones";
18300 if self._scopes.is_empty() {
18301 self._scopes
18302 .insert(Scope::CloudPlatform.as_ref().to_string());
18303 }
18304
18305 #[allow(clippy::single_element_loop)]
18306 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
18307 url = params.uri_replacement(url, param_name, find_this, true);
18308 }
18309 {
18310 let to_remove = ["parent"];
18311 params.remove_params(&to_remove);
18312 }
18313
18314 let url = params.parse_with_url(&url);
18315
18316 let mut json_mime_type = mime::APPLICATION_JSON;
18317 let mut request_value_reader = {
18318 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18319 common::remove_json_null_values(&mut value);
18320 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18321 serde_json::to_writer(&mut dst, &value).unwrap();
18322 dst
18323 };
18324 let request_size = request_value_reader
18325 .seek(std::io::SeekFrom::End(0))
18326 .unwrap();
18327 request_value_reader
18328 .seek(std::io::SeekFrom::Start(0))
18329 .unwrap();
18330
18331 loop {
18332 let token = match self
18333 .hub
18334 .auth
18335 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18336 .await
18337 {
18338 Ok(token) => token,
18339 Err(e) => match dlg.token(e) {
18340 Ok(token) => token,
18341 Err(e) => {
18342 dlg.finished(false);
18343 return Err(common::Error::MissingToken(e));
18344 }
18345 },
18346 };
18347 request_value_reader
18348 .seek(std::io::SeekFrom::Start(0))
18349 .unwrap();
18350 let mut req_result = {
18351 let client = &self.hub.client;
18352 dlg.pre_request();
18353 let mut req_builder = hyper::Request::builder()
18354 .method(hyper::Method::POST)
18355 .uri(url.as_str())
18356 .header(USER_AGENT, self.hub._user_agent.clone());
18357
18358 if let Some(token) = token.as_ref() {
18359 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18360 }
18361
18362 let request = req_builder
18363 .header(CONTENT_TYPE, json_mime_type.to_string())
18364 .header(CONTENT_LENGTH, request_size as u64)
18365 .body(common::to_body(
18366 request_value_reader.get_ref().clone().into(),
18367 ));
18368
18369 client.request(request.unwrap()).await
18370 };
18371
18372 match req_result {
18373 Err(err) => {
18374 if let common::Retry::After(d) = dlg.http_error(&err) {
18375 sleep(d).await;
18376 continue;
18377 }
18378 dlg.finished(false);
18379 return Err(common::Error::HttpError(err));
18380 }
18381 Ok(res) => {
18382 let (mut parts, body) = res.into_parts();
18383 let mut body = common::Body::new(body);
18384 if !parts.status.is_success() {
18385 let bytes = common::to_bytes(body).await.unwrap_or_default();
18386 let error = serde_json::from_str(&common::to_string(&bytes));
18387 let response = common::to_response(parts, bytes.into());
18388
18389 if let common::Retry::After(d) =
18390 dlg.http_failure(&response, error.as_ref().ok())
18391 {
18392 sleep(d).await;
18393 continue;
18394 }
18395
18396 dlg.finished(false);
18397
18398 return Err(match error {
18399 Ok(value) => common::Error::BadRequest(value),
18400 _ => common::Error::Failure(response),
18401 });
18402 }
18403 let response = {
18404 let bytes = common::to_bytes(body).await.unwrap_or_default();
18405 let encoded = common::to_string(&bytes);
18406 match serde_json::from_str(&encoded) {
18407 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18408 Err(error) => {
18409 dlg.response_json_decode_error(&encoded, &error);
18410 return Err(common::Error::JsonDecodeError(
18411 encoded.to_string(),
18412 error,
18413 ));
18414 }
18415 }
18416 };
18417
18418 dlg.finished(true);
18419 return Ok(response);
18420 }
18421 }
18422 }
18423 }
18424
18425 ///
18426 /// Sets the *request* property to the given value.
18427 ///
18428 /// Even though the property as already been set when instantiating this call,
18429 /// we provide this method for API completeness.
18430 pub fn request(
18431 mut self,
18432 new_value: ManagedZone,
18433 ) -> ProjectLocationGlobalManagedZoneCreateCall<'a, C> {
18434 self._request = new_value;
18435 self
18436 }
18437 /// Required. Parent resource of the ManagedZone, of the form: `projects/*/locations/global`
18438 ///
18439 /// Sets the *parent* path property to the given value.
18440 ///
18441 /// Even though the property as already been set when instantiating this call,
18442 /// we provide this method for API completeness.
18443 pub fn parent(mut self, new_value: &str) -> ProjectLocationGlobalManagedZoneCreateCall<'a, C> {
18444 self._parent = new_value.to_string();
18445 self
18446 }
18447 /// Required. Identifier to assign to the ManagedZone. Must be unique within scope of the parent resource.
18448 ///
18449 /// Sets the *managed zone id* query property to the given value.
18450 pub fn managed_zone_id(
18451 mut self,
18452 new_value: &str,
18453 ) -> ProjectLocationGlobalManagedZoneCreateCall<'a, C> {
18454 self._managed_zone_id = Some(new_value.to_string());
18455 self
18456 }
18457 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18458 /// while executing the actual API request.
18459 ///
18460 /// ````text
18461 /// It should be used to handle progress information, and to implement a certain level of resilience.
18462 /// ````
18463 ///
18464 /// Sets the *delegate* property to the given value.
18465 pub fn delegate(
18466 mut self,
18467 new_value: &'a mut dyn common::Delegate,
18468 ) -> ProjectLocationGlobalManagedZoneCreateCall<'a, C> {
18469 self._delegate = Some(new_value);
18470 self
18471 }
18472
18473 /// Set any additional parameter of the query string used in the request.
18474 /// It should be used to set parameters which are not yet available through their own
18475 /// setters.
18476 ///
18477 /// Please note that this method must not be used to set any of the known parameters
18478 /// which have their own setter method. If done anyway, the request will fail.
18479 ///
18480 /// # Additional Parameters
18481 ///
18482 /// * *$.xgafv* (query-string) - V1 error format.
18483 /// * *access_token* (query-string) - OAuth access token.
18484 /// * *alt* (query-string) - Data format for response.
18485 /// * *callback* (query-string) - JSONP
18486 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18487 /// * *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.
18488 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18489 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18490 /// * *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.
18491 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18492 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18493 pub fn param<T>(
18494 mut self,
18495 name: T,
18496 value: T,
18497 ) -> ProjectLocationGlobalManagedZoneCreateCall<'a, C>
18498 where
18499 T: AsRef<str>,
18500 {
18501 self._additional_params
18502 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18503 self
18504 }
18505
18506 /// Identifies the authorization scope for the method you are building.
18507 ///
18508 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18509 /// [`Scope::CloudPlatform`].
18510 ///
18511 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18512 /// tokens for more than one scope.
18513 ///
18514 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18515 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18516 /// sufficient, a read-write scope will do as well.
18517 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalManagedZoneCreateCall<'a, C>
18518 where
18519 St: AsRef<str>,
18520 {
18521 self._scopes.insert(String::from(scope.as_ref()));
18522 self
18523 }
18524 /// Identifies the authorization scope(s) for the method you are building.
18525 ///
18526 /// See [`Self::add_scope()`] for details.
18527 pub fn add_scopes<I, St>(
18528 mut self,
18529 scopes: I,
18530 ) -> ProjectLocationGlobalManagedZoneCreateCall<'a, C>
18531 where
18532 I: IntoIterator<Item = St>,
18533 St: AsRef<str>,
18534 {
18535 self._scopes
18536 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18537 self
18538 }
18539
18540 /// Removes all scopes, and no default scope will be used either.
18541 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18542 /// for details).
18543 pub fn clear_scopes(mut self) -> ProjectLocationGlobalManagedZoneCreateCall<'a, C> {
18544 self._scopes.clear();
18545 self
18546 }
18547}
18548
18549/// Deletes a single ManagedZone.
18550///
18551/// A builder for the *locations.global.managedZones.delete* method supported by a *project* resource.
18552/// It is not used directly, but through a [`ProjectMethods`] instance.
18553///
18554/// # Example
18555///
18556/// Instantiate a resource method builder
18557///
18558/// ```test_harness,no_run
18559/// # extern crate hyper;
18560/// # extern crate hyper_rustls;
18561/// # extern crate google_connectors1 as connectors1;
18562/// # async fn dox() {
18563/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18564///
18565/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18566/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18567/// # secret,
18568/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18569/// # ).build().await.unwrap();
18570///
18571/// # let client = hyper_util::client::legacy::Client::builder(
18572/// # hyper_util::rt::TokioExecutor::new()
18573/// # )
18574/// # .build(
18575/// # hyper_rustls::HttpsConnectorBuilder::new()
18576/// # .with_native_roots()
18577/// # .unwrap()
18578/// # .https_or_http()
18579/// # .enable_http1()
18580/// # .build()
18581/// # );
18582/// # let mut hub = Connectors::new(client, auth);
18583/// // You can configure optional parameters by calling the respective setters at will, and
18584/// // execute the final call using `doit()`.
18585/// // Values shown here are possibly random and not representative !
18586/// let result = hub.projects().locations_global_managed_zones_delete("name")
18587/// .doit().await;
18588/// # }
18589/// ```
18590pub struct ProjectLocationGlobalManagedZoneDeleteCall<'a, C>
18591where
18592 C: 'a,
18593{
18594 hub: &'a Connectors<C>,
18595 _name: String,
18596 _delegate: Option<&'a mut dyn common::Delegate>,
18597 _additional_params: HashMap<String, String>,
18598 _scopes: BTreeSet<String>,
18599}
18600
18601impl<'a, C> common::CallBuilder for ProjectLocationGlobalManagedZoneDeleteCall<'a, C> {}
18602
18603impl<'a, C> ProjectLocationGlobalManagedZoneDeleteCall<'a, C>
18604where
18605 C: common::Connector,
18606{
18607 /// Perform the operation you have build so far.
18608 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
18609 use std::borrow::Cow;
18610 use std::io::{Read, Seek};
18611
18612 use common::{url::Params, ToParts};
18613 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18614
18615 let mut dd = common::DefaultDelegate;
18616 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18617 dlg.begin(common::MethodInfo {
18618 id: "connectors.projects.locations.global.managedZones.delete",
18619 http_method: hyper::Method::DELETE,
18620 });
18621
18622 for &field in ["alt", "name"].iter() {
18623 if self._additional_params.contains_key(field) {
18624 dlg.finished(false);
18625 return Err(common::Error::FieldClash(field));
18626 }
18627 }
18628
18629 let mut params = Params::with_capacity(3 + self._additional_params.len());
18630 params.push("name", self._name);
18631
18632 params.extend(self._additional_params.iter());
18633
18634 params.push("alt", "json");
18635 let mut url = self.hub._base_url.clone() + "v1/{+name}";
18636 if self._scopes.is_empty() {
18637 self._scopes
18638 .insert(Scope::CloudPlatform.as_ref().to_string());
18639 }
18640
18641 #[allow(clippy::single_element_loop)]
18642 for &(find_this, param_name) in [("{+name}", "name")].iter() {
18643 url = params.uri_replacement(url, param_name, find_this, true);
18644 }
18645 {
18646 let to_remove = ["name"];
18647 params.remove_params(&to_remove);
18648 }
18649
18650 let url = params.parse_with_url(&url);
18651
18652 loop {
18653 let token = match self
18654 .hub
18655 .auth
18656 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18657 .await
18658 {
18659 Ok(token) => token,
18660 Err(e) => match dlg.token(e) {
18661 Ok(token) => token,
18662 Err(e) => {
18663 dlg.finished(false);
18664 return Err(common::Error::MissingToken(e));
18665 }
18666 },
18667 };
18668 let mut req_result = {
18669 let client = &self.hub.client;
18670 dlg.pre_request();
18671 let mut req_builder = hyper::Request::builder()
18672 .method(hyper::Method::DELETE)
18673 .uri(url.as_str())
18674 .header(USER_AGENT, self.hub._user_agent.clone());
18675
18676 if let Some(token) = token.as_ref() {
18677 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18678 }
18679
18680 let request = req_builder
18681 .header(CONTENT_LENGTH, 0_u64)
18682 .body(common::to_body::<String>(None));
18683
18684 client.request(request.unwrap()).await
18685 };
18686
18687 match req_result {
18688 Err(err) => {
18689 if let common::Retry::After(d) = dlg.http_error(&err) {
18690 sleep(d).await;
18691 continue;
18692 }
18693 dlg.finished(false);
18694 return Err(common::Error::HttpError(err));
18695 }
18696 Ok(res) => {
18697 let (mut parts, body) = res.into_parts();
18698 let mut body = common::Body::new(body);
18699 if !parts.status.is_success() {
18700 let bytes = common::to_bytes(body).await.unwrap_or_default();
18701 let error = serde_json::from_str(&common::to_string(&bytes));
18702 let response = common::to_response(parts, bytes.into());
18703
18704 if let common::Retry::After(d) =
18705 dlg.http_failure(&response, error.as_ref().ok())
18706 {
18707 sleep(d).await;
18708 continue;
18709 }
18710
18711 dlg.finished(false);
18712
18713 return Err(match error {
18714 Ok(value) => common::Error::BadRequest(value),
18715 _ => common::Error::Failure(response),
18716 });
18717 }
18718 let response = {
18719 let bytes = common::to_bytes(body).await.unwrap_or_default();
18720 let encoded = common::to_string(&bytes);
18721 match serde_json::from_str(&encoded) {
18722 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18723 Err(error) => {
18724 dlg.response_json_decode_error(&encoded, &error);
18725 return Err(common::Error::JsonDecodeError(
18726 encoded.to_string(),
18727 error,
18728 ));
18729 }
18730 }
18731 };
18732
18733 dlg.finished(true);
18734 return Ok(response);
18735 }
18736 }
18737 }
18738 }
18739
18740 /// Required. Resource name of the form: `projects/*/locations/global/managedZones/*`
18741 ///
18742 /// Sets the *name* path property to the given value.
18743 ///
18744 /// Even though the property as already been set when instantiating this call,
18745 /// we provide this method for API completeness.
18746 pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalManagedZoneDeleteCall<'a, C> {
18747 self._name = new_value.to_string();
18748 self
18749 }
18750 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18751 /// while executing the actual API request.
18752 ///
18753 /// ````text
18754 /// It should be used to handle progress information, and to implement a certain level of resilience.
18755 /// ````
18756 ///
18757 /// Sets the *delegate* property to the given value.
18758 pub fn delegate(
18759 mut self,
18760 new_value: &'a mut dyn common::Delegate,
18761 ) -> ProjectLocationGlobalManagedZoneDeleteCall<'a, C> {
18762 self._delegate = Some(new_value);
18763 self
18764 }
18765
18766 /// Set any additional parameter of the query string used in the request.
18767 /// It should be used to set parameters which are not yet available through their own
18768 /// setters.
18769 ///
18770 /// Please note that this method must not be used to set any of the known parameters
18771 /// which have their own setter method. If done anyway, the request will fail.
18772 ///
18773 /// # Additional Parameters
18774 ///
18775 /// * *$.xgafv* (query-string) - V1 error format.
18776 /// * *access_token* (query-string) - OAuth access token.
18777 /// * *alt* (query-string) - Data format for response.
18778 /// * *callback* (query-string) - JSONP
18779 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18780 /// * *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.
18781 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18782 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18783 /// * *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.
18784 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18785 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18786 pub fn param<T>(
18787 mut self,
18788 name: T,
18789 value: T,
18790 ) -> ProjectLocationGlobalManagedZoneDeleteCall<'a, C>
18791 where
18792 T: AsRef<str>,
18793 {
18794 self._additional_params
18795 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18796 self
18797 }
18798
18799 /// Identifies the authorization scope for the method you are building.
18800 ///
18801 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18802 /// [`Scope::CloudPlatform`].
18803 ///
18804 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18805 /// tokens for more than one scope.
18806 ///
18807 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18808 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18809 /// sufficient, a read-write scope will do as well.
18810 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalManagedZoneDeleteCall<'a, C>
18811 where
18812 St: AsRef<str>,
18813 {
18814 self._scopes.insert(String::from(scope.as_ref()));
18815 self
18816 }
18817 /// Identifies the authorization scope(s) for the method you are building.
18818 ///
18819 /// See [`Self::add_scope()`] for details.
18820 pub fn add_scopes<I, St>(
18821 mut self,
18822 scopes: I,
18823 ) -> ProjectLocationGlobalManagedZoneDeleteCall<'a, C>
18824 where
18825 I: IntoIterator<Item = St>,
18826 St: AsRef<str>,
18827 {
18828 self._scopes
18829 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18830 self
18831 }
18832
18833 /// Removes all scopes, and no default scope will be used either.
18834 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18835 /// for details).
18836 pub fn clear_scopes(mut self) -> ProjectLocationGlobalManagedZoneDeleteCall<'a, C> {
18837 self._scopes.clear();
18838 self
18839 }
18840}
18841
18842/// Gets details of a single ManagedZone.
18843///
18844/// A builder for the *locations.global.managedZones.get* method supported by a *project* resource.
18845/// It is not used directly, but through a [`ProjectMethods`] instance.
18846///
18847/// # Example
18848///
18849/// Instantiate a resource method builder
18850///
18851/// ```test_harness,no_run
18852/// # extern crate hyper;
18853/// # extern crate hyper_rustls;
18854/// # extern crate google_connectors1 as connectors1;
18855/// # async fn dox() {
18856/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18857///
18858/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18859/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18860/// # secret,
18861/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18862/// # ).build().await.unwrap();
18863///
18864/// # let client = hyper_util::client::legacy::Client::builder(
18865/// # hyper_util::rt::TokioExecutor::new()
18866/// # )
18867/// # .build(
18868/// # hyper_rustls::HttpsConnectorBuilder::new()
18869/// # .with_native_roots()
18870/// # .unwrap()
18871/// # .https_or_http()
18872/// # .enable_http1()
18873/// # .build()
18874/// # );
18875/// # let mut hub = Connectors::new(client, auth);
18876/// // You can configure optional parameters by calling the respective setters at will, and
18877/// // execute the final call using `doit()`.
18878/// // Values shown here are possibly random and not representative !
18879/// let result = hub.projects().locations_global_managed_zones_get("name")
18880/// .doit().await;
18881/// # }
18882/// ```
18883pub struct ProjectLocationGlobalManagedZoneGetCall<'a, C>
18884where
18885 C: 'a,
18886{
18887 hub: &'a Connectors<C>,
18888 _name: String,
18889 _delegate: Option<&'a mut dyn common::Delegate>,
18890 _additional_params: HashMap<String, String>,
18891 _scopes: BTreeSet<String>,
18892}
18893
18894impl<'a, C> common::CallBuilder for ProjectLocationGlobalManagedZoneGetCall<'a, C> {}
18895
18896impl<'a, C> ProjectLocationGlobalManagedZoneGetCall<'a, C>
18897where
18898 C: common::Connector,
18899{
18900 /// Perform the operation you have build so far.
18901 pub async fn doit(mut self) -> common::Result<(common::Response, ManagedZone)> {
18902 use std::borrow::Cow;
18903 use std::io::{Read, Seek};
18904
18905 use common::{url::Params, ToParts};
18906 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18907
18908 let mut dd = common::DefaultDelegate;
18909 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18910 dlg.begin(common::MethodInfo {
18911 id: "connectors.projects.locations.global.managedZones.get",
18912 http_method: hyper::Method::GET,
18913 });
18914
18915 for &field in ["alt", "name"].iter() {
18916 if self._additional_params.contains_key(field) {
18917 dlg.finished(false);
18918 return Err(common::Error::FieldClash(field));
18919 }
18920 }
18921
18922 let mut params = Params::with_capacity(3 + self._additional_params.len());
18923 params.push("name", self._name);
18924
18925 params.extend(self._additional_params.iter());
18926
18927 params.push("alt", "json");
18928 let mut url = self.hub._base_url.clone() + "v1/{+name}";
18929 if self._scopes.is_empty() {
18930 self._scopes
18931 .insert(Scope::CloudPlatform.as_ref().to_string());
18932 }
18933
18934 #[allow(clippy::single_element_loop)]
18935 for &(find_this, param_name) in [("{+name}", "name")].iter() {
18936 url = params.uri_replacement(url, param_name, find_this, true);
18937 }
18938 {
18939 let to_remove = ["name"];
18940 params.remove_params(&to_remove);
18941 }
18942
18943 let url = params.parse_with_url(&url);
18944
18945 loop {
18946 let token = match self
18947 .hub
18948 .auth
18949 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18950 .await
18951 {
18952 Ok(token) => token,
18953 Err(e) => match dlg.token(e) {
18954 Ok(token) => token,
18955 Err(e) => {
18956 dlg.finished(false);
18957 return Err(common::Error::MissingToken(e));
18958 }
18959 },
18960 };
18961 let mut req_result = {
18962 let client = &self.hub.client;
18963 dlg.pre_request();
18964 let mut req_builder = hyper::Request::builder()
18965 .method(hyper::Method::GET)
18966 .uri(url.as_str())
18967 .header(USER_AGENT, self.hub._user_agent.clone());
18968
18969 if let Some(token) = token.as_ref() {
18970 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18971 }
18972
18973 let request = req_builder
18974 .header(CONTENT_LENGTH, 0_u64)
18975 .body(common::to_body::<String>(None));
18976
18977 client.request(request.unwrap()).await
18978 };
18979
18980 match req_result {
18981 Err(err) => {
18982 if let common::Retry::After(d) = dlg.http_error(&err) {
18983 sleep(d).await;
18984 continue;
18985 }
18986 dlg.finished(false);
18987 return Err(common::Error::HttpError(err));
18988 }
18989 Ok(res) => {
18990 let (mut parts, body) = res.into_parts();
18991 let mut body = common::Body::new(body);
18992 if !parts.status.is_success() {
18993 let bytes = common::to_bytes(body).await.unwrap_or_default();
18994 let error = serde_json::from_str(&common::to_string(&bytes));
18995 let response = common::to_response(parts, bytes.into());
18996
18997 if let common::Retry::After(d) =
18998 dlg.http_failure(&response, error.as_ref().ok())
18999 {
19000 sleep(d).await;
19001 continue;
19002 }
19003
19004 dlg.finished(false);
19005
19006 return Err(match error {
19007 Ok(value) => common::Error::BadRequest(value),
19008 _ => common::Error::Failure(response),
19009 });
19010 }
19011 let response = {
19012 let bytes = common::to_bytes(body).await.unwrap_or_default();
19013 let encoded = common::to_string(&bytes);
19014 match serde_json::from_str(&encoded) {
19015 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19016 Err(error) => {
19017 dlg.response_json_decode_error(&encoded, &error);
19018 return Err(common::Error::JsonDecodeError(
19019 encoded.to_string(),
19020 error,
19021 ));
19022 }
19023 }
19024 };
19025
19026 dlg.finished(true);
19027 return Ok(response);
19028 }
19029 }
19030 }
19031 }
19032
19033 /// Required. Resource name of the form: `projects/*/locations/global/managedZones/*`
19034 ///
19035 /// Sets the *name* path property to the given value.
19036 ///
19037 /// Even though the property as already been set when instantiating this call,
19038 /// we provide this method for API completeness.
19039 pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalManagedZoneGetCall<'a, C> {
19040 self._name = new_value.to_string();
19041 self
19042 }
19043 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19044 /// while executing the actual API request.
19045 ///
19046 /// ````text
19047 /// It should be used to handle progress information, and to implement a certain level of resilience.
19048 /// ````
19049 ///
19050 /// Sets the *delegate* property to the given value.
19051 pub fn delegate(
19052 mut self,
19053 new_value: &'a mut dyn common::Delegate,
19054 ) -> ProjectLocationGlobalManagedZoneGetCall<'a, C> {
19055 self._delegate = Some(new_value);
19056 self
19057 }
19058
19059 /// Set any additional parameter of the query string used in the request.
19060 /// It should be used to set parameters which are not yet available through their own
19061 /// setters.
19062 ///
19063 /// Please note that this method must not be used to set any of the known parameters
19064 /// which have their own setter method. If done anyway, the request will fail.
19065 ///
19066 /// # Additional Parameters
19067 ///
19068 /// * *$.xgafv* (query-string) - V1 error format.
19069 /// * *access_token* (query-string) - OAuth access token.
19070 /// * *alt* (query-string) - Data format for response.
19071 /// * *callback* (query-string) - JSONP
19072 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19073 /// * *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.
19074 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19075 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19076 /// * *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.
19077 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19078 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19079 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalManagedZoneGetCall<'a, C>
19080 where
19081 T: AsRef<str>,
19082 {
19083 self._additional_params
19084 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19085 self
19086 }
19087
19088 /// Identifies the authorization scope for the method you are building.
19089 ///
19090 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19091 /// [`Scope::CloudPlatform`].
19092 ///
19093 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19094 /// tokens for more than one scope.
19095 ///
19096 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19097 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19098 /// sufficient, a read-write scope will do as well.
19099 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalManagedZoneGetCall<'a, C>
19100 where
19101 St: AsRef<str>,
19102 {
19103 self._scopes.insert(String::from(scope.as_ref()));
19104 self
19105 }
19106 /// Identifies the authorization scope(s) for the method you are building.
19107 ///
19108 /// See [`Self::add_scope()`] for details.
19109 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalManagedZoneGetCall<'a, C>
19110 where
19111 I: IntoIterator<Item = St>,
19112 St: AsRef<str>,
19113 {
19114 self._scopes
19115 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19116 self
19117 }
19118
19119 /// Removes all scopes, and no default scope will be used either.
19120 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19121 /// for details).
19122 pub fn clear_scopes(mut self) -> ProjectLocationGlobalManagedZoneGetCall<'a, C> {
19123 self._scopes.clear();
19124 self
19125 }
19126}
19127
19128/// List ManagedZones in a given project
19129///
19130/// A builder for the *locations.global.managedZones.list* method supported by a *project* resource.
19131/// It is not used directly, but through a [`ProjectMethods`] instance.
19132///
19133/// # Example
19134///
19135/// Instantiate a resource method builder
19136///
19137/// ```test_harness,no_run
19138/// # extern crate hyper;
19139/// # extern crate hyper_rustls;
19140/// # extern crate google_connectors1 as connectors1;
19141/// # async fn dox() {
19142/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19143///
19144/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19145/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19146/// # secret,
19147/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19148/// # ).build().await.unwrap();
19149///
19150/// # let client = hyper_util::client::legacy::Client::builder(
19151/// # hyper_util::rt::TokioExecutor::new()
19152/// # )
19153/// # .build(
19154/// # hyper_rustls::HttpsConnectorBuilder::new()
19155/// # .with_native_roots()
19156/// # .unwrap()
19157/// # .https_or_http()
19158/// # .enable_http1()
19159/// # .build()
19160/// # );
19161/// # let mut hub = Connectors::new(client, auth);
19162/// // You can configure optional parameters by calling the respective setters at will, and
19163/// // execute the final call using `doit()`.
19164/// // Values shown here are possibly random and not representative !
19165/// let result = hub.projects().locations_global_managed_zones_list("parent")
19166/// .page_token("invidunt")
19167/// .page_size(-11)
19168/// .order_by("est")
19169/// .filter("At")
19170/// .doit().await;
19171/// # }
19172/// ```
19173pub struct ProjectLocationGlobalManagedZoneListCall<'a, C>
19174where
19175 C: 'a,
19176{
19177 hub: &'a Connectors<C>,
19178 _parent: String,
19179 _page_token: Option<String>,
19180 _page_size: Option<i32>,
19181 _order_by: Option<String>,
19182 _filter: Option<String>,
19183 _delegate: Option<&'a mut dyn common::Delegate>,
19184 _additional_params: HashMap<String, String>,
19185 _scopes: BTreeSet<String>,
19186}
19187
19188impl<'a, C> common::CallBuilder for ProjectLocationGlobalManagedZoneListCall<'a, C> {}
19189
19190impl<'a, C> ProjectLocationGlobalManagedZoneListCall<'a, C>
19191where
19192 C: common::Connector,
19193{
19194 /// Perform the operation you have build so far.
19195 pub async fn doit(mut self) -> common::Result<(common::Response, ListManagedZonesResponse)> {
19196 use std::borrow::Cow;
19197 use std::io::{Read, Seek};
19198
19199 use common::{url::Params, ToParts};
19200 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19201
19202 let mut dd = common::DefaultDelegate;
19203 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19204 dlg.begin(common::MethodInfo {
19205 id: "connectors.projects.locations.global.managedZones.list",
19206 http_method: hyper::Method::GET,
19207 });
19208
19209 for &field in [
19210 "alt",
19211 "parent",
19212 "pageToken",
19213 "pageSize",
19214 "orderBy",
19215 "filter",
19216 ]
19217 .iter()
19218 {
19219 if self._additional_params.contains_key(field) {
19220 dlg.finished(false);
19221 return Err(common::Error::FieldClash(field));
19222 }
19223 }
19224
19225 let mut params = Params::with_capacity(7 + self._additional_params.len());
19226 params.push("parent", self._parent);
19227 if let Some(value) = self._page_token.as_ref() {
19228 params.push("pageToken", value);
19229 }
19230 if let Some(value) = self._page_size.as_ref() {
19231 params.push("pageSize", value.to_string());
19232 }
19233 if let Some(value) = self._order_by.as_ref() {
19234 params.push("orderBy", value);
19235 }
19236 if let Some(value) = self._filter.as_ref() {
19237 params.push("filter", value);
19238 }
19239
19240 params.extend(self._additional_params.iter());
19241
19242 params.push("alt", "json");
19243 let mut url = self.hub._base_url.clone() + "v1/{+parent}/managedZones";
19244 if self._scopes.is_empty() {
19245 self._scopes
19246 .insert(Scope::CloudPlatform.as_ref().to_string());
19247 }
19248
19249 #[allow(clippy::single_element_loop)]
19250 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
19251 url = params.uri_replacement(url, param_name, find_this, true);
19252 }
19253 {
19254 let to_remove = ["parent"];
19255 params.remove_params(&to_remove);
19256 }
19257
19258 let url = params.parse_with_url(&url);
19259
19260 loop {
19261 let token = match self
19262 .hub
19263 .auth
19264 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19265 .await
19266 {
19267 Ok(token) => token,
19268 Err(e) => match dlg.token(e) {
19269 Ok(token) => token,
19270 Err(e) => {
19271 dlg.finished(false);
19272 return Err(common::Error::MissingToken(e));
19273 }
19274 },
19275 };
19276 let mut req_result = {
19277 let client = &self.hub.client;
19278 dlg.pre_request();
19279 let mut req_builder = hyper::Request::builder()
19280 .method(hyper::Method::GET)
19281 .uri(url.as_str())
19282 .header(USER_AGENT, self.hub._user_agent.clone());
19283
19284 if let Some(token) = token.as_ref() {
19285 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19286 }
19287
19288 let request = req_builder
19289 .header(CONTENT_LENGTH, 0_u64)
19290 .body(common::to_body::<String>(None));
19291
19292 client.request(request.unwrap()).await
19293 };
19294
19295 match req_result {
19296 Err(err) => {
19297 if let common::Retry::After(d) = dlg.http_error(&err) {
19298 sleep(d).await;
19299 continue;
19300 }
19301 dlg.finished(false);
19302 return Err(common::Error::HttpError(err));
19303 }
19304 Ok(res) => {
19305 let (mut parts, body) = res.into_parts();
19306 let mut body = common::Body::new(body);
19307 if !parts.status.is_success() {
19308 let bytes = common::to_bytes(body).await.unwrap_or_default();
19309 let error = serde_json::from_str(&common::to_string(&bytes));
19310 let response = common::to_response(parts, bytes.into());
19311
19312 if let common::Retry::After(d) =
19313 dlg.http_failure(&response, error.as_ref().ok())
19314 {
19315 sleep(d).await;
19316 continue;
19317 }
19318
19319 dlg.finished(false);
19320
19321 return Err(match error {
19322 Ok(value) => common::Error::BadRequest(value),
19323 _ => common::Error::Failure(response),
19324 });
19325 }
19326 let response = {
19327 let bytes = common::to_bytes(body).await.unwrap_or_default();
19328 let encoded = common::to_string(&bytes);
19329 match serde_json::from_str(&encoded) {
19330 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19331 Err(error) => {
19332 dlg.response_json_decode_error(&encoded, &error);
19333 return Err(common::Error::JsonDecodeError(
19334 encoded.to_string(),
19335 error,
19336 ));
19337 }
19338 }
19339 };
19340
19341 dlg.finished(true);
19342 return Ok(response);
19343 }
19344 }
19345 }
19346 }
19347
19348 /// Required. Parent resource of the Managed Zone, of the form: `projects/*/locations/global`
19349 ///
19350 /// Sets the *parent* path property to the given value.
19351 ///
19352 /// Even though the property as already been set when instantiating this call,
19353 /// we provide this method for API completeness.
19354 pub fn parent(mut self, new_value: &str) -> ProjectLocationGlobalManagedZoneListCall<'a, C> {
19355 self._parent = new_value.to_string();
19356 self
19357 }
19358 /// Page token.
19359 ///
19360 /// Sets the *page token* query property to the given value.
19361 pub fn page_token(
19362 mut self,
19363 new_value: &str,
19364 ) -> ProjectLocationGlobalManagedZoneListCall<'a, C> {
19365 self._page_token = Some(new_value.to_string());
19366 self
19367 }
19368 /// Page size.
19369 ///
19370 /// Sets the *page size* query property to the given value.
19371 pub fn page_size(mut self, new_value: i32) -> ProjectLocationGlobalManagedZoneListCall<'a, C> {
19372 self._page_size = Some(new_value);
19373 self
19374 }
19375 /// Order by parameters.
19376 ///
19377 /// Sets the *order by* query property to the given value.
19378 pub fn order_by(mut self, new_value: &str) -> ProjectLocationGlobalManagedZoneListCall<'a, C> {
19379 self._order_by = Some(new_value.to_string());
19380 self
19381 }
19382 /// Filter.
19383 ///
19384 /// Sets the *filter* query property to the given value.
19385 pub fn filter(mut self, new_value: &str) -> ProjectLocationGlobalManagedZoneListCall<'a, C> {
19386 self._filter = Some(new_value.to_string());
19387 self
19388 }
19389 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19390 /// while executing the actual API request.
19391 ///
19392 /// ````text
19393 /// It should be used to handle progress information, and to implement a certain level of resilience.
19394 /// ````
19395 ///
19396 /// Sets the *delegate* property to the given value.
19397 pub fn delegate(
19398 mut self,
19399 new_value: &'a mut dyn common::Delegate,
19400 ) -> ProjectLocationGlobalManagedZoneListCall<'a, C> {
19401 self._delegate = Some(new_value);
19402 self
19403 }
19404
19405 /// Set any additional parameter of the query string used in the request.
19406 /// It should be used to set parameters which are not yet available through their own
19407 /// setters.
19408 ///
19409 /// Please note that this method must not be used to set any of the known parameters
19410 /// which have their own setter method. If done anyway, the request will fail.
19411 ///
19412 /// # Additional Parameters
19413 ///
19414 /// * *$.xgafv* (query-string) - V1 error format.
19415 /// * *access_token* (query-string) - OAuth access token.
19416 /// * *alt* (query-string) - Data format for response.
19417 /// * *callback* (query-string) - JSONP
19418 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19419 /// * *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.
19420 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19421 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19422 /// * *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.
19423 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19424 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19425 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalManagedZoneListCall<'a, C>
19426 where
19427 T: AsRef<str>,
19428 {
19429 self._additional_params
19430 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19431 self
19432 }
19433
19434 /// Identifies the authorization scope for the method you are building.
19435 ///
19436 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19437 /// [`Scope::CloudPlatform`].
19438 ///
19439 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19440 /// tokens for more than one scope.
19441 ///
19442 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19443 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19444 /// sufficient, a read-write scope will do as well.
19445 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalManagedZoneListCall<'a, C>
19446 where
19447 St: AsRef<str>,
19448 {
19449 self._scopes.insert(String::from(scope.as_ref()));
19450 self
19451 }
19452 /// Identifies the authorization scope(s) for the method you are building.
19453 ///
19454 /// See [`Self::add_scope()`] for details.
19455 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalManagedZoneListCall<'a, C>
19456 where
19457 I: IntoIterator<Item = St>,
19458 St: AsRef<str>,
19459 {
19460 self._scopes
19461 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19462 self
19463 }
19464
19465 /// Removes all scopes, and no default scope will be used either.
19466 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19467 /// for details).
19468 pub fn clear_scopes(mut self) -> ProjectLocationGlobalManagedZoneListCall<'a, C> {
19469 self._scopes.clear();
19470 self
19471 }
19472}
19473
19474/// Updates the parameters of a single ManagedZone.
19475///
19476/// A builder for the *locations.global.managedZones.patch* method supported by a *project* resource.
19477/// It is not used directly, but through a [`ProjectMethods`] instance.
19478///
19479/// # Example
19480///
19481/// Instantiate a resource method builder
19482///
19483/// ```test_harness,no_run
19484/// # extern crate hyper;
19485/// # extern crate hyper_rustls;
19486/// # extern crate google_connectors1 as connectors1;
19487/// use connectors1::api::ManagedZone;
19488/// # async fn dox() {
19489/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19490///
19491/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19492/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19493/// # secret,
19494/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19495/// # ).build().await.unwrap();
19496///
19497/// # let client = hyper_util::client::legacy::Client::builder(
19498/// # hyper_util::rt::TokioExecutor::new()
19499/// # )
19500/// # .build(
19501/// # hyper_rustls::HttpsConnectorBuilder::new()
19502/// # .with_native_roots()
19503/// # .unwrap()
19504/// # .https_or_http()
19505/// # .enable_http1()
19506/// # .build()
19507/// # );
19508/// # let mut hub = Connectors::new(client, auth);
19509/// // As the method needs a request, you would usually fill it with the desired information
19510/// // into the respective structure. Some of the parts shown here might not be applicable !
19511/// // Values shown here are possibly random and not representative !
19512/// let mut req = ManagedZone::default();
19513///
19514/// // You can configure optional parameters by calling the respective setters at will, and
19515/// // execute the final call using `doit()`.
19516/// // Values shown here are possibly random and not representative !
19517/// let result = hub.projects().locations_global_managed_zones_patch(req, "name")
19518/// .update_mask(FieldMask::new::<&str>(&[]))
19519/// .doit().await;
19520/// # }
19521/// ```
19522pub struct ProjectLocationGlobalManagedZonePatchCall<'a, C>
19523where
19524 C: 'a,
19525{
19526 hub: &'a Connectors<C>,
19527 _request: ManagedZone,
19528 _name: String,
19529 _update_mask: Option<common::FieldMask>,
19530 _delegate: Option<&'a mut dyn common::Delegate>,
19531 _additional_params: HashMap<String, String>,
19532 _scopes: BTreeSet<String>,
19533}
19534
19535impl<'a, C> common::CallBuilder for ProjectLocationGlobalManagedZonePatchCall<'a, C> {}
19536
19537impl<'a, C> ProjectLocationGlobalManagedZonePatchCall<'a, C>
19538where
19539 C: common::Connector,
19540{
19541 /// Perform the operation you have build so far.
19542 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
19543 use std::borrow::Cow;
19544 use std::io::{Read, Seek};
19545
19546 use common::{url::Params, ToParts};
19547 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19548
19549 let mut dd = common::DefaultDelegate;
19550 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19551 dlg.begin(common::MethodInfo {
19552 id: "connectors.projects.locations.global.managedZones.patch",
19553 http_method: hyper::Method::PATCH,
19554 });
19555
19556 for &field in ["alt", "name", "updateMask"].iter() {
19557 if self._additional_params.contains_key(field) {
19558 dlg.finished(false);
19559 return Err(common::Error::FieldClash(field));
19560 }
19561 }
19562
19563 let mut params = Params::with_capacity(5 + self._additional_params.len());
19564 params.push("name", self._name);
19565 if let Some(value) = self._update_mask.as_ref() {
19566 params.push("updateMask", value.to_string());
19567 }
19568
19569 params.extend(self._additional_params.iter());
19570
19571 params.push("alt", "json");
19572 let mut url = self.hub._base_url.clone() + "v1/{+name}";
19573 if self._scopes.is_empty() {
19574 self._scopes
19575 .insert(Scope::CloudPlatform.as_ref().to_string());
19576 }
19577
19578 #[allow(clippy::single_element_loop)]
19579 for &(find_this, param_name) in [("{+name}", "name")].iter() {
19580 url = params.uri_replacement(url, param_name, find_this, true);
19581 }
19582 {
19583 let to_remove = ["name"];
19584 params.remove_params(&to_remove);
19585 }
19586
19587 let url = params.parse_with_url(&url);
19588
19589 let mut json_mime_type = mime::APPLICATION_JSON;
19590 let mut request_value_reader = {
19591 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19592 common::remove_json_null_values(&mut value);
19593 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19594 serde_json::to_writer(&mut dst, &value).unwrap();
19595 dst
19596 };
19597 let request_size = request_value_reader
19598 .seek(std::io::SeekFrom::End(0))
19599 .unwrap();
19600 request_value_reader
19601 .seek(std::io::SeekFrom::Start(0))
19602 .unwrap();
19603
19604 loop {
19605 let token = match self
19606 .hub
19607 .auth
19608 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19609 .await
19610 {
19611 Ok(token) => token,
19612 Err(e) => match dlg.token(e) {
19613 Ok(token) => token,
19614 Err(e) => {
19615 dlg.finished(false);
19616 return Err(common::Error::MissingToken(e));
19617 }
19618 },
19619 };
19620 request_value_reader
19621 .seek(std::io::SeekFrom::Start(0))
19622 .unwrap();
19623 let mut req_result = {
19624 let client = &self.hub.client;
19625 dlg.pre_request();
19626 let mut req_builder = hyper::Request::builder()
19627 .method(hyper::Method::PATCH)
19628 .uri(url.as_str())
19629 .header(USER_AGENT, self.hub._user_agent.clone());
19630
19631 if let Some(token) = token.as_ref() {
19632 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19633 }
19634
19635 let request = req_builder
19636 .header(CONTENT_TYPE, json_mime_type.to_string())
19637 .header(CONTENT_LENGTH, request_size as u64)
19638 .body(common::to_body(
19639 request_value_reader.get_ref().clone().into(),
19640 ));
19641
19642 client.request(request.unwrap()).await
19643 };
19644
19645 match req_result {
19646 Err(err) => {
19647 if let common::Retry::After(d) = dlg.http_error(&err) {
19648 sleep(d).await;
19649 continue;
19650 }
19651 dlg.finished(false);
19652 return Err(common::Error::HttpError(err));
19653 }
19654 Ok(res) => {
19655 let (mut parts, body) = res.into_parts();
19656 let mut body = common::Body::new(body);
19657 if !parts.status.is_success() {
19658 let bytes = common::to_bytes(body).await.unwrap_or_default();
19659 let error = serde_json::from_str(&common::to_string(&bytes));
19660 let response = common::to_response(parts, bytes.into());
19661
19662 if let common::Retry::After(d) =
19663 dlg.http_failure(&response, error.as_ref().ok())
19664 {
19665 sleep(d).await;
19666 continue;
19667 }
19668
19669 dlg.finished(false);
19670
19671 return Err(match error {
19672 Ok(value) => common::Error::BadRequest(value),
19673 _ => common::Error::Failure(response),
19674 });
19675 }
19676 let response = {
19677 let bytes = common::to_bytes(body).await.unwrap_or_default();
19678 let encoded = common::to_string(&bytes);
19679 match serde_json::from_str(&encoded) {
19680 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19681 Err(error) => {
19682 dlg.response_json_decode_error(&encoded, &error);
19683 return Err(common::Error::JsonDecodeError(
19684 encoded.to_string(),
19685 error,
19686 ));
19687 }
19688 }
19689 };
19690
19691 dlg.finished(true);
19692 return Ok(response);
19693 }
19694 }
19695 }
19696 }
19697
19698 ///
19699 /// Sets the *request* property to the given value.
19700 ///
19701 /// Even though the property as already been set when instantiating this call,
19702 /// we provide this method for API completeness.
19703 pub fn request(
19704 mut self,
19705 new_value: ManagedZone,
19706 ) -> ProjectLocationGlobalManagedZonePatchCall<'a, C> {
19707 self._request = new_value;
19708 self
19709 }
19710 /// Output only. Resource name of the Managed Zone. Format: projects/{project}/locations/global/managedZones/{managed_zone}
19711 ///
19712 /// Sets the *name* path property to the given value.
19713 ///
19714 /// Even though the property as already been set when instantiating this call,
19715 /// we provide this method for API completeness.
19716 pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalManagedZonePatchCall<'a, C> {
19717 self._name = new_value.to_string();
19718 self
19719 }
19720 /// 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`
19721 ///
19722 /// Sets the *update mask* query property to the given value.
19723 pub fn update_mask(
19724 mut self,
19725 new_value: common::FieldMask,
19726 ) -> ProjectLocationGlobalManagedZonePatchCall<'a, C> {
19727 self._update_mask = Some(new_value);
19728 self
19729 }
19730 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19731 /// while executing the actual API request.
19732 ///
19733 /// ````text
19734 /// It should be used to handle progress information, and to implement a certain level of resilience.
19735 /// ````
19736 ///
19737 /// Sets the *delegate* property to the given value.
19738 pub fn delegate(
19739 mut self,
19740 new_value: &'a mut dyn common::Delegate,
19741 ) -> ProjectLocationGlobalManagedZonePatchCall<'a, C> {
19742 self._delegate = Some(new_value);
19743 self
19744 }
19745
19746 /// Set any additional parameter of the query string used in the request.
19747 /// It should be used to set parameters which are not yet available through their own
19748 /// setters.
19749 ///
19750 /// Please note that this method must not be used to set any of the known parameters
19751 /// which have their own setter method. If done anyway, the request will fail.
19752 ///
19753 /// # Additional Parameters
19754 ///
19755 /// * *$.xgafv* (query-string) - V1 error format.
19756 /// * *access_token* (query-string) - OAuth access token.
19757 /// * *alt* (query-string) - Data format for response.
19758 /// * *callback* (query-string) - JSONP
19759 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19760 /// * *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.
19761 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19762 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19763 /// * *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.
19764 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19765 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19766 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalManagedZonePatchCall<'a, C>
19767 where
19768 T: AsRef<str>,
19769 {
19770 self._additional_params
19771 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19772 self
19773 }
19774
19775 /// Identifies the authorization scope for the method you are building.
19776 ///
19777 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19778 /// [`Scope::CloudPlatform`].
19779 ///
19780 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19781 /// tokens for more than one scope.
19782 ///
19783 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19784 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19785 /// sufficient, a read-write scope will do as well.
19786 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalManagedZonePatchCall<'a, C>
19787 where
19788 St: AsRef<str>,
19789 {
19790 self._scopes.insert(String::from(scope.as_ref()));
19791 self
19792 }
19793 /// Identifies the authorization scope(s) for the method you are building.
19794 ///
19795 /// See [`Self::add_scope()`] for details.
19796 pub fn add_scopes<I, St>(
19797 mut self,
19798 scopes: I,
19799 ) -> ProjectLocationGlobalManagedZonePatchCall<'a, C>
19800 where
19801 I: IntoIterator<Item = St>,
19802 St: AsRef<str>,
19803 {
19804 self._scopes
19805 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19806 self
19807 }
19808
19809 /// Removes all scopes, and no default scope will be used either.
19810 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19811 /// for details).
19812 pub fn clear_scopes(mut self) -> ProjectLocationGlobalManagedZonePatchCall<'a, C> {
19813 self._scopes.clear();
19814 self
19815 }
19816}
19817
19818/// GetGlobalSettings gets settings of a project. GlobalSettings is a singleton resource.
19819///
19820/// A builder for the *locations.global.getSettings* method supported by a *project* resource.
19821/// It is not used directly, but through a [`ProjectMethods`] instance.
19822///
19823/// # Example
19824///
19825/// Instantiate a resource method builder
19826///
19827/// ```test_harness,no_run
19828/// # extern crate hyper;
19829/// # extern crate hyper_rustls;
19830/// # extern crate google_connectors1 as connectors1;
19831/// # async fn dox() {
19832/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19833///
19834/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19835/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19836/// # secret,
19837/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19838/// # ).build().await.unwrap();
19839///
19840/// # let client = hyper_util::client::legacy::Client::builder(
19841/// # hyper_util::rt::TokioExecutor::new()
19842/// # )
19843/// # .build(
19844/// # hyper_rustls::HttpsConnectorBuilder::new()
19845/// # .with_native_roots()
19846/// # .unwrap()
19847/// # .https_or_http()
19848/// # .enable_http1()
19849/// # .build()
19850/// # );
19851/// # let mut hub = Connectors::new(client, auth);
19852/// // You can configure optional parameters by calling the respective setters at will, and
19853/// // execute the final call using `doit()`.
19854/// // Values shown here are possibly random and not representative !
19855/// let result = hub.projects().locations_global_get_settings("name")
19856/// .doit().await;
19857/// # }
19858/// ```
19859pub struct ProjectLocationGlobalGetSettingCall<'a, C>
19860where
19861 C: 'a,
19862{
19863 hub: &'a Connectors<C>,
19864 _name: String,
19865 _delegate: Option<&'a mut dyn common::Delegate>,
19866 _additional_params: HashMap<String, String>,
19867 _scopes: BTreeSet<String>,
19868}
19869
19870impl<'a, C> common::CallBuilder for ProjectLocationGlobalGetSettingCall<'a, C> {}
19871
19872impl<'a, C> ProjectLocationGlobalGetSettingCall<'a, C>
19873where
19874 C: common::Connector,
19875{
19876 /// Perform the operation you have build so far.
19877 pub async fn doit(mut self) -> common::Result<(common::Response, Settings)> {
19878 use std::borrow::Cow;
19879 use std::io::{Read, Seek};
19880
19881 use common::{url::Params, ToParts};
19882 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19883
19884 let mut dd = common::DefaultDelegate;
19885 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19886 dlg.begin(common::MethodInfo {
19887 id: "connectors.projects.locations.global.getSettings",
19888 http_method: hyper::Method::GET,
19889 });
19890
19891 for &field in ["alt", "name"].iter() {
19892 if self._additional_params.contains_key(field) {
19893 dlg.finished(false);
19894 return Err(common::Error::FieldClash(field));
19895 }
19896 }
19897
19898 let mut params = Params::with_capacity(3 + self._additional_params.len());
19899 params.push("name", self._name);
19900
19901 params.extend(self._additional_params.iter());
19902
19903 params.push("alt", "json");
19904 let mut url = self.hub._base_url.clone() + "v1/{+name}";
19905 if self._scopes.is_empty() {
19906 self._scopes
19907 .insert(Scope::CloudPlatform.as_ref().to_string());
19908 }
19909
19910 #[allow(clippy::single_element_loop)]
19911 for &(find_this, param_name) in [("{+name}", "name")].iter() {
19912 url = params.uri_replacement(url, param_name, find_this, true);
19913 }
19914 {
19915 let to_remove = ["name"];
19916 params.remove_params(&to_remove);
19917 }
19918
19919 let url = params.parse_with_url(&url);
19920
19921 loop {
19922 let token = match self
19923 .hub
19924 .auth
19925 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19926 .await
19927 {
19928 Ok(token) => token,
19929 Err(e) => match dlg.token(e) {
19930 Ok(token) => token,
19931 Err(e) => {
19932 dlg.finished(false);
19933 return Err(common::Error::MissingToken(e));
19934 }
19935 },
19936 };
19937 let mut req_result = {
19938 let client = &self.hub.client;
19939 dlg.pre_request();
19940 let mut req_builder = hyper::Request::builder()
19941 .method(hyper::Method::GET)
19942 .uri(url.as_str())
19943 .header(USER_AGENT, self.hub._user_agent.clone());
19944
19945 if let Some(token) = token.as_ref() {
19946 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19947 }
19948
19949 let request = req_builder
19950 .header(CONTENT_LENGTH, 0_u64)
19951 .body(common::to_body::<String>(None));
19952
19953 client.request(request.unwrap()).await
19954 };
19955
19956 match req_result {
19957 Err(err) => {
19958 if let common::Retry::After(d) = dlg.http_error(&err) {
19959 sleep(d).await;
19960 continue;
19961 }
19962 dlg.finished(false);
19963 return Err(common::Error::HttpError(err));
19964 }
19965 Ok(res) => {
19966 let (mut parts, body) = res.into_parts();
19967 let mut body = common::Body::new(body);
19968 if !parts.status.is_success() {
19969 let bytes = common::to_bytes(body).await.unwrap_or_default();
19970 let error = serde_json::from_str(&common::to_string(&bytes));
19971 let response = common::to_response(parts, bytes.into());
19972
19973 if let common::Retry::After(d) =
19974 dlg.http_failure(&response, error.as_ref().ok())
19975 {
19976 sleep(d).await;
19977 continue;
19978 }
19979
19980 dlg.finished(false);
19981
19982 return Err(match error {
19983 Ok(value) => common::Error::BadRequest(value),
19984 _ => common::Error::Failure(response),
19985 });
19986 }
19987 let response = {
19988 let bytes = common::to_bytes(body).await.unwrap_or_default();
19989 let encoded = common::to_string(&bytes);
19990 match serde_json::from_str(&encoded) {
19991 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19992 Err(error) => {
19993 dlg.response_json_decode_error(&encoded, &error);
19994 return Err(common::Error::JsonDecodeError(
19995 encoded.to_string(),
19996 error,
19997 ));
19998 }
19999 }
20000 };
20001
20002 dlg.finished(true);
20003 return Ok(response);
20004 }
20005 }
20006 }
20007 }
20008
20009 /// Required. The resource name of the Settings.
20010 ///
20011 /// Sets the *name* path property to the given value.
20012 ///
20013 /// Even though the property as already been set when instantiating this call,
20014 /// we provide this method for API completeness.
20015 pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalGetSettingCall<'a, C> {
20016 self._name = new_value.to_string();
20017 self
20018 }
20019 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20020 /// while executing the actual API request.
20021 ///
20022 /// ````text
20023 /// It should be used to handle progress information, and to implement a certain level of resilience.
20024 /// ````
20025 ///
20026 /// Sets the *delegate* property to the given value.
20027 pub fn delegate(
20028 mut self,
20029 new_value: &'a mut dyn common::Delegate,
20030 ) -> ProjectLocationGlobalGetSettingCall<'a, C> {
20031 self._delegate = Some(new_value);
20032 self
20033 }
20034
20035 /// Set any additional parameter of the query string used in the request.
20036 /// It should be used to set parameters which are not yet available through their own
20037 /// setters.
20038 ///
20039 /// Please note that this method must not be used to set any of the known parameters
20040 /// which have their own setter method. If done anyway, the request will fail.
20041 ///
20042 /// # Additional Parameters
20043 ///
20044 /// * *$.xgafv* (query-string) - V1 error format.
20045 /// * *access_token* (query-string) - OAuth access token.
20046 /// * *alt* (query-string) - Data format for response.
20047 /// * *callback* (query-string) - JSONP
20048 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20049 /// * *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.
20050 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20051 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20052 /// * *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.
20053 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20054 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20055 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalGetSettingCall<'a, C>
20056 where
20057 T: AsRef<str>,
20058 {
20059 self._additional_params
20060 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20061 self
20062 }
20063
20064 /// Identifies the authorization scope for the method you are building.
20065 ///
20066 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20067 /// [`Scope::CloudPlatform`].
20068 ///
20069 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20070 /// tokens for more than one scope.
20071 ///
20072 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20073 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20074 /// sufficient, a read-write scope will do as well.
20075 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalGetSettingCall<'a, C>
20076 where
20077 St: AsRef<str>,
20078 {
20079 self._scopes.insert(String::from(scope.as_ref()));
20080 self
20081 }
20082 /// Identifies the authorization scope(s) for the method you are building.
20083 ///
20084 /// See [`Self::add_scope()`] for details.
20085 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalGetSettingCall<'a, C>
20086 where
20087 I: IntoIterator<Item = St>,
20088 St: AsRef<str>,
20089 {
20090 self._scopes
20091 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20092 self
20093 }
20094
20095 /// Removes all scopes, and no default scope will be used either.
20096 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20097 /// for details).
20098 pub fn clear_scopes(mut self) -> ProjectLocationGlobalGetSettingCall<'a, C> {
20099 self._scopes.clear();
20100 self
20101 }
20102}
20103
20104/// Update the global settings of a project.
20105///
20106/// A builder for the *locations.global.updateSettings* method supported by a *project* resource.
20107/// It is not used directly, but through a [`ProjectMethods`] instance.
20108///
20109/// # Example
20110///
20111/// Instantiate a resource method builder
20112///
20113/// ```test_harness,no_run
20114/// # extern crate hyper;
20115/// # extern crate hyper_rustls;
20116/// # extern crate google_connectors1 as connectors1;
20117/// use connectors1::api::Settings;
20118/// # async fn dox() {
20119/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20120///
20121/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20122/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20123/// # secret,
20124/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20125/// # ).build().await.unwrap();
20126///
20127/// # let client = hyper_util::client::legacy::Client::builder(
20128/// # hyper_util::rt::TokioExecutor::new()
20129/// # )
20130/// # .build(
20131/// # hyper_rustls::HttpsConnectorBuilder::new()
20132/// # .with_native_roots()
20133/// # .unwrap()
20134/// # .https_or_http()
20135/// # .enable_http1()
20136/// # .build()
20137/// # );
20138/// # let mut hub = Connectors::new(client, auth);
20139/// // As the method needs a request, you would usually fill it with the desired information
20140/// // into the respective structure. Some of the parts shown here might not be applicable !
20141/// // Values shown here are possibly random and not representative !
20142/// let mut req = Settings::default();
20143///
20144/// // You can configure optional parameters by calling the respective setters at will, and
20145/// // execute the final call using `doit()`.
20146/// // Values shown here are possibly random and not representative !
20147/// let result = hub.projects().locations_global_update_settings(req, "name")
20148/// .update_mask(FieldMask::new::<&str>(&[]))
20149/// .doit().await;
20150/// # }
20151/// ```
20152pub struct ProjectLocationGlobalUpdateSettingCall<'a, C>
20153where
20154 C: 'a,
20155{
20156 hub: &'a Connectors<C>,
20157 _request: Settings,
20158 _name: String,
20159 _update_mask: Option<common::FieldMask>,
20160 _delegate: Option<&'a mut dyn common::Delegate>,
20161 _additional_params: HashMap<String, String>,
20162 _scopes: BTreeSet<String>,
20163}
20164
20165impl<'a, C> common::CallBuilder for ProjectLocationGlobalUpdateSettingCall<'a, C> {}
20166
20167impl<'a, C> ProjectLocationGlobalUpdateSettingCall<'a, C>
20168where
20169 C: common::Connector,
20170{
20171 /// Perform the operation you have build so far.
20172 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
20173 use std::borrow::Cow;
20174 use std::io::{Read, Seek};
20175
20176 use common::{url::Params, ToParts};
20177 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20178
20179 let mut dd = common::DefaultDelegate;
20180 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20181 dlg.begin(common::MethodInfo {
20182 id: "connectors.projects.locations.global.updateSettings",
20183 http_method: hyper::Method::PATCH,
20184 });
20185
20186 for &field in ["alt", "name", "updateMask"].iter() {
20187 if self._additional_params.contains_key(field) {
20188 dlg.finished(false);
20189 return Err(common::Error::FieldClash(field));
20190 }
20191 }
20192
20193 let mut params = Params::with_capacity(5 + self._additional_params.len());
20194 params.push("name", self._name);
20195 if let Some(value) = self._update_mask.as_ref() {
20196 params.push("updateMask", value.to_string());
20197 }
20198
20199 params.extend(self._additional_params.iter());
20200
20201 params.push("alt", "json");
20202 let mut url = self.hub._base_url.clone() + "v1/{+name}";
20203 if self._scopes.is_empty() {
20204 self._scopes
20205 .insert(Scope::CloudPlatform.as_ref().to_string());
20206 }
20207
20208 #[allow(clippy::single_element_loop)]
20209 for &(find_this, param_name) in [("{+name}", "name")].iter() {
20210 url = params.uri_replacement(url, param_name, find_this, true);
20211 }
20212 {
20213 let to_remove = ["name"];
20214 params.remove_params(&to_remove);
20215 }
20216
20217 let url = params.parse_with_url(&url);
20218
20219 let mut json_mime_type = mime::APPLICATION_JSON;
20220 let mut request_value_reader = {
20221 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20222 common::remove_json_null_values(&mut value);
20223 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20224 serde_json::to_writer(&mut dst, &value).unwrap();
20225 dst
20226 };
20227 let request_size = request_value_reader
20228 .seek(std::io::SeekFrom::End(0))
20229 .unwrap();
20230 request_value_reader
20231 .seek(std::io::SeekFrom::Start(0))
20232 .unwrap();
20233
20234 loop {
20235 let token = match self
20236 .hub
20237 .auth
20238 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20239 .await
20240 {
20241 Ok(token) => token,
20242 Err(e) => match dlg.token(e) {
20243 Ok(token) => token,
20244 Err(e) => {
20245 dlg.finished(false);
20246 return Err(common::Error::MissingToken(e));
20247 }
20248 },
20249 };
20250 request_value_reader
20251 .seek(std::io::SeekFrom::Start(0))
20252 .unwrap();
20253 let mut req_result = {
20254 let client = &self.hub.client;
20255 dlg.pre_request();
20256 let mut req_builder = hyper::Request::builder()
20257 .method(hyper::Method::PATCH)
20258 .uri(url.as_str())
20259 .header(USER_AGENT, self.hub._user_agent.clone());
20260
20261 if let Some(token) = token.as_ref() {
20262 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20263 }
20264
20265 let request = req_builder
20266 .header(CONTENT_TYPE, json_mime_type.to_string())
20267 .header(CONTENT_LENGTH, request_size as u64)
20268 .body(common::to_body(
20269 request_value_reader.get_ref().clone().into(),
20270 ));
20271
20272 client.request(request.unwrap()).await
20273 };
20274
20275 match req_result {
20276 Err(err) => {
20277 if let common::Retry::After(d) = dlg.http_error(&err) {
20278 sleep(d).await;
20279 continue;
20280 }
20281 dlg.finished(false);
20282 return Err(common::Error::HttpError(err));
20283 }
20284 Ok(res) => {
20285 let (mut parts, body) = res.into_parts();
20286 let mut body = common::Body::new(body);
20287 if !parts.status.is_success() {
20288 let bytes = common::to_bytes(body).await.unwrap_or_default();
20289 let error = serde_json::from_str(&common::to_string(&bytes));
20290 let response = common::to_response(parts, bytes.into());
20291
20292 if let common::Retry::After(d) =
20293 dlg.http_failure(&response, error.as_ref().ok())
20294 {
20295 sleep(d).await;
20296 continue;
20297 }
20298
20299 dlg.finished(false);
20300
20301 return Err(match error {
20302 Ok(value) => common::Error::BadRequest(value),
20303 _ => common::Error::Failure(response),
20304 });
20305 }
20306 let response = {
20307 let bytes = common::to_bytes(body).await.unwrap_or_default();
20308 let encoded = common::to_string(&bytes);
20309 match serde_json::from_str(&encoded) {
20310 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20311 Err(error) => {
20312 dlg.response_json_decode_error(&encoded, &error);
20313 return Err(common::Error::JsonDecodeError(
20314 encoded.to_string(),
20315 error,
20316 ));
20317 }
20318 }
20319 };
20320
20321 dlg.finished(true);
20322 return Ok(response);
20323 }
20324 }
20325 }
20326 }
20327
20328 ///
20329 /// Sets the *request* property to the given value.
20330 ///
20331 /// Even though the property as already been set when instantiating this call,
20332 /// we provide this method for API completeness.
20333 pub fn request(mut self, new_value: Settings) -> ProjectLocationGlobalUpdateSettingCall<'a, C> {
20334 self._request = new_value;
20335 self
20336 }
20337 /// Output only. Resource name of the Connection. Format: projects/{project}/locations/global/settings}
20338 ///
20339 /// Sets the *name* path property to the given value.
20340 ///
20341 /// Even though the property as already been set when instantiating this call,
20342 /// we provide this method for API completeness.
20343 pub fn name(mut self, new_value: &str) -> ProjectLocationGlobalUpdateSettingCall<'a, C> {
20344 self._name = new_value.to_string();
20345 self
20346 }
20347 /// Required. The list of fields to update.
20348 ///
20349 /// Sets the *update mask* query property to the given value.
20350 pub fn update_mask(
20351 mut self,
20352 new_value: common::FieldMask,
20353 ) -> ProjectLocationGlobalUpdateSettingCall<'a, C> {
20354 self._update_mask = Some(new_value);
20355 self
20356 }
20357 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20358 /// while executing the actual API request.
20359 ///
20360 /// ````text
20361 /// It should be used to handle progress information, and to implement a certain level of resilience.
20362 /// ````
20363 ///
20364 /// Sets the *delegate* property to the given value.
20365 pub fn delegate(
20366 mut self,
20367 new_value: &'a mut dyn common::Delegate,
20368 ) -> ProjectLocationGlobalUpdateSettingCall<'a, C> {
20369 self._delegate = Some(new_value);
20370 self
20371 }
20372
20373 /// Set any additional parameter of the query string used in the request.
20374 /// It should be used to set parameters which are not yet available through their own
20375 /// setters.
20376 ///
20377 /// Please note that this method must not be used to set any of the known parameters
20378 /// which have their own setter method. If done anyway, the request will fail.
20379 ///
20380 /// # Additional Parameters
20381 ///
20382 /// * *$.xgafv* (query-string) - V1 error format.
20383 /// * *access_token* (query-string) - OAuth access token.
20384 /// * *alt* (query-string) - Data format for response.
20385 /// * *callback* (query-string) - JSONP
20386 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20387 /// * *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.
20388 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20389 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20390 /// * *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.
20391 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20392 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20393 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGlobalUpdateSettingCall<'a, C>
20394 where
20395 T: AsRef<str>,
20396 {
20397 self._additional_params
20398 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20399 self
20400 }
20401
20402 /// Identifies the authorization scope for the method you are building.
20403 ///
20404 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20405 /// [`Scope::CloudPlatform`].
20406 ///
20407 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20408 /// tokens for more than one scope.
20409 ///
20410 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20411 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20412 /// sufficient, a read-write scope will do as well.
20413 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGlobalUpdateSettingCall<'a, C>
20414 where
20415 St: AsRef<str>,
20416 {
20417 self._scopes.insert(String::from(scope.as_ref()));
20418 self
20419 }
20420 /// Identifies the authorization scope(s) for the method you are building.
20421 ///
20422 /// See [`Self::add_scope()`] for details.
20423 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGlobalUpdateSettingCall<'a, C>
20424 where
20425 I: IntoIterator<Item = St>,
20426 St: AsRef<str>,
20427 {
20428 self._scopes
20429 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20430 self
20431 }
20432
20433 /// Removes all scopes, and no default scope will be used either.
20434 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20435 /// for details).
20436 pub fn clear_scopes(mut self) -> ProjectLocationGlobalUpdateSettingCall<'a, C> {
20437 self._scopes.clear();
20438 self
20439 }
20440}
20441
20442/// 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`.
20443///
20444/// A builder for the *locations.operations.cancel* method supported by a *project* resource.
20445/// It is not used directly, but through a [`ProjectMethods`] instance.
20446///
20447/// # Example
20448///
20449/// Instantiate a resource method builder
20450///
20451/// ```test_harness,no_run
20452/// # extern crate hyper;
20453/// # extern crate hyper_rustls;
20454/// # extern crate google_connectors1 as connectors1;
20455/// use connectors1::api::CancelOperationRequest;
20456/// # async fn dox() {
20457/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20458///
20459/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20460/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20461/// # secret,
20462/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20463/// # ).build().await.unwrap();
20464///
20465/// # let client = hyper_util::client::legacy::Client::builder(
20466/// # hyper_util::rt::TokioExecutor::new()
20467/// # )
20468/// # .build(
20469/// # hyper_rustls::HttpsConnectorBuilder::new()
20470/// # .with_native_roots()
20471/// # .unwrap()
20472/// # .https_or_http()
20473/// # .enable_http1()
20474/// # .build()
20475/// # );
20476/// # let mut hub = Connectors::new(client, auth);
20477/// // As the method needs a request, you would usually fill it with the desired information
20478/// // into the respective structure. Some of the parts shown here might not be applicable !
20479/// // Values shown here are possibly random and not representative !
20480/// let mut req = CancelOperationRequest::default();
20481///
20482/// // You can configure optional parameters by calling the respective setters at will, and
20483/// // execute the final call using `doit()`.
20484/// // Values shown here are possibly random and not representative !
20485/// let result = hub.projects().locations_operations_cancel(req, "name")
20486/// .doit().await;
20487/// # }
20488/// ```
20489pub struct ProjectLocationOperationCancelCall<'a, C>
20490where
20491 C: 'a,
20492{
20493 hub: &'a Connectors<C>,
20494 _request: CancelOperationRequest,
20495 _name: String,
20496 _delegate: Option<&'a mut dyn common::Delegate>,
20497 _additional_params: HashMap<String, String>,
20498 _scopes: BTreeSet<String>,
20499}
20500
20501impl<'a, C> common::CallBuilder for ProjectLocationOperationCancelCall<'a, C> {}
20502
20503impl<'a, C> ProjectLocationOperationCancelCall<'a, C>
20504where
20505 C: common::Connector,
20506{
20507 /// Perform the operation you have build so far.
20508 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
20509 use std::borrow::Cow;
20510 use std::io::{Read, Seek};
20511
20512 use common::{url::Params, ToParts};
20513 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20514
20515 let mut dd = common::DefaultDelegate;
20516 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20517 dlg.begin(common::MethodInfo {
20518 id: "connectors.projects.locations.operations.cancel",
20519 http_method: hyper::Method::POST,
20520 });
20521
20522 for &field in ["alt", "name"].iter() {
20523 if self._additional_params.contains_key(field) {
20524 dlg.finished(false);
20525 return Err(common::Error::FieldClash(field));
20526 }
20527 }
20528
20529 let mut params = Params::with_capacity(4 + self._additional_params.len());
20530 params.push("name", self._name);
20531
20532 params.extend(self._additional_params.iter());
20533
20534 params.push("alt", "json");
20535 let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
20536 if self._scopes.is_empty() {
20537 self._scopes
20538 .insert(Scope::CloudPlatform.as_ref().to_string());
20539 }
20540
20541 #[allow(clippy::single_element_loop)]
20542 for &(find_this, param_name) in [("{+name}", "name")].iter() {
20543 url = params.uri_replacement(url, param_name, find_this, true);
20544 }
20545 {
20546 let to_remove = ["name"];
20547 params.remove_params(&to_remove);
20548 }
20549
20550 let url = params.parse_with_url(&url);
20551
20552 let mut json_mime_type = mime::APPLICATION_JSON;
20553 let mut request_value_reader = {
20554 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20555 common::remove_json_null_values(&mut value);
20556 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20557 serde_json::to_writer(&mut dst, &value).unwrap();
20558 dst
20559 };
20560 let request_size = request_value_reader
20561 .seek(std::io::SeekFrom::End(0))
20562 .unwrap();
20563 request_value_reader
20564 .seek(std::io::SeekFrom::Start(0))
20565 .unwrap();
20566
20567 loop {
20568 let token = match self
20569 .hub
20570 .auth
20571 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20572 .await
20573 {
20574 Ok(token) => token,
20575 Err(e) => match dlg.token(e) {
20576 Ok(token) => token,
20577 Err(e) => {
20578 dlg.finished(false);
20579 return Err(common::Error::MissingToken(e));
20580 }
20581 },
20582 };
20583 request_value_reader
20584 .seek(std::io::SeekFrom::Start(0))
20585 .unwrap();
20586 let mut req_result = {
20587 let client = &self.hub.client;
20588 dlg.pre_request();
20589 let mut req_builder = hyper::Request::builder()
20590 .method(hyper::Method::POST)
20591 .uri(url.as_str())
20592 .header(USER_AGENT, self.hub._user_agent.clone());
20593
20594 if let Some(token) = token.as_ref() {
20595 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20596 }
20597
20598 let request = req_builder
20599 .header(CONTENT_TYPE, json_mime_type.to_string())
20600 .header(CONTENT_LENGTH, request_size as u64)
20601 .body(common::to_body(
20602 request_value_reader.get_ref().clone().into(),
20603 ));
20604
20605 client.request(request.unwrap()).await
20606 };
20607
20608 match req_result {
20609 Err(err) => {
20610 if let common::Retry::After(d) = dlg.http_error(&err) {
20611 sleep(d).await;
20612 continue;
20613 }
20614 dlg.finished(false);
20615 return Err(common::Error::HttpError(err));
20616 }
20617 Ok(res) => {
20618 let (mut parts, body) = res.into_parts();
20619 let mut body = common::Body::new(body);
20620 if !parts.status.is_success() {
20621 let bytes = common::to_bytes(body).await.unwrap_or_default();
20622 let error = serde_json::from_str(&common::to_string(&bytes));
20623 let response = common::to_response(parts, bytes.into());
20624
20625 if let common::Retry::After(d) =
20626 dlg.http_failure(&response, error.as_ref().ok())
20627 {
20628 sleep(d).await;
20629 continue;
20630 }
20631
20632 dlg.finished(false);
20633
20634 return Err(match error {
20635 Ok(value) => common::Error::BadRequest(value),
20636 _ => common::Error::Failure(response),
20637 });
20638 }
20639 let response = {
20640 let bytes = common::to_bytes(body).await.unwrap_or_default();
20641 let encoded = common::to_string(&bytes);
20642 match serde_json::from_str(&encoded) {
20643 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20644 Err(error) => {
20645 dlg.response_json_decode_error(&encoded, &error);
20646 return Err(common::Error::JsonDecodeError(
20647 encoded.to_string(),
20648 error,
20649 ));
20650 }
20651 }
20652 };
20653
20654 dlg.finished(true);
20655 return Ok(response);
20656 }
20657 }
20658 }
20659 }
20660
20661 ///
20662 /// Sets the *request* property to the given value.
20663 ///
20664 /// Even though the property as already been set when instantiating this call,
20665 /// we provide this method for API completeness.
20666 pub fn request(
20667 mut self,
20668 new_value: CancelOperationRequest,
20669 ) -> ProjectLocationOperationCancelCall<'a, C> {
20670 self._request = new_value;
20671 self
20672 }
20673 /// The name of the operation resource to be cancelled.
20674 ///
20675 /// Sets the *name* path property to the given value.
20676 ///
20677 /// Even though the property as already been set when instantiating this call,
20678 /// we provide this method for API completeness.
20679 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationCancelCall<'a, C> {
20680 self._name = new_value.to_string();
20681 self
20682 }
20683 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20684 /// while executing the actual API request.
20685 ///
20686 /// ````text
20687 /// It should be used to handle progress information, and to implement a certain level of resilience.
20688 /// ````
20689 ///
20690 /// Sets the *delegate* property to the given value.
20691 pub fn delegate(
20692 mut self,
20693 new_value: &'a mut dyn common::Delegate,
20694 ) -> ProjectLocationOperationCancelCall<'a, C> {
20695 self._delegate = Some(new_value);
20696 self
20697 }
20698
20699 /// Set any additional parameter of the query string used in the request.
20700 /// It should be used to set parameters which are not yet available through their own
20701 /// setters.
20702 ///
20703 /// Please note that this method must not be used to set any of the known parameters
20704 /// which have their own setter method. If done anyway, the request will fail.
20705 ///
20706 /// # Additional Parameters
20707 ///
20708 /// * *$.xgafv* (query-string) - V1 error format.
20709 /// * *access_token* (query-string) - OAuth access token.
20710 /// * *alt* (query-string) - Data format for response.
20711 /// * *callback* (query-string) - JSONP
20712 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20713 /// * *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.
20714 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20715 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20716 /// * *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.
20717 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20718 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20719 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationCancelCall<'a, C>
20720 where
20721 T: AsRef<str>,
20722 {
20723 self._additional_params
20724 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20725 self
20726 }
20727
20728 /// Identifies the authorization scope for the method you are building.
20729 ///
20730 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20731 /// [`Scope::CloudPlatform`].
20732 ///
20733 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20734 /// tokens for more than one scope.
20735 ///
20736 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20737 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20738 /// sufficient, a read-write scope will do as well.
20739 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationCancelCall<'a, C>
20740 where
20741 St: AsRef<str>,
20742 {
20743 self._scopes.insert(String::from(scope.as_ref()));
20744 self
20745 }
20746 /// Identifies the authorization scope(s) for the method you are building.
20747 ///
20748 /// See [`Self::add_scope()`] for details.
20749 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationCancelCall<'a, C>
20750 where
20751 I: IntoIterator<Item = St>,
20752 St: AsRef<str>,
20753 {
20754 self._scopes
20755 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20756 self
20757 }
20758
20759 /// Removes all scopes, and no default scope will be used either.
20760 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20761 /// for details).
20762 pub fn clear_scopes(mut self) -> ProjectLocationOperationCancelCall<'a, C> {
20763 self._scopes.clear();
20764 self
20765 }
20766}
20767
20768/// 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`.
20769///
20770/// A builder for the *locations.operations.delete* method supported by a *project* resource.
20771/// It is not used directly, but through a [`ProjectMethods`] instance.
20772///
20773/// # Example
20774///
20775/// Instantiate a resource method builder
20776///
20777/// ```test_harness,no_run
20778/// # extern crate hyper;
20779/// # extern crate hyper_rustls;
20780/// # extern crate google_connectors1 as connectors1;
20781/// # async fn dox() {
20782/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20783///
20784/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20785/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20786/// # secret,
20787/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20788/// # ).build().await.unwrap();
20789///
20790/// # let client = hyper_util::client::legacy::Client::builder(
20791/// # hyper_util::rt::TokioExecutor::new()
20792/// # )
20793/// # .build(
20794/// # hyper_rustls::HttpsConnectorBuilder::new()
20795/// # .with_native_roots()
20796/// # .unwrap()
20797/// # .https_or_http()
20798/// # .enable_http1()
20799/// # .build()
20800/// # );
20801/// # let mut hub = Connectors::new(client, auth);
20802/// // You can configure optional parameters by calling the respective setters at will, and
20803/// // execute the final call using `doit()`.
20804/// // Values shown here are possibly random and not representative !
20805/// let result = hub.projects().locations_operations_delete("name")
20806/// .doit().await;
20807/// # }
20808/// ```
20809pub struct ProjectLocationOperationDeleteCall<'a, C>
20810where
20811 C: 'a,
20812{
20813 hub: &'a Connectors<C>,
20814 _name: String,
20815 _delegate: Option<&'a mut dyn common::Delegate>,
20816 _additional_params: HashMap<String, String>,
20817 _scopes: BTreeSet<String>,
20818}
20819
20820impl<'a, C> common::CallBuilder for ProjectLocationOperationDeleteCall<'a, C> {}
20821
20822impl<'a, C> ProjectLocationOperationDeleteCall<'a, C>
20823where
20824 C: common::Connector,
20825{
20826 /// Perform the operation you have build so far.
20827 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
20828 use std::borrow::Cow;
20829 use std::io::{Read, Seek};
20830
20831 use common::{url::Params, ToParts};
20832 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20833
20834 let mut dd = common::DefaultDelegate;
20835 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20836 dlg.begin(common::MethodInfo {
20837 id: "connectors.projects.locations.operations.delete",
20838 http_method: hyper::Method::DELETE,
20839 });
20840
20841 for &field in ["alt", "name"].iter() {
20842 if self._additional_params.contains_key(field) {
20843 dlg.finished(false);
20844 return Err(common::Error::FieldClash(field));
20845 }
20846 }
20847
20848 let mut params = Params::with_capacity(3 + self._additional_params.len());
20849 params.push("name", self._name);
20850
20851 params.extend(self._additional_params.iter());
20852
20853 params.push("alt", "json");
20854 let mut url = self.hub._base_url.clone() + "v1/{+name}";
20855 if self._scopes.is_empty() {
20856 self._scopes
20857 .insert(Scope::CloudPlatform.as_ref().to_string());
20858 }
20859
20860 #[allow(clippy::single_element_loop)]
20861 for &(find_this, param_name) in [("{+name}", "name")].iter() {
20862 url = params.uri_replacement(url, param_name, find_this, true);
20863 }
20864 {
20865 let to_remove = ["name"];
20866 params.remove_params(&to_remove);
20867 }
20868
20869 let url = params.parse_with_url(&url);
20870
20871 loop {
20872 let token = match self
20873 .hub
20874 .auth
20875 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20876 .await
20877 {
20878 Ok(token) => token,
20879 Err(e) => match dlg.token(e) {
20880 Ok(token) => token,
20881 Err(e) => {
20882 dlg.finished(false);
20883 return Err(common::Error::MissingToken(e));
20884 }
20885 },
20886 };
20887 let mut req_result = {
20888 let client = &self.hub.client;
20889 dlg.pre_request();
20890 let mut req_builder = hyper::Request::builder()
20891 .method(hyper::Method::DELETE)
20892 .uri(url.as_str())
20893 .header(USER_AGENT, self.hub._user_agent.clone());
20894
20895 if let Some(token) = token.as_ref() {
20896 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20897 }
20898
20899 let request = req_builder
20900 .header(CONTENT_LENGTH, 0_u64)
20901 .body(common::to_body::<String>(None));
20902
20903 client.request(request.unwrap()).await
20904 };
20905
20906 match req_result {
20907 Err(err) => {
20908 if let common::Retry::After(d) = dlg.http_error(&err) {
20909 sleep(d).await;
20910 continue;
20911 }
20912 dlg.finished(false);
20913 return Err(common::Error::HttpError(err));
20914 }
20915 Ok(res) => {
20916 let (mut parts, body) = res.into_parts();
20917 let mut body = common::Body::new(body);
20918 if !parts.status.is_success() {
20919 let bytes = common::to_bytes(body).await.unwrap_or_default();
20920 let error = serde_json::from_str(&common::to_string(&bytes));
20921 let response = common::to_response(parts, bytes.into());
20922
20923 if let common::Retry::After(d) =
20924 dlg.http_failure(&response, error.as_ref().ok())
20925 {
20926 sleep(d).await;
20927 continue;
20928 }
20929
20930 dlg.finished(false);
20931
20932 return Err(match error {
20933 Ok(value) => common::Error::BadRequest(value),
20934 _ => common::Error::Failure(response),
20935 });
20936 }
20937 let response = {
20938 let bytes = common::to_bytes(body).await.unwrap_or_default();
20939 let encoded = common::to_string(&bytes);
20940 match serde_json::from_str(&encoded) {
20941 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20942 Err(error) => {
20943 dlg.response_json_decode_error(&encoded, &error);
20944 return Err(common::Error::JsonDecodeError(
20945 encoded.to_string(),
20946 error,
20947 ));
20948 }
20949 }
20950 };
20951
20952 dlg.finished(true);
20953 return Ok(response);
20954 }
20955 }
20956 }
20957 }
20958
20959 /// The name of the operation resource to be deleted.
20960 ///
20961 /// Sets the *name* path property to the given value.
20962 ///
20963 /// Even though the property as already been set when instantiating this call,
20964 /// we provide this method for API completeness.
20965 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationDeleteCall<'a, C> {
20966 self._name = new_value.to_string();
20967 self
20968 }
20969 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20970 /// while executing the actual API request.
20971 ///
20972 /// ````text
20973 /// It should be used to handle progress information, and to implement a certain level of resilience.
20974 /// ````
20975 ///
20976 /// Sets the *delegate* property to the given value.
20977 pub fn delegate(
20978 mut self,
20979 new_value: &'a mut dyn common::Delegate,
20980 ) -> ProjectLocationOperationDeleteCall<'a, C> {
20981 self._delegate = Some(new_value);
20982 self
20983 }
20984
20985 /// Set any additional parameter of the query string used in the request.
20986 /// It should be used to set parameters which are not yet available through their own
20987 /// setters.
20988 ///
20989 /// Please note that this method must not be used to set any of the known parameters
20990 /// which have their own setter method. If done anyway, the request will fail.
20991 ///
20992 /// # Additional Parameters
20993 ///
20994 /// * *$.xgafv* (query-string) - V1 error format.
20995 /// * *access_token* (query-string) - OAuth access token.
20996 /// * *alt* (query-string) - Data format for response.
20997 /// * *callback* (query-string) - JSONP
20998 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20999 /// * *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.
21000 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21001 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21002 /// * *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.
21003 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21004 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21005 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationDeleteCall<'a, C>
21006 where
21007 T: AsRef<str>,
21008 {
21009 self._additional_params
21010 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21011 self
21012 }
21013
21014 /// Identifies the authorization scope for the method you are building.
21015 ///
21016 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21017 /// [`Scope::CloudPlatform`].
21018 ///
21019 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21020 /// tokens for more than one scope.
21021 ///
21022 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21023 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21024 /// sufficient, a read-write scope will do as well.
21025 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationDeleteCall<'a, C>
21026 where
21027 St: AsRef<str>,
21028 {
21029 self._scopes.insert(String::from(scope.as_ref()));
21030 self
21031 }
21032 /// Identifies the authorization scope(s) for the method you are building.
21033 ///
21034 /// See [`Self::add_scope()`] for details.
21035 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationDeleteCall<'a, C>
21036 where
21037 I: IntoIterator<Item = St>,
21038 St: AsRef<str>,
21039 {
21040 self._scopes
21041 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21042 self
21043 }
21044
21045 /// Removes all scopes, and no default scope will be used either.
21046 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21047 /// for details).
21048 pub fn clear_scopes(mut self) -> ProjectLocationOperationDeleteCall<'a, C> {
21049 self._scopes.clear();
21050 self
21051 }
21052}
21053
21054/// 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.
21055///
21056/// A builder for the *locations.operations.get* method supported by a *project* resource.
21057/// It is not used directly, but through a [`ProjectMethods`] instance.
21058///
21059/// # Example
21060///
21061/// Instantiate a resource method builder
21062///
21063/// ```test_harness,no_run
21064/// # extern crate hyper;
21065/// # extern crate hyper_rustls;
21066/// # extern crate google_connectors1 as connectors1;
21067/// # async fn dox() {
21068/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21069///
21070/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21071/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21072/// # secret,
21073/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21074/// # ).build().await.unwrap();
21075///
21076/// # let client = hyper_util::client::legacy::Client::builder(
21077/// # hyper_util::rt::TokioExecutor::new()
21078/// # )
21079/// # .build(
21080/// # hyper_rustls::HttpsConnectorBuilder::new()
21081/// # .with_native_roots()
21082/// # .unwrap()
21083/// # .https_or_http()
21084/// # .enable_http1()
21085/// # .build()
21086/// # );
21087/// # let mut hub = Connectors::new(client, auth);
21088/// // You can configure optional parameters by calling the respective setters at will, and
21089/// // execute the final call using `doit()`.
21090/// // Values shown here are possibly random and not representative !
21091/// let result = hub.projects().locations_operations_get("name")
21092/// .doit().await;
21093/// # }
21094/// ```
21095pub struct ProjectLocationOperationGetCall<'a, C>
21096where
21097 C: 'a,
21098{
21099 hub: &'a Connectors<C>,
21100 _name: String,
21101 _delegate: Option<&'a mut dyn common::Delegate>,
21102 _additional_params: HashMap<String, String>,
21103 _scopes: BTreeSet<String>,
21104}
21105
21106impl<'a, C> common::CallBuilder for ProjectLocationOperationGetCall<'a, C> {}
21107
21108impl<'a, C> ProjectLocationOperationGetCall<'a, C>
21109where
21110 C: common::Connector,
21111{
21112 /// Perform the operation you have build so far.
21113 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
21114 use std::borrow::Cow;
21115 use std::io::{Read, Seek};
21116
21117 use common::{url::Params, ToParts};
21118 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21119
21120 let mut dd = common::DefaultDelegate;
21121 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21122 dlg.begin(common::MethodInfo {
21123 id: "connectors.projects.locations.operations.get",
21124 http_method: hyper::Method::GET,
21125 });
21126
21127 for &field in ["alt", "name"].iter() {
21128 if self._additional_params.contains_key(field) {
21129 dlg.finished(false);
21130 return Err(common::Error::FieldClash(field));
21131 }
21132 }
21133
21134 let mut params = Params::with_capacity(3 + self._additional_params.len());
21135 params.push("name", self._name);
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::GET)
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 /// The name of the operation resource.
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(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
21252 self._name = new_value.to_string();
21253 self
21254 }
21255 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21256 /// while executing the actual API request.
21257 ///
21258 /// ````text
21259 /// It should be used to handle progress information, and to implement a certain level of resilience.
21260 /// ````
21261 ///
21262 /// Sets the *delegate* property to the given value.
21263 pub fn delegate(
21264 mut self,
21265 new_value: &'a mut dyn common::Delegate,
21266 ) -> ProjectLocationOperationGetCall<'a, C> {
21267 self._delegate = Some(new_value);
21268 self
21269 }
21270
21271 /// Set any additional parameter of the query string used in the request.
21272 /// It should be used to set parameters which are not yet available through their own
21273 /// setters.
21274 ///
21275 /// Please note that this method must not be used to set any of the known parameters
21276 /// which have their own setter method. If done anyway, the request will fail.
21277 ///
21278 /// # Additional Parameters
21279 ///
21280 /// * *$.xgafv* (query-string) - V1 error format.
21281 /// * *access_token* (query-string) - OAuth access token.
21282 /// * *alt* (query-string) - Data format for response.
21283 /// * *callback* (query-string) - JSONP
21284 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21285 /// * *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.
21286 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21287 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21288 /// * *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.
21289 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21290 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21291 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationGetCall<'a, C>
21292 where
21293 T: AsRef<str>,
21294 {
21295 self._additional_params
21296 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21297 self
21298 }
21299
21300 /// Identifies the authorization scope for the method you are building.
21301 ///
21302 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21303 /// [`Scope::CloudPlatform`].
21304 ///
21305 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21306 /// tokens for more than one scope.
21307 ///
21308 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21309 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21310 /// sufficient, a read-write scope will do as well.
21311 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationGetCall<'a, C>
21312 where
21313 St: AsRef<str>,
21314 {
21315 self._scopes.insert(String::from(scope.as_ref()));
21316 self
21317 }
21318 /// Identifies the authorization scope(s) for the method you are building.
21319 ///
21320 /// See [`Self::add_scope()`] for details.
21321 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationGetCall<'a, C>
21322 where
21323 I: IntoIterator<Item = St>,
21324 St: AsRef<str>,
21325 {
21326 self._scopes
21327 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21328 self
21329 }
21330
21331 /// Removes all scopes, and no default scope will be used either.
21332 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21333 /// for details).
21334 pub fn clear_scopes(mut self) -> ProjectLocationOperationGetCall<'a, C> {
21335 self._scopes.clear();
21336 self
21337 }
21338}
21339
21340/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
21341///
21342/// A builder for the *locations.operations.list* method supported by a *project* resource.
21343/// It is not used directly, but through a [`ProjectMethods`] instance.
21344///
21345/// # Example
21346///
21347/// Instantiate a resource method builder
21348///
21349/// ```test_harness,no_run
21350/// # extern crate hyper;
21351/// # extern crate hyper_rustls;
21352/// # extern crate google_connectors1 as connectors1;
21353/// # async fn dox() {
21354/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21355///
21356/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21357/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21358/// # secret,
21359/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21360/// # ).build().await.unwrap();
21361///
21362/// # let client = hyper_util::client::legacy::Client::builder(
21363/// # hyper_util::rt::TokioExecutor::new()
21364/// # )
21365/// # .build(
21366/// # hyper_rustls::HttpsConnectorBuilder::new()
21367/// # .with_native_roots()
21368/// # .unwrap()
21369/// # .https_or_http()
21370/// # .enable_http1()
21371/// # .build()
21372/// # );
21373/// # let mut hub = Connectors::new(client, auth);
21374/// // You can configure optional parameters by calling the respective setters at will, and
21375/// // execute the final call using `doit()`.
21376/// // Values shown here are possibly random and not representative !
21377/// let result = hub.projects().locations_operations_list("name")
21378/// .page_token("sanctus")
21379/// .page_size(-56)
21380/// .filter("est")
21381/// .doit().await;
21382/// # }
21383/// ```
21384pub struct ProjectLocationOperationListCall<'a, C>
21385where
21386 C: 'a,
21387{
21388 hub: &'a Connectors<C>,
21389 _name: String,
21390 _page_token: Option<String>,
21391 _page_size: Option<i32>,
21392 _filter: Option<String>,
21393 _delegate: Option<&'a mut dyn common::Delegate>,
21394 _additional_params: HashMap<String, String>,
21395 _scopes: BTreeSet<String>,
21396}
21397
21398impl<'a, C> common::CallBuilder for ProjectLocationOperationListCall<'a, C> {}
21399
21400impl<'a, C> ProjectLocationOperationListCall<'a, C>
21401where
21402 C: common::Connector,
21403{
21404 /// Perform the operation you have build so far.
21405 pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
21406 use std::borrow::Cow;
21407 use std::io::{Read, Seek};
21408
21409 use common::{url::Params, ToParts};
21410 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21411
21412 let mut dd = common::DefaultDelegate;
21413 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21414 dlg.begin(common::MethodInfo {
21415 id: "connectors.projects.locations.operations.list",
21416 http_method: hyper::Method::GET,
21417 });
21418
21419 for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
21420 if self._additional_params.contains_key(field) {
21421 dlg.finished(false);
21422 return Err(common::Error::FieldClash(field));
21423 }
21424 }
21425
21426 let mut params = Params::with_capacity(6 + self._additional_params.len());
21427 params.push("name", self._name);
21428 if let Some(value) = self._page_token.as_ref() {
21429 params.push("pageToken", value);
21430 }
21431 if let Some(value) = self._page_size.as_ref() {
21432 params.push("pageSize", value.to_string());
21433 }
21434 if let Some(value) = self._filter.as_ref() {
21435 params.push("filter", value);
21436 }
21437
21438 params.extend(self._additional_params.iter());
21439
21440 params.push("alt", "json");
21441 let mut url = self.hub._base_url.clone() + "v1/{+name}/operations";
21442 if self._scopes.is_empty() {
21443 self._scopes
21444 .insert(Scope::CloudPlatform.as_ref().to_string());
21445 }
21446
21447 #[allow(clippy::single_element_loop)]
21448 for &(find_this, param_name) in [("{+name}", "name")].iter() {
21449 url = params.uri_replacement(url, param_name, find_this, true);
21450 }
21451 {
21452 let to_remove = ["name"];
21453 params.remove_params(&to_remove);
21454 }
21455
21456 let url = params.parse_with_url(&url);
21457
21458 loop {
21459 let token = match self
21460 .hub
21461 .auth
21462 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21463 .await
21464 {
21465 Ok(token) => token,
21466 Err(e) => match dlg.token(e) {
21467 Ok(token) => token,
21468 Err(e) => {
21469 dlg.finished(false);
21470 return Err(common::Error::MissingToken(e));
21471 }
21472 },
21473 };
21474 let mut req_result = {
21475 let client = &self.hub.client;
21476 dlg.pre_request();
21477 let mut req_builder = hyper::Request::builder()
21478 .method(hyper::Method::GET)
21479 .uri(url.as_str())
21480 .header(USER_AGENT, self.hub._user_agent.clone());
21481
21482 if let Some(token) = token.as_ref() {
21483 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21484 }
21485
21486 let request = req_builder
21487 .header(CONTENT_LENGTH, 0_u64)
21488 .body(common::to_body::<String>(None));
21489
21490 client.request(request.unwrap()).await
21491 };
21492
21493 match req_result {
21494 Err(err) => {
21495 if let common::Retry::After(d) = dlg.http_error(&err) {
21496 sleep(d).await;
21497 continue;
21498 }
21499 dlg.finished(false);
21500 return Err(common::Error::HttpError(err));
21501 }
21502 Ok(res) => {
21503 let (mut parts, body) = res.into_parts();
21504 let mut body = common::Body::new(body);
21505 if !parts.status.is_success() {
21506 let bytes = common::to_bytes(body).await.unwrap_or_default();
21507 let error = serde_json::from_str(&common::to_string(&bytes));
21508 let response = common::to_response(parts, bytes.into());
21509
21510 if let common::Retry::After(d) =
21511 dlg.http_failure(&response, error.as_ref().ok())
21512 {
21513 sleep(d).await;
21514 continue;
21515 }
21516
21517 dlg.finished(false);
21518
21519 return Err(match error {
21520 Ok(value) => common::Error::BadRequest(value),
21521 _ => common::Error::Failure(response),
21522 });
21523 }
21524 let response = {
21525 let bytes = common::to_bytes(body).await.unwrap_or_default();
21526 let encoded = common::to_string(&bytes);
21527 match serde_json::from_str(&encoded) {
21528 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21529 Err(error) => {
21530 dlg.response_json_decode_error(&encoded, &error);
21531 return Err(common::Error::JsonDecodeError(
21532 encoded.to_string(),
21533 error,
21534 ));
21535 }
21536 }
21537 };
21538
21539 dlg.finished(true);
21540 return Ok(response);
21541 }
21542 }
21543 }
21544 }
21545
21546 /// The name of the operation's parent resource.
21547 ///
21548 /// Sets the *name* path property to the given value.
21549 ///
21550 /// Even though the property as already been set when instantiating this call,
21551 /// we provide this method for API completeness.
21552 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
21553 self._name = new_value.to_string();
21554 self
21555 }
21556 /// The standard list page token.
21557 ///
21558 /// Sets the *page token* query property to the given value.
21559 pub fn page_token(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
21560 self._page_token = Some(new_value.to_string());
21561 self
21562 }
21563 /// The standard list page size.
21564 ///
21565 /// Sets the *page size* query property to the given value.
21566 pub fn page_size(mut self, new_value: i32) -> ProjectLocationOperationListCall<'a, C> {
21567 self._page_size = Some(new_value);
21568 self
21569 }
21570 /// The standard list filter.
21571 ///
21572 /// Sets the *filter* query property to the given value.
21573 pub fn filter(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
21574 self._filter = Some(new_value.to_string());
21575 self
21576 }
21577 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21578 /// while executing the actual API request.
21579 ///
21580 /// ````text
21581 /// It should be used to handle progress information, and to implement a certain level of resilience.
21582 /// ````
21583 ///
21584 /// Sets the *delegate* property to the given value.
21585 pub fn delegate(
21586 mut self,
21587 new_value: &'a mut dyn common::Delegate,
21588 ) -> ProjectLocationOperationListCall<'a, C> {
21589 self._delegate = Some(new_value);
21590 self
21591 }
21592
21593 /// Set any additional parameter of the query string used in the request.
21594 /// It should be used to set parameters which are not yet available through their own
21595 /// setters.
21596 ///
21597 /// Please note that this method must not be used to set any of the known parameters
21598 /// which have their own setter method. If done anyway, the request will fail.
21599 ///
21600 /// # Additional Parameters
21601 ///
21602 /// * *$.xgafv* (query-string) - V1 error format.
21603 /// * *access_token* (query-string) - OAuth access token.
21604 /// * *alt* (query-string) - Data format for response.
21605 /// * *callback* (query-string) - JSONP
21606 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21607 /// * *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.
21608 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21609 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21610 /// * *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.
21611 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21612 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21613 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationListCall<'a, C>
21614 where
21615 T: AsRef<str>,
21616 {
21617 self._additional_params
21618 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21619 self
21620 }
21621
21622 /// Identifies the authorization scope for the method you are building.
21623 ///
21624 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21625 /// [`Scope::CloudPlatform`].
21626 ///
21627 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21628 /// tokens for more than one scope.
21629 ///
21630 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21631 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21632 /// sufficient, a read-write scope will do as well.
21633 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationListCall<'a, C>
21634 where
21635 St: AsRef<str>,
21636 {
21637 self._scopes.insert(String::from(scope.as_ref()));
21638 self
21639 }
21640 /// Identifies the authorization scope(s) for the method you are building.
21641 ///
21642 /// See [`Self::add_scope()`] for details.
21643 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationListCall<'a, C>
21644 where
21645 I: IntoIterator<Item = St>,
21646 St: AsRef<str>,
21647 {
21648 self._scopes
21649 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21650 self
21651 }
21652
21653 /// Removes all scopes, and no default scope will be used either.
21654 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21655 /// for details).
21656 pub fn clear_scopes(mut self) -> ProjectLocationOperationListCall<'a, C> {
21657 self._scopes.clear();
21658 self
21659 }
21660}
21661
21662/// Gets details of a single event type.
21663///
21664/// A builder for the *locations.providers.connectors.versions.eventtypes.get* method supported by a *project* resource.
21665/// It is not used directly, but through a [`ProjectMethods`] instance.
21666///
21667/// # Example
21668///
21669/// Instantiate a resource method builder
21670///
21671/// ```test_harness,no_run
21672/// # extern crate hyper;
21673/// # extern crate hyper_rustls;
21674/// # extern crate google_connectors1 as connectors1;
21675/// # async fn dox() {
21676/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21677///
21678/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21679/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21680/// # secret,
21681/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21682/// # ).build().await.unwrap();
21683///
21684/// # let client = hyper_util::client::legacy::Client::builder(
21685/// # hyper_util::rt::TokioExecutor::new()
21686/// # )
21687/// # .build(
21688/// # hyper_rustls::HttpsConnectorBuilder::new()
21689/// # .with_native_roots()
21690/// # .unwrap()
21691/// # .https_or_http()
21692/// # .enable_http1()
21693/// # .build()
21694/// # );
21695/// # let mut hub = Connectors::new(client, auth);
21696/// // You can configure optional parameters by calling the respective setters at will, and
21697/// // execute the final call using `doit()`.
21698/// // Values shown here are possibly random and not representative !
21699/// let result = hub.projects().locations_providers_connectors_versions_eventtypes_get("name")
21700/// .doit().await;
21701/// # }
21702/// ```
21703pub struct ProjectLocationProviderConnectorVersionEventtypeGetCall<'a, C>
21704where
21705 C: 'a,
21706{
21707 hub: &'a Connectors<C>,
21708 _name: String,
21709 _delegate: Option<&'a mut dyn common::Delegate>,
21710 _additional_params: HashMap<String, String>,
21711 _scopes: BTreeSet<String>,
21712}
21713
21714impl<'a, C> common::CallBuilder for ProjectLocationProviderConnectorVersionEventtypeGetCall<'a, C> {}
21715
21716impl<'a, C> ProjectLocationProviderConnectorVersionEventtypeGetCall<'a, C>
21717where
21718 C: common::Connector,
21719{
21720 /// Perform the operation you have build so far.
21721 pub async fn doit(mut self) -> common::Result<(common::Response, EventType)> {
21722 use std::borrow::Cow;
21723 use std::io::{Read, Seek};
21724
21725 use common::{url::Params, ToParts};
21726 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21727
21728 let mut dd = common::DefaultDelegate;
21729 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21730 dlg.begin(common::MethodInfo {
21731 id: "connectors.projects.locations.providers.connectors.versions.eventtypes.get",
21732 http_method: hyper::Method::GET,
21733 });
21734
21735 for &field in ["alt", "name"].iter() {
21736 if self._additional_params.contains_key(field) {
21737 dlg.finished(false);
21738 return Err(common::Error::FieldClash(field));
21739 }
21740 }
21741
21742 let mut params = Params::with_capacity(3 + self._additional_params.len());
21743 params.push("name", self._name);
21744
21745 params.extend(self._additional_params.iter());
21746
21747 params.push("alt", "json");
21748 let mut url = self.hub._base_url.clone() + "v1/{+name}";
21749 if self._scopes.is_empty() {
21750 self._scopes
21751 .insert(Scope::CloudPlatform.as_ref().to_string());
21752 }
21753
21754 #[allow(clippy::single_element_loop)]
21755 for &(find_this, param_name) in [("{+name}", "name")].iter() {
21756 url = params.uri_replacement(url, param_name, find_this, true);
21757 }
21758 {
21759 let to_remove = ["name"];
21760 params.remove_params(&to_remove);
21761 }
21762
21763 let url = params.parse_with_url(&url);
21764
21765 loop {
21766 let token = match self
21767 .hub
21768 .auth
21769 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21770 .await
21771 {
21772 Ok(token) => token,
21773 Err(e) => match dlg.token(e) {
21774 Ok(token) => token,
21775 Err(e) => {
21776 dlg.finished(false);
21777 return Err(common::Error::MissingToken(e));
21778 }
21779 },
21780 };
21781 let mut req_result = {
21782 let client = &self.hub.client;
21783 dlg.pre_request();
21784 let mut req_builder = hyper::Request::builder()
21785 .method(hyper::Method::GET)
21786 .uri(url.as_str())
21787 .header(USER_AGENT, self.hub._user_agent.clone());
21788
21789 if let Some(token) = token.as_ref() {
21790 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21791 }
21792
21793 let request = req_builder
21794 .header(CONTENT_LENGTH, 0_u64)
21795 .body(common::to_body::<String>(None));
21796
21797 client.request(request.unwrap()).await
21798 };
21799
21800 match req_result {
21801 Err(err) => {
21802 if let common::Retry::After(d) = dlg.http_error(&err) {
21803 sleep(d).await;
21804 continue;
21805 }
21806 dlg.finished(false);
21807 return Err(common::Error::HttpError(err));
21808 }
21809 Ok(res) => {
21810 let (mut parts, body) = res.into_parts();
21811 let mut body = common::Body::new(body);
21812 if !parts.status.is_success() {
21813 let bytes = common::to_bytes(body).await.unwrap_or_default();
21814 let error = serde_json::from_str(&common::to_string(&bytes));
21815 let response = common::to_response(parts, bytes.into());
21816
21817 if let common::Retry::After(d) =
21818 dlg.http_failure(&response, error.as_ref().ok())
21819 {
21820 sleep(d).await;
21821 continue;
21822 }
21823
21824 dlg.finished(false);
21825
21826 return Err(match error {
21827 Ok(value) => common::Error::BadRequest(value),
21828 _ => common::Error::Failure(response),
21829 });
21830 }
21831 let response = {
21832 let bytes = common::to_bytes(body).await.unwrap_or_default();
21833 let encoded = common::to_string(&bytes);
21834 match serde_json::from_str(&encoded) {
21835 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21836 Err(error) => {
21837 dlg.response_json_decode_error(&encoded, &error);
21838 return Err(common::Error::JsonDecodeError(
21839 encoded.to_string(),
21840 error,
21841 ));
21842 }
21843 }
21844 };
21845
21846 dlg.finished(true);
21847 return Ok(response);
21848 }
21849 }
21850 }
21851 }
21852
21853 /// Required. Resource name of the form: `projects/*/locations/*/providers/*/connectors/*/versions/*/eventtypes/*` Only global location is supported for EventType resource.
21854 ///
21855 /// Sets the *name* path property to the given value.
21856 ///
21857 /// Even though the property as already been set when instantiating this call,
21858 /// we provide this method for API completeness.
21859 pub fn name(
21860 mut self,
21861 new_value: &str,
21862 ) -> ProjectLocationProviderConnectorVersionEventtypeGetCall<'a, C> {
21863 self._name = new_value.to_string();
21864 self
21865 }
21866 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21867 /// while executing the actual API request.
21868 ///
21869 /// ````text
21870 /// It should be used to handle progress information, and to implement a certain level of resilience.
21871 /// ````
21872 ///
21873 /// Sets the *delegate* property to the given value.
21874 pub fn delegate(
21875 mut self,
21876 new_value: &'a mut dyn common::Delegate,
21877 ) -> ProjectLocationProviderConnectorVersionEventtypeGetCall<'a, C> {
21878 self._delegate = Some(new_value);
21879 self
21880 }
21881
21882 /// Set any additional parameter of the query string used in the request.
21883 /// It should be used to set parameters which are not yet available through their own
21884 /// setters.
21885 ///
21886 /// Please note that this method must not be used to set any of the known parameters
21887 /// which have their own setter method. If done anyway, the request will fail.
21888 ///
21889 /// # Additional Parameters
21890 ///
21891 /// * *$.xgafv* (query-string) - V1 error format.
21892 /// * *access_token* (query-string) - OAuth access token.
21893 /// * *alt* (query-string) - Data format for response.
21894 /// * *callback* (query-string) - JSONP
21895 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21896 /// * *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.
21897 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21898 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21899 /// * *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.
21900 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21901 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21902 pub fn param<T>(
21903 mut self,
21904 name: T,
21905 value: T,
21906 ) -> ProjectLocationProviderConnectorVersionEventtypeGetCall<'a, C>
21907 where
21908 T: AsRef<str>,
21909 {
21910 self._additional_params
21911 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21912 self
21913 }
21914
21915 /// Identifies the authorization scope for the method you are building.
21916 ///
21917 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21918 /// [`Scope::CloudPlatform`].
21919 ///
21920 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21921 /// tokens for more than one scope.
21922 ///
21923 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21924 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21925 /// sufficient, a read-write scope will do as well.
21926 pub fn add_scope<St>(
21927 mut self,
21928 scope: St,
21929 ) -> ProjectLocationProviderConnectorVersionEventtypeGetCall<'a, C>
21930 where
21931 St: AsRef<str>,
21932 {
21933 self._scopes.insert(String::from(scope.as_ref()));
21934 self
21935 }
21936 /// Identifies the authorization scope(s) for the method you are building.
21937 ///
21938 /// See [`Self::add_scope()`] for details.
21939 pub fn add_scopes<I, St>(
21940 mut self,
21941 scopes: I,
21942 ) -> ProjectLocationProviderConnectorVersionEventtypeGetCall<'a, C>
21943 where
21944 I: IntoIterator<Item = St>,
21945 St: AsRef<str>,
21946 {
21947 self._scopes
21948 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21949 self
21950 }
21951
21952 /// Removes all scopes, and no default scope will be used either.
21953 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21954 /// for details).
21955 pub fn clear_scopes(
21956 mut self,
21957 ) -> ProjectLocationProviderConnectorVersionEventtypeGetCall<'a, C> {
21958 self._scopes.clear();
21959 self
21960 }
21961}
21962
21963/// Lists Event Types in a given Connector Version.
21964///
21965/// A builder for the *locations.providers.connectors.versions.eventtypes.list* method supported by a *project* resource.
21966/// It is not used directly, but through a [`ProjectMethods`] instance.
21967///
21968/// # Example
21969///
21970/// Instantiate a resource method builder
21971///
21972/// ```test_harness,no_run
21973/// # extern crate hyper;
21974/// # extern crate hyper_rustls;
21975/// # extern crate google_connectors1 as connectors1;
21976/// # async fn dox() {
21977/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21978///
21979/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21980/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21981/// # secret,
21982/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21983/// # ).build().await.unwrap();
21984///
21985/// # let client = hyper_util::client::legacy::Client::builder(
21986/// # hyper_util::rt::TokioExecutor::new()
21987/// # )
21988/// # .build(
21989/// # hyper_rustls::HttpsConnectorBuilder::new()
21990/// # .with_native_roots()
21991/// # .unwrap()
21992/// # .https_or_http()
21993/// # .enable_http1()
21994/// # .build()
21995/// # );
21996/// # let mut hub = Connectors::new(client, auth);
21997/// // You can configure optional parameters by calling the respective setters at will, and
21998/// // execute the final call using `doit()`.
21999/// // Values shown here are possibly random and not representative !
22000/// let result = hub.projects().locations_providers_connectors_versions_eventtypes_list("parent")
22001/// .page_token("dolores")
22002/// .page_size(-69)
22003/// .doit().await;
22004/// # }
22005/// ```
22006pub struct ProjectLocationProviderConnectorVersionEventtypeListCall<'a, C>
22007where
22008 C: 'a,
22009{
22010 hub: &'a Connectors<C>,
22011 _parent: String,
22012 _page_token: Option<String>,
22013 _page_size: Option<i32>,
22014 _delegate: Option<&'a mut dyn common::Delegate>,
22015 _additional_params: HashMap<String, String>,
22016 _scopes: BTreeSet<String>,
22017}
22018
22019impl<'a, C> common::CallBuilder
22020 for ProjectLocationProviderConnectorVersionEventtypeListCall<'a, C>
22021{
22022}
22023
22024impl<'a, C> ProjectLocationProviderConnectorVersionEventtypeListCall<'a, C>
22025where
22026 C: common::Connector,
22027{
22028 /// Perform the operation you have build so far.
22029 pub async fn doit(mut self) -> common::Result<(common::Response, ListEventTypesResponse)> {
22030 use std::borrow::Cow;
22031 use std::io::{Read, Seek};
22032
22033 use common::{url::Params, ToParts};
22034 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22035
22036 let mut dd = common::DefaultDelegate;
22037 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22038 dlg.begin(common::MethodInfo {
22039 id: "connectors.projects.locations.providers.connectors.versions.eventtypes.list",
22040 http_method: hyper::Method::GET,
22041 });
22042
22043 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
22044 if self._additional_params.contains_key(field) {
22045 dlg.finished(false);
22046 return Err(common::Error::FieldClash(field));
22047 }
22048 }
22049
22050 let mut params = Params::with_capacity(5 + self._additional_params.len());
22051 params.push("parent", self._parent);
22052 if let Some(value) = self._page_token.as_ref() {
22053 params.push("pageToken", value);
22054 }
22055 if let Some(value) = self._page_size.as_ref() {
22056 params.push("pageSize", value.to_string());
22057 }
22058
22059 params.extend(self._additional_params.iter());
22060
22061 params.push("alt", "json");
22062 let mut url = self.hub._base_url.clone() + "v1/{+parent}/eventtypes";
22063 if self._scopes.is_empty() {
22064 self._scopes
22065 .insert(Scope::CloudPlatform.as_ref().to_string());
22066 }
22067
22068 #[allow(clippy::single_element_loop)]
22069 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
22070 url = params.uri_replacement(url, param_name, find_this, true);
22071 }
22072 {
22073 let to_remove = ["parent"];
22074 params.remove_params(&to_remove);
22075 }
22076
22077 let url = params.parse_with_url(&url);
22078
22079 loop {
22080 let token = match self
22081 .hub
22082 .auth
22083 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22084 .await
22085 {
22086 Ok(token) => token,
22087 Err(e) => match dlg.token(e) {
22088 Ok(token) => token,
22089 Err(e) => {
22090 dlg.finished(false);
22091 return Err(common::Error::MissingToken(e));
22092 }
22093 },
22094 };
22095 let mut req_result = {
22096 let client = &self.hub.client;
22097 dlg.pre_request();
22098 let mut req_builder = hyper::Request::builder()
22099 .method(hyper::Method::GET)
22100 .uri(url.as_str())
22101 .header(USER_AGENT, self.hub._user_agent.clone());
22102
22103 if let Some(token) = token.as_ref() {
22104 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22105 }
22106
22107 let request = req_builder
22108 .header(CONTENT_LENGTH, 0_u64)
22109 .body(common::to_body::<String>(None));
22110
22111 client.request(request.unwrap()).await
22112 };
22113
22114 match req_result {
22115 Err(err) => {
22116 if let common::Retry::After(d) = dlg.http_error(&err) {
22117 sleep(d).await;
22118 continue;
22119 }
22120 dlg.finished(false);
22121 return Err(common::Error::HttpError(err));
22122 }
22123 Ok(res) => {
22124 let (mut parts, body) = res.into_parts();
22125 let mut body = common::Body::new(body);
22126 if !parts.status.is_success() {
22127 let bytes = common::to_bytes(body).await.unwrap_or_default();
22128 let error = serde_json::from_str(&common::to_string(&bytes));
22129 let response = common::to_response(parts, bytes.into());
22130
22131 if let common::Retry::After(d) =
22132 dlg.http_failure(&response, error.as_ref().ok())
22133 {
22134 sleep(d).await;
22135 continue;
22136 }
22137
22138 dlg.finished(false);
22139
22140 return Err(match error {
22141 Ok(value) => common::Error::BadRequest(value),
22142 _ => common::Error::Failure(response),
22143 });
22144 }
22145 let response = {
22146 let bytes = common::to_bytes(body).await.unwrap_or_default();
22147 let encoded = common::to_string(&bytes);
22148 match serde_json::from_str(&encoded) {
22149 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22150 Err(error) => {
22151 dlg.response_json_decode_error(&encoded, &error);
22152 return Err(common::Error::JsonDecodeError(
22153 encoded.to_string(),
22154 error,
22155 ));
22156 }
22157 }
22158 };
22159
22160 dlg.finished(true);
22161 return Ok(response);
22162 }
22163 }
22164 }
22165 }
22166
22167 /// Required. Parent resource of the connectors, of the form: `projects/*/locations/*/providers/*/connectors/*/versions/*` Only global location is supported for EventType resource.
22168 ///
22169 /// Sets the *parent* path property to the given value.
22170 ///
22171 /// Even though the property as already been set when instantiating this call,
22172 /// we provide this method for API completeness.
22173 pub fn parent(
22174 mut self,
22175 new_value: &str,
22176 ) -> ProjectLocationProviderConnectorVersionEventtypeListCall<'a, C> {
22177 self._parent = new_value.to_string();
22178 self
22179 }
22180 /// Page token.
22181 ///
22182 /// Sets the *page token* query property to the given value.
22183 pub fn page_token(
22184 mut self,
22185 new_value: &str,
22186 ) -> ProjectLocationProviderConnectorVersionEventtypeListCall<'a, C> {
22187 self._page_token = Some(new_value.to_string());
22188 self
22189 }
22190 /// Page size.
22191 ///
22192 /// Sets the *page size* query property to the given value.
22193 pub fn page_size(
22194 mut self,
22195 new_value: i32,
22196 ) -> ProjectLocationProviderConnectorVersionEventtypeListCall<'a, C> {
22197 self._page_size = Some(new_value);
22198 self
22199 }
22200 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22201 /// while executing the actual API request.
22202 ///
22203 /// ````text
22204 /// It should be used to handle progress information, and to implement a certain level of resilience.
22205 /// ````
22206 ///
22207 /// Sets the *delegate* property to the given value.
22208 pub fn delegate(
22209 mut self,
22210 new_value: &'a mut dyn common::Delegate,
22211 ) -> ProjectLocationProviderConnectorVersionEventtypeListCall<'a, C> {
22212 self._delegate = Some(new_value);
22213 self
22214 }
22215
22216 /// Set any additional parameter of the query string used in the request.
22217 /// It should be used to set parameters which are not yet available through their own
22218 /// setters.
22219 ///
22220 /// Please note that this method must not be used to set any of the known parameters
22221 /// which have their own setter method. If done anyway, the request will fail.
22222 ///
22223 /// # Additional Parameters
22224 ///
22225 /// * *$.xgafv* (query-string) - V1 error format.
22226 /// * *access_token* (query-string) - OAuth access token.
22227 /// * *alt* (query-string) - Data format for response.
22228 /// * *callback* (query-string) - JSONP
22229 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22230 /// * *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.
22231 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22232 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22233 /// * *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.
22234 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22235 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22236 pub fn param<T>(
22237 mut self,
22238 name: T,
22239 value: T,
22240 ) -> ProjectLocationProviderConnectorVersionEventtypeListCall<'a, C>
22241 where
22242 T: AsRef<str>,
22243 {
22244 self._additional_params
22245 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22246 self
22247 }
22248
22249 /// Identifies the authorization scope for the method you are building.
22250 ///
22251 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22252 /// [`Scope::CloudPlatform`].
22253 ///
22254 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22255 /// tokens for more than one scope.
22256 ///
22257 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22258 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22259 /// sufficient, a read-write scope will do as well.
22260 pub fn add_scope<St>(
22261 mut self,
22262 scope: St,
22263 ) -> ProjectLocationProviderConnectorVersionEventtypeListCall<'a, C>
22264 where
22265 St: AsRef<str>,
22266 {
22267 self._scopes.insert(String::from(scope.as_ref()));
22268 self
22269 }
22270 /// Identifies the authorization scope(s) for the method you are building.
22271 ///
22272 /// See [`Self::add_scope()`] for details.
22273 pub fn add_scopes<I, St>(
22274 mut self,
22275 scopes: I,
22276 ) -> ProjectLocationProviderConnectorVersionEventtypeListCall<'a, C>
22277 where
22278 I: IntoIterator<Item = St>,
22279 St: AsRef<str>,
22280 {
22281 self._scopes
22282 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22283 self
22284 }
22285
22286 /// Removes all scopes, and no default scope will be used either.
22287 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22288 /// for details).
22289 pub fn clear_scopes(
22290 mut self,
22291 ) -> ProjectLocationProviderConnectorVersionEventtypeListCall<'a, C> {
22292 self._scopes.clear();
22293 self
22294 }
22295}
22296
22297/// Gets details of a single connector version.
22298///
22299/// A builder for the *locations.providers.connectors.versions.get* method supported by a *project* resource.
22300/// It is not used directly, but through a [`ProjectMethods`] instance.
22301///
22302/// # Example
22303///
22304/// Instantiate a resource method builder
22305///
22306/// ```test_harness,no_run
22307/// # extern crate hyper;
22308/// # extern crate hyper_rustls;
22309/// # extern crate google_connectors1 as connectors1;
22310/// # async fn dox() {
22311/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22312///
22313/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22314/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
22315/// # secret,
22316/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22317/// # ).build().await.unwrap();
22318///
22319/// # let client = hyper_util::client::legacy::Client::builder(
22320/// # hyper_util::rt::TokioExecutor::new()
22321/// # )
22322/// # .build(
22323/// # hyper_rustls::HttpsConnectorBuilder::new()
22324/// # .with_native_roots()
22325/// # .unwrap()
22326/// # .https_or_http()
22327/// # .enable_http1()
22328/// # .build()
22329/// # );
22330/// # let mut hub = Connectors::new(client, auth);
22331/// // You can configure optional parameters by calling the respective setters at will, and
22332/// // execute the final call using `doit()`.
22333/// // Values shown here are possibly random and not representative !
22334/// let result = hub.projects().locations_providers_connectors_versions_get("name")
22335/// .view("sed")
22336/// .doit().await;
22337/// # }
22338/// ```
22339pub struct ProjectLocationProviderConnectorVersionGetCall<'a, C>
22340where
22341 C: 'a,
22342{
22343 hub: &'a Connectors<C>,
22344 _name: String,
22345 _view: Option<String>,
22346 _delegate: Option<&'a mut dyn common::Delegate>,
22347 _additional_params: HashMap<String, String>,
22348 _scopes: BTreeSet<String>,
22349}
22350
22351impl<'a, C> common::CallBuilder for ProjectLocationProviderConnectorVersionGetCall<'a, C> {}
22352
22353impl<'a, C> ProjectLocationProviderConnectorVersionGetCall<'a, C>
22354where
22355 C: common::Connector,
22356{
22357 /// Perform the operation you have build so far.
22358 pub async fn doit(mut self) -> common::Result<(common::Response, ConnectorVersion)> {
22359 use std::borrow::Cow;
22360 use std::io::{Read, Seek};
22361
22362 use common::{url::Params, ToParts};
22363 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22364
22365 let mut dd = common::DefaultDelegate;
22366 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22367 dlg.begin(common::MethodInfo {
22368 id: "connectors.projects.locations.providers.connectors.versions.get",
22369 http_method: hyper::Method::GET,
22370 });
22371
22372 for &field in ["alt", "name", "view"].iter() {
22373 if self._additional_params.contains_key(field) {
22374 dlg.finished(false);
22375 return Err(common::Error::FieldClash(field));
22376 }
22377 }
22378
22379 let mut params = Params::with_capacity(4 + self._additional_params.len());
22380 params.push("name", self._name);
22381 if let Some(value) = self._view.as_ref() {
22382 params.push("view", value);
22383 }
22384
22385 params.extend(self._additional_params.iter());
22386
22387 params.push("alt", "json");
22388 let mut url = self.hub._base_url.clone() + "v1/{+name}";
22389 if self._scopes.is_empty() {
22390 self._scopes
22391 .insert(Scope::CloudPlatform.as_ref().to_string());
22392 }
22393
22394 #[allow(clippy::single_element_loop)]
22395 for &(find_this, param_name) in [("{+name}", "name")].iter() {
22396 url = params.uri_replacement(url, param_name, find_this, true);
22397 }
22398 {
22399 let to_remove = ["name"];
22400 params.remove_params(&to_remove);
22401 }
22402
22403 let url = params.parse_with_url(&url);
22404
22405 loop {
22406 let token = match self
22407 .hub
22408 .auth
22409 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22410 .await
22411 {
22412 Ok(token) => token,
22413 Err(e) => match dlg.token(e) {
22414 Ok(token) => token,
22415 Err(e) => {
22416 dlg.finished(false);
22417 return Err(common::Error::MissingToken(e));
22418 }
22419 },
22420 };
22421 let mut req_result = {
22422 let client = &self.hub.client;
22423 dlg.pre_request();
22424 let mut req_builder = hyper::Request::builder()
22425 .method(hyper::Method::GET)
22426 .uri(url.as_str())
22427 .header(USER_AGENT, self.hub._user_agent.clone());
22428
22429 if let Some(token) = token.as_ref() {
22430 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22431 }
22432
22433 let request = req_builder
22434 .header(CONTENT_LENGTH, 0_u64)
22435 .body(common::to_body::<String>(None));
22436
22437 client.request(request.unwrap()).await
22438 };
22439
22440 match req_result {
22441 Err(err) => {
22442 if let common::Retry::After(d) = dlg.http_error(&err) {
22443 sleep(d).await;
22444 continue;
22445 }
22446 dlg.finished(false);
22447 return Err(common::Error::HttpError(err));
22448 }
22449 Ok(res) => {
22450 let (mut parts, body) = res.into_parts();
22451 let mut body = common::Body::new(body);
22452 if !parts.status.is_success() {
22453 let bytes = common::to_bytes(body).await.unwrap_or_default();
22454 let error = serde_json::from_str(&common::to_string(&bytes));
22455 let response = common::to_response(parts, bytes.into());
22456
22457 if let common::Retry::After(d) =
22458 dlg.http_failure(&response, error.as_ref().ok())
22459 {
22460 sleep(d).await;
22461 continue;
22462 }
22463
22464 dlg.finished(false);
22465
22466 return Err(match error {
22467 Ok(value) => common::Error::BadRequest(value),
22468 _ => common::Error::Failure(response),
22469 });
22470 }
22471 let response = {
22472 let bytes = common::to_bytes(body).await.unwrap_or_default();
22473 let encoded = common::to_string(&bytes);
22474 match serde_json::from_str(&encoded) {
22475 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22476 Err(error) => {
22477 dlg.response_json_decode_error(&encoded, &error);
22478 return Err(common::Error::JsonDecodeError(
22479 encoded.to_string(),
22480 error,
22481 ));
22482 }
22483 }
22484 };
22485
22486 dlg.finished(true);
22487 return Ok(response);
22488 }
22489 }
22490 }
22491 }
22492
22493 /// Required. Resource name of the form: `projects/*/locations/*/providers/*/connectors/*/versions/*` Only global location is supported for ConnectorVersion resource.
22494 ///
22495 /// Sets the *name* path property to the given value.
22496 ///
22497 /// Even though the property as already been set when instantiating this call,
22498 /// we provide this method for API completeness.
22499 pub fn name(
22500 mut self,
22501 new_value: &str,
22502 ) -> ProjectLocationProviderConnectorVersionGetCall<'a, C> {
22503 self._name = new_value.to_string();
22504 self
22505 }
22506 /// Specifies which fields of the ConnectorVersion are returned in the response. Defaults to `CUSTOMER` view.
22507 ///
22508 /// Sets the *view* query property to the given value.
22509 pub fn view(
22510 mut self,
22511 new_value: &str,
22512 ) -> ProjectLocationProviderConnectorVersionGetCall<'a, C> {
22513 self._view = Some(new_value.to_string());
22514 self
22515 }
22516 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22517 /// while executing the actual API request.
22518 ///
22519 /// ````text
22520 /// It should be used to handle progress information, and to implement a certain level of resilience.
22521 /// ````
22522 ///
22523 /// Sets the *delegate* property to the given value.
22524 pub fn delegate(
22525 mut self,
22526 new_value: &'a mut dyn common::Delegate,
22527 ) -> ProjectLocationProviderConnectorVersionGetCall<'a, C> {
22528 self._delegate = Some(new_value);
22529 self
22530 }
22531
22532 /// Set any additional parameter of the query string used in the request.
22533 /// It should be used to set parameters which are not yet available through their own
22534 /// setters.
22535 ///
22536 /// Please note that this method must not be used to set any of the known parameters
22537 /// which have their own setter method. If done anyway, the request will fail.
22538 ///
22539 /// # Additional Parameters
22540 ///
22541 /// * *$.xgafv* (query-string) - V1 error format.
22542 /// * *access_token* (query-string) - OAuth access token.
22543 /// * *alt* (query-string) - Data format for response.
22544 /// * *callback* (query-string) - JSONP
22545 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22546 /// * *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.
22547 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22548 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22549 /// * *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.
22550 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22551 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22552 pub fn param<T>(
22553 mut self,
22554 name: T,
22555 value: T,
22556 ) -> ProjectLocationProviderConnectorVersionGetCall<'a, C>
22557 where
22558 T: AsRef<str>,
22559 {
22560 self._additional_params
22561 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22562 self
22563 }
22564
22565 /// Identifies the authorization scope for the method you are building.
22566 ///
22567 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22568 /// [`Scope::CloudPlatform`].
22569 ///
22570 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22571 /// tokens for more than one scope.
22572 ///
22573 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22574 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22575 /// sufficient, a read-write scope will do as well.
22576 pub fn add_scope<St>(
22577 mut self,
22578 scope: St,
22579 ) -> ProjectLocationProviderConnectorVersionGetCall<'a, C>
22580 where
22581 St: AsRef<str>,
22582 {
22583 self._scopes.insert(String::from(scope.as_ref()));
22584 self
22585 }
22586 /// Identifies the authorization scope(s) for the method you are building.
22587 ///
22588 /// See [`Self::add_scope()`] for details.
22589 pub fn add_scopes<I, St>(
22590 mut self,
22591 scopes: I,
22592 ) -> ProjectLocationProviderConnectorVersionGetCall<'a, C>
22593 where
22594 I: IntoIterator<Item = St>,
22595 St: AsRef<str>,
22596 {
22597 self._scopes
22598 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22599 self
22600 }
22601
22602 /// Removes all scopes, and no default scope will be used either.
22603 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22604 /// for details).
22605 pub fn clear_scopes(mut self) -> ProjectLocationProviderConnectorVersionGetCall<'a, C> {
22606 self._scopes.clear();
22607 self
22608 }
22609}
22610
22611/// Lists Connector Versions in a given project and location.
22612///
22613/// A builder for the *locations.providers.connectors.versions.list* method supported by a *project* resource.
22614/// It is not used directly, but through a [`ProjectMethods`] instance.
22615///
22616/// # Example
22617///
22618/// Instantiate a resource method builder
22619///
22620/// ```test_harness,no_run
22621/// # extern crate hyper;
22622/// # extern crate hyper_rustls;
22623/// # extern crate google_connectors1 as connectors1;
22624/// # async fn dox() {
22625/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22626///
22627/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22628/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
22629/// # secret,
22630/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22631/// # ).build().await.unwrap();
22632///
22633/// # let client = hyper_util::client::legacy::Client::builder(
22634/// # hyper_util::rt::TokioExecutor::new()
22635/// # )
22636/// # .build(
22637/// # hyper_rustls::HttpsConnectorBuilder::new()
22638/// # .with_native_roots()
22639/// # .unwrap()
22640/// # .https_or_http()
22641/// # .enable_http1()
22642/// # .build()
22643/// # );
22644/// # let mut hub = Connectors::new(client, auth);
22645/// // You can configure optional parameters by calling the respective setters at will, and
22646/// // execute the final call using `doit()`.
22647/// // Values shown here are possibly random and not representative !
22648/// let result = hub.projects().locations_providers_connectors_versions_list("parent")
22649/// .view("et")
22650/// .page_token("elitr")
22651/// .page_size(-80)
22652/// .doit().await;
22653/// # }
22654/// ```
22655pub struct ProjectLocationProviderConnectorVersionListCall<'a, C>
22656where
22657 C: 'a,
22658{
22659 hub: &'a Connectors<C>,
22660 _parent: String,
22661 _view: Option<String>,
22662 _page_token: Option<String>,
22663 _page_size: Option<i32>,
22664 _delegate: Option<&'a mut dyn common::Delegate>,
22665 _additional_params: HashMap<String, String>,
22666 _scopes: BTreeSet<String>,
22667}
22668
22669impl<'a, C> common::CallBuilder for ProjectLocationProviderConnectorVersionListCall<'a, C> {}
22670
22671impl<'a, C> ProjectLocationProviderConnectorVersionListCall<'a, C>
22672where
22673 C: common::Connector,
22674{
22675 /// Perform the operation you have build so far.
22676 pub async fn doit(
22677 mut self,
22678 ) -> common::Result<(common::Response, ListConnectorVersionsResponse)> {
22679 use std::borrow::Cow;
22680 use std::io::{Read, Seek};
22681
22682 use common::{url::Params, ToParts};
22683 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22684
22685 let mut dd = common::DefaultDelegate;
22686 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22687 dlg.begin(common::MethodInfo {
22688 id: "connectors.projects.locations.providers.connectors.versions.list",
22689 http_method: hyper::Method::GET,
22690 });
22691
22692 for &field in ["alt", "parent", "view", "pageToken", "pageSize"].iter() {
22693 if self._additional_params.contains_key(field) {
22694 dlg.finished(false);
22695 return Err(common::Error::FieldClash(field));
22696 }
22697 }
22698
22699 let mut params = Params::with_capacity(6 + self._additional_params.len());
22700 params.push("parent", self._parent);
22701 if let Some(value) = self._view.as_ref() {
22702 params.push("view", value);
22703 }
22704 if let Some(value) = self._page_token.as_ref() {
22705 params.push("pageToken", value);
22706 }
22707 if let Some(value) = self._page_size.as_ref() {
22708 params.push("pageSize", value.to_string());
22709 }
22710
22711 params.extend(self._additional_params.iter());
22712
22713 params.push("alt", "json");
22714 let mut url = self.hub._base_url.clone() + "v1/{+parent}/versions";
22715 if self._scopes.is_empty() {
22716 self._scopes
22717 .insert(Scope::CloudPlatform.as_ref().to_string());
22718 }
22719
22720 #[allow(clippy::single_element_loop)]
22721 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
22722 url = params.uri_replacement(url, param_name, find_this, true);
22723 }
22724 {
22725 let to_remove = ["parent"];
22726 params.remove_params(&to_remove);
22727 }
22728
22729 let url = params.parse_with_url(&url);
22730
22731 loop {
22732 let token = match self
22733 .hub
22734 .auth
22735 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22736 .await
22737 {
22738 Ok(token) => token,
22739 Err(e) => match dlg.token(e) {
22740 Ok(token) => token,
22741 Err(e) => {
22742 dlg.finished(false);
22743 return Err(common::Error::MissingToken(e));
22744 }
22745 },
22746 };
22747 let mut req_result = {
22748 let client = &self.hub.client;
22749 dlg.pre_request();
22750 let mut req_builder = hyper::Request::builder()
22751 .method(hyper::Method::GET)
22752 .uri(url.as_str())
22753 .header(USER_AGENT, self.hub._user_agent.clone());
22754
22755 if let Some(token) = token.as_ref() {
22756 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22757 }
22758
22759 let request = req_builder
22760 .header(CONTENT_LENGTH, 0_u64)
22761 .body(common::to_body::<String>(None));
22762
22763 client.request(request.unwrap()).await
22764 };
22765
22766 match req_result {
22767 Err(err) => {
22768 if let common::Retry::After(d) = dlg.http_error(&err) {
22769 sleep(d).await;
22770 continue;
22771 }
22772 dlg.finished(false);
22773 return Err(common::Error::HttpError(err));
22774 }
22775 Ok(res) => {
22776 let (mut parts, body) = res.into_parts();
22777 let mut body = common::Body::new(body);
22778 if !parts.status.is_success() {
22779 let bytes = common::to_bytes(body).await.unwrap_or_default();
22780 let error = serde_json::from_str(&common::to_string(&bytes));
22781 let response = common::to_response(parts, bytes.into());
22782
22783 if let common::Retry::After(d) =
22784 dlg.http_failure(&response, error.as_ref().ok())
22785 {
22786 sleep(d).await;
22787 continue;
22788 }
22789
22790 dlg.finished(false);
22791
22792 return Err(match error {
22793 Ok(value) => common::Error::BadRequest(value),
22794 _ => common::Error::Failure(response),
22795 });
22796 }
22797 let response = {
22798 let bytes = common::to_bytes(body).await.unwrap_or_default();
22799 let encoded = common::to_string(&bytes);
22800 match serde_json::from_str(&encoded) {
22801 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22802 Err(error) => {
22803 dlg.response_json_decode_error(&encoded, &error);
22804 return Err(common::Error::JsonDecodeError(
22805 encoded.to_string(),
22806 error,
22807 ));
22808 }
22809 }
22810 };
22811
22812 dlg.finished(true);
22813 return Ok(response);
22814 }
22815 }
22816 }
22817 }
22818
22819 /// Required. Parent resource of the connectors, of the form: `projects/*/locations/*/providers/*/connectors/*` Only global location is supported for ConnectorVersion resource.
22820 ///
22821 /// Sets the *parent* path property to the given value.
22822 ///
22823 /// Even though the property as already been set when instantiating this call,
22824 /// we provide this method for API completeness.
22825 pub fn parent(
22826 mut self,
22827 new_value: &str,
22828 ) -> ProjectLocationProviderConnectorVersionListCall<'a, C> {
22829 self._parent = new_value.to_string();
22830 self
22831 }
22832 /// Specifies which fields of the ConnectorVersion are returned in the response. Defaults to `BASIC` view.
22833 ///
22834 /// Sets the *view* query property to the given value.
22835 pub fn view(
22836 mut self,
22837 new_value: &str,
22838 ) -> ProjectLocationProviderConnectorVersionListCall<'a, C> {
22839 self._view = Some(new_value.to_string());
22840 self
22841 }
22842 /// Page token.
22843 ///
22844 /// Sets the *page token* query property to the given value.
22845 pub fn page_token(
22846 mut self,
22847 new_value: &str,
22848 ) -> ProjectLocationProviderConnectorVersionListCall<'a, C> {
22849 self._page_token = Some(new_value.to_string());
22850 self
22851 }
22852 /// Page size.
22853 ///
22854 /// Sets the *page size* query property to the given value.
22855 pub fn page_size(
22856 mut self,
22857 new_value: i32,
22858 ) -> ProjectLocationProviderConnectorVersionListCall<'a, C> {
22859 self._page_size = Some(new_value);
22860 self
22861 }
22862 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22863 /// while executing the actual API request.
22864 ///
22865 /// ````text
22866 /// It should be used to handle progress information, and to implement a certain level of resilience.
22867 /// ````
22868 ///
22869 /// Sets the *delegate* property to the given value.
22870 pub fn delegate(
22871 mut self,
22872 new_value: &'a mut dyn common::Delegate,
22873 ) -> ProjectLocationProviderConnectorVersionListCall<'a, C> {
22874 self._delegate = Some(new_value);
22875 self
22876 }
22877
22878 /// Set any additional parameter of the query string used in the request.
22879 /// It should be used to set parameters which are not yet available through their own
22880 /// setters.
22881 ///
22882 /// Please note that this method must not be used to set any of the known parameters
22883 /// which have their own setter method. If done anyway, the request will fail.
22884 ///
22885 /// # Additional Parameters
22886 ///
22887 /// * *$.xgafv* (query-string) - V1 error format.
22888 /// * *access_token* (query-string) - OAuth access token.
22889 /// * *alt* (query-string) - Data format for response.
22890 /// * *callback* (query-string) - JSONP
22891 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22892 /// * *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.
22893 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22894 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22895 /// * *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.
22896 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22897 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22898 pub fn param<T>(
22899 mut self,
22900 name: T,
22901 value: T,
22902 ) -> ProjectLocationProviderConnectorVersionListCall<'a, C>
22903 where
22904 T: AsRef<str>,
22905 {
22906 self._additional_params
22907 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22908 self
22909 }
22910
22911 /// Identifies the authorization scope for the method you are building.
22912 ///
22913 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22914 /// [`Scope::CloudPlatform`].
22915 ///
22916 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22917 /// tokens for more than one scope.
22918 ///
22919 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22920 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22921 /// sufficient, a read-write scope will do as well.
22922 pub fn add_scope<St>(
22923 mut self,
22924 scope: St,
22925 ) -> ProjectLocationProviderConnectorVersionListCall<'a, C>
22926 where
22927 St: AsRef<str>,
22928 {
22929 self._scopes.insert(String::from(scope.as_ref()));
22930 self
22931 }
22932 /// Identifies the authorization scope(s) for the method you are building.
22933 ///
22934 /// See [`Self::add_scope()`] for details.
22935 pub fn add_scopes<I, St>(
22936 mut self,
22937 scopes: I,
22938 ) -> ProjectLocationProviderConnectorVersionListCall<'a, C>
22939 where
22940 I: IntoIterator<Item = St>,
22941 St: AsRef<str>,
22942 {
22943 self._scopes
22944 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22945 self
22946 }
22947
22948 /// Removes all scopes, and no default scope will be used either.
22949 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22950 /// for details).
22951 pub fn clear_scopes(mut self) -> ProjectLocationProviderConnectorVersionListCall<'a, C> {
22952 self._scopes.clear();
22953 self
22954 }
22955}
22956
22957/// Gets details of a single Connector.
22958///
22959/// A builder for the *locations.providers.connectors.get* method supported by a *project* resource.
22960/// It is not used directly, but through a [`ProjectMethods`] instance.
22961///
22962/// # Example
22963///
22964/// Instantiate a resource method builder
22965///
22966/// ```test_harness,no_run
22967/// # extern crate hyper;
22968/// # extern crate hyper_rustls;
22969/// # extern crate google_connectors1 as connectors1;
22970/// # async fn dox() {
22971/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22972///
22973/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22974/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
22975/// # secret,
22976/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22977/// # ).build().await.unwrap();
22978///
22979/// # let client = hyper_util::client::legacy::Client::builder(
22980/// # hyper_util::rt::TokioExecutor::new()
22981/// # )
22982/// # .build(
22983/// # hyper_rustls::HttpsConnectorBuilder::new()
22984/// # .with_native_roots()
22985/// # .unwrap()
22986/// # .https_or_http()
22987/// # .enable_http1()
22988/// # .build()
22989/// # );
22990/// # let mut hub = Connectors::new(client, auth);
22991/// // You can configure optional parameters by calling the respective setters at will, and
22992/// // execute the final call using `doit()`.
22993/// // Values shown here are possibly random and not representative !
22994/// let result = hub.projects().locations_providers_connectors_get("name")
22995/// .doit().await;
22996/// # }
22997/// ```
22998pub struct ProjectLocationProviderConnectorGetCall<'a, C>
22999where
23000 C: 'a,
23001{
23002 hub: &'a Connectors<C>,
23003 _name: String,
23004 _delegate: Option<&'a mut dyn common::Delegate>,
23005 _additional_params: HashMap<String, String>,
23006 _scopes: BTreeSet<String>,
23007}
23008
23009impl<'a, C> common::CallBuilder for ProjectLocationProviderConnectorGetCall<'a, C> {}
23010
23011impl<'a, C> ProjectLocationProviderConnectorGetCall<'a, C>
23012where
23013 C: common::Connector,
23014{
23015 /// Perform the operation you have build so far.
23016 pub async fn doit(mut self) -> common::Result<(common::Response, Connector)> {
23017 use std::borrow::Cow;
23018 use std::io::{Read, Seek};
23019
23020 use common::{url::Params, ToParts};
23021 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23022
23023 let mut dd = common::DefaultDelegate;
23024 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23025 dlg.begin(common::MethodInfo {
23026 id: "connectors.projects.locations.providers.connectors.get",
23027 http_method: hyper::Method::GET,
23028 });
23029
23030 for &field in ["alt", "name"].iter() {
23031 if self._additional_params.contains_key(field) {
23032 dlg.finished(false);
23033 return Err(common::Error::FieldClash(field));
23034 }
23035 }
23036
23037 let mut params = Params::with_capacity(3 + self._additional_params.len());
23038 params.push("name", self._name);
23039
23040 params.extend(self._additional_params.iter());
23041
23042 params.push("alt", "json");
23043 let mut url = self.hub._base_url.clone() + "v1/{+name}";
23044 if self._scopes.is_empty() {
23045 self._scopes
23046 .insert(Scope::CloudPlatform.as_ref().to_string());
23047 }
23048
23049 #[allow(clippy::single_element_loop)]
23050 for &(find_this, param_name) in [("{+name}", "name")].iter() {
23051 url = params.uri_replacement(url, param_name, find_this, true);
23052 }
23053 {
23054 let to_remove = ["name"];
23055 params.remove_params(&to_remove);
23056 }
23057
23058 let url = params.parse_with_url(&url);
23059
23060 loop {
23061 let token = match self
23062 .hub
23063 .auth
23064 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23065 .await
23066 {
23067 Ok(token) => token,
23068 Err(e) => match dlg.token(e) {
23069 Ok(token) => token,
23070 Err(e) => {
23071 dlg.finished(false);
23072 return Err(common::Error::MissingToken(e));
23073 }
23074 },
23075 };
23076 let mut req_result = {
23077 let client = &self.hub.client;
23078 dlg.pre_request();
23079 let mut req_builder = hyper::Request::builder()
23080 .method(hyper::Method::GET)
23081 .uri(url.as_str())
23082 .header(USER_AGENT, self.hub._user_agent.clone());
23083
23084 if let Some(token) = token.as_ref() {
23085 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23086 }
23087
23088 let request = req_builder
23089 .header(CONTENT_LENGTH, 0_u64)
23090 .body(common::to_body::<String>(None));
23091
23092 client.request(request.unwrap()).await
23093 };
23094
23095 match req_result {
23096 Err(err) => {
23097 if let common::Retry::After(d) = dlg.http_error(&err) {
23098 sleep(d).await;
23099 continue;
23100 }
23101 dlg.finished(false);
23102 return Err(common::Error::HttpError(err));
23103 }
23104 Ok(res) => {
23105 let (mut parts, body) = res.into_parts();
23106 let mut body = common::Body::new(body);
23107 if !parts.status.is_success() {
23108 let bytes = common::to_bytes(body).await.unwrap_or_default();
23109 let error = serde_json::from_str(&common::to_string(&bytes));
23110 let response = common::to_response(parts, bytes.into());
23111
23112 if let common::Retry::After(d) =
23113 dlg.http_failure(&response, error.as_ref().ok())
23114 {
23115 sleep(d).await;
23116 continue;
23117 }
23118
23119 dlg.finished(false);
23120
23121 return Err(match error {
23122 Ok(value) => common::Error::BadRequest(value),
23123 _ => common::Error::Failure(response),
23124 });
23125 }
23126 let response = {
23127 let bytes = common::to_bytes(body).await.unwrap_or_default();
23128 let encoded = common::to_string(&bytes);
23129 match serde_json::from_str(&encoded) {
23130 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23131 Err(error) => {
23132 dlg.response_json_decode_error(&encoded, &error);
23133 return Err(common::Error::JsonDecodeError(
23134 encoded.to_string(),
23135 error,
23136 ));
23137 }
23138 }
23139 };
23140
23141 dlg.finished(true);
23142 return Ok(response);
23143 }
23144 }
23145 }
23146 }
23147
23148 /// Required. Resource name of the form: `projects/*/locations/*/providers/*/connectors/*` Only global location is supported for Connector resource.
23149 ///
23150 /// Sets the *name* path property to the given value.
23151 ///
23152 /// Even though the property as already been set when instantiating this call,
23153 /// we provide this method for API completeness.
23154 pub fn name(mut self, new_value: &str) -> ProjectLocationProviderConnectorGetCall<'a, C> {
23155 self._name = new_value.to_string();
23156 self
23157 }
23158 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23159 /// while executing the actual API request.
23160 ///
23161 /// ````text
23162 /// It should be used to handle progress information, and to implement a certain level of resilience.
23163 /// ````
23164 ///
23165 /// Sets the *delegate* property to the given value.
23166 pub fn delegate(
23167 mut self,
23168 new_value: &'a mut dyn common::Delegate,
23169 ) -> ProjectLocationProviderConnectorGetCall<'a, C> {
23170 self._delegate = Some(new_value);
23171 self
23172 }
23173
23174 /// Set any additional parameter of the query string used in the request.
23175 /// It should be used to set parameters which are not yet available through their own
23176 /// setters.
23177 ///
23178 /// Please note that this method must not be used to set any of the known parameters
23179 /// which have their own setter method. If done anyway, the request will fail.
23180 ///
23181 /// # Additional Parameters
23182 ///
23183 /// * *$.xgafv* (query-string) - V1 error format.
23184 /// * *access_token* (query-string) - OAuth access token.
23185 /// * *alt* (query-string) - Data format for response.
23186 /// * *callback* (query-string) - JSONP
23187 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23188 /// * *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.
23189 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23190 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23191 /// * *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.
23192 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23193 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23194 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationProviderConnectorGetCall<'a, C>
23195 where
23196 T: AsRef<str>,
23197 {
23198 self._additional_params
23199 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23200 self
23201 }
23202
23203 /// Identifies the authorization scope for the method you are building.
23204 ///
23205 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23206 /// [`Scope::CloudPlatform`].
23207 ///
23208 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23209 /// tokens for more than one scope.
23210 ///
23211 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23212 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23213 /// sufficient, a read-write scope will do as well.
23214 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationProviderConnectorGetCall<'a, C>
23215 where
23216 St: AsRef<str>,
23217 {
23218 self._scopes.insert(String::from(scope.as_ref()));
23219 self
23220 }
23221 /// Identifies the authorization scope(s) for the method you are building.
23222 ///
23223 /// See [`Self::add_scope()`] for details.
23224 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationProviderConnectorGetCall<'a, C>
23225 where
23226 I: IntoIterator<Item = St>,
23227 St: AsRef<str>,
23228 {
23229 self._scopes
23230 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23231 self
23232 }
23233
23234 /// Removes all scopes, and no default scope will be used either.
23235 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23236 /// for details).
23237 pub fn clear_scopes(mut self) -> ProjectLocationProviderConnectorGetCall<'a, C> {
23238 self._scopes.clear();
23239 self
23240 }
23241}
23242
23243/// Lists Connectors in a given project and location.
23244///
23245/// A builder for the *locations.providers.connectors.list* method supported by a *project* resource.
23246/// It is not used directly, but through a [`ProjectMethods`] instance.
23247///
23248/// # Example
23249///
23250/// Instantiate a resource method builder
23251///
23252/// ```test_harness,no_run
23253/// # extern crate hyper;
23254/// # extern crate hyper_rustls;
23255/// # extern crate google_connectors1 as connectors1;
23256/// # async fn dox() {
23257/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23258///
23259/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23260/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
23261/// # secret,
23262/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23263/// # ).build().await.unwrap();
23264///
23265/// # let client = hyper_util::client::legacy::Client::builder(
23266/// # hyper_util::rt::TokioExecutor::new()
23267/// # )
23268/// # .build(
23269/// # hyper_rustls::HttpsConnectorBuilder::new()
23270/// # .with_native_roots()
23271/// # .unwrap()
23272/// # .https_or_http()
23273/// # .enable_http1()
23274/// # .build()
23275/// # );
23276/// # let mut hub = Connectors::new(client, auth);
23277/// // You can configure optional parameters by calling the respective setters at will, and
23278/// // execute the final call using `doit()`.
23279/// // Values shown here are possibly random and not representative !
23280/// let result = hub.projects().locations_providers_connectors_list("parent")
23281/// .page_token("At")
23282/// .page_size(-45)
23283/// .filter("aliquyam")
23284/// .doit().await;
23285/// # }
23286/// ```
23287pub struct ProjectLocationProviderConnectorListCall<'a, C>
23288where
23289 C: 'a,
23290{
23291 hub: &'a Connectors<C>,
23292 _parent: String,
23293 _page_token: Option<String>,
23294 _page_size: Option<i32>,
23295 _filter: Option<String>,
23296 _delegate: Option<&'a mut dyn common::Delegate>,
23297 _additional_params: HashMap<String, String>,
23298 _scopes: BTreeSet<String>,
23299}
23300
23301impl<'a, C> common::CallBuilder for ProjectLocationProviderConnectorListCall<'a, C> {}
23302
23303impl<'a, C> ProjectLocationProviderConnectorListCall<'a, C>
23304where
23305 C: common::Connector,
23306{
23307 /// Perform the operation you have build so far.
23308 pub async fn doit(mut self) -> common::Result<(common::Response, ListConnectorsResponse)> {
23309 use std::borrow::Cow;
23310 use std::io::{Read, Seek};
23311
23312 use common::{url::Params, ToParts};
23313 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23314
23315 let mut dd = common::DefaultDelegate;
23316 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23317 dlg.begin(common::MethodInfo {
23318 id: "connectors.projects.locations.providers.connectors.list",
23319 http_method: hyper::Method::GET,
23320 });
23321
23322 for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
23323 if self._additional_params.contains_key(field) {
23324 dlg.finished(false);
23325 return Err(common::Error::FieldClash(field));
23326 }
23327 }
23328
23329 let mut params = Params::with_capacity(6 + self._additional_params.len());
23330 params.push("parent", self._parent);
23331 if let Some(value) = self._page_token.as_ref() {
23332 params.push("pageToken", value);
23333 }
23334 if let Some(value) = self._page_size.as_ref() {
23335 params.push("pageSize", value.to_string());
23336 }
23337 if let Some(value) = self._filter.as_ref() {
23338 params.push("filter", value);
23339 }
23340
23341 params.extend(self._additional_params.iter());
23342
23343 params.push("alt", "json");
23344 let mut url = self.hub._base_url.clone() + "v1/{+parent}/connectors";
23345 if self._scopes.is_empty() {
23346 self._scopes
23347 .insert(Scope::CloudPlatform.as_ref().to_string());
23348 }
23349
23350 #[allow(clippy::single_element_loop)]
23351 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
23352 url = params.uri_replacement(url, param_name, find_this, true);
23353 }
23354 {
23355 let to_remove = ["parent"];
23356 params.remove_params(&to_remove);
23357 }
23358
23359 let url = params.parse_with_url(&url);
23360
23361 loop {
23362 let token = match self
23363 .hub
23364 .auth
23365 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23366 .await
23367 {
23368 Ok(token) => token,
23369 Err(e) => match dlg.token(e) {
23370 Ok(token) => token,
23371 Err(e) => {
23372 dlg.finished(false);
23373 return Err(common::Error::MissingToken(e));
23374 }
23375 },
23376 };
23377 let mut req_result = {
23378 let client = &self.hub.client;
23379 dlg.pre_request();
23380 let mut req_builder = hyper::Request::builder()
23381 .method(hyper::Method::GET)
23382 .uri(url.as_str())
23383 .header(USER_AGENT, self.hub._user_agent.clone());
23384
23385 if let Some(token) = token.as_ref() {
23386 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23387 }
23388
23389 let request = req_builder
23390 .header(CONTENT_LENGTH, 0_u64)
23391 .body(common::to_body::<String>(None));
23392
23393 client.request(request.unwrap()).await
23394 };
23395
23396 match req_result {
23397 Err(err) => {
23398 if let common::Retry::After(d) = dlg.http_error(&err) {
23399 sleep(d).await;
23400 continue;
23401 }
23402 dlg.finished(false);
23403 return Err(common::Error::HttpError(err));
23404 }
23405 Ok(res) => {
23406 let (mut parts, body) = res.into_parts();
23407 let mut body = common::Body::new(body);
23408 if !parts.status.is_success() {
23409 let bytes = common::to_bytes(body).await.unwrap_or_default();
23410 let error = serde_json::from_str(&common::to_string(&bytes));
23411 let response = common::to_response(parts, bytes.into());
23412
23413 if let common::Retry::After(d) =
23414 dlg.http_failure(&response, error.as_ref().ok())
23415 {
23416 sleep(d).await;
23417 continue;
23418 }
23419
23420 dlg.finished(false);
23421
23422 return Err(match error {
23423 Ok(value) => common::Error::BadRequest(value),
23424 _ => common::Error::Failure(response),
23425 });
23426 }
23427 let response = {
23428 let bytes = common::to_bytes(body).await.unwrap_or_default();
23429 let encoded = common::to_string(&bytes);
23430 match serde_json::from_str(&encoded) {
23431 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23432 Err(error) => {
23433 dlg.response_json_decode_error(&encoded, &error);
23434 return Err(common::Error::JsonDecodeError(
23435 encoded.to_string(),
23436 error,
23437 ));
23438 }
23439 }
23440 };
23441
23442 dlg.finished(true);
23443 return Ok(response);
23444 }
23445 }
23446 }
23447 }
23448
23449 /// Required. Parent resource of the connectors, of the form: `projects/*/locations/*/providers/*` Only global location is supported for Connector resource.
23450 ///
23451 /// Sets the *parent* path property to the given value.
23452 ///
23453 /// Even though the property as already been set when instantiating this call,
23454 /// we provide this method for API completeness.
23455 pub fn parent(mut self, new_value: &str) -> ProjectLocationProviderConnectorListCall<'a, C> {
23456 self._parent = new_value.to_string();
23457 self
23458 }
23459 /// Page token.
23460 ///
23461 /// Sets the *page token* query property to the given value.
23462 pub fn page_token(
23463 mut self,
23464 new_value: &str,
23465 ) -> ProjectLocationProviderConnectorListCall<'a, C> {
23466 self._page_token = Some(new_value.to_string());
23467 self
23468 }
23469 /// Page size.
23470 ///
23471 /// Sets the *page size* query property to the given value.
23472 pub fn page_size(mut self, new_value: i32) -> ProjectLocationProviderConnectorListCall<'a, C> {
23473 self._page_size = Some(new_value);
23474 self
23475 }
23476 /// Filter string.
23477 ///
23478 /// Sets the *filter* query property to the given value.
23479 pub fn filter(mut self, new_value: &str) -> ProjectLocationProviderConnectorListCall<'a, C> {
23480 self._filter = Some(new_value.to_string());
23481 self
23482 }
23483 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23484 /// while executing the actual API request.
23485 ///
23486 /// ````text
23487 /// It should be used to handle progress information, and to implement a certain level of resilience.
23488 /// ````
23489 ///
23490 /// Sets the *delegate* property to the given value.
23491 pub fn delegate(
23492 mut self,
23493 new_value: &'a mut dyn common::Delegate,
23494 ) -> ProjectLocationProviderConnectorListCall<'a, C> {
23495 self._delegate = Some(new_value);
23496 self
23497 }
23498
23499 /// Set any additional parameter of the query string used in the request.
23500 /// It should be used to set parameters which are not yet available through their own
23501 /// setters.
23502 ///
23503 /// Please note that this method must not be used to set any of the known parameters
23504 /// which have their own setter method. If done anyway, the request will fail.
23505 ///
23506 /// # Additional Parameters
23507 ///
23508 /// * *$.xgafv* (query-string) - V1 error format.
23509 /// * *access_token* (query-string) - OAuth access token.
23510 /// * *alt* (query-string) - Data format for response.
23511 /// * *callback* (query-string) - JSONP
23512 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23513 /// * *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.
23514 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23515 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23516 /// * *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.
23517 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23518 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23519 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationProviderConnectorListCall<'a, C>
23520 where
23521 T: AsRef<str>,
23522 {
23523 self._additional_params
23524 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23525 self
23526 }
23527
23528 /// Identifies the authorization scope for the method you are building.
23529 ///
23530 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23531 /// [`Scope::CloudPlatform`].
23532 ///
23533 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23534 /// tokens for more than one scope.
23535 ///
23536 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23537 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23538 /// sufficient, a read-write scope will do as well.
23539 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationProviderConnectorListCall<'a, C>
23540 where
23541 St: AsRef<str>,
23542 {
23543 self._scopes.insert(String::from(scope.as_ref()));
23544 self
23545 }
23546 /// Identifies the authorization scope(s) for the method you are building.
23547 ///
23548 /// See [`Self::add_scope()`] for details.
23549 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationProviderConnectorListCall<'a, C>
23550 where
23551 I: IntoIterator<Item = St>,
23552 St: AsRef<str>,
23553 {
23554 self._scopes
23555 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23556 self
23557 }
23558
23559 /// Removes all scopes, and no default scope will be used either.
23560 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23561 /// for details).
23562 pub fn clear_scopes(mut self) -> ProjectLocationProviderConnectorListCall<'a, C> {
23563 self._scopes.clear();
23564 self
23565 }
23566}
23567
23568/// Gets details of a provider.
23569///
23570/// A builder for the *locations.providers.get* method supported by a *project* resource.
23571/// It is not used directly, but through a [`ProjectMethods`] instance.
23572///
23573/// # Example
23574///
23575/// Instantiate a resource method builder
23576///
23577/// ```test_harness,no_run
23578/// # extern crate hyper;
23579/// # extern crate hyper_rustls;
23580/// # extern crate google_connectors1 as connectors1;
23581/// # async fn dox() {
23582/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23583///
23584/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23585/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
23586/// # secret,
23587/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23588/// # ).build().await.unwrap();
23589///
23590/// # let client = hyper_util::client::legacy::Client::builder(
23591/// # hyper_util::rt::TokioExecutor::new()
23592/// # )
23593/// # .build(
23594/// # hyper_rustls::HttpsConnectorBuilder::new()
23595/// # .with_native_roots()
23596/// # .unwrap()
23597/// # .https_or_http()
23598/// # .enable_http1()
23599/// # .build()
23600/// # );
23601/// # let mut hub = Connectors::new(client, auth);
23602/// // You can configure optional parameters by calling the respective setters at will, and
23603/// // execute the final call using `doit()`.
23604/// // Values shown here are possibly random and not representative !
23605/// let result = hub.projects().locations_providers_get("name")
23606/// .doit().await;
23607/// # }
23608/// ```
23609pub struct ProjectLocationProviderGetCall<'a, C>
23610where
23611 C: 'a,
23612{
23613 hub: &'a Connectors<C>,
23614 _name: String,
23615 _delegate: Option<&'a mut dyn common::Delegate>,
23616 _additional_params: HashMap<String, String>,
23617 _scopes: BTreeSet<String>,
23618}
23619
23620impl<'a, C> common::CallBuilder for ProjectLocationProviderGetCall<'a, C> {}
23621
23622impl<'a, C> ProjectLocationProviderGetCall<'a, C>
23623where
23624 C: common::Connector,
23625{
23626 /// Perform the operation you have build so far.
23627 pub async fn doit(mut self) -> common::Result<(common::Response, Provider)> {
23628 use std::borrow::Cow;
23629 use std::io::{Read, Seek};
23630
23631 use common::{url::Params, ToParts};
23632 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23633
23634 let mut dd = common::DefaultDelegate;
23635 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23636 dlg.begin(common::MethodInfo {
23637 id: "connectors.projects.locations.providers.get",
23638 http_method: hyper::Method::GET,
23639 });
23640
23641 for &field in ["alt", "name"].iter() {
23642 if self._additional_params.contains_key(field) {
23643 dlg.finished(false);
23644 return Err(common::Error::FieldClash(field));
23645 }
23646 }
23647
23648 let mut params = Params::with_capacity(3 + self._additional_params.len());
23649 params.push("name", self._name);
23650
23651 params.extend(self._additional_params.iter());
23652
23653 params.push("alt", "json");
23654 let mut url = self.hub._base_url.clone() + "v1/{+name}";
23655 if self._scopes.is_empty() {
23656 self._scopes
23657 .insert(Scope::CloudPlatform.as_ref().to_string());
23658 }
23659
23660 #[allow(clippy::single_element_loop)]
23661 for &(find_this, param_name) in [("{+name}", "name")].iter() {
23662 url = params.uri_replacement(url, param_name, find_this, true);
23663 }
23664 {
23665 let to_remove = ["name"];
23666 params.remove_params(&to_remove);
23667 }
23668
23669 let url = params.parse_with_url(&url);
23670
23671 loop {
23672 let token = match self
23673 .hub
23674 .auth
23675 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23676 .await
23677 {
23678 Ok(token) => token,
23679 Err(e) => match dlg.token(e) {
23680 Ok(token) => token,
23681 Err(e) => {
23682 dlg.finished(false);
23683 return Err(common::Error::MissingToken(e));
23684 }
23685 },
23686 };
23687 let mut req_result = {
23688 let client = &self.hub.client;
23689 dlg.pre_request();
23690 let mut req_builder = hyper::Request::builder()
23691 .method(hyper::Method::GET)
23692 .uri(url.as_str())
23693 .header(USER_AGENT, self.hub._user_agent.clone());
23694
23695 if let Some(token) = token.as_ref() {
23696 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23697 }
23698
23699 let request = req_builder
23700 .header(CONTENT_LENGTH, 0_u64)
23701 .body(common::to_body::<String>(None));
23702
23703 client.request(request.unwrap()).await
23704 };
23705
23706 match req_result {
23707 Err(err) => {
23708 if let common::Retry::After(d) = dlg.http_error(&err) {
23709 sleep(d).await;
23710 continue;
23711 }
23712 dlg.finished(false);
23713 return Err(common::Error::HttpError(err));
23714 }
23715 Ok(res) => {
23716 let (mut parts, body) = res.into_parts();
23717 let mut body = common::Body::new(body);
23718 if !parts.status.is_success() {
23719 let bytes = common::to_bytes(body).await.unwrap_or_default();
23720 let error = serde_json::from_str(&common::to_string(&bytes));
23721 let response = common::to_response(parts, bytes.into());
23722
23723 if let common::Retry::After(d) =
23724 dlg.http_failure(&response, error.as_ref().ok())
23725 {
23726 sleep(d).await;
23727 continue;
23728 }
23729
23730 dlg.finished(false);
23731
23732 return Err(match error {
23733 Ok(value) => common::Error::BadRequest(value),
23734 _ => common::Error::Failure(response),
23735 });
23736 }
23737 let response = {
23738 let bytes = common::to_bytes(body).await.unwrap_or_default();
23739 let encoded = common::to_string(&bytes);
23740 match serde_json::from_str(&encoded) {
23741 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23742 Err(error) => {
23743 dlg.response_json_decode_error(&encoded, &error);
23744 return Err(common::Error::JsonDecodeError(
23745 encoded.to_string(),
23746 error,
23747 ));
23748 }
23749 }
23750 };
23751
23752 dlg.finished(true);
23753 return Ok(response);
23754 }
23755 }
23756 }
23757 }
23758
23759 /// Required. Resource name of the form: `projects/*/locations/*/providers/*` Only global location is supported for Provider resource.
23760 ///
23761 /// Sets the *name* path property to the given value.
23762 ///
23763 /// Even though the property as already been set when instantiating this call,
23764 /// we provide this method for API completeness.
23765 pub fn name(mut self, new_value: &str) -> ProjectLocationProviderGetCall<'a, C> {
23766 self._name = new_value.to_string();
23767 self
23768 }
23769 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23770 /// while executing the actual API request.
23771 ///
23772 /// ````text
23773 /// It should be used to handle progress information, and to implement a certain level of resilience.
23774 /// ````
23775 ///
23776 /// Sets the *delegate* property to the given value.
23777 pub fn delegate(
23778 mut self,
23779 new_value: &'a mut dyn common::Delegate,
23780 ) -> ProjectLocationProviderGetCall<'a, C> {
23781 self._delegate = Some(new_value);
23782 self
23783 }
23784
23785 /// Set any additional parameter of the query string used in the request.
23786 /// It should be used to set parameters which are not yet available through their own
23787 /// setters.
23788 ///
23789 /// Please note that this method must not be used to set any of the known parameters
23790 /// which have their own setter method. If done anyway, the request will fail.
23791 ///
23792 /// # Additional Parameters
23793 ///
23794 /// * *$.xgafv* (query-string) - V1 error format.
23795 /// * *access_token* (query-string) - OAuth access token.
23796 /// * *alt* (query-string) - Data format for response.
23797 /// * *callback* (query-string) - JSONP
23798 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23799 /// * *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.
23800 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23801 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23802 /// * *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.
23803 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23804 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23805 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationProviderGetCall<'a, C>
23806 where
23807 T: AsRef<str>,
23808 {
23809 self._additional_params
23810 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23811 self
23812 }
23813
23814 /// Identifies the authorization scope for the method you are building.
23815 ///
23816 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23817 /// [`Scope::CloudPlatform`].
23818 ///
23819 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23820 /// tokens for more than one scope.
23821 ///
23822 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23823 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23824 /// sufficient, a read-write scope will do as well.
23825 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationProviderGetCall<'a, C>
23826 where
23827 St: AsRef<str>,
23828 {
23829 self._scopes.insert(String::from(scope.as_ref()));
23830 self
23831 }
23832 /// Identifies the authorization scope(s) for the method you are building.
23833 ///
23834 /// See [`Self::add_scope()`] for details.
23835 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationProviderGetCall<'a, C>
23836 where
23837 I: IntoIterator<Item = St>,
23838 St: AsRef<str>,
23839 {
23840 self._scopes
23841 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23842 self
23843 }
23844
23845 /// Removes all scopes, and no default scope will be used either.
23846 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23847 /// for details).
23848 pub fn clear_scopes(mut self) -> ProjectLocationProviderGetCall<'a, C> {
23849 self._scopes.clear();
23850 self
23851 }
23852}
23853
23854/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
23855///
23856/// A builder for the *locations.providers.getIamPolicy* method supported by a *project* resource.
23857/// It is not used directly, but through a [`ProjectMethods`] instance.
23858///
23859/// # Example
23860///
23861/// Instantiate a resource method builder
23862///
23863/// ```test_harness,no_run
23864/// # extern crate hyper;
23865/// # extern crate hyper_rustls;
23866/// # extern crate google_connectors1 as connectors1;
23867/// # async fn dox() {
23868/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23869///
23870/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23871/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
23872/// # secret,
23873/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23874/// # ).build().await.unwrap();
23875///
23876/// # let client = hyper_util::client::legacy::Client::builder(
23877/// # hyper_util::rt::TokioExecutor::new()
23878/// # )
23879/// # .build(
23880/// # hyper_rustls::HttpsConnectorBuilder::new()
23881/// # .with_native_roots()
23882/// # .unwrap()
23883/// # .https_or_http()
23884/// # .enable_http1()
23885/// # .build()
23886/// # );
23887/// # let mut hub = Connectors::new(client, auth);
23888/// // You can configure optional parameters by calling the respective setters at will, and
23889/// // execute the final call using `doit()`.
23890/// // Values shown here are possibly random and not representative !
23891/// let result = hub.projects().locations_providers_get_iam_policy("resource")
23892/// .options_requested_policy_version(-31)
23893/// .doit().await;
23894/// # }
23895/// ```
23896pub struct ProjectLocationProviderGetIamPolicyCall<'a, C>
23897where
23898 C: 'a,
23899{
23900 hub: &'a Connectors<C>,
23901 _resource: String,
23902 _options_requested_policy_version: Option<i32>,
23903 _delegate: Option<&'a mut dyn common::Delegate>,
23904 _additional_params: HashMap<String, String>,
23905 _scopes: BTreeSet<String>,
23906}
23907
23908impl<'a, C> common::CallBuilder for ProjectLocationProviderGetIamPolicyCall<'a, C> {}
23909
23910impl<'a, C> ProjectLocationProviderGetIamPolicyCall<'a, C>
23911where
23912 C: common::Connector,
23913{
23914 /// Perform the operation you have build so far.
23915 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
23916 use std::borrow::Cow;
23917 use std::io::{Read, Seek};
23918
23919 use common::{url::Params, ToParts};
23920 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23921
23922 let mut dd = common::DefaultDelegate;
23923 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23924 dlg.begin(common::MethodInfo {
23925 id: "connectors.projects.locations.providers.getIamPolicy",
23926 http_method: hyper::Method::GET,
23927 });
23928
23929 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
23930 if self._additional_params.contains_key(field) {
23931 dlg.finished(false);
23932 return Err(common::Error::FieldClash(field));
23933 }
23934 }
23935
23936 let mut params = Params::with_capacity(4 + self._additional_params.len());
23937 params.push("resource", self._resource);
23938 if let Some(value) = self._options_requested_policy_version.as_ref() {
23939 params.push("options.requestedPolicyVersion", value.to_string());
23940 }
23941
23942 params.extend(self._additional_params.iter());
23943
23944 params.push("alt", "json");
23945 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
23946 if self._scopes.is_empty() {
23947 self._scopes
23948 .insert(Scope::CloudPlatform.as_ref().to_string());
23949 }
23950
23951 #[allow(clippy::single_element_loop)]
23952 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
23953 url = params.uri_replacement(url, param_name, find_this, true);
23954 }
23955 {
23956 let to_remove = ["resource"];
23957 params.remove_params(&to_remove);
23958 }
23959
23960 let url = params.parse_with_url(&url);
23961
23962 loop {
23963 let token = match self
23964 .hub
23965 .auth
23966 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23967 .await
23968 {
23969 Ok(token) => token,
23970 Err(e) => match dlg.token(e) {
23971 Ok(token) => token,
23972 Err(e) => {
23973 dlg.finished(false);
23974 return Err(common::Error::MissingToken(e));
23975 }
23976 },
23977 };
23978 let mut req_result = {
23979 let client = &self.hub.client;
23980 dlg.pre_request();
23981 let mut req_builder = hyper::Request::builder()
23982 .method(hyper::Method::GET)
23983 .uri(url.as_str())
23984 .header(USER_AGENT, self.hub._user_agent.clone());
23985
23986 if let Some(token) = token.as_ref() {
23987 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23988 }
23989
23990 let request = req_builder
23991 .header(CONTENT_LENGTH, 0_u64)
23992 .body(common::to_body::<String>(None));
23993
23994 client.request(request.unwrap()).await
23995 };
23996
23997 match req_result {
23998 Err(err) => {
23999 if let common::Retry::After(d) = dlg.http_error(&err) {
24000 sleep(d).await;
24001 continue;
24002 }
24003 dlg.finished(false);
24004 return Err(common::Error::HttpError(err));
24005 }
24006 Ok(res) => {
24007 let (mut parts, body) = res.into_parts();
24008 let mut body = common::Body::new(body);
24009 if !parts.status.is_success() {
24010 let bytes = common::to_bytes(body).await.unwrap_or_default();
24011 let error = serde_json::from_str(&common::to_string(&bytes));
24012 let response = common::to_response(parts, bytes.into());
24013
24014 if let common::Retry::After(d) =
24015 dlg.http_failure(&response, error.as_ref().ok())
24016 {
24017 sleep(d).await;
24018 continue;
24019 }
24020
24021 dlg.finished(false);
24022
24023 return Err(match error {
24024 Ok(value) => common::Error::BadRequest(value),
24025 _ => common::Error::Failure(response),
24026 });
24027 }
24028 let response = {
24029 let bytes = common::to_bytes(body).await.unwrap_or_default();
24030 let encoded = common::to_string(&bytes);
24031 match serde_json::from_str(&encoded) {
24032 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24033 Err(error) => {
24034 dlg.response_json_decode_error(&encoded, &error);
24035 return Err(common::Error::JsonDecodeError(
24036 encoded.to_string(),
24037 error,
24038 ));
24039 }
24040 }
24041 };
24042
24043 dlg.finished(true);
24044 return Ok(response);
24045 }
24046 }
24047 }
24048 }
24049
24050 /// 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.
24051 ///
24052 /// Sets the *resource* path property to the given value.
24053 ///
24054 /// Even though the property as already been set when instantiating this call,
24055 /// we provide this method for API completeness.
24056 pub fn resource(mut self, new_value: &str) -> ProjectLocationProviderGetIamPolicyCall<'a, C> {
24057 self._resource = new_value.to_string();
24058 self
24059 }
24060 /// 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).
24061 ///
24062 /// Sets the *options.requested policy version* query property to the given value.
24063 pub fn options_requested_policy_version(
24064 mut self,
24065 new_value: i32,
24066 ) -> ProjectLocationProviderGetIamPolicyCall<'a, C> {
24067 self._options_requested_policy_version = Some(new_value);
24068 self
24069 }
24070 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24071 /// while executing the actual API request.
24072 ///
24073 /// ````text
24074 /// It should be used to handle progress information, and to implement a certain level of resilience.
24075 /// ````
24076 ///
24077 /// Sets the *delegate* property to the given value.
24078 pub fn delegate(
24079 mut self,
24080 new_value: &'a mut dyn common::Delegate,
24081 ) -> ProjectLocationProviderGetIamPolicyCall<'a, C> {
24082 self._delegate = Some(new_value);
24083 self
24084 }
24085
24086 /// Set any additional parameter of the query string used in the request.
24087 /// It should be used to set parameters which are not yet available through their own
24088 /// setters.
24089 ///
24090 /// Please note that this method must not be used to set any of the known parameters
24091 /// which have their own setter method. If done anyway, the request will fail.
24092 ///
24093 /// # Additional Parameters
24094 ///
24095 /// * *$.xgafv* (query-string) - V1 error format.
24096 /// * *access_token* (query-string) - OAuth access token.
24097 /// * *alt* (query-string) - Data format for response.
24098 /// * *callback* (query-string) - JSONP
24099 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24100 /// * *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.
24101 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24102 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24103 /// * *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.
24104 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24105 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24106 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationProviderGetIamPolicyCall<'a, C>
24107 where
24108 T: AsRef<str>,
24109 {
24110 self._additional_params
24111 .insert(name.as_ref().to_string(), value.as_ref().to_string());
24112 self
24113 }
24114
24115 /// Identifies the authorization scope for the method you are building.
24116 ///
24117 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24118 /// [`Scope::CloudPlatform`].
24119 ///
24120 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24121 /// tokens for more than one scope.
24122 ///
24123 /// Usually there is more than one suitable scope to authorize an operation, some of which may
24124 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24125 /// sufficient, a read-write scope will do as well.
24126 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationProviderGetIamPolicyCall<'a, C>
24127 where
24128 St: AsRef<str>,
24129 {
24130 self._scopes.insert(String::from(scope.as_ref()));
24131 self
24132 }
24133 /// Identifies the authorization scope(s) for the method you are building.
24134 ///
24135 /// See [`Self::add_scope()`] for details.
24136 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationProviderGetIamPolicyCall<'a, C>
24137 where
24138 I: IntoIterator<Item = St>,
24139 St: AsRef<str>,
24140 {
24141 self._scopes
24142 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24143 self
24144 }
24145
24146 /// Removes all scopes, and no default scope will be used either.
24147 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24148 /// for details).
24149 pub fn clear_scopes(mut self) -> ProjectLocationProviderGetIamPolicyCall<'a, C> {
24150 self._scopes.clear();
24151 self
24152 }
24153}
24154
24155/// Lists Providers in a given project and location.
24156///
24157/// A builder for the *locations.providers.list* method supported by a *project* resource.
24158/// It is not used directly, but through a [`ProjectMethods`] instance.
24159///
24160/// # Example
24161///
24162/// Instantiate a resource method builder
24163///
24164/// ```test_harness,no_run
24165/// # extern crate hyper;
24166/// # extern crate hyper_rustls;
24167/// # extern crate google_connectors1 as connectors1;
24168/// # async fn dox() {
24169/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24170///
24171/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24172/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
24173/// # secret,
24174/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24175/// # ).build().await.unwrap();
24176///
24177/// # let client = hyper_util::client::legacy::Client::builder(
24178/// # hyper_util::rt::TokioExecutor::new()
24179/// # )
24180/// # .build(
24181/// # hyper_rustls::HttpsConnectorBuilder::new()
24182/// # .with_native_roots()
24183/// # .unwrap()
24184/// # .https_or_http()
24185/// # .enable_http1()
24186/// # .build()
24187/// # );
24188/// # let mut hub = Connectors::new(client, auth);
24189/// // You can configure optional parameters by calling the respective setters at will, and
24190/// // execute the final call using `doit()`.
24191/// // Values shown here are possibly random and not representative !
24192/// let result = hub.projects().locations_providers_list("parent")
24193/// .page_token("amet")
24194/// .page_size(-57)
24195/// .doit().await;
24196/// # }
24197/// ```
24198pub struct ProjectLocationProviderListCall<'a, C>
24199where
24200 C: 'a,
24201{
24202 hub: &'a Connectors<C>,
24203 _parent: String,
24204 _page_token: Option<String>,
24205 _page_size: Option<i32>,
24206 _delegate: Option<&'a mut dyn common::Delegate>,
24207 _additional_params: HashMap<String, String>,
24208 _scopes: BTreeSet<String>,
24209}
24210
24211impl<'a, C> common::CallBuilder for ProjectLocationProviderListCall<'a, C> {}
24212
24213impl<'a, C> ProjectLocationProviderListCall<'a, C>
24214where
24215 C: common::Connector,
24216{
24217 /// Perform the operation you have build so far.
24218 pub async fn doit(mut self) -> common::Result<(common::Response, ListProvidersResponse)> {
24219 use std::borrow::Cow;
24220 use std::io::{Read, Seek};
24221
24222 use common::{url::Params, ToParts};
24223 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24224
24225 let mut dd = common::DefaultDelegate;
24226 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24227 dlg.begin(common::MethodInfo {
24228 id: "connectors.projects.locations.providers.list",
24229 http_method: hyper::Method::GET,
24230 });
24231
24232 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
24233 if self._additional_params.contains_key(field) {
24234 dlg.finished(false);
24235 return Err(common::Error::FieldClash(field));
24236 }
24237 }
24238
24239 let mut params = Params::with_capacity(5 + self._additional_params.len());
24240 params.push("parent", self._parent);
24241 if let Some(value) = self._page_token.as_ref() {
24242 params.push("pageToken", value);
24243 }
24244 if let Some(value) = self._page_size.as_ref() {
24245 params.push("pageSize", value.to_string());
24246 }
24247
24248 params.extend(self._additional_params.iter());
24249
24250 params.push("alt", "json");
24251 let mut url = self.hub._base_url.clone() + "v1/{+parent}/providers";
24252 if self._scopes.is_empty() {
24253 self._scopes
24254 .insert(Scope::CloudPlatform.as_ref().to_string());
24255 }
24256
24257 #[allow(clippy::single_element_loop)]
24258 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
24259 url = params.uri_replacement(url, param_name, find_this, true);
24260 }
24261 {
24262 let to_remove = ["parent"];
24263 params.remove_params(&to_remove);
24264 }
24265
24266 let url = params.parse_with_url(&url);
24267
24268 loop {
24269 let token = match self
24270 .hub
24271 .auth
24272 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24273 .await
24274 {
24275 Ok(token) => token,
24276 Err(e) => match dlg.token(e) {
24277 Ok(token) => token,
24278 Err(e) => {
24279 dlg.finished(false);
24280 return Err(common::Error::MissingToken(e));
24281 }
24282 },
24283 };
24284 let mut req_result = {
24285 let client = &self.hub.client;
24286 dlg.pre_request();
24287 let mut req_builder = hyper::Request::builder()
24288 .method(hyper::Method::GET)
24289 .uri(url.as_str())
24290 .header(USER_AGENT, self.hub._user_agent.clone());
24291
24292 if let Some(token) = token.as_ref() {
24293 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24294 }
24295
24296 let request = req_builder
24297 .header(CONTENT_LENGTH, 0_u64)
24298 .body(common::to_body::<String>(None));
24299
24300 client.request(request.unwrap()).await
24301 };
24302
24303 match req_result {
24304 Err(err) => {
24305 if let common::Retry::After(d) = dlg.http_error(&err) {
24306 sleep(d).await;
24307 continue;
24308 }
24309 dlg.finished(false);
24310 return Err(common::Error::HttpError(err));
24311 }
24312 Ok(res) => {
24313 let (mut parts, body) = res.into_parts();
24314 let mut body = common::Body::new(body);
24315 if !parts.status.is_success() {
24316 let bytes = common::to_bytes(body).await.unwrap_or_default();
24317 let error = serde_json::from_str(&common::to_string(&bytes));
24318 let response = common::to_response(parts, bytes.into());
24319
24320 if let common::Retry::After(d) =
24321 dlg.http_failure(&response, error.as_ref().ok())
24322 {
24323 sleep(d).await;
24324 continue;
24325 }
24326
24327 dlg.finished(false);
24328
24329 return Err(match error {
24330 Ok(value) => common::Error::BadRequest(value),
24331 _ => common::Error::Failure(response),
24332 });
24333 }
24334 let response = {
24335 let bytes = common::to_bytes(body).await.unwrap_or_default();
24336 let encoded = common::to_string(&bytes);
24337 match serde_json::from_str(&encoded) {
24338 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24339 Err(error) => {
24340 dlg.response_json_decode_error(&encoded, &error);
24341 return Err(common::Error::JsonDecodeError(
24342 encoded.to_string(),
24343 error,
24344 ));
24345 }
24346 }
24347 };
24348
24349 dlg.finished(true);
24350 return Ok(response);
24351 }
24352 }
24353 }
24354 }
24355
24356 /// Required. Parent resource of the API, of the form: `projects/*/locations/*` Only global location is supported for Provider resource.
24357 ///
24358 /// Sets the *parent* path property to the given value.
24359 ///
24360 /// Even though the property as already been set when instantiating this call,
24361 /// we provide this method for API completeness.
24362 pub fn parent(mut self, new_value: &str) -> ProjectLocationProviderListCall<'a, C> {
24363 self._parent = new_value.to_string();
24364 self
24365 }
24366 /// Page token.
24367 ///
24368 /// Sets the *page token* query property to the given value.
24369 pub fn page_token(mut self, new_value: &str) -> ProjectLocationProviderListCall<'a, C> {
24370 self._page_token = Some(new_value.to_string());
24371 self
24372 }
24373 /// Page size.
24374 ///
24375 /// Sets the *page size* query property to the given value.
24376 pub fn page_size(mut self, new_value: i32) -> ProjectLocationProviderListCall<'a, C> {
24377 self._page_size = Some(new_value);
24378 self
24379 }
24380 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24381 /// while executing the actual API request.
24382 ///
24383 /// ````text
24384 /// It should be used to handle progress information, and to implement a certain level of resilience.
24385 /// ````
24386 ///
24387 /// Sets the *delegate* property to the given value.
24388 pub fn delegate(
24389 mut self,
24390 new_value: &'a mut dyn common::Delegate,
24391 ) -> ProjectLocationProviderListCall<'a, C> {
24392 self._delegate = Some(new_value);
24393 self
24394 }
24395
24396 /// Set any additional parameter of the query string used in the request.
24397 /// It should be used to set parameters which are not yet available through their own
24398 /// setters.
24399 ///
24400 /// Please note that this method must not be used to set any of the known parameters
24401 /// which have their own setter method. If done anyway, the request will fail.
24402 ///
24403 /// # Additional Parameters
24404 ///
24405 /// * *$.xgafv* (query-string) - V1 error format.
24406 /// * *access_token* (query-string) - OAuth access token.
24407 /// * *alt* (query-string) - Data format for response.
24408 /// * *callback* (query-string) - JSONP
24409 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24410 /// * *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.
24411 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24412 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24413 /// * *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.
24414 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24415 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24416 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationProviderListCall<'a, C>
24417 where
24418 T: AsRef<str>,
24419 {
24420 self._additional_params
24421 .insert(name.as_ref().to_string(), value.as_ref().to_string());
24422 self
24423 }
24424
24425 /// Identifies the authorization scope for the method you are building.
24426 ///
24427 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24428 /// [`Scope::CloudPlatform`].
24429 ///
24430 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24431 /// tokens for more than one scope.
24432 ///
24433 /// Usually there is more than one suitable scope to authorize an operation, some of which may
24434 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24435 /// sufficient, a read-write scope will do as well.
24436 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationProviderListCall<'a, C>
24437 where
24438 St: AsRef<str>,
24439 {
24440 self._scopes.insert(String::from(scope.as_ref()));
24441 self
24442 }
24443 /// Identifies the authorization scope(s) for the method you are building.
24444 ///
24445 /// See [`Self::add_scope()`] for details.
24446 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationProviderListCall<'a, C>
24447 where
24448 I: IntoIterator<Item = St>,
24449 St: AsRef<str>,
24450 {
24451 self._scopes
24452 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24453 self
24454 }
24455
24456 /// Removes all scopes, and no default scope will be used either.
24457 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24458 /// for details).
24459 pub fn clear_scopes(mut self) -> ProjectLocationProviderListCall<'a, C> {
24460 self._scopes.clear();
24461 self
24462 }
24463}
24464
24465/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
24466///
24467/// A builder for the *locations.providers.setIamPolicy* method supported by a *project* resource.
24468/// It is not used directly, but through a [`ProjectMethods`] instance.
24469///
24470/// # Example
24471///
24472/// Instantiate a resource method builder
24473///
24474/// ```test_harness,no_run
24475/// # extern crate hyper;
24476/// # extern crate hyper_rustls;
24477/// # extern crate google_connectors1 as connectors1;
24478/// use connectors1::api::SetIamPolicyRequest;
24479/// # async fn dox() {
24480/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24481///
24482/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24483/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
24484/// # secret,
24485/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24486/// # ).build().await.unwrap();
24487///
24488/// # let client = hyper_util::client::legacy::Client::builder(
24489/// # hyper_util::rt::TokioExecutor::new()
24490/// # )
24491/// # .build(
24492/// # hyper_rustls::HttpsConnectorBuilder::new()
24493/// # .with_native_roots()
24494/// # .unwrap()
24495/// # .https_or_http()
24496/// # .enable_http1()
24497/// # .build()
24498/// # );
24499/// # let mut hub = Connectors::new(client, auth);
24500/// // As the method needs a request, you would usually fill it with the desired information
24501/// // into the respective structure. Some of the parts shown here might not be applicable !
24502/// // Values shown here are possibly random and not representative !
24503/// let mut req = SetIamPolicyRequest::default();
24504///
24505/// // You can configure optional parameters by calling the respective setters at will, and
24506/// // execute the final call using `doit()`.
24507/// // Values shown here are possibly random and not representative !
24508/// let result = hub.projects().locations_providers_set_iam_policy(req, "resource")
24509/// .doit().await;
24510/// # }
24511/// ```
24512pub struct ProjectLocationProviderSetIamPolicyCall<'a, C>
24513where
24514 C: 'a,
24515{
24516 hub: &'a Connectors<C>,
24517 _request: SetIamPolicyRequest,
24518 _resource: String,
24519 _delegate: Option<&'a mut dyn common::Delegate>,
24520 _additional_params: HashMap<String, String>,
24521 _scopes: BTreeSet<String>,
24522}
24523
24524impl<'a, C> common::CallBuilder for ProjectLocationProviderSetIamPolicyCall<'a, C> {}
24525
24526impl<'a, C> ProjectLocationProviderSetIamPolicyCall<'a, C>
24527where
24528 C: common::Connector,
24529{
24530 /// Perform the operation you have build so far.
24531 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
24532 use std::borrow::Cow;
24533 use std::io::{Read, Seek};
24534
24535 use common::{url::Params, ToParts};
24536 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24537
24538 let mut dd = common::DefaultDelegate;
24539 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24540 dlg.begin(common::MethodInfo {
24541 id: "connectors.projects.locations.providers.setIamPolicy",
24542 http_method: hyper::Method::POST,
24543 });
24544
24545 for &field in ["alt", "resource"].iter() {
24546 if self._additional_params.contains_key(field) {
24547 dlg.finished(false);
24548 return Err(common::Error::FieldClash(field));
24549 }
24550 }
24551
24552 let mut params = Params::with_capacity(4 + self._additional_params.len());
24553 params.push("resource", self._resource);
24554
24555 params.extend(self._additional_params.iter());
24556
24557 params.push("alt", "json");
24558 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
24559 if self._scopes.is_empty() {
24560 self._scopes
24561 .insert(Scope::CloudPlatform.as_ref().to_string());
24562 }
24563
24564 #[allow(clippy::single_element_loop)]
24565 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
24566 url = params.uri_replacement(url, param_name, find_this, true);
24567 }
24568 {
24569 let to_remove = ["resource"];
24570 params.remove_params(&to_remove);
24571 }
24572
24573 let url = params.parse_with_url(&url);
24574
24575 let mut json_mime_type = mime::APPLICATION_JSON;
24576 let mut request_value_reader = {
24577 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
24578 common::remove_json_null_values(&mut value);
24579 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
24580 serde_json::to_writer(&mut dst, &value).unwrap();
24581 dst
24582 };
24583 let request_size = request_value_reader
24584 .seek(std::io::SeekFrom::End(0))
24585 .unwrap();
24586 request_value_reader
24587 .seek(std::io::SeekFrom::Start(0))
24588 .unwrap();
24589
24590 loop {
24591 let token = match self
24592 .hub
24593 .auth
24594 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24595 .await
24596 {
24597 Ok(token) => token,
24598 Err(e) => match dlg.token(e) {
24599 Ok(token) => token,
24600 Err(e) => {
24601 dlg.finished(false);
24602 return Err(common::Error::MissingToken(e));
24603 }
24604 },
24605 };
24606 request_value_reader
24607 .seek(std::io::SeekFrom::Start(0))
24608 .unwrap();
24609 let mut req_result = {
24610 let client = &self.hub.client;
24611 dlg.pre_request();
24612 let mut req_builder = hyper::Request::builder()
24613 .method(hyper::Method::POST)
24614 .uri(url.as_str())
24615 .header(USER_AGENT, self.hub._user_agent.clone());
24616
24617 if let Some(token) = token.as_ref() {
24618 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24619 }
24620
24621 let request = req_builder
24622 .header(CONTENT_TYPE, json_mime_type.to_string())
24623 .header(CONTENT_LENGTH, request_size as u64)
24624 .body(common::to_body(
24625 request_value_reader.get_ref().clone().into(),
24626 ));
24627
24628 client.request(request.unwrap()).await
24629 };
24630
24631 match req_result {
24632 Err(err) => {
24633 if let common::Retry::After(d) = dlg.http_error(&err) {
24634 sleep(d).await;
24635 continue;
24636 }
24637 dlg.finished(false);
24638 return Err(common::Error::HttpError(err));
24639 }
24640 Ok(res) => {
24641 let (mut parts, body) = res.into_parts();
24642 let mut body = common::Body::new(body);
24643 if !parts.status.is_success() {
24644 let bytes = common::to_bytes(body).await.unwrap_or_default();
24645 let error = serde_json::from_str(&common::to_string(&bytes));
24646 let response = common::to_response(parts, bytes.into());
24647
24648 if let common::Retry::After(d) =
24649 dlg.http_failure(&response, error.as_ref().ok())
24650 {
24651 sleep(d).await;
24652 continue;
24653 }
24654
24655 dlg.finished(false);
24656
24657 return Err(match error {
24658 Ok(value) => common::Error::BadRequest(value),
24659 _ => common::Error::Failure(response),
24660 });
24661 }
24662 let response = {
24663 let bytes = common::to_bytes(body).await.unwrap_or_default();
24664 let encoded = common::to_string(&bytes);
24665 match serde_json::from_str(&encoded) {
24666 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24667 Err(error) => {
24668 dlg.response_json_decode_error(&encoded, &error);
24669 return Err(common::Error::JsonDecodeError(
24670 encoded.to_string(),
24671 error,
24672 ));
24673 }
24674 }
24675 };
24676
24677 dlg.finished(true);
24678 return Ok(response);
24679 }
24680 }
24681 }
24682 }
24683
24684 ///
24685 /// Sets the *request* property to the given value.
24686 ///
24687 /// Even though the property as already been set when instantiating this call,
24688 /// we provide this method for API completeness.
24689 pub fn request(
24690 mut self,
24691 new_value: SetIamPolicyRequest,
24692 ) -> ProjectLocationProviderSetIamPolicyCall<'a, C> {
24693 self._request = new_value;
24694 self
24695 }
24696 /// 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.
24697 ///
24698 /// Sets the *resource* path property to the given value.
24699 ///
24700 /// Even though the property as already been set when instantiating this call,
24701 /// we provide this method for API completeness.
24702 pub fn resource(mut self, new_value: &str) -> ProjectLocationProviderSetIamPolicyCall<'a, C> {
24703 self._resource = new_value.to_string();
24704 self
24705 }
24706 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24707 /// while executing the actual API request.
24708 ///
24709 /// ````text
24710 /// It should be used to handle progress information, and to implement a certain level of resilience.
24711 /// ````
24712 ///
24713 /// Sets the *delegate* property to the given value.
24714 pub fn delegate(
24715 mut self,
24716 new_value: &'a mut dyn common::Delegate,
24717 ) -> ProjectLocationProviderSetIamPolicyCall<'a, C> {
24718 self._delegate = Some(new_value);
24719 self
24720 }
24721
24722 /// Set any additional parameter of the query string used in the request.
24723 /// It should be used to set parameters which are not yet available through their own
24724 /// setters.
24725 ///
24726 /// Please note that this method must not be used to set any of the known parameters
24727 /// which have their own setter method. If done anyway, the request will fail.
24728 ///
24729 /// # Additional Parameters
24730 ///
24731 /// * *$.xgafv* (query-string) - V1 error format.
24732 /// * *access_token* (query-string) - OAuth access token.
24733 /// * *alt* (query-string) - Data format for response.
24734 /// * *callback* (query-string) - JSONP
24735 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24736 /// * *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.
24737 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24738 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24739 /// * *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.
24740 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24741 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24742 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationProviderSetIamPolicyCall<'a, C>
24743 where
24744 T: AsRef<str>,
24745 {
24746 self._additional_params
24747 .insert(name.as_ref().to_string(), value.as_ref().to_string());
24748 self
24749 }
24750
24751 /// Identifies the authorization scope for the method you are building.
24752 ///
24753 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24754 /// [`Scope::CloudPlatform`].
24755 ///
24756 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24757 /// tokens for more than one scope.
24758 ///
24759 /// Usually there is more than one suitable scope to authorize an operation, some of which may
24760 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24761 /// sufficient, a read-write scope will do as well.
24762 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationProviderSetIamPolicyCall<'a, C>
24763 where
24764 St: AsRef<str>,
24765 {
24766 self._scopes.insert(String::from(scope.as_ref()));
24767 self
24768 }
24769 /// Identifies the authorization scope(s) for the method you are building.
24770 ///
24771 /// See [`Self::add_scope()`] for details.
24772 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationProviderSetIamPolicyCall<'a, C>
24773 where
24774 I: IntoIterator<Item = St>,
24775 St: AsRef<str>,
24776 {
24777 self._scopes
24778 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24779 self
24780 }
24781
24782 /// Removes all scopes, and no default scope will be used either.
24783 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24784 /// for details).
24785 pub fn clear_scopes(mut self) -> ProjectLocationProviderSetIamPolicyCall<'a, C> {
24786 self._scopes.clear();
24787 self
24788 }
24789}
24790
24791/// 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.
24792///
24793/// A builder for the *locations.providers.testIamPermissions* method supported by a *project* resource.
24794/// It is not used directly, but through a [`ProjectMethods`] instance.
24795///
24796/// # Example
24797///
24798/// Instantiate a resource method builder
24799///
24800/// ```test_harness,no_run
24801/// # extern crate hyper;
24802/// # extern crate hyper_rustls;
24803/// # extern crate google_connectors1 as connectors1;
24804/// use connectors1::api::TestIamPermissionsRequest;
24805/// # async fn dox() {
24806/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24807///
24808/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24809/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
24810/// # secret,
24811/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24812/// # ).build().await.unwrap();
24813///
24814/// # let client = hyper_util::client::legacy::Client::builder(
24815/// # hyper_util::rt::TokioExecutor::new()
24816/// # )
24817/// # .build(
24818/// # hyper_rustls::HttpsConnectorBuilder::new()
24819/// # .with_native_roots()
24820/// # .unwrap()
24821/// # .https_or_http()
24822/// # .enable_http1()
24823/// # .build()
24824/// # );
24825/// # let mut hub = Connectors::new(client, auth);
24826/// // As the method needs a request, you would usually fill it with the desired information
24827/// // into the respective structure. Some of the parts shown here might not be applicable !
24828/// // Values shown here are possibly random and not representative !
24829/// let mut req = TestIamPermissionsRequest::default();
24830///
24831/// // You can configure optional parameters by calling the respective setters at will, and
24832/// // execute the final call using `doit()`.
24833/// // Values shown here are possibly random and not representative !
24834/// let result = hub.projects().locations_providers_test_iam_permissions(req, "resource")
24835/// .doit().await;
24836/// # }
24837/// ```
24838pub struct ProjectLocationProviderTestIamPermissionCall<'a, C>
24839where
24840 C: 'a,
24841{
24842 hub: &'a Connectors<C>,
24843 _request: TestIamPermissionsRequest,
24844 _resource: String,
24845 _delegate: Option<&'a mut dyn common::Delegate>,
24846 _additional_params: HashMap<String, String>,
24847 _scopes: BTreeSet<String>,
24848}
24849
24850impl<'a, C> common::CallBuilder for ProjectLocationProviderTestIamPermissionCall<'a, C> {}
24851
24852impl<'a, C> ProjectLocationProviderTestIamPermissionCall<'a, C>
24853where
24854 C: common::Connector,
24855{
24856 /// Perform the operation you have build so far.
24857 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
24858 use std::borrow::Cow;
24859 use std::io::{Read, Seek};
24860
24861 use common::{url::Params, ToParts};
24862 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24863
24864 let mut dd = common::DefaultDelegate;
24865 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24866 dlg.begin(common::MethodInfo {
24867 id: "connectors.projects.locations.providers.testIamPermissions",
24868 http_method: hyper::Method::POST,
24869 });
24870
24871 for &field in ["alt", "resource"].iter() {
24872 if self._additional_params.contains_key(field) {
24873 dlg.finished(false);
24874 return Err(common::Error::FieldClash(field));
24875 }
24876 }
24877
24878 let mut params = Params::with_capacity(4 + self._additional_params.len());
24879 params.push("resource", self._resource);
24880
24881 params.extend(self._additional_params.iter());
24882
24883 params.push("alt", "json");
24884 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
24885 if self._scopes.is_empty() {
24886 self._scopes
24887 .insert(Scope::CloudPlatform.as_ref().to_string());
24888 }
24889
24890 #[allow(clippy::single_element_loop)]
24891 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
24892 url = params.uri_replacement(url, param_name, find_this, true);
24893 }
24894 {
24895 let to_remove = ["resource"];
24896 params.remove_params(&to_remove);
24897 }
24898
24899 let url = params.parse_with_url(&url);
24900
24901 let mut json_mime_type = mime::APPLICATION_JSON;
24902 let mut request_value_reader = {
24903 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
24904 common::remove_json_null_values(&mut value);
24905 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
24906 serde_json::to_writer(&mut dst, &value).unwrap();
24907 dst
24908 };
24909 let request_size = request_value_reader
24910 .seek(std::io::SeekFrom::End(0))
24911 .unwrap();
24912 request_value_reader
24913 .seek(std::io::SeekFrom::Start(0))
24914 .unwrap();
24915
24916 loop {
24917 let token = match self
24918 .hub
24919 .auth
24920 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24921 .await
24922 {
24923 Ok(token) => token,
24924 Err(e) => match dlg.token(e) {
24925 Ok(token) => token,
24926 Err(e) => {
24927 dlg.finished(false);
24928 return Err(common::Error::MissingToken(e));
24929 }
24930 },
24931 };
24932 request_value_reader
24933 .seek(std::io::SeekFrom::Start(0))
24934 .unwrap();
24935 let mut req_result = {
24936 let client = &self.hub.client;
24937 dlg.pre_request();
24938 let mut req_builder = hyper::Request::builder()
24939 .method(hyper::Method::POST)
24940 .uri(url.as_str())
24941 .header(USER_AGENT, self.hub._user_agent.clone());
24942
24943 if let Some(token) = token.as_ref() {
24944 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24945 }
24946
24947 let request = req_builder
24948 .header(CONTENT_TYPE, json_mime_type.to_string())
24949 .header(CONTENT_LENGTH, request_size as u64)
24950 .body(common::to_body(
24951 request_value_reader.get_ref().clone().into(),
24952 ));
24953
24954 client.request(request.unwrap()).await
24955 };
24956
24957 match req_result {
24958 Err(err) => {
24959 if let common::Retry::After(d) = dlg.http_error(&err) {
24960 sleep(d).await;
24961 continue;
24962 }
24963 dlg.finished(false);
24964 return Err(common::Error::HttpError(err));
24965 }
24966 Ok(res) => {
24967 let (mut parts, body) = res.into_parts();
24968 let mut body = common::Body::new(body);
24969 if !parts.status.is_success() {
24970 let bytes = common::to_bytes(body).await.unwrap_or_default();
24971 let error = serde_json::from_str(&common::to_string(&bytes));
24972 let response = common::to_response(parts, bytes.into());
24973
24974 if let common::Retry::After(d) =
24975 dlg.http_failure(&response, error.as_ref().ok())
24976 {
24977 sleep(d).await;
24978 continue;
24979 }
24980
24981 dlg.finished(false);
24982
24983 return Err(match error {
24984 Ok(value) => common::Error::BadRequest(value),
24985 _ => common::Error::Failure(response),
24986 });
24987 }
24988 let response = {
24989 let bytes = common::to_bytes(body).await.unwrap_or_default();
24990 let encoded = common::to_string(&bytes);
24991 match serde_json::from_str(&encoded) {
24992 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24993 Err(error) => {
24994 dlg.response_json_decode_error(&encoded, &error);
24995 return Err(common::Error::JsonDecodeError(
24996 encoded.to_string(),
24997 error,
24998 ));
24999 }
25000 }
25001 };
25002
25003 dlg.finished(true);
25004 return Ok(response);
25005 }
25006 }
25007 }
25008 }
25009
25010 ///
25011 /// Sets the *request* property to the given value.
25012 ///
25013 /// Even though the property as already been set when instantiating this call,
25014 /// we provide this method for API completeness.
25015 pub fn request(
25016 mut self,
25017 new_value: TestIamPermissionsRequest,
25018 ) -> ProjectLocationProviderTestIamPermissionCall<'a, C> {
25019 self._request = new_value;
25020 self
25021 }
25022 /// 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.
25023 ///
25024 /// Sets the *resource* path property to the given value.
25025 ///
25026 /// Even though the property as already been set when instantiating this call,
25027 /// we provide this method for API completeness.
25028 pub fn resource(
25029 mut self,
25030 new_value: &str,
25031 ) -> ProjectLocationProviderTestIamPermissionCall<'a, C> {
25032 self._resource = new_value.to_string();
25033 self
25034 }
25035 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25036 /// while executing the actual API request.
25037 ///
25038 /// ````text
25039 /// It should be used to handle progress information, and to implement a certain level of resilience.
25040 /// ````
25041 ///
25042 /// Sets the *delegate* property to the given value.
25043 pub fn delegate(
25044 mut self,
25045 new_value: &'a mut dyn common::Delegate,
25046 ) -> ProjectLocationProviderTestIamPermissionCall<'a, C> {
25047 self._delegate = Some(new_value);
25048 self
25049 }
25050
25051 /// Set any additional parameter of the query string used in the request.
25052 /// It should be used to set parameters which are not yet available through their own
25053 /// setters.
25054 ///
25055 /// Please note that this method must not be used to set any of the known parameters
25056 /// which have their own setter method. If done anyway, the request will fail.
25057 ///
25058 /// # Additional Parameters
25059 ///
25060 /// * *$.xgafv* (query-string) - V1 error format.
25061 /// * *access_token* (query-string) - OAuth access token.
25062 /// * *alt* (query-string) - Data format for response.
25063 /// * *callback* (query-string) - JSONP
25064 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25065 /// * *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.
25066 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25067 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25068 /// * *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.
25069 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25070 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25071 pub fn param<T>(
25072 mut self,
25073 name: T,
25074 value: T,
25075 ) -> ProjectLocationProviderTestIamPermissionCall<'a, C>
25076 where
25077 T: AsRef<str>,
25078 {
25079 self._additional_params
25080 .insert(name.as_ref().to_string(), value.as_ref().to_string());
25081 self
25082 }
25083
25084 /// Identifies the authorization scope for the method you are building.
25085 ///
25086 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25087 /// [`Scope::CloudPlatform`].
25088 ///
25089 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25090 /// tokens for more than one scope.
25091 ///
25092 /// Usually there is more than one suitable scope to authorize an operation, some of which may
25093 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25094 /// sufficient, a read-write scope will do as well.
25095 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationProviderTestIamPermissionCall<'a, C>
25096 where
25097 St: AsRef<str>,
25098 {
25099 self._scopes.insert(String::from(scope.as_ref()));
25100 self
25101 }
25102 /// Identifies the authorization scope(s) for the method you are building.
25103 ///
25104 /// See [`Self::add_scope()`] for details.
25105 pub fn add_scopes<I, St>(
25106 mut self,
25107 scopes: I,
25108 ) -> ProjectLocationProviderTestIamPermissionCall<'a, C>
25109 where
25110 I: IntoIterator<Item = St>,
25111 St: AsRef<str>,
25112 {
25113 self._scopes
25114 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25115 self
25116 }
25117
25118 /// Removes all scopes, and no default scope will be used either.
25119 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25120 /// for details).
25121 pub fn clear_scopes(mut self) -> ProjectLocationProviderTestIamPermissionCall<'a, C> {
25122 self._scopes.clear();
25123 self
25124 }
25125}
25126
25127/// Gets information about a location.
25128///
25129/// A builder for the *locations.get* method supported by a *project* resource.
25130/// It is not used directly, but through a [`ProjectMethods`] instance.
25131///
25132/// # Example
25133///
25134/// Instantiate a resource method builder
25135///
25136/// ```test_harness,no_run
25137/// # extern crate hyper;
25138/// # extern crate hyper_rustls;
25139/// # extern crate google_connectors1 as connectors1;
25140/// # async fn dox() {
25141/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25142///
25143/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25144/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
25145/// # secret,
25146/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25147/// # ).build().await.unwrap();
25148///
25149/// # let client = hyper_util::client::legacy::Client::builder(
25150/// # hyper_util::rt::TokioExecutor::new()
25151/// # )
25152/// # .build(
25153/// # hyper_rustls::HttpsConnectorBuilder::new()
25154/// # .with_native_roots()
25155/// # .unwrap()
25156/// # .https_or_http()
25157/// # .enable_http1()
25158/// # .build()
25159/// # );
25160/// # let mut hub = Connectors::new(client, auth);
25161/// // You can configure optional parameters by calling the respective setters at will, and
25162/// // execute the final call using `doit()`.
25163/// // Values shown here are possibly random and not representative !
25164/// let result = hub.projects().locations_get("name")
25165/// .doit().await;
25166/// # }
25167/// ```
25168pub struct ProjectLocationGetCall<'a, C>
25169where
25170 C: 'a,
25171{
25172 hub: &'a Connectors<C>,
25173 _name: String,
25174 _delegate: Option<&'a mut dyn common::Delegate>,
25175 _additional_params: HashMap<String, String>,
25176 _scopes: BTreeSet<String>,
25177}
25178
25179impl<'a, C> common::CallBuilder for ProjectLocationGetCall<'a, C> {}
25180
25181impl<'a, C> ProjectLocationGetCall<'a, C>
25182where
25183 C: common::Connector,
25184{
25185 /// Perform the operation you have build so far.
25186 pub async fn doit(mut self) -> common::Result<(common::Response, Location)> {
25187 use std::borrow::Cow;
25188 use std::io::{Read, Seek};
25189
25190 use common::{url::Params, ToParts};
25191 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25192
25193 let mut dd = common::DefaultDelegate;
25194 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25195 dlg.begin(common::MethodInfo {
25196 id: "connectors.projects.locations.get",
25197 http_method: hyper::Method::GET,
25198 });
25199
25200 for &field in ["alt", "name"].iter() {
25201 if self._additional_params.contains_key(field) {
25202 dlg.finished(false);
25203 return Err(common::Error::FieldClash(field));
25204 }
25205 }
25206
25207 let mut params = Params::with_capacity(3 + self._additional_params.len());
25208 params.push("name", self._name);
25209
25210 params.extend(self._additional_params.iter());
25211
25212 params.push("alt", "json");
25213 let mut url = self.hub._base_url.clone() + "v1/{+name}";
25214 if self._scopes.is_empty() {
25215 self._scopes
25216 .insert(Scope::CloudPlatform.as_ref().to_string());
25217 }
25218
25219 #[allow(clippy::single_element_loop)]
25220 for &(find_this, param_name) in [("{+name}", "name")].iter() {
25221 url = params.uri_replacement(url, param_name, find_this, true);
25222 }
25223 {
25224 let to_remove = ["name"];
25225 params.remove_params(&to_remove);
25226 }
25227
25228 let url = params.parse_with_url(&url);
25229
25230 loop {
25231 let token = match self
25232 .hub
25233 .auth
25234 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25235 .await
25236 {
25237 Ok(token) => token,
25238 Err(e) => match dlg.token(e) {
25239 Ok(token) => token,
25240 Err(e) => {
25241 dlg.finished(false);
25242 return Err(common::Error::MissingToken(e));
25243 }
25244 },
25245 };
25246 let mut req_result = {
25247 let client = &self.hub.client;
25248 dlg.pre_request();
25249 let mut req_builder = hyper::Request::builder()
25250 .method(hyper::Method::GET)
25251 .uri(url.as_str())
25252 .header(USER_AGENT, self.hub._user_agent.clone());
25253
25254 if let Some(token) = token.as_ref() {
25255 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25256 }
25257
25258 let request = req_builder
25259 .header(CONTENT_LENGTH, 0_u64)
25260 .body(common::to_body::<String>(None));
25261
25262 client.request(request.unwrap()).await
25263 };
25264
25265 match req_result {
25266 Err(err) => {
25267 if let common::Retry::After(d) = dlg.http_error(&err) {
25268 sleep(d).await;
25269 continue;
25270 }
25271 dlg.finished(false);
25272 return Err(common::Error::HttpError(err));
25273 }
25274 Ok(res) => {
25275 let (mut parts, body) = res.into_parts();
25276 let mut body = common::Body::new(body);
25277 if !parts.status.is_success() {
25278 let bytes = common::to_bytes(body).await.unwrap_or_default();
25279 let error = serde_json::from_str(&common::to_string(&bytes));
25280 let response = common::to_response(parts, bytes.into());
25281
25282 if let common::Retry::After(d) =
25283 dlg.http_failure(&response, error.as_ref().ok())
25284 {
25285 sleep(d).await;
25286 continue;
25287 }
25288
25289 dlg.finished(false);
25290
25291 return Err(match error {
25292 Ok(value) => common::Error::BadRequest(value),
25293 _ => common::Error::Failure(response),
25294 });
25295 }
25296 let response = {
25297 let bytes = common::to_bytes(body).await.unwrap_or_default();
25298 let encoded = common::to_string(&bytes);
25299 match serde_json::from_str(&encoded) {
25300 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25301 Err(error) => {
25302 dlg.response_json_decode_error(&encoded, &error);
25303 return Err(common::Error::JsonDecodeError(
25304 encoded.to_string(),
25305 error,
25306 ));
25307 }
25308 }
25309 };
25310
25311 dlg.finished(true);
25312 return Ok(response);
25313 }
25314 }
25315 }
25316 }
25317
25318 /// Resource name for the location.
25319 ///
25320 /// Sets the *name* path property to the given value.
25321 ///
25322 /// Even though the property as already been set when instantiating this call,
25323 /// we provide this method for API completeness.
25324 pub fn name(mut self, new_value: &str) -> ProjectLocationGetCall<'a, C> {
25325 self._name = new_value.to_string();
25326 self
25327 }
25328 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25329 /// while executing the actual API request.
25330 ///
25331 /// ````text
25332 /// It should be used to handle progress information, and to implement a certain level of resilience.
25333 /// ````
25334 ///
25335 /// Sets the *delegate* property to the given value.
25336 pub fn delegate(
25337 mut self,
25338 new_value: &'a mut dyn common::Delegate,
25339 ) -> ProjectLocationGetCall<'a, C> {
25340 self._delegate = Some(new_value);
25341 self
25342 }
25343
25344 /// Set any additional parameter of the query string used in the request.
25345 /// It should be used to set parameters which are not yet available through their own
25346 /// setters.
25347 ///
25348 /// Please note that this method must not be used to set any of the known parameters
25349 /// which have their own setter method. If done anyway, the request will fail.
25350 ///
25351 /// # Additional Parameters
25352 ///
25353 /// * *$.xgafv* (query-string) - V1 error format.
25354 /// * *access_token* (query-string) - OAuth access token.
25355 /// * *alt* (query-string) - Data format for response.
25356 /// * *callback* (query-string) - JSONP
25357 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25358 /// * *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.
25359 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25360 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25361 /// * *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.
25362 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25363 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25364 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C>
25365 where
25366 T: AsRef<str>,
25367 {
25368 self._additional_params
25369 .insert(name.as_ref().to_string(), value.as_ref().to_string());
25370 self
25371 }
25372
25373 /// Identifies the authorization scope for the method you are building.
25374 ///
25375 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25376 /// [`Scope::CloudPlatform`].
25377 ///
25378 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25379 /// tokens for more than one scope.
25380 ///
25381 /// Usually there is more than one suitable scope to authorize an operation, some of which may
25382 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25383 /// sufficient, a read-write scope will do as well.
25384 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetCall<'a, C>
25385 where
25386 St: AsRef<str>,
25387 {
25388 self._scopes.insert(String::from(scope.as_ref()));
25389 self
25390 }
25391 /// Identifies the authorization scope(s) for the method you are building.
25392 ///
25393 /// See [`Self::add_scope()`] for details.
25394 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetCall<'a, C>
25395 where
25396 I: IntoIterator<Item = St>,
25397 St: AsRef<str>,
25398 {
25399 self._scopes
25400 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25401 self
25402 }
25403
25404 /// Removes all scopes, and no default scope will be used either.
25405 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25406 /// for details).
25407 pub fn clear_scopes(mut self) -> ProjectLocationGetCall<'a, C> {
25408 self._scopes.clear();
25409 self
25410 }
25411}
25412
25413/// GetRegionalSettings gets settings of a region. RegionalSettings is a singleton resource.
25414///
25415/// A builder for the *locations.getRegionalSettings* method supported by a *project* resource.
25416/// It is not used directly, but through a [`ProjectMethods`] instance.
25417///
25418/// # Example
25419///
25420/// Instantiate a resource method builder
25421///
25422/// ```test_harness,no_run
25423/// # extern crate hyper;
25424/// # extern crate hyper_rustls;
25425/// # extern crate google_connectors1 as connectors1;
25426/// # async fn dox() {
25427/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25428///
25429/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25430/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
25431/// # secret,
25432/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25433/// # ).build().await.unwrap();
25434///
25435/// # let client = hyper_util::client::legacy::Client::builder(
25436/// # hyper_util::rt::TokioExecutor::new()
25437/// # )
25438/// # .build(
25439/// # hyper_rustls::HttpsConnectorBuilder::new()
25440/// # .with_native_roots()
25441/// # .unwrap()
25442/// # .https_or_http()
25443/// # .enable_http1()
25444/// # .build()
25445/// # );
25446/// # let mut hub = Connectors::new(client, auth);
25447/// // You can configure optional parameters by calling the respective setters at will, and
25448/// // execute the final call using `doit()`.
25449/// // Values shown here are possibly random and not representative !
25450/// let result = hub.projects().locations_get_regional_settings("name")
25451/// .doit().await;
25452/// # }
25453/// ```
25454pub struct ProjectLocationGetRegionalSettingCall<'a, C>
25455where
25456 C: 'a,
25457{
25458 hub: &'a Connectors<C>,
25459 _name: String,
25460 _delegate: Option<&'a mut dyn common::Delegate>,
25461 _additional_params: HashMap<String, String>,
25462 _scopes: BTreeSet<String>,
25463}
25464
25465impl<'a, C> common::CallBuilder for ProjectLocationGetRegionalSettingCall<'a, C> {}
25466
25467impl<'a, C> ProjectLocationGetRegionalSettingCall<'a, C>
25468where
25469 C: common::Connector,
25470{
25471 /// Perform the operation you have build so far.
25472 pub async fn doit(mut self) -> common::Result<(common::Response, RegionalSettings)> {
25473 use std::borrow::Cow;
25474 use std::io::{Read, Seek};
25475
25476 use common::{url::Params, ToParts};
25477 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25478
25479 let mut dd = common::DefaultDelegate;
25480 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25481 dlg.begin(common::MethodInfo {
25482 id: "connectors.projects.locations.getRegionalSettings",
25483 http_method: hyper::Method::GET,
25484 });
25485
25486 for &field in ["alt", "name"].iter() {
25487 if self._additional_params.contains_key(field) {
25488 dlg.finished(false);
25489 return Err(common::Error::FieldClash(field));
25490 }
25491 }
25492
25493 let mut params = Params::with_capacity(3 + self._additional_params.len());
25494 params.push("name", self._name);
25495
25496 params.extend(self._additional_params.iter());
25497
25498 params.push("alt", "json");
25499 let mut url = self.hub._base_url.clone() + "v1/{+name}";
25500 if self._scopes.is_empty() {
25501 self._scopes
25502 .insert(Scope::CloudPlatform.as_ref().to_string());
25503 }
25504
25505 #[allow(clippy::single_element_loop)]
25506 for &(find_this, param_name) in [("{+name}", "name")].iter() {
25507 url = params.uri_replacement(url, param_name, find_this, true);
25508 }
25509 {
25510 let to_remove = ["name"];
25511 params.remove_params(&to_remove);
25512 }
25513
25514 let url = params.parse_with_url(&url);
25515
25516 loop {
25517 let token = match self
25518 .hub
25519 .auth
25520 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25521 .await
25522 {
25523 Ok(token) => token,
25524 Err(e) => match dlg.token(e) {
25525 Ok(token) => token,
25526 Err(e) => {
25527 dlg.finished(false);
25528 return Err(common::Error::MissingToken(e));
25529 }
25530 },
25531 };
25532 let mut req_result = {
25533 let client = &self.hub.client;
25534 dlg.pre_request();
25535 let mut req_builder = hyper::Request::builder()
25536 .method(hyper::Method::GET)
25537 .uri(url.as_str())
25538 .header(USER_AGENT, self.hub._user_agent.clone());
25539
25540 if let Some(token) = token.as_ref() {
25541 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25542 }
25543
25544 let request = req_builder
25545 .header(CONTENT_LENGTH, 0_u64)
25546 .body(common::to_body::<String>(None));
25547
25548 client.request(request.unwrap()).await
25549 };
25550
25551 match req_result {
25552 Err(err) => {
25553 if let common::Retry::After(d) = dlg.http_error(&err) {
25554 sleep(d).await;
25555 continue;
25556 }
25557 dlg.finished(false);
25558 return Err(common::Error::HttpError(err));
25559 }
25560 Ok(res) => {
25561 let (mut parts, body) = res.into_parts();
25562 let mut body = common::Body::new(body);
25563 if !parts.status.is_success() {
25564 let bytes = common::to_bytes(body).await.unwrap_or_default();
25565 let error = serde_json::from_str(&common::to_string(&bytes));
25566 let response = common::to_response(parts, bytes.into());
25567
25568 if let common::Retry::After(d) =
25569 dlg.http_failure(&response, error.as_ref().ok())
25570 {
25571 sleep(d).await;
25572 continue;
25573 }
25574
25575 dlg.finished(false);
25576
25577 return Err(match error {
25578 Ok(value) => common::Error::BadRequest(value),
25579 _ => common::Error::Failure(response),
25580 });
25581 }
25582 let response = {
25583 let bytes = common::to_bytes(body).await.unwrap_or_default();
25584 let encoded = common::to_string(&bytes);
25585 match serde_json::from_str(&encoded) {
25586 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25587 Err(error) => {
25588 dlg.response_json_decode_error(&encoded, &error);
25589 return Err(common::Error::JsonDecodeError(
25590 encoded.to_string(),
25591 error,
25592 ));
25593 }
25594 }
25595 };
25596
25597 dlg.finished(true);
25598 return Ok(response);
25599 }
25600 }
25601 }
25602 }
25603
25604 /// Required. The resource name of the Regional Settings.
25605 ///
25606 /// Sets the *name* path property to the given value.
25607 ///
25608 /// Even though the property as already been set when instantiating this call,
25609 /// we provide this method for API completeness.
25610 pub fn name(mut self, new_value: &str) -> ProjectLocationGetRegionalSettingCall<'a, C> {
25611 self._name = new_value.to_string();
25612 self
25613 }
25614 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25615 /// while executing the actual API request.
25616 ///
25617 /// ````text
25618 /// It should be used to handle progress information, and to implement a certain level of resilience.
25619 /// ````
25620 ///
25621 /// Sets the *delegate* property to the given value.
25622 pub fn delegate(
25623 mut self,
25624 new_value: &'a mut dyn common::Delegate,
25625 ) -> ProjectLocationGetRegionalSettingCall<'a, C> {
25626 self._delegate = Some(new_value);
25627 self
25628 }
25629
25630 /// Set any additional parameter of the query string used in the request.
25631 /// It should be used to set parameters which are not yet available through their own
25632 /// setters.
25633 ///
25634 /// Please note that this method must not be used to set any of the known parameters
25635 /// which have their own setter method. If done anyway, the request will fail.
25636 ///
25637 /// # Additional Parameters
25638 ///
25639 /// * *$.xgafv* (query-string) - V1 error format.
25640 /// * *access_token* (query-string) - OAuth access token.
25641 /// * *alt* (query-string) - Data format for response.
25642 /// * *callback* (query-string) - JSONP
25643 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25644 /// * *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.
25645 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25646 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25647 /// * *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.
25648 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25649 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25650 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetRegionalSettingCall<'a, C>
25651 where
25652 T: AsRef<str>,
25653 {
25654 self._additional_params
25655 .insert(name.as_ref().to_string(), value.as_ref().to_string());
25656 self
25657 }
25658
25659 /// Identifies the authorization scope for the method you are building.
25660 ///
25661 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25662 /// [`Scope::CloudPlatform`].
25663 ///
25664 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25665 /// tokens for more than one scope.
25666 ///
25667 /// Usually there is more than one suitable scope to authorize an operation, some of which may
25668 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25669 /// sufficient, a read-write scope will do as well.
25670 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetRegionalSettingCall<'a, C>
25671 where
25672 St: AsRef<str>,
25673 {
25674 self._scopes.insert(String::from(scope.as_ref()));
25675 self
25676 }
25677 /// Identifies the authorization scope(s) for the method you are building.
25678 ///
25679 /// See [`Self::add_scope()`] for details.
25680 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetRegionalSettingCall<'a, C>
25681 where
25682 I: IntoIterator<Item = St>,
25683 St: AsRef<str>,
25684 {
25685 self._scopes
25686 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25687 self
25688 }
25689
25690 /// Removes all scopes, and no default scope will be used either.
25691 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25692 /// for details).
25693 pub fn clear_scopes(mut self) -> ProjectLocationGetRegionalSettingCall<'a, C> {
25694 self._scopes.clear();
25695 self
25696 }
25697}
25698
25699/// Gets the runtimeConfig of a location. RuntimeConfig is a singleton resource for each location.
25700///
25701/// A builder for the *locations.getRuntimeConfig* method supported by a *project* resource.
25702/// It is not used directly, but through a [`ProjectMethods`] instance.
25703///
25704/// # Example
25705///
25706/// Instantiate a resource method builder
25707///
25708/// ```test_harness,no_run
25709/// # extern crate hyper;
25710/// # extern crate hyper_rustls;
25711/// # extern crate google_connectors1 as connectors1;
25712/// # async fn dox() {
25713/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25714///
25715/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25716/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
25717/// # secret,
25718/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25719/// # ).build().await.unwrap();
25720///
25721/// # let client = hyper_util::client::legacy::Client::builder(
25722/// # hyper_util::rt::TokioExecutor::new()
25723/// # )
25724/// # .build(
25725/// # hyper_rustls::HttpsConnectorBuilder::new()
25726/// # .with_native_roots()
25727/// # .unwrap()
25728/// # .https_or_http()
25729/// # .enable_http1()
25730/// # .build()
25731/// # );
25732/// # let mut hub = Connectors::new(client, auth);
25733/// // You can configure optional parameters by calling the respective setters at will, and
25734/// // execute the final call using `doit()`.
25735/// // Values shown here are possibly random and not representative !
25736/// let result = hub.projects().locations_get_runtime_config("name")
25737/// .doit().await;
25738/// # }
25739/// ```
25740pub struct ProjectLocationGetRuntimeConfigCall<'a, C>
25741where
25742 C: 'a,
25743{
25744 hub: &'a Connectors<C>,
25745 _name: String,
25746 _delegate: Option<&'a mut dyn common::Delegate>,
25747 _additional_params: HashMap<String, String>,
25748 _scopes: BTreeSet<String>,
25749}
25750
25751impl<'a, C> common::CallBuilder for ProjectLocationGetRuntimeConfigCall<'a, C> {}
25752
25753impl<'a, C> ProjectLocationGetRuntimeConfigCall<'a, C>
25754where
25755 C: common::Connector,
25756{
25757 /// Perform the operation you have build so far.
25758 pub async fn doit(mut self) -> common::Result<(common::Response, RuntimeConfig)> {
25759 use std::borrow::Cow;
25760 use std::io::{Read, Seek};
25761
25762 use common::{url::Params, ToParts};
25763 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25764
25765 let mut dd = common::DefaultDelegate;
25766 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25767 dlg.begin(common::MethodInfo {
25768 id: "connectors.projects.locations.getRuntimeConfig",
25769 http_method: hyper::Method::GET,
25770 });
25771
25772 for &field in ["alt", "name"].iter() {
25773 if self._additional_params.contains_key(field) {
25774 dlg.finished(false);
25775 return Err(common::Error::FieldClash(field));
25776 }
25777 }
25778
25779 let mut params = Params::with_capacity(3 + self._additional_params.len());
25780 params.push("name", self._name);
25781
25782 params.extend(self._additional_params.iter());
25783
25784 params.push("alt", "json");
25785 let mut url = self.hub._base_url.clone() + "v1/{+name}";
25786 if self._scopes.is_empty() {
25787 self._scopes
25788 .insert(Scope::CloudPlatform.as_ref().to_string());
25789 }
25790
25791 #[allow(clippy::single_element_loop)]
25792 for &(find_this, param_name) in [("{+name}", "name")].iter() {
25793 url = params.uri_replacement(url, param_name, find_this, true);
25794 }
25795 {
25796 let to_remove = ["name"];
25797 params.remove_params(&to_remove);
25798 }
25799
25800 let url = params.parse_with_url(&url);
25801
25802 loop {
25803 let token = match self
25804 .hub
25805 .auth
25806 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25807 .await
25808 {
25809 Ok(token) => token,
25810 Err(e) => match dlg.token(e) {
25811 Ok(token) => token,
25812 Err(e) => {
25813 dlg.finished(false);
25814 return Err(common::Error::MissingToken(e));
25815 }
25816 },
25817 };
25818 let mut req_result = {
25819 let client = &self.hub.client;
25820 dlg.pre_request();
25821 let mut req_builder = hyper::Request::builder()
25822 .method(hyper::Method::GET)
25823 .uri(url.as_str())
25824 .header(USER_AGENT, self.hub._user_agent.clone());
25825
25826 if let Some(token) = token.as_ref() {
25827 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25828 }
25829
25830 let request = req_builder
25831 .header(CONTENT_LENGTH, 0_u64)
25832 .body(common::to_body::<String>(None));
25833
25834 client.request(request.unwrap()).await
25835 };
25836
25837 match req_result {
25838 Err(err) => {
25839 if let common::Retry::After(d) = dlg.http_error(&err) {
25840 sleep(d).await;
25841 continue;
25842 }
25843 dlg.finished(false);
25844 return Err(common::Error::HttpError(err));
25845 }
25846 Ok(res) => {
25847 let (mut parts, body) = res.into_parts();
25848 let mut body = common::Body::new(body);
25849 if !parts.status.is_success() {
25850 let bytes = common::to_bytes(body).await.unwrap_or_default();
25851 let error = serde_json::from_str(&common::to_string(&bytes));
25852 let response = common::to_response(parts, bytes.into());
25853
25854 if let common::Retry::After(d) =
25855 dlg.http_failure(&response, error.as_ref().ok())
25856 {
25857 sleep(d).await;
25858 continue;
25859 }
25860
25861 dlg.finished(false);
25862
25863 return Err(match error {
25864 Ok(value) => common::Error::BadRequest(value),
25865 _ => common::Error::Failure(response),
25866 });
25867 }
25868 let response = {
25869 let bytes = common::to_bytes(body).await.unwrap_or_default();
25870 let encoded = common::to_string(&bytes);
25871 match serde_json::from_str(&encoded) {
25872 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25873 Err(error) => {
25874 dlg.response_json_decode_error(&encoded, &error);
25875 return Err(common::Error::JsonDecodeError(
25876 encoded.to_string(),
25877 error,
25878 ));
25879 }
25880 }
25881 };
25882
25883 dlg.finished(true);
25884 return Ok(response);
25885 }
25886 }
25887 }
25888 }
25889
25890 /// Required. Resource name of the form: `projects/*/locations/*/runtimeConfig`
25891 ///
25892 /// Sets the *name* path property to the given value.
25893 ///
25894 /// Even though the property as already been set when instantiating this call,
25895 /// we provide this method for API completeness.
25896 pub fn name(mut self, new_value: &str) -> ProjectLocationGetRuntimeConfigCall<'a, C> {
25897 self._name = new_value.to_string();
25898 self
25899 }
25900 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25901 /// while executing the actual API request.
25902 ///
25903 /// ````text
25904 /// It should be used to handle progress information, and to implement a certain level of resilience.
25905 /// ````
25906 ///
25907 /// Sets the *delegate* property to the given value.
25908 pub fn delegate(
25909 mut self,
25910 new_value: &'a mut dyn common::Delegate,
25911 ) -> ProjectLocationGetRuntimeConfigCall<'a, C> {
25912 self._delegate = Some(new_value);
25913 self
25914 }
25915
25916 /// Set any additional parameter of the query string used in the request.
25917 /// It should be used to set parameters which are not yet available through their own
25918 /// setters.
25919 ///
25920 /// Please note that this method must not be used to set any of the known parameters
25921 /// which have their own setter method. If done anyway, the request will fail.
25922 ///
25923 /// # Additional Parameters
25924 ///
25925 /// * *$.xgafv* (query-string) - V1 error format.
25926 /// * *access_token* (query-string) - OAuth access token.
25927 /// * *alt* (query-string) - Data format for response.
25928 /// * *callback* (query-string) - JSONP
25929 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25930 /// * *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.
25931 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25932 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25933 /// * *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.
25934 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25935 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25936 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetRuntimeConfigCall<'a, C>
25937 where
25938 T: AsRef<str>,
25939 {
25940 self._additional_params
25941 .insert(name.as_ref().to_string(), value.as_ref().to_string());
25942 self
25943 }
25944
25945 /// Identifies the authorization scope for the method you are building.
25946 ///
25947 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25948 /// [`Scope::CloudPlatform`].
25949 ///
25950 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25951 /// tokens for more than one scope.
25952 ///
25953 /// Usually there is more than one suitable scope to authorize an operation, some of which may
25954 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25955 /// sufficient, a read-write scope will do as well.
25956 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetRuntimeConfigCall<'a, C>
25957 where
25958 St: AsRef<str>,
25959 {
25960 self._scopes.insert(String::from(scope.as_ref()));
25961 self
25962 }
25963 /// Identifies the authorization scope(s) for the method you are building.
25964 ///
25965 /// See [`Self::add_scope()`] for details.
25966 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetRuntimeConfigCall<'a, C>
25967 where
25968 I: IntoIterator<Item = St>,
25969 St: AsRef<str>,
25970 {
25971 self._scopes
25972 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25973 self
25974 }
25975
25976 /// Removes all scopes, and no default scope will be used either.
25977 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25978 /// for details).
25979 pub fn clear_scopes(mut self) -> ProjectLocationGetRuntimeConfigCall<'a, C> {
25980 self._scopes.clear();
25981 self
25982 }
25983}
25984
25985/// Lists information about the supported locations for this service.
25986///
25987/// A builder for the *locations.list* method supported by a *project* resource.
25988/// It is not used directly, but through a [`ProjectMethods`] instance.
25989///
25990/// # Example
25991///
25992/// Instantiate a resource method builder
25993///
25994/// ```test_harness,no_run
25995/// # extern crate hyper;
25996/// # extern crate hyper_rustls;
25997/// # extern crate google_connectors1 as connectors1;
25998/// # async fn dox() {
25999/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26000///
26001/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26002/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
26003/// # secret,
26004/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26005/// # ).build().await.unwrap();
26006///
26007/// # let client = hyper_util::client::legacy::Client::builder(
26008/// # hyper_util::rt::TokioExecutor::new()
26009/// # )
26010/// # .build(
26011/// # hyper_rustls::HttpsConnectorBuilder::new()
26012/// # .with_native_roots()
26013/// # .unwrap()
26014/// # .https_or_http()
26015/// # .enable_http1()
26016/// # .build()
26017/// # );
26018/// # let mut hub = Connectors::new(client, auth);
26019/// // You can configure optional parameters by calling the respective setters at will, and
26020/// // execute the final call using `doit()`.
26021/// // Values shown here are possibly random and not representative !
26022/// let result = hub.projects().locations_list("name")
26023/// .page_token("aliquyam")
26024/// .page_size(-94)
26025/// .filter("duo")
26026/// .doit().await;
26027/// # }
26028/// ```
26029pub struct ProjectLocationListCall<'a, C>
26030where
26031 C: 'a,
26032{
26033 hub: &'a Connectors<C>,
26034 _name: String,
26035 _page_token: Option<String>,
26036 _page_size: Option<i32>,
26037 _filter: Option<String>,
26038 _delegate: Option<&'a mut dyn common::Delegate>,
26039 _additional_params: HashMap<String, String>,
26040 _scopes: BTreeSet<String>,
26041}
26042
26043impl<'a, C> common::CallBuilder for ProjectLocationListCall<'a, C> {}
26044
26045impl<'a, C> ProjectLocationListCall<'a, C>
26046where
26047 C: common::Connector,
26048{
26049 /// Perform the operation you have build so far.
26050 pub async fn doit(mut self) -> common::Result<(common::Response, ListLocationsResponse)> {
26051 use std::borrow::Cow;
26052 use std::io::{Read, Seek};
26053
26054 use common::{url::Params, ToParts};
26055 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26056
26057 let mut dd = common::DefaultDelegate;
26058 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26059 dlg.begin(common::MethodInfo {
26060 id: "connectors.projects.locations.list",
26061 http_method: hyper::Method::GET,
26062 });
26063
26064 for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
26065 if self._additional_params.contains_key(field) {
26066 dlg.finished(false);
26067 return Err(common::Error::FieldClash(field));
26068 }
26069 }
26070
26071 let mut params = Params::with_capacity(6 + self._additional_params.len());
26072 params.push("name", self._name);
26073 if let Some(value) = self._page_token.as_ref() {
26074 params.push("pageToken", value);
26075 }
26076 if let Some(value) = self._page_size.as_ref() {
26077 params.push("pageSize", value.to_string());
26078 }
26079 if let Some(value) = self._filter.as_ref() {
26080 params.push("filter", value);
26081 }
26082
26083 params.extend(self._additional_params.iter());
26084
26085 params.push("alt", "json");
26086 let mut url = self.hub._base_url.clone() + "v1/{+name}/locations";
26087 if self._scopes.is_empty() {
26088 self._scopes
26089 .insert(Scope::CloudPlatform.as_ref().to_string());
26090 }
26091
26092 #[allow(clippy::single_element_loop)]
26093 for &(find_this, param_name) in [("{+name}", "name")].iter() {
26094 url = params.uri_replacement(url, param_name, find_this, true);
26095 }
26096 {
26097 let to_remove = ["name"];
26098 params.remove_params(&to_remove);
26099 }
26100
26101 let url = params.parse_with_url(&url);
26102
26103 loop {
26104 let token = match self
26105 .hub
26106 .auth
26107 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26108 .await
26109 {
26110 Ok(token) => token,
26111 Err(e) => match dlg.token(e) {
26112 Ok(token) => token,
26113 Err(e) => {
26114 dlg.finished(false);
26115 return Err(common::Error::MissingToken(e));
26116 }
26117 },
26118 };
26119 let mut req_result = {
26120 let client = &self.hub.client;
26121 dlg.pre_request();
26122 let mut req_builder = hyper::Request::builder()
26123 .method(hyper::Method::GET)
26124 .uri(url.as_str())
26125 .header(USER_AGENT, self.hub._user_agent.clone());
26126
26127 if let Some(token) = token.as_ref() {
26128 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26129 }
26130
26131 let request = req_builder
26132 .header(CONTENT_LENGTH, 0_u64)
26133 .body(common::to_body::<String>(None));
26134
26135 client.request(request.unwrap()).await
26136 };
26137
26138 match req_result {
26139 Err(err) => {
26140 if let common::Retry::After(d) = dlg.http_error(&err) {
26141 sleep(d).await;
26142 continue;
26143 }
26144 dlg.finished(false);
26145 return Err(common::Error::HttpError(err));
26146 }
26147 Ok(res) => {
26148 let (mut parts, body) = res.into_parts();
26149 let mut body = common::Body::new(body);
26150 if !parts.status.is_success() {
26151 let bytes = common::to_bytes(body).await.unwrap_or_default();
26152 let error = serde_json::from_str(&common::to_string(&bytes));
26153 let response = common::to_response(parts, bytes.into());
26154
26155 if let common::Retry::After(d) =
26156 dlg.http_failure(&response, error.as_ref().ok())
26157 {
26158 sleep(d).await;
26159 continue;
26160 }
26161
26162 dlg.finished(false);
26163
26164 return Err(match error {
26165 Ok(value) => common::Error::BadRequest(value),
26166 _ => common::Error::Failure(response),
26167 });
26168 }
26169 let response = {
26170 let bytes = common::to_bytes(body).await.unwrap_or_default();
26171 let encoded = common::to_string(&bytes);
26172 match serde_json::from_str(&encoded) {
26173 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26174 Err(error) => {
26175 dlg.response_json_decode_error(&encoded, &error);
26176 return Err(common::Error::JsonDecodeError(
26177 encoded.to_string(),
26178 error,
26179 ));
26180 }
26181 }
26182 };
26183
26184 dlg.finished(true);
26185 return Ok(response);
26186 }
26187 }
26188 }
26189 }
26190
26191 /// The resource that owns the locations collection, if applicable.
26192 ///
26193 /// Sets the *name* path property to the given value.
26194 ///
26195 /// Even though the property as already been set when instantiating this call,
26196 /// we provide this method for API completeness.
26197 pub fn name(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
26198 self._name = new_value.to_string();
26199 self
26200 }
26201 /// A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.
26202 ///
26203 /// Sets the *page token* query property to the given value.
26204 pub fn page_token(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
26205 self._page_token = Some(new_value.to_string());
26206 self
26207 }
26208 /// The maximum number of results to return. If not set, the service selects a default.
26209 ///
26210 /// Sets the *page size* query property to the given value.
26211 pub fn page_size(mut self, new_value: i32) -> ProjectLocationListCall<'a, C> {
26212 self._page_size = Some(new_value);
26213 self
26214 }
26215 /// 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).
26216 ///
26217 /// Sets the *filter* query property to the given value.
26218 pub fn filter(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
26219 self._filter = Some(new_value.to_string());
26220 self
26221 }
26222 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26223 /// while executing the actual API request.
26224 ///
26225 /// ````text
26226 /// It should be used to handle progress information, and to implement a certain level of resilience.
26227 /// ````
26228 ///
26229 /// Sets the *delegate* property to the given value.
26230 pub fn delegate(
26231 mut self,
26232 new_value: &'a mut dyn common::Delegate,
26233 ) -> ProjectLocationListCall<'a, C> {
26234 self._delegate = Some(new_value);
26235 self
26236 }
26237
26238 /// Set any additional parameter of the query string used in the request.
26239 /// It should be used to set parameters which are not yet available through their own
26240 /// setters.
26241 ///
26242 /// Please note that this method must not be used to set any of the known parameters
26243 /// which have their own setter method. If done anyway, the request will fail.
26244 ///
26245 /// # Additional Parameters
26246 ///
26247 /// * *$.xgafv* (query-string) - V1 error format.
26248 /// * *access_token* (query-string) - OAuth access token.
26249 /// * *alt* (query-string) - Data format for response.
26250 /// * *callback* (query-string) - JSONP
26251 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26252 /// * *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.
26253 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26254 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26255 /// * *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.
26256 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26257 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26258 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C>
26259 where
26260 T: AsRef<str>,
26261 {
26262 self._additional_params
26263 .insert(name.as_ref().to_string(), value.as_ref().to_string());
26264 self
26265 }
26266
26267 /// Identifies the authorization scope for the method you are building.
26268 ///
26269 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26270 /// [`Scope::CloudPlatform`].
26271 ///
26272 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26273 /// tokens for more than one scope.
26274 ///
26275 /// Usually there is more than one suitable scope to authorize an operation, some of which may
26276 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26277 /// sufficient, a read-write scope will do as well.
26278 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationListCall<'a, C>
26279 where
26280 St: AsRef<str>,
26281 {
26282 self._scopes.insert(String::from(scope.as_ref()));
26283 self
26284 }
26285 /// Identifies the authorization scope(s) for the method you are building.
26286 ///
26287 /// See [`Self::add_scope()`] for details.
26288 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationListCall<'a, C>
26289 where
26290 I: IntoIterator<Item = St>,
26291 St: AsRef<str>,
26292 {
26293 self._scopes
26294 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26295 self
26296 }
26297
26298 /// Removes all scopes, and no default scope will be used either.
26299 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26300 /// for details).
26301 pub fn clear_scopes(mut self) -> ProjectLocationListCall<'a, C> {
26302 self._scopes.clear();
26303 self
26304 }
26305}
26306
26307/// Update the settings of a region.
26308///
26309/// A builder for the *locations.updateRegionalSettings* method supported by a *project* resource.
26310/// It is not used directly, but through a [`ProjectMethods`] instance.
26311///
26312/// # Example
26313///
26314/// Instantiate a resource method builder
26315///
26316/// ```test_harness,no_run
26317/// # extern crate hyper;
26318/// # extern crate hyper_rustls;
26319/// # extern crate google_connectors1 as connectors1;
26320/// use connectors1::api::RegionalSettings;
26321/// # async fn dox() {
26322/// # use connectors1::{Connectors, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26323///
26324/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26325/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
26326/// # secret,
26327/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26328/// # ).build().await.unwrap();
26329///
26330/// # let client = hyper_util::client::legacy::Client::builder(
26331/// # hyper_util::rt::TokioExecutor::new()
26332/// # )
26333/// # .build(
26334/// # hyper_rustls::HttpsConnectorBuilder::new()
26335/// # .with_native_roots()
26336/// # .unwrap()
26337/// # .https_or_http()
26338/// # .enable_http1()
26339/// # .build()
26340/// # );
26341/// # let mut hub = Connectors::new(client, auth);
26342/// // As the method needs a request, you would usually fill it with the desired information
26343/// // into the respective structure. Some of the parts shown here might not be applicable !
26344/// // Values shown here are possibly random and not representative !
26345/// let mut req = RegionalSettings::default();
26346///
26347/// // You can configure optional parameters by calling the respective setters at will, and
26348/// // execute the final call using `doit()`.
26349/// // Values shown here are possibly random and not representative !
26350/// let result = hub.projects().locations_update_regional_settings(req, "name")
26351/// .update_mask(FieldMask::new::<&str>(&[]))
26352/// .doit().await;
26353/// # }
26354/// ```
26355pub struct ProjectLocationUpdateRegionalSettingCall<'a, C>
26356where
26357 C: 'a,
26358{
26359 hub: &'a Connectors<C>,
26360 _request: RegionalSettings,
26361 _name: String,
26362 _update_mask: Option<common::FieldMask>,
26363 _delegate: Option<&'a mut dyn common::Delegate>,
26364 _additional_params: HashMap<String, String>,
26365 _scopes: BTreeSet<String>,
26366}
26367
26368impl<'a, C> common::CallBuilder for ProjectLocationUpdateRegionalSettingCall<'a, C> {}
26369
26370impl<'a, C> ProjectLocationUpdateRegionalSettingCall<'a, C>
26371where
26372 C: common::Connector,
26373{
26374 /// Perform the operation you have build so far.
26375 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
26376 use std::borrow::Cow;
26377 use std::io::{Read, Seek};
26378
26379 use common::{url::Params, ToParts};
26380 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26381
26382 let mut dd = common::DefaultDelegate;
26383 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26384 dlg.begin(common::MethodInfo {
26385 id: "connectors.projects.locations.updateRegionalSettings",
26386 http_method: hyper::Method::PATCH,
26387 });
26388
26389 for &field in ["alt", "name", "updateMask"].iter() {
26390 if self._additional_params.contains_key(field) {
26391 dlg.finished(false);
26392 return Err(common::Error::FieldClash(field));
26393 }
26394 }
26395
26396 let mut params = Params::with_capacity(5 + self._additional_params.len());
26397 params.push("name", self._name);
26398 if let Some(value) = self._update_mask.as_ref() {
26399 params.push("updateMask", value.to_string());
26400 }
26401
26402 params.extend(self._additional_params.iter());
26403
26404 params.push("alt", "json");
26405 let mut url = self.hub._base_url.clone() + "v1/{+name}";
26406 if self._scopes.is_empty() {
26407 self._scopes
26408 .insert(Scope::CloudPlatform.as_ref().to_string());
26409 }
26410
26411 #[allow(clippy::single_element_loop)]
26412 for &(find_this, param_name) in [("{+name}", "name")].iter() {
26413 url = params.uri_replacement(url, param_name, find_this, true);
26414 }
26415 {
26416 let to_remove = ["name"];
26417 params.remove_params(&to_remove);
26418 }
26419
26420 let url = params.parse_with_url(&url);
26421
26422 let mut json_mime_type = mime::APPLICATION_JSON;
26423 let mut request_value_reader = {
26424 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
26425 common::remove_json_null_values(&mut value);
26426 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
26427 serde_json::to_writer(&mut dst, &value).unwrap();
26428 dst
26429 };
26430 let request_size = request_value_reader
26431 .seek(std::io::SeekFrom::End(0))
26432 .unwrap();
26433 request_value_reader
26434 .seek(std::io::SeekFrom::Start(0))
26435 .unwrap();
26436
26437 loop {
26438 let token = match self
26439 .hub
26440 .auth
26441 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26442 .await
26443 {
26444 Ok(token) => token,
26445 Err(e) => match dlg.token(e) {
26446 Ok(token) => token,
26447 Err(e) => {
26448 dlg.finished(false);
26449 return Err(common::Error::MissingToken(e));
26450 }
26451 },
26452 };
26453 request_value_reader
26454 .seek(std::io::SeekFrom::Start(0))
26455 .unwrap();
26456 let mut req_result = {
26457 let client = &self.hub.client;
26458 dlg.pre_request();
26459 let mut req_builder = hyper::Request::builder()
26460 .method(hyper::Method::PATCH)
26461 .uri(url.as_str())
26462 .header(USER_AGENT, self.hub._user_agent.clone());
26463
26464 if let Some(token) = token.as_ref() {
26465 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26466 }
26467
26468 let request = req_builder
26469 .header(CONTENT_TYPE, json_mime_type.to_string())
26470 .header(CONTENT_LENGTH, request_size as u64)
26471 .body(common::to_body(
26472 request_value_reader.get_ref().clone().into(),
26473 ));
26474
26475 client.request(request.unwrap()).await
26476 };
26477
26478 match req_result {
26479 Err(err) => {
26480 if let common::Retry::After(d) = dlg.http_error(&err) {
26481 sleep(d).await;
26482 continue;
26483 }
26484 dlg.finished(false);
26485 return Err(common::Error::HttpError(err));
26486 }
26487 Ok(res) => {
26488 let (mut parts, body) = res.into_parts();
26489 let mut body = common::Body::new(body);
26490 if !parts.status.is_success() {
26491 let bytes = common::to_bytes(body).await.unwrap_or_default();
26492 let error = serde_json::from_str(&common::to_string(&bytes));
26493 let response = common::to_response(parts, bytes.into());
26494
26495 if let common::Retry::After(d) =
26496 dlg.http_failure(&response, error.as_ref().ok())
26497 {
26498 sleep(d).await;
26499 continue;
26500 }
26501
26502 dlg.finished(false);
26503
26504 return Err(match error {
26505 Ok(value) => common::Error::BadRequest(value),
26506 _ => common::Error::Failure(response),
26507 });
26508 }
26509 let response = {
26510 let bytes = common::to_bytes(body).await.unwrap_or_default();
26511 let encoded = common::to_string(&bytes);
26512 match serde_json::from_str(&encoded) {
26513 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26514 Err(error) => {
26515 dlg.response_json_decode_error(&encoded, &error);
26516 return Err(common::Error::JsonDecodeError(
26517 encoded.to_string(),
26518 error,
26519 ));
26520 }
26521 }
26522 };
26523
26524 dlg.finished(true);
26525 return Ok(response);
26526 }
26527 }
26528 }
26529 }
26530
26531 ///
26532 /// Sets the *request* property to the given value.
26533 ///
26534 /// Even though the property as already been set when instantiating this call,
26535 /// we provide this method for API completeness.
26536 pub fn request(
26537 mut self,
26538 new_value: RegionalSettings,
26539 ) -> ProjectLocationUpdateRegionalSettingCall<'a, C> {
26540 self._request = new_value;
26541 self
26542 }
26543 /// Output only. Resource name of the Connection. Format: projects/{project}/locations/{location}/regionalSettings
26544 ///
26545 /// Sets the *name* path property to the given value.
26546 ///
26547 /// Even though the property as already been set when instantiating this call,
26548 /// we provide this method for API completeness.
26549 pub fn name(mut self, new_value: &str) -> ProjectLocationUpdateRegionalSettingCall<'a, C> {
26550 self._name = new_value.to_string();
26551 self
26552 }
26553 /// Required. The list of fields to update.
26554 ///
26555 /// Sets the *update mask* query property to the given value.
26556 pub fn update_mask(
26557 mut self,
26558 new_value: common::FieldMask,
26559 ) -> ProjectLocationUpdateRegionalSettingCall<'a, C> {
26560 self._update_mask = Some(new_value);
26561 self
26562 }
26563 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26564 /// while executing the actual API request.
26565 ///
26566 /// ````text
26567 /// It should be used to handle progress information, and to implement a certain level of resilience.
26568 /// ````
26569 ///
26570 /// Sets the *delegate* property to the given value.
26571 pub fn delegate(
26572 mut self,
26573 new_value: &'a mut dyn common::Delegate,
26574 ) -> ProjectLocationUpdateRegionalSettingCall<'a, C> {
26575 self._delegate = Some(new_value);
26576 self
26577 }
26578
26579 /// Set any additional parameter of the query string used in the request.
26580 /// It should be used to set parameters which are not yet available through their own
26581 /// setters.
26582 ///
26583 /// Please note that this method must not be used to set any of the known parameters
26584 /// which have their own setter method. If done anyway, the request will fail.
26585 ///
26586 /// # Additional Parameters
26587 ///
26588 /// * *$.xgafv* (query-string) - V1 error format.
26589 /// * *access_token* (query-string) - OAuth access token.
26590 /// * *alt* (query-string) - Data format for response.
26591 /// * *callback* (query-string) - JSONP
26592 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26593 /// * *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.
26594 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26595 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26596 /// * *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.
26597 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26598 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26599 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationUpdateRegionalSettingCall<'a, C>
26600 where
26601 T: AsRef<str>,
26602 {
26603 self._additional_params
26604 .insert(name.as_ref().to_string(), value.as_ref().to_string());
26605 self
26606 }
26607
26608 /// Identifies the authorization scope for the method you are building.
26609 ///
26610 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26611 /// [`Scope::CloudPlatform`].
26612 ///
26613 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26614 /// tokens for more than one scope.
26615 ///
26616 /// Usually there is more than one suitable scope to authorize an operation, some of which may
26617 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26618 /// sufficient, a read-write scope will do as well.
26619 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationUpdateRegionalSettingCall<'a, C>
26620 where
26621 St: AsRef<str>,
26622 {
26623 self._scopes.insert(String::from(scope.as_ref()));
26624 self
26625 }
26626 /// Identifies the authorization scope(s) for the method you are building.
26627 ///
26628 /// See [`Self::add_scope()`] for details.
26629 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationUpdateRegionalSettingCall<'a, C>
26630 where
26631 I: IntoIterator<Item = St>,
26632 St: AsRef<str>,
26633 {
26634 self._scopes
26635 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26636 self
26637 }
26638
26639 /// Removes all scopes, and no default scope will be used either.
26640 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26641 /// for details).
26642 pub fn clear_scopes(mut self) -> ProjectLocationUpdateRegionalSettingCall<'a, C> {
26643 self._scopes.clear();
26644 self
26645 }
26646}